本文整理汇总了C++中Parcel::checkInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::checkInterface方法的具体用法?C++ Parcel::checkInterface怎么用?C++ Parcel::checkInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parcel
的用法示例。
在下文中一共展示了Parcel::checkInterface方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTransact
status_t BnDemo::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) {
LOGD("BnDemo::onTransact(%i) %i", code, flags);
data.checkInterface(this);
data.print(PLOG); endl(PLOG);
switch(code) {
case ALERT: {
alert(); // Ignoring the fixed alert string
return NO_ERROR;
} break;
case PUSH: {
int32_t inData = data.readInt32();
LOGD("BnDemo::onTransact got %i", inData);
push(inData);
ASSERT(reply != 0);
reply->print(PLOG); endl(PLOG);
return NO_ERROR;
} break;
case ADD: {
int32_t inV1 = data.readInt32();
int32_t inV2 = data.readInt32();
int32_t sum = add(inV1, inV2);
LOGD("BnDemo::onTransact add(%i, %i) = %i", inV1, inV2, sum);
ASSERT(reply != 0);
reply->print(PLOG); endl(PLOG);
reply->writeInt32(sum);
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例2: onTransact
status_t onTransact(void *pthis,
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
#define GET_MEMORY 1
android::IBinder *that = (android::IBinder*)pthis;
switch(code) {
case GET_MEMORY: {
//CHECK_INTERFACE(IMemory, data, reply);
if (!data.checkInterface(that)) { return PERMISSION_DENIED; }
ssize_t offset;
size_t size;
reply->writeStrongBinder( IInterface::asBinder(IMemory::asInterface(that)->getMemory(&offset, &size)) );
printf("%d,%d\n",offset,size);
//important to OOB
offset +=0x30000000;
size +=0x60000000;
reply->writeInt32(offset);
reply->writeInt32(size);
return NO_ERROR;
} break;
}
return ((ONTRANSACT)g_original)(pthis,code,data,reply,flags);
}
示例3: onTransact
virtual status_t onTransact( uint32_t code,
const Parcel& data,
Parcel* reply,
uint32_t flags = 0)
{
ALOGD("enter MySetupCallback onTransact, code=%u", code);
if (data.checkInterface(this))
ALOGD("checkInterface OK");
else
{
ALOGW("checkInterface failed");
return -1;
}
switch (code)
{
default:
break;
}
return 0;
}