| // AUTO_GENERATED FILE - DO NOT EDIT |
| // see system/tools/hidl/templates/TemplateAll.cpp |
| #include <android/hardware/nfc/INfc.h> |
| #include <android/hardware/nfc/BpNfc.h> |
| #include <iostream> |
| #include <stdio.h> |
| using std::cout; |
| using std::endl; |
| |
| namespace android { |
| namespace hardware { |
| namespace nfc { |
| |
| |
| IMPLEMENT_META_INTERFACE(Nfc, "android.hardware.nfc.INfc"); |
| |
| } // namespace nfc |
| } // namespace hardware |
| } // namespace android |
| |
| |
| #include <android/hardware/nfc/BpNfc.h> |
| #include <binder/Parcel.h> |
| |
| namespace android { |
| namespace hardware { |
| namespace nfc { |
| |
| |
| BpNfc::BpNfc(const ::android::sp<::android::hidl::IBinder>& _aidl_impl) |
| : BpInterface<INfc>(_aidl_impl){ |
| } |
| ::android::hidl::binder::Status BpNfc::open(sp<INfcClientCallback> clientCallback , INfc::open_cb _cb ) { |
| ::android::hidl::Parcel _aidl_data; |
| ::android::hidl::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::hidl::binder::Status _aidl_status; |
| int32_t _cb_retval; |
| |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_data.writeStrongBinder(IInterface::asBinder(clientCallback)); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| _aidl_ret_status = remote()->transact(INfc::OPEN, _aidl_data, &_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(&_cb_retval); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| |
| // Invoke callback to client |
| if (_cb != nullptr) |
| _cb(_cb_retval ); |
| |
| |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| ::android::hidl::binder::Status BpNfc::write(const INfc::nfc_data_t& data , INfc::write_cb _cb ) { |
| ::android::hidl::Parcel _aidl_data; |
| ::android::hidl::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::hidl::binder::Status _aidl_status; |
| int32_t _cb_retval; |
| |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| { |
| uint64_t parent_handle; |
| _aidl_ret_status = _aidl_data.writeBuffer((void *)&data, sizeof(data), &parent_handle); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| // struct fixup write_ |
| { |
| uint64_t child_handle; |
| void *bufp = (void *)data.data.buffer; |
| size_t size = sizeof(uint8_t[data.data.count]); |
| size_t off = (size_t)((char *)&(data.data.buffer)-(char *)(&data)); |
| _aidl_ret_status = _aidl_data.writeEmbeddedBuffer(bufp, |
| size, |
| &child_handle, |
| parent_handle, |
| off /* offset_calculator */); |
| printf("c: wb vec : buf %p size %ld offset %ld parent %ld child %ld ret %d\n", bufp, size, off, parent_handle, child_handle, _aidl_ret_status); |
| // Redefining a variable inside braces works like a static stack. |
| uint64_t parent_handle = child_handle; |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| // Fixup not needed for this vec uint8_t |
| } |
| |
| } |
| |
| _aidl_ret_status = remote()->transact(INfc::WRITE, _aidl_data, &_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(&_cb_retval); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| |
| // Invoke callback to client |
| if (_cb != nullptr) |
| _cb(_cb_retval ); |
| |
| |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| ::android::hidl::binder::Status BpNfc::core_initialized(const hidl_vec<uint8_t> &data , INfc::core_initialized_cb _cb ) { |
| ::android::hidl::Parcel _aidl_data; |
| ::android::hidl::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::hidl::binder::Status _aidl_status; |
| int32_t _cb_retval; |
| |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| { |
| uint64_t parent_handle; |
| |
| _aidl_ret_status = _aidl_data.writeBuffer((void *)&data, sizeof(data), &parent_handle); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| { |
| uint64_t child_handle; |
| void *bufp = (void *)data.buffer; |
| size_t size = sizeof(uint8_t[data.count]); |
| size_t off = (size_t)((char *)&(data.buffer)-(char *)(&data)); |
| _aidl_ret_status = _aidl_data.writeEmbeddedBuffer(bufp, |
| size, |
| &child_handle, |
| parent_handle, |
| off /* offset_calculator */); |
| printf("c: wb vec : buf %p size %ld offset %ld parent %ld child %ld ret %d\n", bufp, size, off, parent_handle, child_handle, _aidl_ret_status); |
| // Redefining a variable inside braces works like a static stack. |
| uint64_t parent_handle = child_handle; |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| // Fixup not needed for this vec uint8_t |
| } |
| |
| } |
| |
| _aidl_ret_status = remote()->transact(INfc::CORE_INITIALIZED, _aidl_data, &_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(&_cb_retval); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| |
| // Invoke callback to client |
| if (_cb != nullptr) |
| _cb(_cb_retval ); |
| |
| |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| ::android::hidl::binder::Status BpNfc::pre_discover(INfc::pre_discover_cb _cb ) { |
| ::android::hidl::Parcel _aidl_data; |
| ::android::hidl::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::hidl::binder::Status _aidl_status; |
| int32_t _cb_retval; |
| |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| _aidl_ret_status = remote()->transact(INfc::PRE_DISCOVER, _aidl_data, &_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(&_cb_retval); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| |
| // Invoke callback to client |
| if (_cb != nullptr) |
| _cb(_cb_retval ); |
| |
| |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| ::android::hidl::binder::Status BpNfc::close(INfc::close_cb _cb ) { |
| ::android::hidl::Parcel _aidl_data; |
| ::android::hidl::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::hidl::binder::Status _aidl_status; |
| int32_t _cb_retval; |
| |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| _aidl_ret_status = remote()->transact(INfc::CLOSE, _aidl_data, &_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(&_cb_retval); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| |
| // Invoke callback to client |
| if (_cb != nullptr) |
| _cb(_cb_retval ); |
| |
| |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| ::android::hidl::binder::Status BpNfc::control_granted(INfc::control_granted_cb _cb ) { |
| ::android::hidl::Parcel _aidl_data; |
| ::android::hidl::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::hidl::binder::Status _aidl_status; |
| int32_t _cb_retval; |
| |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| _aidl_ret_status = remote()->transact(INfc::CONTROL_GRANTED, _aidl_data, &_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(&_cb_retval); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| |
| // Invoke callback to client |
| if (_cb != nullptr) |
| _cb(_cb_retval ); |
| |
| |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| ::android::hidl::binder::Status BpNfc::power_cycle(INfc::power_cycle_cb _cb ) { |
| ::android::hidl::Parcel _aidl_data; |
| ::android::hidl::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::hidl::binder::Status _aidl_status; |
| int32_t _cb_retval; |
| |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| _aidl_ret_status = remote()->transact(INfc::POWER_CYCLE, _aidl_data, &_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(&_cb_retval); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| |
| |
| // Invoke callback to client |
| if (_cb != nullptr) |
| _cb(_cb_retval ); |
| |
| |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| |
| |
| } // namespace nfc |
| } // namespace hardware |
| } // namespace android |
| |
| |
| // |
| #include <android/hardware/nfc/INfc.h> |
| #include <android/hardware/nfc/BpNfc.h> |
| |
| |
| #include <iostream> |
| #include <android/hardware/nfc/BnNfc.h> |
| #include <binder/Parcel.h> |
| |
| namespace android { |
| namespace hardware { |
| namespace nfc { |
| |
| |
| ::android::status_t BnNfc::onTransact(uint32_t _aidl_code, const ::android::hidl::Parcel& _aidl_data, ::android::hidl::Parcel* _aidl_reply, uint32_t _aidl_flags, TransactCallback _cb) { |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| switch (_aidl_code) { |
| case Call::OPEN: |
| { |
| sp<INfcClientCallback> clientCallback ; |
| |
| bool callback_called; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| _aidl_ret_status = _aidl_data.readStrongBinder(&clientCallback); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| |
| // Make the call into the server |
| ::android::hidl::binder::Status _aidl_status( |
| open(clientCallback , [&](auto retval ) { |
| callback_called = true; |
| // Write "OK" to parcel |
| ::android::hidl::binder::Status::ok().writeToParcel(_aidl_reply); |
| // Serialize |
| _aidl_reply->writeInt32(retval); |
| |
| // Callback |
| _cb(*_aidl_reply); |
| } |
| )); |
| |
| // |
| |
| if (!callback_called) { |
| // Callback not called, the call must have returned an error |
| // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| } |
| |
| break; |
| } |
| case Call::WRITE: |
| { |
| INfc::nfc_data_t *data ; |
| |
| bool callback_called; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| data = (INfc::nfc_data_t *)_aidl_data.readBuffer(nullptr); |
| // struct fixup read_ |
| |
| |
| // Make the call into the server |
| ::android::hidl::binder::Status _aidl_status( |
| write(*data , [&](auto retval ) { |
| callback_called = true; |
| // Write "OK" to parcel |
| ::android::hidl::binder::Status::ok().writeToParcel(_aidl_reply); |
| // Serialize |
| _aidl_reply->writeInt32(retval); |
| |
| // Callback |
| _cb(*_aidl_reply); |
| } |
| )); |
| |
| // |
| |
| if (!callback_called) { |
| // Callback not called, the call must have returned an error |
| // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| } |
| |
| break; |
| } |
| case Call::CORE_INITIALIZED: |
| { |
| hidl_vec<uint8_t> *data ; |
| |
| bool callback_called; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| data = (hidl_vec<uint8_t> *)_aidl_data.readBuffer(nullptr); |
| |
| // Make the call into the server |
| ::android::hidl::binder::Status _aidl_status( |
| core_initialized(*data , [&](auto retval ) { |
| callback_called = true; |
| // Write "OK" to parcel |
| ::android::hidl::binder::Status::ok().writeToParcel(_aidl_reply); |
| // Serialize |
| _aidl_reply->writeInt32(retval); |
| |
| // Callback |
| _cb(*_aidl_reply); |
| } |
| )); |
| |
| // |
| |
| if (!callback_called) { |
| // Callback not called, the call must have returned an error |
| // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| } |
| |
| break; |
| } |
| case Call::PRE_DISCOVER: |
| { |
| |
| bool callback_called; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| |
| // Make the call into the server |
| ::android::hidl::binder::Status _aidl_status( |
| pre_discover( [&](auto retval ) { |
| callback_called = true; |
| // Write "OK" to parcel |
| ::android::hidl::binder::Status::ok().writeToParcel(_aidl_reply); |
| // Serialize |
| _aidl_reply->writeInt32(retval); |
| |
| // Callback |
| _cb(*_aidl_reply); |
| } |
| )); |
| |
| // |
| |
| if (!callback_called) { |
| // Callback not called, the call must have returned an error |
| // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| } |
| |
| break; |
| } |
| case Call::CLOSE: |
| { |
| |
| bool callback_called; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| |
| // Make the call into the server |
| ::android::hidl::binder::Status _aidl_status( |
| close( [&](auto retval ) { |
| callback_called = true; |
| // Write "OK" to parcel |
| ::android::hidl::binder::Status::ok().writeToParcel(_aidl_reply); |
| // Serialize |
| _aidl_reply->writeInt32(retval); |
| |
| // Callback |
| _cb(*_aidl_reply); |
| } |
| )); |
| |
| // |
| |
| if (!callback_called) { |
| // Callback not called, the call must have returned an error |
| // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| } |
| |
| break; |
| } |
| case Call::CONTROL_GRANTED: |
| { |
| |
| bool callback_called; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| |
| // Make the call into the server |
| ::android::hidl::binder::Status _aidl_status( |
| control_granted( [&](auto retval ) { |
| callback_called = true; |
| // Write "OK" to parcel |
| ::android::hidl::binder::Status::ok().writeToParcel(_aidl_reply); |
| // Serialize |
| _aidl_reply->writeInt32(retval); |
| |
| // Callback |
| _cb(*_aidl_reply); |
| } |
| )); |
| |
| // |
| |
| if (!callback_called) { |
| // Callback not called, the call must have returned an error |
| // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| } |
| |
| break; |
| } |
| case Call::POWER_CYCLE: |
| { |
| |
| bool callback_called; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| |
| // Make the call into the server |
| ::android::hidl::binder::Status _aidl_status( |
| power_cycle( [&](auto retval ) { |
| callback_called = true; |
| // Write "OK" to parcel |
| ::android::hidl::binder::Status::ok().writeToParcel(_aidl_reply); |
| // Serialize |
| _aidl_reply->writeInt32(retval); |
| |
| // Callback |
| _cb(*_aidl_reply); |
| } |
| )); |
| |
| // |
| |
| if (!callback_called) { |
| // Callback not called, the call must have returned an error |
| // TODO set something like ERR_NO_CALLBACK if the call retuned OK |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| } |
| |
| break; |
| } |
| |
| default: |
| { |
| _aidl_ret_status = ::android::hidl::BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags); |
| } |
| break; |
| } |
| if (_aidl_ret_status == ::android::UNEXPECTED_NULL) { |
| _aidl_ret_status = ::android::hidl::binder::Status::fromExceptionCode(::android::hidl::binder::Status::EX_NULL_POINTER).writeToParcel(_aidl_reply); |
| } |
| return _aidl_ret_status; |
| } |
| |
| } // namespace nfc |
| } // namespace hardware |
| } // namespace android |
| |