Martijn Coenen | 1b7297c | 2016-05-19 09:23:46 +0200 | [diff] [blame] | 1 | #include <android/hardware/tests/ITestService.h> |
| 2 | #include <android/hardware/tests/BpTestService.h> |
| 3 | |
| 4 | namespace android { |
| 5 | |
| 6 | namespace hardware { |
| 7 | |
| 8 | namespace tests { |
| 9 | |
| 10 | IMPLEMENT_META_INTERFACE(TestService, "android.hardware.tests.ITestService"); |
| 11 | |
| 12 | } // namespace tests |
| 13 | |
| 14 | } // namespace hardware |
| 15 | |
| 16 | } // namespace android |
| 17 | #include <android/hardware/tests/BpTestService.h> |
| 18 | #include <binder/Parcel.h> |
| 19 | |
| 20 | namespace android { |
| 21 | |
| 22 | namespace hardware { |
| 23 | |
| 24 | namespace tests { |
| 25 | |
| 26 | BpTestService::BpTestService(const ::android::sp<::android::hidl::IBinder>& _aidl_impl) |
| 27 | : BpInterface<ITestService>(_aidl_impl){ |
| 28 | } |
| 29 | |
Martijn Coenen | 84aa7f4 | 2016-05-24 13:54:29 +0200 | [diff] [blame] | 30 | ::android::hidl::binder::Status BpTestService::echoInteger(int32_t echo_me, ITestService::echoInteger_cb _cb) { |
| 31 | ::android::hidl::Parcel _aidl_data; |
| 32 | ::android::hidl::Parcel _aidl_reply; |
| 33 | ::android::status_t _aidl_ret_status = ::android::OK; |
| 34 | ::android::hidl::binder::Status _aidl_status; |
| 35 | |
| 36 | int32_t _aidl_return; // Typed with the type of 'generates' in .hidl |
| 37 | |
| 38 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 39 | if (((_aidl_ret_status) != (::android::OK))) { |
| 40 | goto _aidl_error; |
| 41 | } |
| 42 | _aidl_ret_status = _aidl_data.writeInt32(echo_me); |
| 43 | if (((_aidl_ret_status) != (::android::OK))) { |
| 44 | goto _aidl_error; |
| 45 | } |
| 46 | _aidl_ret_status = remote()->transact(ITestService::ECHOINTEGER, _aidl_data, &_aidl_reply); |
| 47 | if (((_aidl_ret_status) != (::android::OK))) { |
| 48 | goto _aidl_error; |
| 49 | } |
| 50 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 51 | if (((_aidl_ret_status) != (::android::OK))) { |
| 52 | goto _aidl_error; |
| 53 | } |
| 54 | if (!_aidl_status.isOk()) { |
| 55 | return _aidl_status; |
| 56 | } |
| 57 | _aidl_ret_status = _aidl_reply.readInt32(&_aidl_return); |
| 58 | if (((_aidl_ret_status) != (::android::OK))) { |
| 59 | goto _aidl_error; |
| 60 | } |
| 61 | // Invoke callback to client |
| 62 | _cb(_aidl_return); |
| 63 | |
Martijn Coenen | 1b7297c | 2016-05-19 09:23:46 +0200 | [diff] [blame] | 64 | _aidl_error: |
Martijn Coenen | 84aa7f4 | 2016-05-24 13:54:29 +0200 | [diff] [blame] | 65 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 66 | return _aidl_status; |
Martijn Coenen | 1b7297c | 2016-05-19 09:23:46 +0200 | [diff] [blame] | 67 | } |
| 68 | |
Martijn Coenen | 221bb4f | 2016-05-24 21:52:30 +0200 | [diff] [blame^] | 69 | ::android::hidl::binder::Status BpTestService::shareBufferWithRef(int buffer, ITestService::shareBufferWithRef_cb _cb) { |
| 70 | ::android::hidl::Parcel _aidl_data; |
| 71 | ::android::hidl::Parcel _aidl_reply; |
| 72 | ::android::status_t _aidl_ret_status = ::android::OK; |
| 73 | ::android::hidl::binder::Status _aidl_status; |
| 74 | |
| 75 | int32_t _aidl_return; // Typed with the type of 'generates' in .hidl |
| 76 | |
| 77 | _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| 78 | if (((_aidl_ret_status) != (::android::OK))) { |
| 79 | goto _aidl_error; |
| 80 | } |
| 81 | _aidl_ret_status = _aidl_data.writeFileDescriptor(buffer); |
| 82 | if (((_aidl_ret_status) != (::android::OK))) { |
| 83 | goto _aidl_error; |
| 84 | } |
| 85 | _aidl_ret_status = remote()->transact(ITestService::SHAREBUFFERWITHREF, _aidl_data, &_aidl_reply); |
| 86 | if (((_aidl_ret_status) != (::android::OK))) { |
| 87 | goto _aidl_error; |
| 88 | } |
| 89 | _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| 90 | if (((_aidl_ret_status) != (::android::OK))) { |
| 91 | goto _aidl_error; |
| 92 | } |
| 93 | if (!_aidl_status.isOk()) { |
| 94 | return _aidl_status; |
| 95 | } |
| 96 | _aidl_ret_status = _aidl_reply.readInt32(&_aidl_return); |
| 97 | if (((_aidl_ret_status) != (::android::OK))) { |
| 98 | goto _aidl_error; |
| 99 | } |
| 100 | // Invoke callback to client |
| 101 | _cb(_aidl_return); |
| 102 | |
| 103 | _aidl_error: |
| 104 | _aidl_status.setFromStatusT(_aidl_ret_status); |
| 105 | return _aidl_status; |
| 106 | } |
| 107 | |
Martijn Coenen | 1b7297c | 2016-05-19 09:23:46 +0200 | [diff] [blame] | 108 | } // namespace tests |
| 109 | |
| 110 | } // namespace hardware |
| 111 | |
| 112 | } // namespace android |