blob: 8c0e953db836ee9adc583f290e7f8cdfbf66ea21 [file] [log] [blame]
Martijn Coenen1b7297c2016-05-19 09:23:46 +02001#include <android/hardware/tests/ITestService.h>
2#include <android/hardware/tests/BpTestService.h>
3
4namespace android {
5
6namespace hardware {
7
8namespace tests {
9
10IMPLEMENT_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
20namespace android {
21
22namespace hardware {
23
24namespace tests {
25
26BpTestService::BpTestService(const ::android::sp<::android::hidl::IBinder>& _aidl_impl)
27 : BpInterface<ITestService>(_aidl_impl){
28}
29
Martijn Coenen84aa7f42016-05-24 13:54:29 +020030::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 Coenen1b7297c2016-05-19 09:23:46 +020064_aidl_error:
Martijn Coenen84aa7f42016-05-24 13:54:29 +020065 _aidl_status.setFromStatusT(_aidl_ret_status);
66 return _aidl_status;
Martijn Coenen1b7297c2016-05-19 09:23:46 +020067}
68
Martijn Coenen221bb4f2016-05-24 21:52:30 +020069::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 Coenen1b7297c2016-05-19 09:23:46 +0200108} // namespace tests
109
110} // namespace hardware
111
112} // namespace android