本文整理汇总了C++中Parcel::appendFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::appendFrom方法的具体用法?C++ Parcel::appendFrom怎么用?C++ Parcel::appendFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parcel
的用法示例。
在下文中一共展示了Parcel::appendFrom方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTransact
status_t BnHDCPObserver::onTransact(
uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
switch (code) {
case OBSERVER_NOTIFY:
{
CHECK_INTERFACE(IHDCPObserver, data, reply);
int msg = data.readInt32();
int ext1 = data.readInt32();
int ext2 = data.readInt32();
Parcel obj;
if (data.dataAvail() > 0) {
obj.appendFrom(
const_cast<Parcel *>(&data),
data.dataPosition(),
data.dataAvail());
}
notify(msg, ext1, ext2, &obj);
return OK;
}
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例2: onTransact
status_t BnMcuService::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
ALOGI("BnMcuService::onTransact, code[%d]", code);
switch (code) {
case GET_TEST: {
CHECK_INTERFACE(IMcuService, data, reply);
int result = getTest();
reply->writeInt32(result);
return NO_ERROR;
} break;
case obtain_info: {
CHECK_INTERFACE(IMcuService, data, reply);
int domain = data.readInt32();
int cmd = data.readInt32();
Parcel out;
bool res = obtainInfo(domain, cmd, out);
reply->appendFrom(&out, 0, out.dataSize());
reply->writeInt32(res?1:0);
out.freeData();
return NO_ERROR;
} break;
case send_info: {
CHECK_INTERFACE(IMcuService, data, reply);
int domain = data.readInt32();
int cmd = data.readInt32();
Parcel in;
if(data.dataAvail() >0)
{
in.appendFrom(&data, data.dataPosition(), data.dataSize()-data.dataPosition());
in.setDataPosition(0);
}
bool res = sendInfo(domain, cmd, in);
reply->writeInt32(res?1:0);
in.freeData();
return NO_ERROR;
} break;
case regist_data_changed_listener: {
CHECK_INTERFACE(IMcuService, data, reply);
int domain = data.readInt32();
sp<IDataChangedListener> client = interface_cast<IDataChangedListener>(data.readStrongBinder());
bool res = registDataChanagedListener(domain, client);
reply->writeInt32((res?1:0));
return NO_ERROR;
} break;
case unregist_data_changed_listener: {
CHECK_INTERFACE(IMcuService, data, reply);
int domain = data.readInt32();
sp<IDataChangedListener> client = interface_cast<IDataChangedListener>(data.readStrongBinder());
bool res = unregistDataChanagedListener(domain, client);
reply->writeInt32((res?1:0));
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例3: obtainInfo
bool obtainInfo(int domain, int cmd, Parcel& info)
{
//done in java client
Parcel data, reply;
data.writeInterfaceToken(IMcuService::getInterfaceDescriptor());
data.writeInt32(domain);
data.writeInt32(cmd);
remote()->transact(obtain_info, data, &reply);
info.appendFrom(&reply, 0, reply.dataSize()-4);
info.setDataPosition(0);
return (reply.readInt32()==1);
}
示例4: android_os_Parcel_appendFrom
static void android_os_Parcel_appendFrom(JNIEnv* env, jclass clazz, jlong thisNativePtr,
jlong otherNativePtr, jint offset, jint length)
{
Parcel* thisParcel = reinterpret_cast<Parcel*>(thisNativePtr);
if (thisParcel == NULL) {
return;
}
Parcel* otherParcel = reinterpret_cast<Parcel*>(otherNativePtr);
if (otherParcel == NULL) {
return;
}
status_t err = thisParcel->appendFrom(otherParcel, offset, length);
if (err != NO_ERROR) {
signalExceptionForError(env, clazz, err);
}
}
示例5: onTransact
status_t BnDrmClient::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch (code) {
case NOTIFY: {
CHECK_INTERFACE(IDrmClient, data, reply);
int eventType = data.readInt32();
int extra = data.readInt32();
Parcel obj;
if (data.dataAvail() > 0) {
obj.appendFrom(const_cast<Parcel *>(&data), data.dataPosition(), data.dataAvail());
}
notify((DrmPlugin::EventType)eventType, extra, &obj);
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例6: onTransact
status_t BnMediaPlayerClient::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch (code) {
case NOTIFY: {
CHECK_INTERFACE(IMediaPlayerClient, data, reply);
int msg = data.readInt32();
int ext1 = data.readInt32();
int ext2 = data.readInt32();
Parcel obj;
if (data.dataAvail() > 0) {
obj.appendFrom(const_cast<Parcel *>(&data), data.dataPosition(), data.dataAvail());
}
notify(msg, ext1, ext2, &obj);
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例7: onTransact
status_t BnListenReceiver::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch (code) {
case NOTIFY: {
ALOGI("BnListenReceiver::onTransact received NOTIFY");
CHECK_INTERFACE(IListenReceiver, data, reply);
int msg = data.readInt32();
Parcel obj;
if (data.dataAvail() > 0) {
ALOGI("append %d bytes available at pos %d",
data.dataAvail(), data.dataPosition());
obj.appendFrom(const_cast<Parcel *>(&data), data.dataPosition(), data.dataAvail());
}
notify(msg, &obj);
return NO_ERROR;
} break;
default:
ALOGI("BnListenReceiver::onTransact received unknown msg %d", code);
return BBinder::onTransact(code, data, reply, flags);
}
}
示例8: onTransact
//.........这里部分代码省略.........
} break;
case PAUSE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(pause());
return NO_ERROR;
} break;
case SEEK_TO: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(seekTo(data.readInt32()));
return NO_ERROR;
} break;
case GET_CURRENT_POSITION: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
int msec;
status_t ret = getCurrentPosition(&msec);
reply->writeInt32(msec);
reply->writeInt32(ret);
return NO_ERROR;
} break;
case GET_DURATION: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
int msec;
status_t ret = getDuration(&msec);
reply->writeInt32(msec);
reply->writeInt32(ret);
return NO_ERROR;
} break;
case RESET: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(reset());
return NO_ERROR;
} break;
case SET_AUDIO_STREAM_TYPE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setAudioStreamType(data.readInt32()));
return NO_ERROR;
} break;
case SET_LOOPING: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setLooping(data.readInt32()));
return NO_ERROR;
} break;
case SET_VOLUME: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
float leftVolume = data.readFloat();
float rightVolume = data.readFloat();
reply->writeInt32(setVolume(leftVolume, rightVolume));
return NO_ERROR;
} break;
case INVOKE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
status_t result = invoke(data, reply);
return result;
} break;
case SET_METADATA_FILTER: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setMetadataFilter(data));
return NO_ERROR;
} break;
case GET_METADATA: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
bool update_only = static_cast<bool>(data.readInt32());
bool apply_filter = static_cast<bool>(data.readInt32());
const status_t retcode = getMetadata(update_only, apply_filter, reply);
reply->setDataPosition(0);
reply->writeInt32(retcode);
reply->setDataPosition(0);
return NO_ERROR;
} break;
case SET_AUX_EFFECT_SEND_LEVEL: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setAuxEffectSendLevel(data.readFloat()));
return NO_ERROR;
} break;
case ATTACH_AUX_EFFECT: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(attachAuxEffect(data.readInt32()));
return NO_ERROR;
} break;
case SET_PARAMETER: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
int key = data.readInt32();
Parcel request;
if (data.dataAvail() > 0) {
request.appendFrom(
const_cast<Parcel *>(&data), data.dataPosition(), data.dataAvail());
}
request.setDataPosition(0);
reply->writeInt32(setParameter(key, request));
return NO_ERROR;
} break;
case GET_PARAMETER: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
return getParameter(data.readInt32(), reply);
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}