blob: d968987f157c54d9ee7cc526c3f495610e4afa3b [file] [log] [blame]
Nirav Atreb4186162018-06-08 16:51:29 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "SafeUnion.h"
18#include <android-base/logging.h>
19
20namespace android {
21namespace hardware {
22namespace tests {
23namespace safeunion {
24namespace V1_0 {
25namespace implementation {
26
27// Methods from ::android::hardware::tests::safeunion::V1_0::ISafeUnion follow.
28Return<void> SafeUnion::newLargeSafeUnion(newLargeSafeUnion_cb _hidl_cb) {
29 LOG(INFO) << "SERVER(SafeUnion) newLargeSafeUnion()";
30
31 LargeSafeUnion ret;
32 _hidl_cb(ret);
33 return Void();
34}
35
36Return<void> SafeUnion::setA(const LargeSafeUnion& myUnion, int8_t a, setA_cb _hidl_cb) {
37 LOG(INFO) << "SERVER(SafeUnion) setA(myUnion, " << a << ")";
38
39 LargeSafeUnion myNewUnion = myUnion;
40 myNewUnion.a(a);
41
42 _hidl_cb(myNewUnion);
43 return Void();
44}
45
46Return<void> SafeUnion::setB(const LargeSafeUnion& myUnion, uint16_t b, setB_cb _hidl_cb) {
47 LOG(INFO) << "SERVER(SafeUnion) setB(myUnion, " << b << ")";
48
49 LargeSafeUnion myNewUnion = myUnion;
50 myNewUnion.b(b);
51
52 _hidl_cb(myNewUnion);
53 return Void();
54}
55
56Return<void> SafeUnion::setC(const LargeSafeUnion& myUnion, int32_t c, setC_cb _hidl_cb) {
57 LOG(INFO) << "SERVER(SafeUnion) setC(myUnion, " << c << ")";
58
59 LargeSafeUnion myNewUnion = myUnion;
60 myNewUnion.c(c);
61
62 _hidl_cb(myNewUnion);
63 return Void();
64}
65
66Return<void> SafeUnion::setD(const LargeSafeUnion& myUnion, uint64_t d, setD_cb _hidl_cb) {
67 LOG(INFO) << "SERVER(SafeUnion) setD(myUnion, " << d << ")";
68
69 LargeSafeUnion myNewUnion = myUnion;
70 myNewUnion.d(d);
71
72 _hidl_cb(myNewUnion);
73 return Void();
74}
75
76Return<void> SafeUnion::setE(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int8_t, 13>& e, setE_cb _hidl_cb) {
77 LOG(INFO) << "SERVER(SafeUnion) setE(myUnion, " << toString(e) << ")";
78
79 LargeSafeUnion myNewUnion = myUnion;
80 myNewUnion.e(e);
81
82 _hidl_cb(myNewUnion);
83 return Void();
84}
85
86Return<void> SafeUnion::setF(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_array<int64_t, 5>& f, setF_cb _hidl_cb) {
87 LOG(INFO) << "SERVER(SafeUnion) setF(myUnion, " << toString(f) << ")";
88
89 LargeSafeUnion myNewUnion = myUnion;
90 myNewUnion.f(f);
91
92 _hidl_cb(myNewUnion);
93 return Void();
94}
95
96Return<void> SafeUnion::setG(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_string& g, setG_cb _hidl_cb) {
97 LOG(INFO) << "SERVER(SafeUnion) setG(myUnion, " << toString(g) << ")";
98
99 LargeSafeUnion myNewUnion = myUnion;
100 myNewUnion.g(g);
101
102 _hidl_cb(myNewUnion);
103 return Void();
104}
105
106Return<void> SafeUnion::setH(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<bool>& h, setH_cb _hidl_cb) {
107 LOG(INFO) << "SERVER(SafeUnion) setH(myUnion, " << toString(h) << ")";
108
109 LargeSafeUnion myNewUnion = myUnion;
110 myNewUnion.h(h);
111
112 _hidl_cb(myNewUnion);
113 return Void();
114}
115
116Return<void> SafeUnion::setI(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const hidl_vec<uint64_t>& i, setI_cb _hidl_cb) {
117 LOG(INFO) << "SERVER(SafeUnion) setI(myUnion, " << toString(i) << ")";
118
119 LargeSafeUnion myNewUnion = myUnion;
120 myNewUnion.i(i);
121
122 _hidl_cb(myNewUnion);
123 return Void();
124}
125
126Return<void> SafeUnion::setJ(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const J& j, setJ_cb _hidl_cb) {
127 LOG(INFO) << "SERVER(SafeUnion) setJ(myUnion, " << toString(j) << ")";
128
129 LargeSafeUnion myNewUnion = myUnion;
130 myNewUnion.j(j);
131
132 _hidl_cb(myNewUnion);
133 return Void();
134}
135
136Return<void> SafeUnion::setK(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const LargeSafeUnion::K& k, setK_cb _hidl_cb) {
137 LOG(INFO) << "SERVER(SafeUnion) setK(myUnion, " << toString(k) << ")";
138
139 LargeSafeUnion myNewUnion = myUnion;
140 myNewUnion.k(k);
141
142 _hidl_cb(myNewUnion);
143 return Void();
144}
145
146Return<void> SafeUnion::setL(const ::android::hardware::tests::safeunion::V1_0::LargeSafeUnion& myUnion, const ::android::hardware::tests::safeunion::V1_0::SmallSafeUnion& l, setL_cb _hidl_cb) {
147 LOG(INFO) << "SERVER(SafeUnion) setL(myUnion, " << toString(l) << ")";
148
149 LargeSafeUnion myNewUnion = myUnion;
150 myNewUnion.l(l);
151
152 _hidl_cb(myNewUnion);
153 return Void();
154}
155
156Return<void> SafeUnion::newMiscTypesSafeUnion(newMiscTypesSafeUnion_cb _hidl_cb) {
157 LOG(INFO) << "SERVER(SafeUnion) newMiscTypesSafeUnion()";
158
159 MiscTypesSafeUnion ret;
160 _hidl_cb(ret);
161 return Void();
162}
163
164Return<void> SafeUnion::setMiscA(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_memory& a, setMiscA_cb _hidl_cb) {
165 LOG(INFO) << "SERVER(SafeUnion) setMiscA(myUnion, " << toString(a) << ")";
166
167 MiscTypesSafeUnion myNewUnion = myUnion;
168 myNewUnion.a(a);
169
170 _hidl_cb(myNewUnion);
171 return Void();
172}
173
174Return<void> SafeUnion::setMiscB(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, const hidl_handle& b, setMiscB_cb _hidl_cb) {
175 LOG(INFO) << "SERVER(SafeUnion) setMiscB(myUnion, " << toString(b) << ")";
176
177 MiscTypesSafeUnion myNewUnion = myUnion;
178 myNewUnion.b(b);
179
180 _hidl_cb(myNewUnion);
181 return Void();
182}
183
184Return<void> SafeUnion::setMiscC(const ::android::hardware::tests::safeunion::V1_0::MiscTypesSafeUnion& myUnion, hidl_bitfield<BitField> c, setMiscC_cb _hidl_cb) {
185 LOG(INFO) << "SERVER(SafeUnion) setMiscC(myUnion, " << c << ")";
186
187 MiscTypesSafeUnion myNewUnion = myUnion;
188 myNewUnion.c(c);
189
190 _hidl_cb(myNewUnion);
191 return Void();
192}
193
194
195ISafeUnion* HIDL_FETCH_ISafeUnion(const char* /* name */) {
196 return new SafeUnion();
197}
198
199} // namespace implementation
200} // namespace V1_0
201} // namespace safeunion
202} // namespace tests
203} // namespace hardware
204} // namespace android