blob: be913ce791594e9d63de81aeb72187b720b2b661 [file] [log] [blame]
// 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 <INfc.h>
#include <BpNfc.h>
#include <iostream>
#include <stdio.h>
using std::cout;
using std::endl;
namespace android {
namespace hardware {
namespace nfc {
IMPLEMENT_HWBINDER_META_INTERFACE(Nfc, "android.hardware.nfc.INfc");
} // namespace nfc
} // namespace hardware
} // namespace android
//#include <android/hardware/nfc/BpNfc.h>
#include <BpNfc.h>
#include <binder/Parcel.h>
namespace android {
namespace hardware {
namespace nfc {
BpNfc::BpNfc(const ::android::sp<::android::hardware::IBinder>& _aidl_impl)
: BpInterface<INfc>(_aidl_impl){
}
::android::hardware::Status BpNfc::open(sp<INfcClientCallback> clientCallback , INfc::open_cb _cb ) {
::android::hardware::Parcel _aidl_data;
::android::hardware::Parcel _aidl_reply;
::android::status_t _aidl_ret_status = ::android::OK;
::android::hardware::Status _aidl_status;
const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK
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::hardware::Status BpNfc::write(const INfc::nfc_data_t& data , INfc::write_cb _cb ) {
::android::hardware::Parcel _aidl_data;
::android::hardware::Parcel _aidl_reply;
::android::status_t _aidl_ret_status = ::android::OK;
::android::hardware::Status _aidl_status;
const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK
int32_t _cb_retval;
_aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
if (((_aidl_ret_status) != (::android::OK))) {
goto _aidl_error;
}
{
size_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_
{
size_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 */);
// Redefining a variable inside braces works like a static stack.
size_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::hardware::Status BpNfc::core_initialized(const hidl_vec<uint8_t> &data , INfc::core_initialized_cb _cb ) {
::android::hardware::Parcel _aidl_data;
::android::hardware::Parcel _aidl_reply;
::android::status_t _aidl_ret_status = ::android::OK;
::android::hardware::Status _aidl_status;
const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK
int32_t _cb_retval;
_aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
if (((_aidl_ret_status) != (::android::OK))) {
goto _aidl_error;
}
{
size_t parent_handle;
_aidl_ret_status = _aidl_data.writeBuffer((void *)&data, sizeof(data), &parent_handle);
if (((_aidl_ret_status) != (::android::OK))) {
goto _aidl_error;
}
{
size_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 */);
// Redefining a variable inside braces works like a static stack.
size_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::hardware::Status BpNfc::pre_discover(INfc::pre_discover_cb _cb ) {
::android::hardware::Parcel _aidl_data;
::android::hardware::Parcel _aidl_reply;
::android::status_t _aidl_ret_status = ::android::OK;
::android::hardware::Status _aidl_status;
const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK
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::hardware::Status BpNfc::close(INfc::close_cb _cb ) {
::android::hardware::Parcel _aidl_data;
::android::hardware::Parcel _aidl_reply;
::android::status_t _aidl_ret_status = ::android::OK;
::android::hardware::Status _aidl_status;
const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK
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::hardware::Status BpNfc::control_granted(INfc::control_granted_cb _cb ) {
::android::hardware::Parcel _aidl_data;
::android::hardware::Parcel _aidl_reply;
::android::status_t _aidl_ret_status = ::android::OK;
::android::hardware::Status _aidl_status;
const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK
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::hardware::Status BpNfc::power_cycle(INfc::power_cycle_cb _cb ) {
::android::hardware::Parcel _aidl_data;
::android::hardware::Parcel _aidl_reply;
::android::status_t _aidl_ret_status = ::android::OK;
::android::hardware::Status _aidl_status;
const void *_aidl_ret_pointer; // For checking if all the nested buffers are OK
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 <INfc.h>
#include <BpNfc.h>
#include <iostream>
//#include <android/hardware/nfc/BnNfc.h>
#include <BnNfc.h>
#include <binder/Parcel.h>
namespace android {
namespace hardware {
namespace nfc {
::android::status_t BnNfc::onTransact(uint32_t _aidl_code, const ::android::hardware::Parcel& _aidl_data, ::android::hardware::Parcel* _aidl_reply, uint32_t _aidl_flags, TransactCallback _cb) {
::android::status_t _aidl_ret_status = ::android::OK;
const void *_aidl_ret_pointer; // For checking if all the nested buffers are 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::hardware::Status _aidl_status(
open(clientCallback , [&](auto retval ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::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;
}
{
size_t parent_handle;
data = (INfc::nfc_data_t *)_aidl_data.readBuffer(&parent_handle);
if ((data) == nullptr) {
break;
}
// struct fixup read_
{
size_t child_handle;
_aidl_ret_pointer = _aidl_data.readEmbeddedBuffer(&child_handle, parent_handle,
(size_t)((char *)&((*data).data.buffer)-(char *)(&(*data))));
// Redefining a variable inside braces works like a static stack.
size_t parent_handle = child_handle;
if (_aidl_ret_pointer == nullptr) {
break;
}
// Fixup not needed for this vec uint8_t
}
}
// Make the call into the server
::android::hardware::Status _aidl_status(
write(*data , [&](auto retval ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::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;
}
{
size_t parent_handle;
data = (hidl_vec<uint8_t> *)_aidl_data.readBuffer(&parent_handle);
if ((data) == nullptr) {
break;
}
{
size_t child_handle;
_aidl_ret_pointer = _aidl_data.readEmbeddedBuffer(&child_handle, parent_handle,
(size_t)((char *)&((*data).buffer)-(char *)(&(*data))));
// Redefining a variable inside braces works like a static stack.
size_t parent_handle = child_handle;
if (_aidl_ret_pointer == nullptr) {
break;
}
// Fixup not needed for this vec uint8_t
}
}
// Make the call into the server
::android::hardware::Status _aidl_status(
core_initialized(*data , [&](auto retval ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::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::hardware::Status _aidl_status(
pre_discover( [&](auto retval ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::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::hardware::Status _aidl_status(
close( [&](auto retval ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::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::hardware::Status _aidl_status(
control_granted( [&](auto retval ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::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::hardware::Status _aidl_status(
power_cycle( [&](auto retval ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::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::hardware::BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags);
}
break;
}
if (_aidl_ret_status == ::android::UNEXPECTED_NULL) {
_aidl_ret_status = ::android::hardware::Status::fromExceptionCode(::android::hardware::Status::EX_NULL_POINTER).writeToParcel(_aidl_reply);
}
return _aidl_ret_status;
}
} // namespace nfc
} // namespace hardware
} // namespace android