Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1 | // AUTO_GENERATED FILE - DO NOT EDIT |
| 2 | // see system/tools/hidl/templates/TemplateAll.cpp |
Chris Phoenix | d55ed64 | 2016-07-12 18:43:04 -0700 | [diff] [blame] | 3 | //#include <android/hardware/tests/ITypes.h> |
| 4 | //#include <android/hardware/tests/BpTypes.h> |
| 5 | #include <ITypes.h> |
| 6 | #include <BpTypes.h> |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 7 | #include <iostream> |
| 8 | #include <stdio.h> |
| 9 | using std::cout; |
| 10 | using std::endl; |
| 11 | |
| 12 | namespace android { |
| 13 | namespace hardware { |
| 14 | namespace tests { |
| 15 | |
| 16 | |
Chris Phoenix | 60b2bca | 2016-07-25 13:06:07 -0700 | [diff] [blame] | 17 | IMPLEMENT_HWBINDER_META_INTERFACE(Types, "android.hardware.tests.ITypes"); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 18 | |
| 19 | } // namespace tests |
| 20 | } // namespace hardware |
| 21 | } // namespace android |
| 22 | |
| 23 | |
Chris Phoenix | d55ed64 | 2016-07-12 18:43:04 -0700 | [diff] [blame] | 24 | //#include <android/hardware/tests/BpTypes.h> |
| 25 | #include <BpTypes.h> |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 26 | #include <binder/Parcel.h> |
| 27 | |
| 28 | namespace android { |
| 29 | namespace hardware { |
| 30 | namespace tests { |
| 31 | |
| 32 | |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 33 | BpTypes::BpTypes(const ::android::sp<::android::hardware::IBinder>& _aidl_impl) |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 34 | : BpInterface<ITypes>(_aidl_impl){ |
| 35 | } |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 36 | ::android::hardware::Status BpTypes::echoInteger(int32_t echo_me, const ITypes::simple_t& my_struct , ITypes::echoInteger_cb _cb ) { |
| 37 | ::android::hardware::Parcel _aidl_data; |
| 38 | ::android::hardware::Parcel _aidl_reply; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 39 | ::android::status_t _aidl_ret_status = ::android::OK; |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 40 | ::android::hardware::Status _aidl_status; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 41 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 42 | int32_t _cb_ret; |
| 43 | |
| 44 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 45 | if (((_aidl_ret_status) != (::android::OK))) { |
| 46 | goto _aidl_error; |
| 47 | } |
| 48 | _aidl_ret_status = _aidl_data.writeInt32((int32_t)echo_me); |
| 49 | if (((_aidl_ret_status) != (::android::OK))) { |
| 50 | goto _aidl_error; |
| 51 | } |
| 52 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 53 | size_t parent_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 54 | _aidl_ret_status = _aidl_data.writeBuffer((void *)&my_struct, sizeof(my_struct), &parent_handle); |
| 55 | if (((_aidl_ret_status) != (::android::OK))) { |
| 56 | goto _aidl_error; |
| 57 | } |
| 58 | // struct fixup write_ |
| 59 | |
| 60 | //field int1 doesn't need fixup |
| 61 | |
| 62 | //field int2 doesn't need fixup |
| 63 | |
| 64 | } |
| 65 | |
| 66 | _aidl_ret_status = remote()->transact(ITypes::ECHOINTEGER, _aidl_data, &_aidl_reply); |
| 67 | if (((_aidl_ret_status) != (::android::OK))) { |
| 68 | goto _aidl_error; |
| 69 | } |
| 70 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 71 | if (((_aidl_ret_status) != (::android::OK))) { |
| 72 | goto _aidl_error; |
| 73 | } |
| 74 | if (!_aidl_status.isOk()) { |
| 75 | return _aidl_status; |
| 76 | } |
| 77 | _aidl_ret_status = _aidl_reply.readInt32(&_cb_ret); |
| 78 | if (((_aidl_ret_status) != (::android::OK))) { |
| 79 | goto _aidl_error; |
| 80 | } |
| 81 | |
| 82 | |
| 83 | // Invoke callback to client |
| 84 | if (_cb != nullptr) |
| 85 | _cb(_cb_ret ); |
| 86 | |
| 87 | |
| 88 | _aidl_error: |
| 89 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 90 | return _aidl_status; |
| 91 | } |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 92 | ::android::hardware::Status BpTypes::echoEnum(eu8 a, es8 b, eu16 c, es16 d, eu32 e, es32 f, eu64 g, es64 h, ec i, ITypes::echoEnum_cb _cb ) { |
| 93 | ::android::hardware::Parcel _aidl_data; |
| 94 | ::android::hardware::Parcel _aidl_reply; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 95 | ::android::status_t _aidl_ret_status = ::android::OK; |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 96 | ::android::hardware::Status _aidl_status; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 97 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 98 | ITypes::eu8 |
| 99 | _cb_a; |
| 100 | ITypes::es8 |
| 101 | _cb_b; |
| 102 | ITypes::eu16 |
| 103 | _cb_c; |
| 104 | ITypes::es16 |
| 105 | _cb_d; |
| 106 | ITypes::eu32 |
| 107 | _cb_e; |
| 108 | ITypes::es32 |
| 109 | _cb_f; |
| 110 | ITypes::eu64 |
| 111 | _cb_g; |
| 112 | ITypes::es64 |
| 113 | _cb_h; |
| 114 | ITypes::ec |
| 115 | _cb_i; |
| 116 | |
| 117 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 118 | if (((_aidl_ret_status) != (::android::OK))) { |
| 119 | goto _aidl_error; |
| 120 | } |
| 121 | _aidl_ret_status = _aidl_data.writeByte((int8_t)a); |
| 122 | if (((_aidl_ret_status) != (::android::OK))) { |
| 123 | goto _aidl_error; |
| 124 | } |
| 125 | _aidl_ret_status = _aidl_data.writeByte((int8_t)b); |
| 126 | if (((_aidl_ret_status) != (::android::OK))) { |
| 127 | goto _aidl_error; |
| 128 | } |
| 129 | _aidl_ret_status = _aidl_data.writeChar((char16_t)c); |
| 130 | if (((_aidl_ret_status) != (::android::OK))) { |
| 131 | goto _aidl_error; |
| 132 | } |
| 133 | _aidl_ret_status = _aidl_data.writeChar((char16_t)d); |
| 134 | if (((_aidl_ret_status) != (::android::OK))) { |
| 135 | goto _aidl_error; |
| 136 | } |
| 137 | _aidl_ret_status = _aidl_data.writeUint32((uint32_t)e); |
| 138 | if (((_aidl_ret_status) != (::android::OK))) { |
| 139 | goto _aidl_error; |
| 140 | } |
| 141 | _aidl_ret_status = _aidl_data.writeInt32((int32_t)f); |
| 142 | if (((_aidl_ret_status) != (::android::OK))) { |
| 143 | goto _aidl_error; |
| 144 | } |
| 145 | _aidl_ret_status = _aidl_data.writeUint64((uint64_t)g); |
| 146 | if (((_aidl_ret_status) != (::android::OK))) { |
| 147 | goto _aidl_error; |
| 148 | } |
| 149 | _aidl_ret_status = _aidl_data.writeInt64((int64_t)h); |
| 150 | if (((_aidl_ret_status) != (::android::OK))) { |
| 151 | goto _aidl_error; |
| 152 | } |
| 153 | _aidl_ret_status = _aidl_data.writeByte((int8_t)i); |
| 154 | if (((_aidl_ret_status) != (::android::OK))) { |
| 155 | goto _aidl_error; |
| 156 | } |
| 157 | |
| 158 | _aidl_ret_status = remote()->transact(ITypes::ECHOENUM, _aidl_data, &_aidl_reply); |
| 159 | if (((_aidl_ret_status) != (::android::OK))) { |
| 160 | goto _aidl_error; |
| 161 | } |
| 162 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 163 | if (((_aidl_ret_status) != (::android::OK))) { |
| 164 | goto _aidl_error; |
| 165 | } |
| 166 | if (!_aidl_status.isOk()) { |
| 167 | return _aidl_status; |
| 168 | } |
| 169 | _aidl_ret_status = _aidl_reply.readByte((int8_t *)&_cb_a); |
| 170 | if (((_aidl_ret_status) != (::android::OK))) { |
| 171 | goto _aidl_error; |
| 172 | } |
| 173 | _aidl_ret_status = _aidl_reply.readByte((int8_t *)&_cb_b); |
| 174 | if (((_aidl_ret_status) != (::android::OK))) { |
| 175 | goto _aidl_error; |
| 176 | } |
| 177 | _aidl_ret_status = _aidl_reply.readChar((char16_t *)&_cb_c); |
| 178 | if (((_aidl_ret_status) != (::android::OK))) { |
| 179 | goto _aidl_error; |
| 180 | } |
| 181 | _aidl_ret_status = _aidl_reply.readChar((char16_t *)&_cb_d); |
| 182 | if (((_aidl_ret_status) != (::android::OK))) { |
| 183 | goto _aidl_error; |
| 184 | } |
| 185 | _aidl_ret_status = _aidl_reply.readUint32((uint32_t *)&_cb_e); |
| 186 | if (((_aidl_ret_status) != (::android::OK))) { |
| 187 | goto _aidl_error; |
| 188 | } |
| 189 | _aidl_ret_status = _aidl_reply.readInt32((int32_t *)&_cb_f); |
| 190 | if (((_aidl_ret_status) != (::android::OK))) { |
| 191 | goto _aidl_error; |
| 192 | } |
| 193 | _aidl_ret_status = _aidl_reply.readUint64((uint64_t *)&_cb_g); |
| 194 | if (((_aidl_ret_status) != (::android::OK))) { |
| 195 | goto _aidl_error; |
| 196 | } |
| 197 | _aidl_ret_status = _aidl_reply.readInt64((int64_t *)&_cb_h); |
| 198 | if (((_aidl_ret_status) != (::android::OK))) { |
| 199 | goto _aidl_error; |
| 200 | } |
| 201 | _aidl_ret_status = _aidl_reply.readByte((int8_t *)&_cb_i); |
| 202 | if (((_aidl_ret_status) != (::android::OK))) { |
| 203 | goto _aidl_error; |
| 204 | } |
| 205 | |
| 206 | |
| 207 | // Invoke callback to client |
| 208 | if (_cb != nullptr) |
| 209 | _cb(_cb_a , _cb_b , _cb_c , _cb_d , _cb_e , _cb_f , _cb_g , _cb_h , _cb_i ); |
| 210 | |
| 211 | |
| 212 | _aidl_error: |
| 213 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 214 | return _aidl_status; |
| 215 | } |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 216 | ::android::hardware::Status BpTypes::echoScalar(uint8_t a, int8_t b, uint16_t c, int16_t d, uint32_t e, int32_t f, uint64_t g, int64_t h, char i, ITypes::echoScalar_cb _cb ) { |
| 217 | ::android::hardware::Parcel _aidl_data; |
| 218 | ::android::hardware::Parcel _aidl_reply; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 219 | ::android::status_t _aidl_ret_status = ::android::OK; |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 220 | ::android::hardware::Status _aidl_status; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 221 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 222 | uint8_t _cb_a; |
| 223 | int8_t _cb_b; |
| 224 | uint16_t _cb_c; |
| 225 | int16_t _cb_d; |
| 226 | uint32_t _cb_e; |
| 227 | int32_t _cb_f; |
| 228 | uint64_t _cb_g; |
| 229 | int64_t _cb_h; |
| 230 | char _cb_i; |
| 231 | |
| 232 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 233 | if (((_aidl_ret_status) != (::android::OK))) { |
| 234 | goto _aidl_error; |
| 235 | } |
| 236 | _aidl_ret_status = _aidl_data.writeByte((int8_t)a); |
| 237 | if (((_aidl_ret_status) != (::android::OK))) { |
| 238 | goto _aidl_error; |
| 239 | } |
| 240 | _aidl_ret_status = _aidl_data.writeByte((int8_t)b); |
| 241 | if (((_aidl_ret_status) != (::android::OK))) { |
| 242 | goto _aidl_error; |
| 243 | } |
| 244 | _aidl_ret_status = _aidl_data.writeChar((char16_t)c); |
| 245 | if (((_aidl_ret_status) != (::android::OK))) { |
| 246 | goto _aidl_error; |
| 247 | } |
| 248 | _aidl_ret_status = _aidl_data.writeChar((char16_t)d); |
| 249 | if (((_aidl_ret_status) != (::android::OK))) { |
| 250 | goto _aidl_error; |
| 251 | } |
| 252 | _aidl_ret_status = _aidl_data.writeUint32((uint32_t)e); |
| 253 | if (((_aidl_ret_status) != (::android::OK))) { |
| 254 | goto _aidl_error; |
| 255 | } |
| 256 | _aidl_ret_status = _aidl_data.writeInt32((int32_t)f); |
| 257 | if (((_aidl_ret_status) != (::android::OK))) { |
| 258 | goto _aidl_error; |
| 259 | } |
| 260 | _aidl_ret_status = _aidl_data.writeUint64((uint64_t)g); |
| 261 | if (((_aidl_ret_status) != (::android::OK))) { |
| 262 | goto _aidl_error; |
| 263 | } |
| 264 | _aidl_ret_status = _aidl_data.writeInt64((int64_t)h); |
| 265 | if (((_aidl_ret_status) != (::android::OK))) { |
| 266 | goto _aidl_error; |
| 267 | } |
| 268 | _aidl_ret_status = _aidl_data.writeByte((int8_t)i); |
| 269 | if (((_aidl_ret_status) != (::android::OK))) { |
| 270 | goto _aidl_error; |
| 271 | } |
| 272 | |
| 273 | _aidl_ret_status = remote()->transact(ITypes::ECHOSCALAR, _aidl_data, &_aidl_reply); |
| 274 | if (((_aidl_ret_status) != (::android::OK))) { |
| 275 | goto _aidl_error; |
| 276 | } |
| 277 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 278 | if (((_aidl_ret_status) != (::android::OK))) { |
| 279 | goto _aidl_error; |
| 280 | } |
| 281 | if (!_aidl_status.isOk()) { |
| 282 | return _aidl_status; |
| 283 | } |
| 284 | _aidl_ret_status = _aidl_reply.readByte((int8_t*)&_cb_a); |
| 285 | if (((_aidl_ret_status) != (::android::OK))) { |
| 286 | goto _aidl_error; |
| 287 | } |
| 288 | _aidl_ret_status = _aidl_reply.readByte(&_cb_b); |
| 289 | if (((_aidl_ret_status) != (::android::OK))) { |
| 290 | goto _aidl_error; |
| 291 | } |
| 292 | _aidl_ret_status = _aidl_reply.readChar((char16_t*)&_cb_c); |
| 293 | if (((_aidl_ret_status) != (::android::OK))) { |
| 294 | goto _aidl_error; |
| 295 | } |
| 296 | _aidl_ret_status = _aidl_reply.readChar((char16_t*)&_cb_d); |
| 297 | if (((_aidl_ret_status) != (::android::OK))) { |
| 298 | goto _aidl_error; |
| 299 | } |
| 300 | _aidl_ret_status = _aidl_reply.readUint32(&_cb_e); |
| 301 | if (((_aidl_ret_status) != (::android::OK))) { |
| 302 | goto _aidl_error; |
| 303 | } |
| 304 | _aidl_ret_status = _aidl_reply.readInt32(&_cb_f); |
| 305 | if (((_aidl_ret_status) != (::android::OK))) { |
| 306 | goto _aidl_error; |
| 307 | } |
| 308 | _aidl_ret_status = _aidl_reply.readUint64(&_cb_g); |
| 309 | if (((_aidl_ret_status) != (::android::OK))) { |
| 310 | goto _aidl_error; |
| 311 | } |
| 312 | _aidl_ret_status = _aidl_reply.readInt64(&_cb_h); |
| 313 | if (((_aidl_ret_status) != (::android::OK))) { |
| 314 | goto _aidl_error; |
| 315 | } |
| 316 | _aidl_ret_status = _aidl_reply.readByte((int8_t*)&_cb_i); |
| 317 | if (((_aidl_ret_status) != (::android::OK))) { |
| 318 | goto _aidl_error; |
| 319 | } |
| 320 | |
| 321 | |
| 322 | // Invoke callback to client |
| 323 | if (_cb != nullptr) |
| 324 | _cb(_cb_a , _cb_b , _cb_c , _cb_d , _cb_e , _cb_f , _cb_g , _cb_h , _cb_i ); |
| 325 | |
| 326 | |
| 327 | _aidl_error: |
| 328 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 329 | return _aidl_status; |
| 330 | } |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 331 | ::android::hardware::Status BpTypes::echoStruct(const ITypes::s0& s , ITypes::echoStruct_cb _cb ) { |
| 332 | ::android::hardware::Parcel _aidl_data; |
| 333 | ::android::hardware::Parcel _aidl_reply; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 334 | ::android::status_t _aidl_ret_status = ::android::OK; |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 335 | ::android::hardware::Status _aidl_status; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 336 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 337 | ITypes::s0 *_cb_s ; |
| 338 | |
| 339 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 340 | if (((_aidl_ret_status) != (::android::OK))) { |
| 341 | goto _aidl_error; |
| 342 | } |
| 343 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 344 | size_t parent_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 345 | _aidl_ret_status = _aidl_data.writeBuffer((void *)&s, sizeof(s), &parent_handle); |
| 346 | if (((_aidl_ret_status) != (::android::OK))) { |
| 347 | goto _aidl_error; |
| 348 | } |
| 349 | // struct fixup write_ |
| 350 | // struct fixup write_ |
| 351 | _aidl_ret_status = _aidl_data.writeEmbeddedBuffer((void *)s.s1m1.str1.buffer, |
| 352 | (s.s1m1.str1.length < 0 ? strlen(s.s1m1.str1.buffer)+1 : s.s1m1.str1.length), |
| 353 | nullptr, parent_handle, |
| 354 | (size_t)((char *)&(s.s1m1.str1.buffer)-(char *)(&s))); |
| 355 | if (((_aidl_ret_status) != (::android::OK))) { |
| 356 | goto _aidl_error; |
| 357 | } |
| 358 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 359 | size_t child_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 360 | void *bufp = (void *)s.s1v2.buffer; |
| 361 | size_t size = sizeof(ITypes::s1s |
| 362 | [s.s1v2.count]); |
| 363 | size_t off = (size_t)((char *)&(s.s1v2.buffer)-(char *)(&s)); |
| 364 | _aidl_ret_status = _aidl_data.writeEmbeddedBuffer(bufp, |
| 365 | size, |
| 366 | &child_handle, |
| 367 | parent_handle, |
| 368 | off /* offset_calculator */); |
| 369 | // Redefining a variable inside braces works like a static stack. |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 370 | size_t parent_handle = child_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 371 | if (((_aidl_ret_status) != (::android::OK))) { |
| 372 | goto _aidl_error; |
| 373 | } |
| 374 | for (size_t i1 = 0; i1 < s.s1v2.count; i1++) { |
| 375 | /* fixup_write_vec */ |
| 376 | // struct fixup write_ |
| 377 | _aidl_ret_status = _aidl_data.writeEmbeddedBuffer((void *)s.s1v2.buffer[i1].str1.buffer, |
| 378 | (s.s1v2.buffer[i1].str1.length < 0 ? strlen(s.s1v2.buffer[i1].str1.buffer)+1 : s.s1v2.buffer[i1].str1.length), |
| 379 | nullptr, parent_handle, |
| 380 | (size_t)((char *)&(s.s1v2.buffer[i1].str1.buffer)-(char *)(s.s1v2.buffer))); |
| 381 | if (((_aidl_ret_status) != (::android::OK))) { |
| 382 | goto _aidl_error; |
| 383 | } |
| 384 | |
| 385 | } |
| 386 | |
| 387 | } |
| 388 | |
| 389 | } |
| 390 | |
| 391 | _aidl_ret_status = remote()->transact(ITypes::ECHOSTRUCT, _aidl_data, &_aidl_reply); |
| 392 | if (((_aidl_ret_status) != (::android::OK))) { |
| 393 | goto _aidl_error; |
| 394 | } |
| 395 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 396 | if (((_aidl_ret_status) != (::android::OK))) { |
| 397 | goto _aidl_error; |
| 398 | } |
| 399 | if (!_aidl_status.isOk()) { |
| 400 | return _aidl_status; |
| 401 | } |
| 402 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 403 | size_t parent_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 404 | _cb_s = (ITypes::s0 *)_aidl_reply.readBuffer(&parent_handle); |
| 405 | if ((_cb_s) == nullptr) { |
| 406 | goto _aidl_error; |
| 407 | } |
| 408 | // struct fixup read_ret_ |
| 409 | // struct fixup read_ret_ |
Chris Phoenix | d55ed64 | 2016-07-12 18:43:04 -0700 | [diff] [blame] | 410 | _aidl_ret_pointer = _aidl_reply.readEmbeddedBuffer(nullptr, parent_handle, |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 411 | (size_t)((char *)&((*_cb_s).s1m1.str1.buffer)-(char *)(&(*_cb_s)))); |
| 412 | if (_aidl_ret_pointer == nullptr) { |
| 413 | goto _aidl_error; |
| 414 | } |
| 415 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 416 | size_t child_handle; |
Chris Phoenix | d55ed64 | 2016-07-12 18:43:04 -0700 | [diff] [blame] | 417 | _aidl_ret_pointer = _aidl_reply.readEmbeddedBuffer(&child_handle, parent_handle, |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 418 | (size_t)((char *)&((*_cb_s).s1v2.buffer)-(char *)(&(*_cb_s)))); |
| 419 | // Redefining a variable inside braces works like a static stack. |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 420 | size_t parent_handle = child_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 421 | if (_aidl_ret_pointer == nullptr) { |
| 422 | goto _aidl_error; |
| 423 | } |
| 424 | for (size_t i1 = 0; i1 < (*_cb_s).s1v2.count; i1++) { |
| 425 | /* fixup_write_vec */ |
| 426 | // struct fixup read_ret_ |
Chris Phoenix | d55ed64 | 2016-07-12 18:43:04 -0700 | [diff] [blame] | 427 | _aidl_ret_pointer = _aidl_reply.readEmbeddedBuffer(nullptr, parent_handle, |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 428 | (size_t)((char *)&((*_cb_s).s1v2.buffer[i1].str1.buffer)-(char *)((*_cb_s).s1v2.buffer))); |
| 429 | if (_aidl_ret_pointer == nullptr) { |
| 430 | goto _aidl_error; |
| 431 | } |
| 432 | |
| 433 | } |
| 434 | |
| 435 | } |
| 436 | |
| 437 | } |
| 438 | |
| 439 | |
| 440 | // Invoke callback to client |
| 441 | if (_cb != nullptr) |
| 442 | _cb(*_cb_s ); |
| 443 | |
| 444 | |
| 445 | _aidl_error: |
| 446 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 447 | return _aidl_status; |
| 448 | } |
Chris Phoenix | 55a2900 | 2016-08-04 16:45:40 -0700 | [diff] [blame^] | 449 | ::android::hardware::Status BpTypes::echoInterface(sp<ISmallTest> cb_t , ITypes::echoInterface_cb _cb ) { |
| 450 | ::android::hardware::Parcel _aidl_data; |
| 451 | ::android::hardware::Parcel _aidl_reply; |
| 452 | ::android::status_t _aidl_ret_status = ::android::OK; |
| 453 | ::android::hardware::Status _aidl_status; |
| 454 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 455 | sp<ISmallTest> _cb_cb_t ; |
| 456 | |
| 457 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 458 | if (((_aidl_ret_status) != (::android::OK))) { |
| 459 | goto _aidl_error; |
| 460 | } |
| 461 | _aidl_ret_status = _aidl_data.writeStrongBinder(IInterface::asBinder(cb_t)); |
| 462 | if (((_aidl_ret_status) != (::android::OK))) { |
| 463 | goto _aidl_error; |
| 464 | } |
| 465 | |
| 466 | _aidl_ret_status = remote()->transact(ITypes::ECHOINTERFACE, _aidl_data, &_aidl_reply); |
| 467 | if (((_aidl_ret_status) != (::android::OK))) { |
| 468 | goto _aidl_error; |
| 469 | } |
| 470 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 471 | if (((_aidl_ret_status) != (::android::OK))) { |
| 472 | goto _aidl_error; |
| 473 | } |
| 474 | if (!_aidl_status.isOk()) { |
| 475 | return _aidl_status; |
| 476 | } |
| 477 | _aidl_ret_status = _aidl_reply.readStrongBinder(&_cb_cb_t); |
| 478 | if (((_aidl_ret_status) != (::android::OK))) { |
| 479 | goto _aidl_error; |
| 480 | } |
| 481 | |
| 482 | |
| 483 | // Invoke callback to client |
| 484 | if (_cb != nullptr) |
| 485 | _cb(_cb_cb_t ); |
| 486 | |
| 487 | |
| 488 | _aidl_error: |
| 489 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 490 | return _aidl_status; |
| 491 | } |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 492 | ::android::hardware::Status BpTypes::shareBufferWithRef(hidl_ref<lots_of_data> buffer, ITypes::shareBufferWithRef_cb _cb ) { |
| 493 | ::android::hardware::Parcel _aidl_data; |
| 494 | ::android::hardware::Parcel _aidl_reply; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 495 | ::android::status_t _aidl_ret_status = ::android::OK; |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 496 | ::android::hardware::Status _aidl_status; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 497 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 498 | int32_t _cb_ret; |
| 499 | |
| 500 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 501 | if (((_aidl_ret_status) != (::android::OK))) { |
| 502 | goto _aidl_error; |
| 503 | } |
| 504 | _aidl_ret_status = _aidl_data.writeFileDescriptor(buffer); |
| 505 | if (((_aidl_ret_status) != (::android::OK))) { |
| 506 | goto _aidl_error; |
| 507 | } |
| 508 | |
| 509 | _aidl_ret_status = remote()->transact(ITypes::SHAREBUFFERWITHREF, _aidl_data, &_aidl_reply); |
| 510 | if (((_aidl_ret_status) != (::android::OK))) { |
| 511 | goto _aidl_error; |
| 512 | } |
| 513 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 514 | if (((_aidl_ret_status) != (::android::OK))) { |
| 515 | goto _aidl_error; |
| 516 | } |
| 517 | if (!_aidl_status.isOk()) { |
| 518 | return _aidl_status; |
| 519 | } |
| 520 | _aidl_ret_status = _aidl_reply.readInt32(&_cb_ret); |
| 521 | if (((_aidl_ret_status) != (::android::OK))) { |
| 522 | goto _aidl_error; |
| 523 | } |
| 524 | |
| 525 | |
| 526 | // Invoke callback to client |
| 527 | if (_cb != nullptr) |
| 528 | _cb(_cb_ret ); |
| 529 | |
| 530 | |
| 531 | _aidl_error: |
| 532 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 533 | return _aidl_status; |
| 534 | } |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 535 | ::android::hardware::Status BpTypes::getHash(ITypes::getHash_cb _cb ) { |
| 536 | ::android::hardware::Parcel _aidl_data; |
| 537 | ::android::hardware::Parcel _aidl_reply; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 538 | ::android::status_t _aidl_ret_status = ::android::OK; |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 539 | ::android::hardware::Status _aidl_status; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 540 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 541 | uint64_t _cb_hash; |
| 542 | |
| 543 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 544 | if (((_aidl_ret_status) != (::android::OK))) { |
| 545 | goto _aidl_error; |
| 546 | } |
| 547 | |
| 548 | _aidl_ret_status = remote()->transact(ITypes::GETHASH, _aidl_data, &_aidl_reply); |
| 549 | if (((_aidl_ret_status) != (::android::OK))) { |
| 550 | goto _aidl_error; |
| 551 | } |
| 552 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 553 | if (((_aidl_ret_status) != (::android::OK))) { |
| 554 | goto _aidl_error; |
| 555 | } |
| 556 | if (!_aidl_status.isOk()) { |
| 557 | return _aidl_status; |
| 558 | } |
| 559 | _aidl_ret_status = _aidl_reply.readUint64(&_cb_hash); |
| 560 | if (((_aidl_ret_status) != (::android::OK))) { |
| 561 | goto _aidl_error; |
| 562 | } |
| 563 | |
| 564 | |
| 565 | // Invoke callback to client |
| 566 | if (_cb != nullptr) |
| 567 | _cb(_cb_hash ); |
| 568 | |
| 569 | |
| 570 | _aidl_error: |
| 571 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 572 | return _aidl_status; |
| 573 | } |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 574 | ::android::hardware::Status BpTypes::quit() { |
| 575 | ::android::hardware::Parcel _aidl_data; |
| 576 | ::android::hardware::Parcel _aidl_reply; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 577 | ::android::status_t _aidl_ret_status = ::android::OK; |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 578 | ::android::hardware::Status _aidl_status; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 579 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 580 | |
| 581 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 582 | if (((_aidl_ret_status) != (::android::OK))) { |
| 583 | goto _aidl_error; |
| 584 | } |
| 585 | |
| 586 | _aidl_ret_status = remote()->transact(ITypes::QUIT, _aidl_data, &_aidl_reply); |
| 587 | if (((_aidl_ret_status) != (::android::OK))) { |
| 588 | goto _aidl_error; |
| 589 | } |
| 590 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 591 | if (((_aidl_ret_status) != (::android::OK))) { |
| 592 | goto _aidl_error; |
| 593 | } |
| 594 | if (!_aidl_status.isOk()) { |
| 595 | return _aidl_status; |
| 596 | } |
| 597 | |
| 598 | |
| 599 | |
| 600 | |
| 601 | _aidl_error: |
| 602 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 603 | return _aidl_status; |
| 604 | } |
| 605 | |
| 606 | |
| 607 | } // namespace tests |
| 608 | } // namespace hardware |
| 609 | } // namespace android |
| 610 | |
| 611 | |
| 612 | // |
Chris Phoenix | d55ed64 | 2016-07-12 18:43:04 -0700 | [diff] [blame] | 613 | //#include <android/hardware/tests/ITypes.h> |
| 614 | //#include <android/hardware/tests/BpTypes.h> |
| 615 | #include <ITypes.h> |
| 616 | #include <BpTypes.h> |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 617 | |
| 618 | |
| 619 | #include <iostream> |
Chris Phoenix | d55ed64 | 2016-07-12 18:43:04 -0700 | [diff] [blame] | 620 | //#include <android/hardware/tests/BnTypes.h> |
| 621 | #include <BnTypes.h> |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 622 | #include <binder/Parcel.h> |
| 623 | |
| 624 | namespace android { |
| 625 | namespace hardware { |
| 626 | namespace tests { |
| 627 | |
| 628 | |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 629 | ::android::status_t BnTypes::onTransact(uint32_t _aidl_code, const ::android::hardware::Parcel& _aidl_data, ::android::hardware::Parcel* _aidl_reply, uint32_t _aidl_flags, TransactCallback _cb) { |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 630 | ::android::status_t _aidl_ret_status = ::android::OK; |
| 631 | const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK |
| 632 | switch (_aidl_code) { |
| 633 | case Call::ECHOINTEGER: |
| 634 | { |
| 635 | int32_t echo_me; |
| 636 | ITypes::simple_t *my_struct ; |
| 637 | |
| 638 | bool callback_called; |
| 639 | if (!(_aidl_data.checkInterface(this))) { |
| 640 | _aidl_ret_status = ::android::BAD_TYPE; |
| 641 | break; |
| 642 | } |
| 643 | _aidl_ret_status = _aidl_data.readInt32(&echo_me); |
| 644 | if (((_aidl_ret_status) != (::android::OK))) { |
| 645 | break; |
| 646 | } |
| 647 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 648 | size_t parent_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 649 | my_struct = (ITypes::simple_t *)_aidl_data.readBuffer(&parent_handle); |
| 650 | if ((my_struct) == nullptr) { |
| 651 | break; |
| 652 | } |
| 653 | // struct fixup read_ |
| 654 | |
| 655 | //field int1 doesn't need fixup |
| 656 | |
| 657 | //field int2 doesn't need fixup |
| 658 | |
| 659 | } |
| 660 | |
| 661 | // Make the call into the server |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 662 | ::android::hardware::Status _aidl_status( |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 663 | echoInteger(echo_me , *my_struct , [&](auto ret ) { |
| 664 | callback_called = true; |
| 665 | // Write "OK" to parcel |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 666 | ::android::hardware::Status::ok().writeToParcel(_aidl_reply); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 667 | // Serialize |
| 668 | _aidl_reply->writeInt32(ret); |
| 669 | |
| 670 | // Callback |
| 671 | _cb(*_aidl_reply); |
| 672 | } |
| 673 | )); |
| 674 | |
| 675 | // |
| 676 | |
| 677 | if (!callback_called) { |
| 678 | // Callback not called, the call must have returned an error |
| 679 | // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| 680 | _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| 681 | } |
| 682 | |
| 683 | break; |
| 684 | } |
| 685 | case Call::ECHOENUM: |
| 686 | { |
| 687 | ITypes::eu8 |
| 688 | a; |
| 689 | ITypes::es8 |
| 690 | b; |
| 691 | ITypes::eu16 |
| 692 | c; |
| 693 | ITypes::es16 |
| 694 | d; |
| 695 | ITypes::eu32 |
| 696 | e; |
| 697 | ITypes::es32 |
| 698 | f; |
| 699 | ITypes::eu64 |
| 700 | g; |
| 701 | ITypes::es64 |
| 702 | h; |
| 703 | ITypes::ec |
| 704 | i; |
| 705 | |
| 706 | bool callback_called; |
| 707 | if (!(_aidl_data.checkInterface(this))) { |
| 708 | _aidl_ret_status = ::android::BAD_TYPE; |
| 709 | break; |
| 710 | } |
| 711 | _aidl_ret_status = _aidl_data.readByte((int8_t *)&a); |
| 712 | if (((_aidl_ret_status) != (::android::OK))) { |
| 713 | break; |
| 714 | } |
| 715 | _aidl_ret_status = _aidl_data.readByte((int8_t *)&b); |
| 716 | if (((_aidl_ret_status) != (::android::OK))) { |
| 717 | break; |
| 718 | } |
| 719 | _aidl_ret_status = _aidl_data.readChar((char16_t *)&c); |
| 720 | if (((_aidl_ret_status) != (::android::OK))) { |
| 721 | break; |
| 722 | } |
| 723 | _aidl_ret_status = _aidl_data.readChar((char16_t *)&d); |
| 724 | if (((_aidl_ret_status) != (::android::OK))) { |
| 725 | break; |
| 726 | } |
| 727 | _aidl_ret_status = _aidl_data.readUint32((uint32_t *)&e); |
| 728 | if (((_aidl_ret_status) != (::android::OK))) { |
| 729 | break; |
| 730 | } |
| 731 | _aidl_ret_status = _aidl_data.readInt32((int32_t *)&f); |
| 732 | if (((_aidl_ret_status) != (::android::OK))) { |
| 733 | break; |
| 734 | } |
| 735 | _aidl_ret_status = _aidl_data.readUint64((uint64_t *)&g); |
| 736 | if (((_aidl_ret_status) != (::android::OK))) { |
| 737 | break; |
| 738 | } |
| 739 | _aidl_ret_status = _aidl_data.readInt64((int64_t *)&h); |
| 740 | if (((_aidl_ret_status) != (::android::OK))) { |
| 741 | break; |
| 742 | } |
| 743 | _aidl_ret_status = _aidl_data.readByte((int8_t *)&i); |
| 744 | if (((_aidl_ret_status) != (::android::OK))) { |
| 745 | break; |
| 746 | } |
| 747 | |
| 748 | // Make the call into the server |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 749 | ::android::hardware::Status _aidl_status( |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 750 | echoEnum(a , b , c , d , e , f , g , h , i , [&](auto a , auto b , auto c , auto d , auto e , auto f , auto g , auto h , auto i ) { |
| 751 | callback_called = true; |
| 752 | // Write "OK" to parcel |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 753 | ::android::hardware::Status::ok().writeToParcel(_aidl_reply); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 754 | // Serialize |
| 755 | _aidl_ret_status = _aidl_reply->writeByte((int8_t)a); |
| 756 | if (((_aidl_ret_status) != (::android::OK))) { |
| 757 | return; |
| 758 | } |
| 759 | _aidl_ret_status = _aidl_reply->writeByte((int8_t)b); |
| 760 | if (((_aidl_ret_status) != (::android::OK))) { |
| 761 | return; |
| 762 | } |
| 763 | _aidl_ret_status = _aidl_reply->writeChar((char16_t)c); |
| 764 | if (((_aidl_ret_status) != (::android::OK))) { |
| 765 | return; |
| 766 | } |
| 767 | _aidl_ret_status = _aidl_reply->writeChar((char16_t)d); |
| 768 | if (((_aidl_ret_status) != (::android::OK))) { |
| 769 | return; |
| 770 | } |
| 771 | _aidl_ret_status = _aidl_reply->writeUint32((uint32_t)e); |
| 772 | if (((_aidl_ret_status) != (::android::OK))) { |
| 773 | return; |
| 774 | } |
| 775 | _aidl_ret_status = _aidl_reply->writeInt32((int32_t)f); |
| 776 | if (((_aidl_ret_status) != (::android::OK))) { |
| 777 | return; |
| 778 | } |
| 779 | _aidl_ret_status = _aidl_reply->writeUint64((uint64_t)g); |
| 780 | if (((_aidl_ret_status) != (::android::OK))) { |
| 781 | return; |
| 782 | } |
| 783 | _aidl_ret_status = _aidl_reply->writeInt64((int64_t)h); |
| 784 | if (((_aidl_ret_status) != (::android::OK))) { |
| 785 | return; |
| 786 | } |
| 787 | _aidl_ret_status = _aidl_reply->writeByte((int8_t)i); |
| 788 | if (((_aidl_ret_status) != (::android::OK))) { |
| 789 | return; |
| 790 | } |
| 791 | |
| 792 | // Callback |
| 793 | _cb(*_aidl_reply); |
| 794 | } |
| 795 | )); |
| 796 | |
| 797 | // |
| 798 | |
| 799 | if (!callback_called) { |
| 800 | // Callback not called, the call must have returned an error |
| 801 | // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| 802 | _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| 803 | } |
| 804 | |
| 805 | break; |
| 806 | } |
| 807 | case Call::ECHOSCALAR: |
| 808 | { |
| 809 | uint8_t a; |
| 810 | int8_t b; |
| 811 | uint16_t c; |
| 812 | int16_t d; |
| 813 | uint32_t e; |
| 814 | int32_t f; |
| 815 | uint64_t g; |
| 816 | int64_t h; |
| 817 | char i; |
| 818 | |
| 819 | bool callback_called; |
| 820 | if (!(_aidl_data.checkInterface(this))) { |
| 821 | _aidl_ret_status = ::android::BAD_TYPE; |
| 822 | break; |
| 823 | } |
| 824 | _aidl_ret_status = _aidl_data.readByte((int8_t*)&a); |
| 825 | if (((_aidl_ret_status) != (::android::OK))) { |
| 826 | break; |
| 827 | } |
| 828 | _aidl_ret_status = _aidl_data.readByte(&b); |
| 829 | if (((_aidl_ret_status) != (::android::OK))) { |
| 830 | break; |
| 831 | } |
| 832 | _aidl_ret_status = _aidl_data.readChar((char16_t*)&c); |
| 833 | if (((_aidl_ret_status) != (::android::OK))) { |
| 834 | break; |
| 835 | } |
| 836 | _aidl_ret_status = _aidl_data.readChar((char16_t*)&d); |
| 837 | if (((_aidl_ret_status) != (::android::OK))) { |
| 838 | break; |
| 839 | } |
| 840 | _aidl_ret_status = _aidl_data.readUint32(&e); |
| 841 | if (((_aidl_ret_status) != (::android::OK))) { |
| 842 | break; |
| 843 | } |
| 844 | _aidl_ret_status = _aidl_data.readInt32(&f); |
| 845 | if (((_aidl_ret_status) != (::android::OK))) { |
| 846 | break; |
| 847 | } |
| 848 | _aidl_ret_status = _aidl_data.readUint64(&g); |
| 849 | if (((_aidl_ret_status) != (::android::OK))) { |
| 850 | break; |
| 851 | } |
| 852 | _aidl_ret_status = _aidl_data.readInt64(&h); |
| 853 | if (((_aidl_ret_status) != (::android::OK))) { |
| 854 | break; |
| 855 | } |
| 856 | _aidl_ret_status = _aidl_data.readByte((int8_t*)&i); |
| 857 | if (((_aidl_ret_status) != (::android::OK))) { |
| 858 | break; |
| 859 | } |
| 860 | |
| 861 | // Make the call into the server |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 862 | ::android::hardware::Status _aidl_status( |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 863 | echoScalar(a , b , c , d , e , f , g , h , i , [&](auto a , auto b , auto c , auto d , auto e , auto f , auto g , auto h , auto i ) { |
| 864 | callback_called = true; |
| 865 | // Write "OK" to parcel |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 866 | ::android::hardware::Status::ok().writeToParcel(_aidl_reply); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 867 | // Serialize |
| 868 | _aidl_reply->writeByte((int8_t)a); |
| 869 | _aidl_reply->writeByte(b); |
| 870 | _aidl_reply->writeChar((char16_t)c); |
| 871 | _aidl_reply->writeChar((char16_t)d); |
| 872 | _aidl_reply->writeUint32(e); |
| 873 | _aidl_reply->writeInt32(f); |
| 874 | _aidl_reply->writeUint64(g); |
| 875 | _aidl_reply->writeInt64(h); |
| 876 | _aidl_reply->writeByte((int8_t)i); |
| 877 | |
| 878 | // Callback |
| 879 | _cb(*_aidl_reply); |
| 880 | } |
| 881 | )); |
| 882 | |
| 883 | // |
| 884 | |
| 885 | if (!callback_called) { |
| 886 | // Callback not called, the call must have returned an error |
| 887 | // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| 888 | _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| 889 | } |
| 890 | |
| 891 | break; |
| 892 | } |
| 893 | case Call::ECHOSTRUCT: |
| 894 | { |
| 895 | ITypes::s0 *s ; |
| 896 | |
| 897 | bool callback_called; |
| 898 | if (!(_aidl_data.checkInterface(this))) { |
| 899 | _aidl_ret_status = ::android::BAD_TYPE; |
| 900 | break; |
| 901 | } |
| 902 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 903 | size_t parent_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 904 | s = (ITypes::s0 *)_aidl_data.readBuffer(&parent_handle); |
| 905 | if ((s) == nullptr) { |
| 906 | break; |
| 907 | } |
| 908 | // struct fixup read_ |
| 909 | // struct fixup read_ |
| 910 | _aidl_ret_pointer = _aidl_data.readEmbeddedBuffer(nullptr, parent_handle, |
| 911 | (size_t)((char *)&((*s).s1m1.str1.buffer)-(char *)(&(*s)))); |
| 912 | if (_aidl_ret_pointer == nullptr) { |
| 913 | break; |
| 914 | } |
| 915 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 916 | size_t child_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 917 | _aidl_ret_pointer = _aidl_data.readEmbeddedBuffer(&child_handle, parent_handle, |
| 918 | (size_t)((char *)&((*s).s1v2.buffer)-(char *)(&(*s)))); |
| 919 | // Redefining a variable inside braces works like a static stack. |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 920 | size_t parent_handle = child_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 921 | if (_aidl_ret_pointer == nullptr) { |
| 922 | break; |
| 923 | } |
| 924 | for (size_t i1 = 0; i1 < (*s).s1v2.count; i1++) { |
| 925 | /* fixup_write_vec */ |
| 926 | // struct fixup read_ |
| 927 | _aidl_ret_pointer = _aidl_data.readEmbeddedBuffer(nullptr, parent_handle, |
| 928 | (size_t)((char *)&((*s).s1v2.buffer[i1].str1.buffer)-(char *)((*s).s1v2.buffer))); |
| 929 | if (_aidl_ret_pointer == nullptr) { |
| 930 | break; |
| 931 | } |
| 932 | |
| 933 | } |
| 934 | |
| 935 | } |
| 936 | |
| 937 | } |
| 938 | |
| 939 | // Make the call into the server |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 940 | ::android::hardware::Status _aidl_status( |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 941 | echoStruct(*s , [&](const ITypes::s0 & s ) { |
| 942 | callback_called = true; |
| 943 | // Write "OK" to parcel |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 944 | ::android::hardware::Status::ok().writeToParcel(_aidl_reply); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 945 | // Serialize |
| 946 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 947 | size_t parent_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 948 | _aidl_ret_status = _aidl_reply->writeBuffer((void *)&s, sizeof(s), &parent_handle); |
| 949 | // struct fixup write_ret_ |
| 950 | // struct fixup write_ret_ |
| 951 | _aidl_ret_status = _aidl_reply->writeEmbeddedBuffer((void *)s.s1m1.str1.buffer, |
| 952 | (s.s1m1.str1.length < 0 ? strlen(s.s1m1.str1.buffer)+1 : s.s1m1.str1.length), |
| 953 | nullptr, parent_handle, |
| 954 | (size_t)((char *)&(s.s1m1.str1.buffer)-(char *)(&s))); |
| 955 | { |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 956 | size_t child_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 957 | void *bufp = (void *)s.s1v2.buffer; |
| 958 | size_t size = sizeof(ITypes::s1s |
| 959 | [s.s1v2.count]); |
| 960 | size_t off = (size_t)((char *)&(s.s1v2.buffer)-(char *)(&s)); |
| 961 | _aidl_ret_status = _aidl_reply->writeEmbeddedBuffer(bufp, |
| 962 | size, |
| 963 | &child_handle, |
| 964 | parent_handle, |
| 965 | off /* offset_calculator */); |
| 966 | // Redefining a variable inside braces works like a static stack. |
Steven Moreland | bceb649 | 2016-07-29 10:56:45 -0700 | [diff] [blame] | 967 | size_t parent_handle = child_handle; |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 968 | for (size_t i1 = 0; i1 < s.s1v2.count; i1++) { |
| 969 | /* fixup_write_vec */ |
| 970 | // struct fixup write_ret_ |
| 971 | _aidl_ret_status = _aidl_reply->writeEmbeddedBuffer((void *)s.s1v2.buffer[i1].str1.buffer, |
| 972 | (s.s1v2.buffer[i1].str1.length < 0 ? strlen(s.s1v2.buffer[i1].str1.buffer)+1 : s.s1v2.buffer[i1].str1.length), |
| 973 | nullptr, parent_handle, |
| 974 | (size_t)((char *)&(s.s1v2.buffer[i1].str1.buffer)-(char *)(s.s1v2.buffer))); |
| 975 | |
| 976 | } |
| 977 | |
| 978 | } |
| 979 | |
| 980 | } |
| 981 | |
| 982 | // Callback |
| 983 | _cb(*_aidl_reply); |
| 984 | } |
| 985 | )); |
| 986 | |
| 987 | // |
| 988 | |
| 989 | if (!callback_called) { |
| 990 | // Callback not called, the call must have returned an error |
| 991 | // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| 992 | _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| 993 | } |
| 994 | |
| 995 | break; |
| 996 | } |
Chris Phoenix | 55a2900 | 2016-08-04 16:45:40 -0700 | [diff] [blame^] | 997 | case Call::ECHOINTERFACE: |
| 998 | { |
| 999 | sp<ISmallTest> cb_t ; |
| 1000 | |
| 1001 | bool callback_called; |
| 1002 | if (!(_aidl_data.checkInterface(this))) { |
| 1003 | _aidl_ret_status = ::android::BAD_TYPE; |
| 1004 | break; |
| 1005 | } |
| 1006 | _aidl_ret_status = _aidl_data.readStrongBinder(&cb_t); |
| 1007 | if (((_aidl_ret_status) != (::android::OK))) { |
| 1008 | break; |
| 1009 | } |
| 1010 | |
| 1011 | // Make the call into the server |
| 1012 | ::android::hardware::Status _aidl_status( |
| 1013 | echoInterface(cb_t , [&](auto cb_t ) { |
| 1014 | callback_called = true; |
| 1015 | // Write "OK" to parcel |
| 1016 | ::android::hardware::Status::ok().writeToParcel(_aidl_reply); |
| 1017 | // Serialize |
| 1018 | _aidl_ret_status = _aidl_reply->writeStrongBinder(IInterface::asBinder(cb_t)); |
| 1019 | if (((_aidl_ret_status) != (::android::OK))) { |
| 1020 | // TODO(maco): Log/report all errors. See b/30476330 |
| 1021 | return; |
| 1022 | } |
| 1023 | |
| 1024 | // Callback |
| 1025 | _cb(*_aidl_reply); |
| 1026 | } |
| 1027 | )); |
| 1028 | |
| 1029 | // |
| 1030 | |
| 1031 | if (!callback_called) { |
| 1032 | // Callback not called, the call must have returned an error |
| 1033 | // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| 1034 | _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| 1035 | } |
| 1036 | |
| 1037 | break; |
| 1038 | } |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1039 | case Call::SHAREBUFFERWITHREF: |
| 1040 | { |
| 1041 | hidl_ref<lots_of_data> buffer; |
| 1042 | |
| 1043 | bool callback_called; |
| 1044 | if (!(_aidl_data.checkInterface(this))) { |
| 1045 | _aidl_ret_status = ::android::BAD_TYPE; |
| 1046 | break; |
| 1047 | } |
| 1048 | buffer = _aidl_data.readFileDescriptor(); |
| 1049 | |
| 1050 | // Make the call into the server |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 1051 | ::android::hardware::Status _aidl_status( |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1052 | shareBufferWithRef(buffer , [&](auto ret ) { |
| 1053 | callback_called = true; |
| 1054 | // Write "OK" to parcel |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 1055 | ::android::hardware::Status::ok().writeToParcel(_aidl_reply); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1056 | // Serialize |
| 1057 | _aidl_reply->writeInt32(ret); |
| 1058 | |
| 1059 | // Callback |
| 1060 | _cb(*_aidl_reply); |
| 1061 | } |
| 1062 | )); |
| 1063 | |
| 1064 | // |
| 1065 | |
| 1066 | if (!callback_called) { |
| 1067 | // Callback not called, the call must have returned an error |
| 1068 | // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| 1069 | _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| 1070 | } |
| 1071 | |
| 1072 | break; |
| 1073 | } |
| 1074 | case Call::GETHASH: |
| 1075 | { |
| 1076 | |
| 1077 | bool callback_called; |
| 1078 | if (!(_aidl_data.checkInterface(this))) { |
| 1079 | _aidl_ret_status = ::android::BAD_TYPE; |
| 1080 | break; |
| 1081 | } |
| 1082 | |
| 1083 | // Make the call into the server |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 1084 | ::android::hardware::Status _aidl_status( |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1085 | getHash( [&](auto hash ) { |
| 1086 | callback_called = true; |
| 1087 | // Write "OK" to parcel |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 1088 | ::android::hardware::Status::ok().writeToParcel(_aidl_reply); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1089 | // Serialize |
| 1090 | _aidl_reply->writeUint64(hash); |
| 1091 | |
| 1092 | // Callback |
| 1093 | _cb(*_aidl_reply); |
| 1094 | } |
| 1095 | )); |
| 1096 | |
| 1097 | // |
| 1098 | |
| 1099 | if (!callback_called) { |
| 1100 | // Callback not called, the call must have returned an error |
| 1101 | // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| 1102 | _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| 1103 | } |
| 1104 | |
| 1105 | break; |
| 1106 | } |
| 1107 | case Call::QUIT: |
| 1108 | { |
| 1109 | |
| 1110 | bool callback_called; |
| 1111 | if (!(_aidl_data.checkInterface(this))) { |
| 1112 | _aidl_ret_status = ::android::BAD_TYPE; |
| 1113 | break; |
| 1114 | } |
| 1115 | |
| 1116 | // Make the call into the server |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 1117 | ::android::hardware::Status _aidl_status( |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1118 | quit()); |
| 1119 | |
| 1120 | // |
| 1121 | |
| 1122 | |
| 1123 | break; |
| 1124 | } |
| 1125 | |
| 1126 | default: |
| 1127 | { |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 1128 | _aidl_ret_status = ::android::hardware::BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1129 | } |
| 1130 | break; |
| 1131 | } |
| 1132 | if (_aidl_ret_status == ::android::UNEXPECTED_NULL) { |
Iliyan Malchev | 7e62876 | 2016-08-01 09:21:46 -0700 | [diff] [blame] | 1133 | _aidl_ret_status = ::android::hardware::Status::fromExceptionCode(::android::hardware::Status::EX_NULL_POINTER).writeToParcel(_aidl_reply); |
Chris Phoenix | dadccd3 | 2016-07-07 14:49:20 -0700 | [diff] [blame] | 1134 | } |
| 1135 | return _aidl_ret_status; |
| 1136 | } |
| 1137 | |
| 1138 | } // namespace tests |
| 1139 | } // namespace hardware |
| 1140 | } // namespace android |
| 1141 | |