blob: 6a8a3603dd6005f19b7e792955f7f1776dc15941 [file] [log] [blame]
Yifan Hongd5b5b2e2016-10-06 13:50:49 -07001
2#define LOG_TAG "hidl_test"
3
4#include "Bar.h"
Mark Salyzyna4842ac2017-01-10 10:16:48 -08005
Yifan Hongd5b5b2e2016-10-06 13:50:49 -07006#include <inttypes.h>
7
Mark Salyzyna4842ac2017-01-10 10:16:48 -08008#include <log/log.h>
9
Yifan Hongd5b5b2e2016-10-06 13:50:49 -070010namespace android {
11namespace hardware {
12namespace tests {
13namespace bar {
14namespace V1_0 {
15namespace implementation {
16
17Bar::Bar() {
18 mFoo = IFoo::getService("", true);
19}
20
21// Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
22Return<void> Bar::doThis(float param) {
23 return mFoo->doThis(param);
24}
25
Yifan Hongd5b5b2e2016-10-06 13:50:49 -070026Return<int32_t> Bar::doThatAndReturnSomething(
27 int64_t param) {
28 return mFoo->doThatAndReturnSomething(param);
29}
30
31Return<double> Bar::doQuiteABit(
32 int32_t a,
33 int64_t b,
34 float c,
35 double d) {
36 return mFoo->doQuiteABit(a, b, c, d);
37}
38
39Return<void> Bar::doSomethingElse(
40 const hidl_array<int32_t, 15> &param, doSomethingElse_cb _cb) {
41 return mFoo->doSomethingElse(param, _cb);
42}
43
44Return<void> Bar::doStuffAndReturnAString(
45 doStuffAndReturnAString_cb _cb) {
46 return mFoo->doStuffAndReturnAString(_cb);
47}
48
49Return<void> Bar::mapThisVector(
50 const hidl_vec<int32_t> &param, mapThisVector_cb _cb) {
51 return mFoo->mapThisVector(param, _cb);
52}
53
54Return<void> Bar::callMe(
55 const sp<IFooCallback> &cb) {
56 return mFoo->callMe(cb);
57}
58
59Return<Bar::SomeEnum> Bar::useAnEnum(SomeEnum param) {
60 return mFoo->useAnEnum(param);
61}
62
63Return<void> Bar::haveAGooberVec(const hidl_vec<Goober>& param) {
64 return mFoo->haveAGooberVec(param);
65}
66
67Return<void> Bar::haveAGoober(const Goober &g) {
68 return mFoo->haveAGoober(g);
69}
70
71Return<void> Bar::haveAGooberArray(const hidl_array<Goober, 20> &lots) {
72 return mFoo->haveAGooberArray(lots);
73}
74
75Return<void> Bar::haveATypeFromAnotherFile(const Abc &def) {
76 return mFoo->haveATypeFromAnotherFile(def);
77}
78
79Return<void> Bar::haveSomeStrings(
80 const hidl_array<hidl_string, 3> &array,
81 haveSomeStrings_cb _cb) {
82 return mFoo->haveSomeStrings(array, _cb);
83}
84
85Return<void> Bar::haveAStringVec(
86 const hidl_vec<hidl_string> &vector,
87 haveAStringVec_cb _cb) {
88 return mFoo->haveAStringVec(vector, _cb);
89}
90
91Return<void> Bar::transposeMe(
92 const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) {
93 return mFoo->transposeMe(in, _cb);
94}
95
96Return<void> Bar::callingDrWho(
97 const MultiDimensional &in, callingDrWho_cb _hidl_cb) {
98 return mFoo->callingDrWho(in, _hidl_cb);
99}
100
101Return<void> Bar::transpose(const StringMatrix5x3 &in, transpose_cb _hidl_cb) {
102 return mFoo->transpose(in, _hidl_cb);
103}
104
105Return<void> Bar::transpose2(
106 const hidl_array<hidl_string, 5, 3> &in, transpose2_cb _hidl_cb) {
107 return mFoo->transpose2(in, _hidl_cb);
108}
109
110Return<void> Bar::sendVec(
111 const hidl_vec<uint8_t> &data, sendVec_cb _hidl_cb) {
112 return mFoo->sendVec(data, _hidl_cb);
113}
114
115Return<void> Bar::sendVecVec(sendVecVec_cb _hidl_cb) {
116 return mFoo->sendVecVec(_hidl_cb);
117}
118
Andreas Huber847b1452016-10-19 14:10:55 -0700119Return<void> Bar::haveAVectorOfInterfaces(
120 const hidl_vec<sp<ISimple> > &in,
121 haveAVectorOfInterfaces_cb _hidl_cb) {
122 _hidl_cb(in);
123
124 return Void();
125}
126
127Return<void> Bar::haveAVectorOfGenericInterfaces(
Yifan Hongebcc3322016-11-28 16:09:46 -0800128 const hidl_vec<sp<android::hidl::base::V1_0::IBase> > &in,
Andreas Huber847b1452016-10-19 14:10:55 -0700129 haveAVectorOfGenericInterfaces_cb _hidl_cb) {
Martijn Coenen0dbb9902016-12-15 21:34:38 +0100130 _hidl_cb(in);
Andreas Huber847b1452016-10-19 14:10:55 -0700131
132 return Void();
133}
134
Yifan Hongebfa6332016-10-14 10:41:41 -0700135Return<void> Bar::createMyHandle(createMyHandle_cb _hidl_cb) {
136 return mFoo->createMyHandle(_hidl_cb);
137}
138
139Return<void> Bar::createHandles(uint32_t size, createHandles_cb _hidl_cb) {
140 return mFoo->createHandles(size, _hidl_cb);
141}
142
143Return<void> Bar::closeHandles() {
144 return mFoo->closeHandles();
145}
146
Martijn Coenenb7307d52016-10-27 11:51:46 +0200147Return<void> Bar::echoNullInterface(const sp<IFooCallback> &cb, echoNullInterface_cb _hidl_cb) {
148 return mFoo->echoNullInterface(cb, _hidl_cb);
149}
150
Yifan Hongd5b5b2e2016-10-06 13:50:49 -0700151// Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
152Return<void> Bar::thisIsNew() {
153 ALOGI("SERVER(Bar) thisIsNew");
154
155 return Void();
156}
157
Martijn Coenen403161a2016-11-18 15:29:32 +0100158Return<void> Bar::expectNullHandle(const hidl_handle& h, const Abc& xyz, expectNullHandle_cb _hidl_cb) {
159 ALOGI("SERVER(Bar) h = %p, xyz.z = %p", h.getNativeHandle(), xyz.z.getNativeHandle());
Yifan Hong688bb1e2016-10-27 13:18:43 -0700160 _hidl_cb(h == nullptr, xyz.z == nullptr);
161 return Void();
162}
163
Yifan Honge7ce8222016-12-05 12:34:42 -0800164Return<void> Bar::takeAMask(BitField bf, uint8_t first, const MyMask& second, uint8_t third,
165 takeAMask_cb _hidl_cb) {
166 _hidl_cb(bf, bf | first, second.value & bf, (bf | bf) & third);
167 return Void();
168}
169
Martijn Coenene8b01612017-01-02 15:19:53 +0100170Return<sp<ISimple>> Bar::haveAInterface(const sp<ISimple> &in) {
171 return in;
Yifan Hong87cc71c2016-11-28 12:52:28 -0800172}
173
174
Yifan Hongd5b5b2e2016-10-06 13:50:49 -0700175IBar* HIDL_FETCH_IBar(const char* /* name */) {
176 return new Bar();
177}
178
179} // namespace implementation
180} // namespace V1_0
181} // namespace bar
182} // namespace tests
183} // namespace hardware
184} // namespace android