1
2 #define LOG_TAG "hidl_test"
3
4 #include "Bar.h"
5
6 #include <inttypes.h>
7
8 #include <log/log.h>
9
10 namespace android {
11 namespace hardware {
12 namespace tests {
13 namespace bar {
14 namespace V1_0 {
15 namespace implementation {
16
Bar()17 Bar::Bar() {
18 mFoo = IFoo::getService("", true);
19 }
20
21 // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
convertToBoolIfSmall(Discriminator d,const hidl_vec<Union> & u,convertToBoolIfSmall_cb _hidl_cb)22 Return<void> Bar::convertToBoolIfSmall(Discriminator d, const hidl_vec<Union>& u,
23 convertToBoolIfSmall_cb _hidl_cb) {
24 return mFoo->convertToBoolIfSmall(d, u, _hidl_cb);
25 }
26
doThis(float param)27 Return<void> Bar::doThis(float param) {
28 return mFoo->doThis(param);
29 }
30
doThatAndReturnSomething(int64_t param)31 Return<int32_t> Bar::doThatAndReturnSomething(
32 int64_t param) {
33 return mFoo->doThatAndReturnSomething(param);
34 }
35
doQuiteABit(int32_t a,int64_t b,float c,double d)36 Return<double> Bar::doQuiteABit(
37 int32_t a,
38 int64_t b,
39 float c,
40 double d) {
41 return mFoo->doQuiteABit(a, b, c, d);
42 }
43
doSomethingElse(const hidl_array<int32_t,15> & param,doSomethingElse_cb _cb)44 Return<void> Bar::doSomethingElse(
45 const hidl_array<int32_t, 15> ¶m, doSomethingElse_cb _cb) {
46 return mFoo->doSomethingElse(param, _cb);
47 }
48
doStuffAndReturnAString(doStuffAndReturnAString_cb _cb)49 Return<void> Bar::doStuffAndReturnAString(
50 doStuffAndReturnAString_cb _cb) {
51 return mFoo->doStuffAndReturnAString(_cb);
52 }
53
mapThisVector(const hidl_vec<int32_t> & param,mapThisVector_cb _cb)54 Return<void> Bar::mapThisVector(
55 const hidl_vec<int32_t> ¶m, mapThisVector_cb _cb) {
56 return mFoo->mapThisVector(param, _cb);
57 }
58
callMe(const sp<IFooCallback> & cb)59 Return<void> Bar::callMe(
60 const sp<IFooCallback> &cb) {
61 return mFoo->callMe(cb);
62 }
63
useAnEnum(SomeEnum param)64 Return<Bar::SomeEnum> Bar::useAnEnum(SomeEnum param) {
65 return mFoo->useAnEnum(param);
66 }
67
haveAGooberVec(const hidl_vec<Goober> & param)68 Return<void> Bar::haveAGooberVec(const hidl_vec<Goober>& param) {
69 return mFoo->haveAGooberVec(param);
70 }
71
haveAGoober(const Goober & g)72 Return<void> Bar::haveAGoober(const Goober &g) {
73 return mFoo->haveAGoober(g);
74 }
75
haveAGooberArray(const hidl_array<Goober,20> & lots)76 Return<void> Bar::haveAGooberArray(const hidl_array<Goober, 20> &lots) {
77 return mFoo->haveAGooberArray(lots);
78 }
79
haveATypeFromAnotherFile(const Abc & def)80 Return<void> Bar::haveATypeFromAnotherFile(const Abc &def) {
81 return mFoo->haveATypeFromAnotherFile(def);
82 }
83
haveSomeStrings(const hidl_array<hidl_string,3> & array,haveSomeStrings_cb _cb)84 Return<void> Bar::haveSomeStrings(
85 const hidl_array<hidl_string, 3> &array,
86 haveSomeStrings_cb _cb) {
87 return mFoo->haveSomeStrings(array, _cb);
88 }
89
haveAStringVec(const hidl_vec<hidl_string> & vector,haveAStringVec_cb _cb)90 Return<void> Bar::haveAStringVec(
91 const hidl_vec<hidl_string> &vector,
92 haveAStringVec_cb _cb) {
93 return mFoo->haveAStringVec(vector, _cb);
94 }
95
transposeMe(const hidl_array<float,3,5> & in,transposeMe_cb _cb)96 Return<void> Bar::transposeMe(
97 const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) {
98 return mFoo->transposeMe(in, _cb);
99 }
100
callingDrWho(const MultiDimensional & in,callingDrWho_cb _hidl_cb)101 Return<void> Bar::callingDrWho(
102 const MultiDimensional &in, callingDrWho_cb _hidl_cb) {
103 return mFoo->callingDrWho(in, _hidl_cb);
104 }
105
transpose(const StringMatrix5x3 & in,transpose_cb _hidl_cb)106 Return<void> Bar::transpose(const StringMatrix5x3 &in, transpose_cb _hidl_cb) {
107 return mFoo->transpose(in, _hidl_cb);
108 }
109
transpose2(const hidl_array<hidl_string,5,3> & in,transpose2_cb _hidl_cb)110 Return<void> Bar::transpose2(
111 const hidl_array<hidl_string, 5, 3> &in, transpose2_cb _hidl_cb) {
112 return mFoo->transpose2(in, _hidl_cb);
113 }
114
sendVec(const hidl_vec<uint8_t> & data,sendVec_cb _hidl_cb)115 Return<void> Bar::sendVec(
116 const hidl_vec<uint8_t> &data, sendVec_cb _hidl_cb) {
117 return mFoo->sendVec(data, _hidl_cb);
118 }
119
sendVecVec(sendVecVec_cb _hidl_cb)120 Return<void> Bar::sendVecVec(sendVecVec_cb _hidl_cb) {
121 return mFoo->sendVecVec(_hidl_cb);
122 }
123
haveAVectorOfInterfaces(const hidl_vec<sp<ISimple>> & in,haveAVectorOfInterfaces_cb _hidl_cb)124 Return<void> Bar::haveAVectorOfInterfaces(
125 const hidl_vec<sp<ISimple> > &in,
126 haveAVectorOfInterfaces_cb _hidl_cb) {
127 _hidl_cb(in);
128
129 return Void();
130 }
131
haveAVectorOfGenericInterfaces(const hidl_vec<sp<android::hidl::base::V1_0::IBase>> & in,haveAVectorOfGenericInterfaces_cb _hidl_cb)132 Return<void> Bar::haveAVectorOfGenericInterfaces(
133 const hidl_vec<sp<android::hidl::base::V1_0::IBase> > &in,
134 haveAVectorOfGenericInterfaces_cb _hidl_cb) {
135 _hidl_cb(in);
136
137 return Void();
138 }
139
createMyHandle(createMyHandle_cb _hidl_cb)140 Return<void> Bar::createMyHandle(createMyHandle_cb _hidl_cb) {
141 return mFoo->createMyHandle(_hidl_cb);
142 }
143
createHandles(uint32_t size,createHandles_cb _hidl_cb)144 Return<void> Bar::createHandles(uint32_t size, createHandles_cb _hidl_cb) {
145 return mFoo->createHandles(size, _hidl_cb);
146 }
147
closeHandles()148 Return<void> Bar::closeHandles() {
149 return mFoo->closeHandles();
150 }
151
repeatWithFmq(const IFoo::WithFmq & withFmq,repeatWithFmq_cb _hidl_cb)152 Return<void> Bar::repeatWithFmq(const IFoo::WithFmq& withFmq, repeatWithFmq_cb _hidl_cb) {
153 return mFoo->repeatWithFmq(withFmq, _hidl_cb);
154 }
155
echoNullInterface(const sp<IFooCallback> & cb,echoNullInterface_cb _hidl_cb)156 Return<void> Bar::echoNullInterface(const sp<IFooCallback> &cb, echoNullInterface_cb _hidl_cb) {
157 return mFoo->echoNullInterface(cb, _hidl_cb);
158 }
159
160 // Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
thisIsNew()161 Return<void> Bar::thisIsNew() {
162 ALOGI("SERVER(Bar) thisIsNew");
163
164 return Void();
165 }
166
expectNullHandle(const hidl_handle & h,const Abc & xyz,expectNullHandle_cb _hidl_cb)167 Return<void> Bar::expectNullHandle(const hidl_handle& h, const Abc& xyz, expectNullHandle_cb _hidl_cb) {
168 ALOGI("SERVER(Bar) h = %p, xyz.z = %p", h.getNativeHandle(), xyz.z.getNativeHandle());
169 _hidl_cb(h == nullptr, xyz.z == nullptr);
170 return Void();
171 }
172
takeAMask(BitField bf,uint8_t first,const MyMask & second,uint8_t third,takeAMask_cb _hidl_cb)173 Return<void> Bar::takeAMask(BitField bf, uint8_t first, const MyMask& second, uint8_t third,
174 takeAMask_cb _hidl_cb) {
175 _hidl_cb(bf, bf | first, second.value & bf, (bf | bf) & third);
176 return Void();
177 }
178
haveAInterface(const sp<ISimple> & in)179 Return<sp<ISimple>> Bar::haveAInterface(const sp<ISimple> &in) {
180 return in;
181 }
182
183
HIDL_FETCH_IBar(const char *)184 IBar* HIDL_FETCH_IBar(const char* /* name */) {
185 return new Bar();
186 }
187
188 } // namespace implementation
189 } // namespace V1_0
190 } // namespace bar
191 } // namespace tests
192 } // namespace hardware
193 } // namespace android
194