blob: 86c11c23244528f8ac6b0c52e833138773ff7bf1 [file] [log] [blame]
// AUTO_GENERATED FILE - DO NOT EDIT
// see system/tools/hidl/templates/TemplateStubs.cpp
#include <android/hardware/tests/ITestService.h>
#include <android/hardware/tests/BpTestService.h>
namespace android {
namespace hardware {
namespace tests {
IMPLEMENT_HWBINDER_META_INTERFACE(TestService, "android.hardware.tests.ITestService");
} // namespace tests
} // namespace hardware
} // namespace android
#include <iostream>
#include <android/hardware/tests/BnTestService.h>
#include <binder/Parcel.h>
namespace android {
namespace hardware {
namespace tests {
::android::status_t BnTestService::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;
switch (_aidl_code) {
case Call::ECHOINTEGER:
{
int32_t echo_me;
ITestService::simple_t *my_struct ;
bool callback_called;
if (!(_aidl_data.checkInterface(this))) {
_aidl_ret_status = ::android::BAD_TYPE;
break;
}
_aidl_ret_status = _aidl_data.readInt32(&echo_me);
if (((_aidl_ret_status) != (::android::OK))) {
break;
}
my_struct = (ITestService::simple_t *)_aidl_data.readBuffer();
// Make the call into the server
::android::hardware::Status _aidl_status(
echoInteger(echo_me , *my_struct , [&](auto ret ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::Status::ok().writeToParcel(_aidl_reply);
// Serialize
_aidl_reply->writeInt32(ret);
// 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::SHAREBUFFERWITHREF:
{
hidl_ref<lots_of_data> buffer;
bool callback_called;
if (!(_aidl_data.checkInterface(this))) {
_aidl_ret_status = ::android::BAD_TYPE;
break;
}
buffer = _aidl_data.readFileDescriptor();
// Make the call into the server
::android::hardware::Status _aidl_status(
shareBufferWithRef(buffer , [&](auto ret ) {
callback_called = true;
// Write "OK" to parcel
::android::hardware::Status::ok().writeToParcel(_aidl_reply);
// Serialize
_aidl_reply->writeInt32(ret);
// 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 tests
} // namespace hardware
} // namespace android