1 /*
2 * This file is auto-generated. DO NOT MODIFY.
3 * Using: out/host/linux-x86/bin/aidl --lang=ndk --structured --version 1 --hash 9e4d90844dd965def6c11732252f49d6aeaffc8e -t --stability vintf --min_sdk_version 30 --ninja -d out/soong/.intermediates/hardware/interfaces/threadnetwork/aidl/android.hardware.threadnetwork-V1-ndk-source/gen/staging/android/hardware/threadnetwork/IThreadChipCallback.cpp.d -h out/soong/.intermediates/hardware/interfaces/threadnetwork/aidl/android.hardware.threadnetwork-V1-ndk-source/gen/include/staging -o out/soong/.intermediates/hardware/interfaces/threadnetwork/aidl/android.hardware.threadnetwork-V1-ndk-source/gen/staging -Nhardware/interfaces/threadnetwork/aidl/aidl_api/android.hardware.threadnetwork/1 hardware/interfaces/threadnetwork/aidl/aidl_api/android.hardware.threadnetwork/1/android/hardware/threadnetwork/IThreadChipCallback.aidl
4 *
5 * DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
6 * ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
7 * AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
8 */
9 #include "aidl/android/hardware/threadnetwork/IThreadChipCallback.h"
10
11 #include <android/binder_parcel_utils.h>
12 #include <aidl/android/hardware/threadnetwork/BnThreadChipCallback.h>
13 #include <aidl/android/hardware/threadnetwork/BpThreadChipCallback.h>
14
15 namespace aidl {
16 namespace android {
17 namespace hardware {
18 namespace threadnetwork {
_aidl_android_hardware_threadnetwork_IThreadChipCallback_onTransact(AIBinder * _aidl_binder,transaction_code_t _aidl_code,const AParcel * _aidl_in,AParcel * _aidl_out)19 static binder_status_t _aidl_android_hardware_threadnetwork_IThreadChipCallback_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
20 (void)_aidl_in;
21 (void)_aidl_out;
22 binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
23 std::shared_ptr<BnThreadChipCallback> _aidl_impl = std::static_pointer_cast<BnThreadChipCallback>(::ndk::ICInterface::asInterface(_aidl_binder));
24 switch (_aidl_code) {
25 case (FIRST_CALL_TRANSACTION + 0 /*onReceiveSpinelFrame*/): {
26 std::vector<uint8_t> in_frame;
27
28 _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_frame);
29 if (_aidl_ret_status != STATUS_OK) break;
30
31 ::ndk::ScopedAStatus _aidl_status = _aidl_impl->onReceiveSpinelFrame(in_frame);
32 _aidl_ret_status = STATUS_OK;
33 break;
34 }
35 case (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/): {
36 int32_t _aidl_return;
37
38 ::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceVersion(&_aidl_return);
39 _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
40 if (_aidl_ret_status != STATUS_OK) break;
41
42 if (!AStatus_isOk(_aidl_status.get())) break;
43
44 _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
45 if (_aidl_ret_status != STATUS_OK) break;
46
47 break;
48 }
49 case (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/): {
50 std::string _aidl_return;
51
52 ::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceHash(&_aidl_return);
53 _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
54 if (_aidl_ret_status != STATUS_OK) break;
55
56 if (!AStatus_isOk(_aidl_status.get())) break;
57
58 _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
59 if (_aidl_ret_status != STATUS_OK) break;
60
61 break;
62 }
63 }
64 return _aidl_ret_status;
65 }
66
67 static const char* _g_aidl_android_hardware_threadnetwork_IThreadChipCallback_clazz_code_to_function[] = { "onReceiveSpinelFrame",};
68 static AIBinder_Class* _g_aidl_android_hardware_threadnetwork_IThreadChipCallback_clazz = ::ndk::ICInterface::defineClass(IThreadChipCallback::descriptor, _aidl_android_hardware_threadnetwork_IThreadChipCallback_onTransact, _g_aidl_android_hardware_threadnetwork_IThreadChipCallback_clazz_code_to_function, 1);
69
BpThreadChipCallback(const::ndk::SpAIBinder & binder)70 BpThreadChipCallback::BpThreadChipCallback(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
~BpThreadChipCallback()71 BpThreadChipCallback::~BpThreadChipCallback() {}
72
onReceiveSpinelFrame(const std::vector<uint8_t> & in_frame)73 ::ndk::ScopedAStatus BpThreadChipCallback::onReceiveSpinelFrame(const std::vector<uint8_t>& in_frame) {
74 binder_status_t _aidl_ret_status = STATUS_OK;
75 ::ndk::ScopedAStatus _aidl_status;
76 ::ndk::ScopedAParcel _aidl_in;
77 ::ndk::ScopedAParcel _aidl_out;
78
79 _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
80 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
81
82 _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_frame);
83 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
84
85 _aidl_ret_status = AIBinder_transact(
86 asBinderReference().get(),
87 (FIRST_CALL_TRANSACTION + 0 /*onReceiveSpinelFrame*/),
88 _aidl_in.getR(),
89 _aidl_out.getR(),
90 FLAG_ONEWAY
91 #ifdef BINDER_STABILITY_SUPPORT
92 | static_cast<int>(FLAG_PRIVATE_LOCAL)
93 #endif // BINDER_STABILITY_SUPPORT
94 );
95 if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IThreadChipCallback::getDefaultImpl()) {
96 _aidl_status = IThreadChipCallback::getDefaultImpl()->onReceiveSpinelFrame(in_frame);
97 goto _aidl_status_return;
98 }
99 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
100
101 _aidl_error:
102 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
103 _aidl_status_return:
104 return _aidl_status;
105 }
getInterfaceVersion(int32_t * _aidl_return)106 ::ndk::ScopedAStatus BpThreadChipCallback::getInterfaceVersion(int32_t* _aidl_return) {
107 binder_status_t _aidl_ret_status = STATUS_OK;
108 ::ndk::ScopedAStatus _aidl_status;
109 if (_aidl_cached_version != -1) {
110 *_aidl_return = _aidl_cached_version;
111 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
112 return _aidl_status;
113 }
114 ::ndk::ScopedAParcel _aidl_in;
115 ::ndk::ScopedAParcel _aidl_out;
116
117 _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
118 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
119
120 _aidl_ret_status = AIBinder_transact(
121 asBinderReference().get(),
122 (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/),
123 _aidl_in.getR(),
124 _aidl_out.getR(),
125 0
126 #ifdef BINDER_STABILITY_SUPPORT
127 | static_cast<int>(FLAG_PRIVATE_LOCAL)
128 #endif // BINDER_STABILITY_SUPPORT
129 );
130 if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IThreadChipCallback::getDefaultImpl()) {
131 _aidl_status = IThreadChipCallback::getDefaultImpl()->getInterfaceVersion(_aidl_return);
132 goto _aidl_status_return;
133 }
134 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
135
136 _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
137 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
138
139 if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
140 _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
141 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
142
143 _aidl_cached_version = *_aidl_return;
144 _aidl_error:
145 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
146 _aidl_status_return:
147 return _aidl_status;
148 }
getInterfaceHash(std::string * _aidl_return)149 ::ndk::ScopedAStatus BpThreadChipCallback::getInterfaceHash(std::string* _aidl_return) {
150 binder_status_t _aidl_ret_status = STATUS_OK;
151 ::ndk::ScopedAStatus _aidl_status;
152 const std::lock_guard<std::mutex> lock(_aidl_cached_hash_mutex);
153 if (_aidl_cached_hash != "-1") {
154 *_aidl_return = _aidl_cached_hash;
155 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
156 return _aidl_status;
157 }
158 ::ndk::ScopedAParcel _aidl_in;
159 ::ndk::ScopedAParcel _aidl_out;
160
161 _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
162 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
163
164 _aidl_ret_status = AIBinder_transact(
165 asBinderReference().get(),
166 (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/),
167 _aidl_in.getR(),
168 _aidl_out.getR(),
169 0
170 #ifdef BINDER_STABILITY_SUPPORT
171 | static_cast<int>(FLAG_PRIVATE_LOCAL)
172 #endif // BINDER_STABILITY_SUPPORT
173 );
174 if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IThreadChipCallback::getDefaultImpl()) {
175 _aidl_status = IThreadChipCallback::getDefaultImpl()->getInterfaceHash(_aidl_return);
176 goto _aidl_status_return;
177 }
178 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
179
180 _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
181 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
182
183 if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
184 _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
185 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
186
187 _aidl_cached_hash = *_aidl_return;
188 _aidl_error:
189 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
190 _aidl_status_return:
191 return _aidl_status;
192 }
193 // Source for BnThreadChipCallback
BnThreadChipCallback()194 BnThreadChipCallback::BnThreadChipCallback() {}
~BnThreadChipCallback()195 BnThreadChipCallback::~BnThreadChipCallback() {}
createBinder()196 ::ndk::SpAIBinder BnThreadChipCallback::createBinder() {
197 AIBinder* binder = AIBinder_new(_g_aidl_android_hardware_threadnetwork_IThreadChipCallback_clazz, static_cast<void*>(this));
198 #ifdef BINDER_STABILITY_SUPPORT
199 AIBinder_markVintfStability(binder);
200 #endif // BINDER_STABILITY_SUPPORT
201 return ::ndk::SpAIBinder(binder);
202 }
getInterfaceVersion(int32_t * _aidl_return)203 ::ndk::ScopedAStatus BnThreadChipCallback::getInterfaceVersion(int32_t* _aidl_return) {
204 *_aidl_return = IThreadChipCallback::version;
205 return ::ndk::ScopedAStatus(AStatus_newOk());
206 }
getInterfaceHash(std::string * _aidl_return)207 ::ndk::ScopedAStatus BnThreadChipCallback::getInterfaceHash(std::string* _aidl_return) {
208 *_aidl_return = IThreadChipCallback::hash;
209 return ::ndk::ScopedAStatus(AStatus_newOk());
210 }
211 // Source for IThreadChipCallback
212 const char* IThreadChipCallback::descriptor = "android.hardware.threadnetwork.IThreadChipCallback";
IThreadChipCallback()213 IThreadChipCallback::IThreadChipCallback() {}
~IThreadChipCallback()214 IThreadChipCallback::~IThreadChipCallback() {}
215
216
fromBinder(const::ndk::SpAIBinder & binder)217 std::shared_ptr<IThreadChipCallback> IThreadChipCallback::fromBinder(const ::ndk::SpAIBinder& binder) {
218 if (!AIBinder_associateClass(binder.get(), _g_aidl_android_hardware_threadnetwork_IThreadChipCallback_clazz)) {
219 #if __ANDROID_API__ >= 31
220 const AIBinder_Class* originalClass = AIBinder_getClass(binder.get());
221 if (originalClass == nullptr) return nullptr;
222 if (0 == strcmp(AIBinder_Class_getDescriptor(originalClass), descriptor)) {
223 return ::ndk::SharedRefBase::make<BpThreadChipCallback>(binder);
224 }
225 #endif
226 return nullptr;
227 }
228 std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
229 if (interface) {
230 return std::static_pointer_cast<IThreadChipCallback>(interface);
231 }
232 return ::ndk::SharedRefBase::make<BpThreadChipCallback>(binder);
233 }
234
writeToParcel(AParcel * parcel,const std::shared_ptr<IThreadChipCallback> & instance)235 binder_status_t IThreadChipCallback::writeToParcel(AParcel* parcel, const std::shared_ptr<IThreadChipCallback>& instance) {
236 return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
237 }
readFromParcel(const AParcel * parcel,std::shared_ptr<IThreadChipCallback> * instance)238 binder_status_t IThreadChipCallback::readFromParcel(const AParcel* parcel, std::shared_ptr<IThreadChipCallback>* instance) {
239 ::ndk::SpAIBinder binder;
240 binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
241 if (status != STATUS_OK) return status;
242 *instance = IThreadChipCallback::fromBinder(binder);
243 return STATUS_OK;
244 }
setDefaultImpl(const std::shared_ptr<IThreadChipCallback> & impl)245 bool IThreadChipCallback::setDefaultImpl(const std::shared_ptr<IThreadChipCallback>& impl) {
246 // Only one user of this interface can use this function
247 // at a time. This is a heuristic to detect if two different
248 // users in the same process use this function.
249 assert(!IThreadChipCallback::default_impl);
250 if (impl) {
251 IThreadChipCallback::default_impl = impl;
252 return true;
253 }
254 return false;
255 }
getDefaultImpl()256 const std::shared_ptr<IThreadChipCallback>& IThreadChipCallback::getDefaultImpl() {
257 return IThreadChipCallback::default_impl;
258 }
259 std::shared_ptr<IThreadChipCallback> IThreadChipCallback::default_impl = nullptr;
onReceiveSpinelFrame(const std::vector<uint8_t> &)260 ::ndk::ScopedAStatus IThreadChipCallbackDefault::onReceiveSpinelFrame(const std::vector<uint8_t>& /*in_frame*/) {
261 ::ndk::ScopedAStatus _aidl_status;
262 _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
263 return _aidl_status;
264 }
getInterfaceVersion(int32_t * _aidl_return)265 ::ndk::ScopedAStatus IThreadChipCallbackDefault::getInterfaceVersion(int32_t* _aidl_return) {
266 *_aidl_return = 0;
267 return ::ndk::ScopedAStatus(AStatus_newOk());
268 }
getInterfaceHash(std::string * _aidl_return)269 ::ndk::ScopedAStatus IThreadChipCallbackDefault::getInterfaceHash(std::string* _aidl_return) {
270 *_aidl_return = "";
271 return ::ndk::ScopedAStatus(AStatus_newOk());
272 }
asBinder()273 ::ndk::SpAIBinder IThreadChipCallbackDefault::asBinder() {
274 return ::ndk::SpAIBinder();
275 }
isRemote()276 bool IThreadChipCallbackDefault::isRemote() {
277 return false;
278 }
279 } // namespace threadnetwork
280 } // namespace hardware
281 } // namespace android
282 } // namespace aidl
283