blob: 4ff9e6bdf23b0bc3136618ed76f94a09ec1d6fa9 [file] [log] [blame]
Yifan Hongd5b5b2e2016-10-06 13:50:49 -07001
2#define LOG_TAG "hidl_test"
3
4#include "Bar.h"
5#include <android-base/logging.h>
6#include <inttypes.h>
7
8namespace android {
9namespace hardware {
10namespace tests {
11namespace bar {
12namespace V1_0 {
13namespace implementation {
14
15Bar::Bar() {
16 mFoo = IFoo::getService("", true);
17}
18
19// Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
20Return<void> Bar::doThis(float param) {
21 return mFoo->doThis(param);
22}
23
Yifan Hongd5b5b2e2016-10-06 13:50:49 -070024Return<int32_t> Bar::doThatAndReturnSomething(
25 int64_t param) {
26 return mFoo->doThatAndReturnSomething(param);
27}
28
29Return<double> Bar::doQuiteABit(
30 int32_t a,
31 int64_t b,
32 float c,
33 double d) {
34 return mFoo->doQuiteABit(a, b, c, d);
35}
36
37Return<void> Bar::doSomethingElse(
38 const hidl_array<int32_t, 15> &param, doSomethingElse_cb _cb) {
39 return mFoo->doSomethingElse(param, _cb);
40}
41
42Return<void> Bar::doStuffAndReturnAString(
43 doStuffAndReturnAString_cb _cb) {
44 return mFoo->doStuffAndReturnAString(_cb);
45}
46
47Return<void> Bar::mapThisVector(
48 const hidl_vec<int32_t> &param, mapThisVector_cb _cb) {
49 return mFoo->mapThisVector(param, _cb);
50}
51
52Return<void> Bar::callMe(
53 const sp<IFooCallback> &cb) {
54 return mFoo->callMe(cb);
55}
56
57Return<Bar::SomeEnum> Bar::useAnEnum(SomeEnum param) {
58 return mFoo->useAnEnum(param);
59}
60
61Return<void> Bar::haveAGooberVec(const hidl_vec<Goober>& param) {
62 return mFoo->haveAGooberVec(param);
63}
64
65Return<void> Bar::haveAGoober(const Goober &g) {
66 return mFoo->haveAGoober(g);
67}
68
69Return<void> Bar::haveAGooberArray(const hidl_array<Goober, 20> &lots) {
70 return mFoo->haveAGooberArray(lots);
71}
72
73Return<void> Bar::haveATypeFromAnotherFile(const Abc &def) {
74 return mFoo->haveATypeFromAnotherFile(def);
75}
76
77Return<void> Bar::haveSomeStrings(
78 const hidl_array<hidl_string, 3> &array,
79 haveSomeStrings_cb _cb) {
80 return mFoo->haveSomeStrings(array, _cb);
81}
82
83Return<void> Bar::haveAStringVec(
84 const hidl_vec<hidl_string> &vector,
85 haveAStringVec_cb _cb) {
86 return mFoo->haveAStringVec(vector, _cb);
87}
88
89Return<void> Bar::transposeMe(
90 const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) {
91 return mFoo->transposeMe(in, _cb);
92}
93
94Return<void> Bar::callingDrWho(
95 const MultiDimensional &in, callingDrWho_cb _hidl_cb) {
96 return mFoo->callingDrWho(in, _hidl_cb);
97}
98
99Return<void> Bar::transpose(const StringMatrix5x3 &in, transpose_cb _hidl_cb) {
100 return mFoo->transpose(in, _hidl_cb);
101}
102
103Return<void> Bar::transpose2(
104 const hidl_array<hidl_string, 5, 3> &in, transpose2_cb _hidl_cb) {
105 return mFoo->transpose2(in, _hidl_cb);
106}
107
108Return<void> Bar::sendVec(
109 const hidl_vec<uint8_t> &data, sendVec_cb _hidl_cb) {
110 return mFoo->sendVec(data, _hidl_cb);
111}
112
113Return<void> Bar::sendVecVec(sendVecVec_cb _hidl_cb) {
114 return mFoo->sendVecVec(_hidl_cb);
115}
116
Andreas Huber847b1452016-10-19 14:10:55 -0700117Return<void> Bar::haveAVectorOfInterfaces(
118 const hidl_vec<sp<ISimple> > &in,
119 haveAVectorOfInterfaces_cb _hidl_cb) {
120 _hidl_cb(in);
121
122 return Void();
123}
124
125Return<void> Bar::haveAVectorOfGenericInterfaces(
126 const hidl_vec<sp<android::hardware::IBinder> > &in,
127 haveAVectorOfGenericInterfaces_cb _hidl_cb) {
128 _hidl_cb(in);
129
130 return Void();
131}
132
Yifan Hongebfa6332016-10-14 10:41:41 -0700133Return<void> Bar::createMyHandle(createMyHandle_cb _hidl_cb) {
134 return mFoo->createMyHandle(_hidl_cb);
135}
136
137Return<void> Bar::createHandles(uint32_t size, createHandles_cb _hidl_cb) {
138 return mFoo->createHandles(size, _hidl_cb);
139}
140
141Return<void> Bar::closeHandles() {
142 return mFoo->closeHandles();
143}
144
Martijn Coenenb7307d52016-10-27 11:51:46 +0200145Return<void> Bar::echoNullInterface(const sp<IFooCallback> &cb, echoNullInterface_cb _hidl_cb) {
146 return mFoo->echoNullInterface(cb, _hidl_cb);
147}
148
Yifan Hongd5b5b2e2016-10-06 13:50:49 -0700149// Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
150Return<void> Bar::thisIsNew() {
151 ALOGI("SERVER(Bar) thisIsNew");
152
153 return Void();
154}
155
Yifan Hong688bb1e2016-10-27 13:18:43 -0700156Return<void> Bar::expectNullHandle(const native_handle_t* h, const Abc& xyz, expectNullHandle_cb _hidl_cb) {
157 ALOGI("SERVER(Bar) h = %p, xyz.z = %p", h, xyz.z);
158 _hidl_cb(h == nullptr, xyz.z == nullptr);
159 return Void();
160}
161
Yifan Hongd5b5b2e2016-10-06 13:50:49 -0700162IBar* HIDL_FETCH_IBar(const char* /* name */) {
163 return new Bar();
164}
165
166} // namespace implementation
167} // namespace V1_0
168} // namespace bar
169} // namespace tests
170} // namespace hardware
171} // namespace android