本文整理汇总了C++中Parcel::readInplace方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::readInplace方法的具体用法?C++ Parcel::readInplace怎么用?C++ Parcel::readInplace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parcel
的用法示例。
在下文中一共展示了Parcel::readInplace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadNDEFMessage
bool
NfcMessageHandler::TechDiscoveredNotification(const Parcel& aParcel, EventOptions& aOptions)
{
aOptions.mSessionId = aParcel.readInt32();
aOptions.mIsP2P = aParcel.readInt32();
int32_t techCount = aParcel.readInt32();
aOptions.mTechList.AppendElements(
static_cast<const uint8_t*>(aParcel.readInplace(techCount)), techCount);
int32_t idCount = aParcel.readInt32();
aOptions.mTagId.AppendElements(
static_cast<const uint8_t*>(aParcel.readInplace(idCount)), idCount);
int32_t ndefMsgCount = aParcel.readInt32();
if (ndefMsgCount != 0) {
ReadNDEFMessage(aParcel, aOptions);
}
int32_t ndefInfo = aParcel.readInt32();
if (ndefInfo) {
aOptions.mTagType = aParcel.readInt32();
aOptions.mMaxNDEFSize = aParcel.readInt32();
aOptions.mIsReadOnly = aParcel.readInt32();
aOptions.mIsFormatable = aParcel.readInt32();
}
return true;
}
示例2:
bool
NfcMessageHandler::ReadNDEFMessage(const Parcel& aParcel, EventOptions& aOptions)
{
int32_t recordCount = aParcel.readInt32();
aOptions.mRecords.SetCapacity(recordCount);
for (int i = 0; i < recordCount; i++) {
int32_t tnf = aParcel.readInt32();
NDEFRecordStruct record;
record.mTnf = static_cast<TNF>(tnf);
int32_t typeLength = aParcel.readInt32();
record.mType.AppendElements(
static_cast<const uint8_t*>(aParcel.readInplace(typeLength)), typeLength);
int32_t idLength = aParcel.readInt32();
record.mId.AppendElements(
static_cast<const uint8_t*>(aParcel.readInplace(idLength)), idLength);
int32_t payloadLength = aParcel.readInt32();
record.mPayload.AppendElements(
static_cast<const uint8_t*>(aParcel.readInplace(payloadLength)), payloadLength);
aOptions.mRecords.AppendElement(record);
}
return true;
}
示例3: processUnsolicited
static int processUnsolicited(RilClientPrv *prv, Parcel &p) {
int32_t resp_id, len;
status_t status;
const void *data = NULL;
RilOnUnsolicited unsol_func = NULL;
status = p.readInt32(&resp_id);
if (status != NO_ERROR) {
ALOGE("%s: read resp_id failed.", __FUNCTION__);
return RIL_CLIENT_ERR_IO;
}
status = p.readInt32(&len);
if (status != NO_ERROR) {
//ALOGE("%s: read length failed. assume zero length.", __FUNCTION__);
len = 0;
}
ALOGD("%s(): resp_id (%d), len(%d)\n", __FUNCTION__, resp_id, len);
if (len)
data = p.readInplace(len);
// Find unsolicited response handler.
unsol_func = FindUnsolHandler(prv, (uint32_t)resp_id);
if (unsol_func) {
unsol_func(prv->parent, data, len);
}
return RIL_CLIENT_ERR_SUCCESS;
}
示例4: read
status_t layer_state_t::read(const Parcel& input)
{
surface = input.readStrongBinder();
what = input.readUint32();
x = input.readFloat();
y = input.readFloat();
z = input.readUint32();
w = input.readUint32();
h = input.readUint32();
layerStack = input.readUint32();
alpha = input.readFloat();
flags = static_cast<uint8_t>(input.readUint32());
mask = static_cast<uint8_t>(input.readUint32());
const void* matrix_data = input.readInplace(sizeof(layer_state_t::matrix22_t));
if (matrix_data) {
matrix = *reinterpret_cast<layer_state_t::matrix22_t const *>(matrix_data);
} else {
return BAD_VALUE;
}
input.read(crop);
input.read(finalCrop);
handle = input.readStrongBinder();
frameNumber = input.readUint64();
overrideScalingMode = input.readInt32();
input.read(transparentRegion);
return NO_ERROR;
}
示例5: android_os_Parcel_createByteArray
static jbyteArray android_os_Parcel_createByteArray(JNIEnv* env, jclass clazz, jlong nativePtr)
{
jbyteArray ret = NULL;
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
int32_t len = parcel->readInt32();
// sanity check the stored length against the true data size
if (len >= 0 && len <= (int32_t)parcel->dataAvail()) {
ret = env->NewByteArray(len);
if (ret != NULL) {
jbyte* a2 = (jbyte*)env->GetPrimitiveArrayCritical(ret, 0);
if (a2) {
const void* data = parcel->readInplace(len);
memcpy(a2, data, len);
env->ReleasePrimitiveArrayCritical(ret, a2, 0);
}
}
}
}
return ret;
}
示例6: CheckDataEquals
void CheckDataEquals(const Parcel& parcel, const char* content) {
int32_t intval;
parcel.setDataPosition(16);
parcel.readInt32(&intval);
parcel.setDataPosition(24);
const char* data = (const char*) parcel.readInplace(intval);
int32_t content_len = strlen(content);
EXPECT_EQ(content_len, intval);
EXPECT_TRUE(strncmp(data, content, content_len) == 0);
}
示例7: onTransact
status_t BnCameraClient::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case NOTIFY_CALLBACK: {
ALOGV("NOTIFY_CALLBACK");
CHECK_INTERFACE(ICameraClient, data, reply);
int32_t msgType = data.readInt32();
int32_t ext1 = data.readInt32();
int32_t ext2 = 0;
if ((msgType == CAMERA_MSG_PREVIEW_FRAME) && (ext1 == CAMERA_FRAME_DATA_FD)) {
ext2 = data.readFileDescriptor();
ALOGD("onTransact: CAMERA_MSG_PREVIEW_FRAME fd = %d", ext2);
} else {
ext2 = data.readInt32();
}
notifyCallback(msgType, ext1, ext2);
return NO_ERROR;
} break;
case DATA_CALLBACK: {
ALOGV("DATA_CALLBACK");
CHECK_INTERFACE(ICameraClient, data, reply);
int32_t msgType = data.readInt32();
sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
camera_frame_metadata_t *metadata = NULL;
if (data.dataAvail() > 0) {
metadata = new camera_frame_metadata_t;
metadata->number_of_faces = data.readInt32();
metadata->faces = (camera_face_t *) data.readInplace(
sizeof(camera_face_t) * metadata->number_of_faces);
}
dataCallback(msgType, imageData, metadata);
if (metadata) delete metadata;
return NO_ERROR;
} break;
case DATA_CALLBACK_TIMESTAMP: {
ALOGV("DATA_CALLBACK_TIMESTAMP");
CHECK_INTERFACE(ICameraClient, data, reply);
nsecs_t timestamp = data.readInt64();
int32_t msgType = data.readInt32();
sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
dataCallbackTimestamp(timestamp, msgType, imageData);
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例8: ReadNDEFMessage
bool
NfcMessageHandler::TechDiscoveredNotification(const Parcel& aParcel, EventOptions& aOptions)
{
aOptions.mType = NS_ConvertUTF8toUTF16(kTechDiscoveredNotification);
aOptions.mSessionId = aParcel.readInt32();
int32_t techCount = aParcel.readInt32();
aOptions.mTechList.AppendElements(
static_cast<const uint8_t*>(aParcel.readInplace(techCount)), techCount);
int32_t ndefMsgCount = aParcel.readInt32();
if (ndefMsgCount != 0) {
ReadNDEFMessage(aParcel, aOptions);
}
return true;
}
示例9: onTransact
status_t BnMonzax::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
status_t status = BBinder::onTransact(code, data, reply, flags);
if (status != UNKNOWN_TRANSACTION) {
return status;
}
if (! reply) {
ALOGE("Monzax::onTransact(): null reply parcel received.");
return BAD_VALUE;
}
IPCThreadState *ipc = IPCThreadState::self();
const int pid = ipc->getCallingPid();
const int uid = ipc->getCallingUid();
// dispatch to the appropriate method based on the transaction code.
switch(code){
case FILE_OPEN:
{
CHECK_INTERFACE(IMonzax, data, reply);
ALOGI("BnMonzax: onTransact: FILE_OPEN"
"client to access MonzaxService from uid=%d pid=%d code: %d",
uid, pid, code);
char *pName = (char *) data.readCString();
int ret = file_open(pName);
reply->writeInt32(ret);
return NO_ERROR;
}
break;
case FILE_CLOSE:
{
ALOGI("BnMonzax: onTransact: FILE_CLOSE"
"client to access MonzaxService from uid=%d pid=%d code: %d",
uid, pid, code);
CHECK_INTERFACE(IMonzax, data, reply);
int fd = data.readInt32();
int ret = file_close(fd);
reply->writeInt32(ret);
return NO_ERROR;
}
break;
case FILE_SEEK:
{
CHECK_INTERFACE(IMonzax, data, reply);
int ret;
int fd = data.readInt32();
int offset = data.readInt32();
int whence = data.readInt32();
ret = file_seek(fd, offset, whence);
reply->writeInt32(ret);
return NO_ERROR;
}
break;
case FILE_READ:
{
CHECK_INTERFACE(IMonzax, data, reply);
char *pReadBuf;
int ret;
int fd = data.readInt32();
int length = data.readInt32();
pReadBuf = (char*) malloc(sizeof(char) * length);
if (pReadBuf == NULL) {
ret = -1;
reply->writeInt32(ret);
ALOGE("onTransact File_Read malloc result failed.\n");
goto err_read;
}
ret = file_read(fd, pReadBuf, length);
reply->writeInt32(ret);
if(ret >0){
reply->write((char *) pReadBuf, ret);
}
free(pReadBuf);
pReadBuf = NULL;
return NO_ERROR;
err_read:
ALOGE("onTransact File_Read ,ret =%d out\n", (int)ret);
return ret;
}
break;
case FILE_WRITE:
{
CHECK_INTERFACE(IMonzax, data, reply);
int ret;
int fd = data.readInt32();
int length = data.readInt32();
char *pWriteBuf = (char*) malloc(sizeof(char) * length);
if (pWriteBuf == NULL) {
ret = -1;
reply->writeInt32(ret);
ALOGE("onTransact File_Write malloc result failed.\n");
goto err_write;
}
if(length > 0){
const char *input = (const char *) data.readInplace(length);
if (input)
//.........这里部分代码省略.........
示例10: onTransact
status_t BnFingerprintDaemon::onTransact(uint32_t code, const Parcel& data, Parcel* reply,
uint32_t flags) {
switch(code) {
case AUTHENTICATE: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const uint64_t sessionId = data.readInt64();
const uint32_t groupId = data.readInt32();
const int32_t ret = authenticate(sessionId, groupId);
reply->writeNoException();
reply->writeInt32(ret);
return NO_ERROR;
};
case CANCEL_AUTHENTICATION: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const int32_t ret = stopAuthentication();
reply->writeNoException();
reply->writeInt32(ret);
return NO_ERROR;
}
case ENROLL: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const ssize_t tokenSize = data.readInt32();
const uint8_t* token = static_cast<const uint8_t *>(data.readInplace(tokenSize));
const int32_t groupId = data.readInt32();
const int32_t timeout = data.readInt32();
const int32_t ret = enroll(token, tokenSize, groupId, timeout);
reply->writeNoException();
reply->writeInt32(ret);
return NO_ERROR;
}
case CANCEL_ENROLLMENT: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const int32_t ret = stopEnrollment();
reply->writeNoException();
reply->writeInt32(ret);
return NO_ERROR;
}
case PRE_ENROLL: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const uint64_t ret = preEnroll();
reply->writeNoException();
reply->writeInt64(ret);
return NO_ERROR;
}
case POST_ENROLL: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const int32_t ret = postEnroll();
reply->writeNoException();
reply->writeInt32(ret);
return NO_ERROR;
}
case REMOVE: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const int32_t fingerId = data.readInt32();
const int32_t groupId = data.readInt32();
const int32_t ret = remove(fingerId, groupId);
reply->writeNoException();
reply->writeInt32(ret);
return NO_ERROR;
}
case ENUMERATE: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const int32_t ret = enumerate();
reply->writeNoException();
reply->writeInt32(ret);
return NO_ERROR;
}
case GET_AUTHENTICATOR_ID: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const uint64_t ret = getAuthenticatorId();
reply->writeNoException();
reply->writeInt64(ret);
return NO_ERROR;
//.........这里部分代码省略.........
示例11: onTransact
//.........这里部分代码省略.........
}
}
delete drmConstraints; drmConstraints = NULL;
return DRM_NO_ERROR;
}
case CAN_HANDLE:
{
LOGV("BnDrmManagerService::onTransact :CAN_HANDLE");
CHECK_INTERFACE(IDrmManagerService, data, reply);
const int uniqueId = data.readInt32();
const String8 path = data.readString8();
const String8 mimeType = data.readString8();
bool result = canHandle(uniqueId, path, mimeType);
reply->writeInt32(result);
return DRM_NO_ERROR;
}
case PROCESS_DRM_INFO:
{
LOGV("BnDrmManagerService::onTransact :PROCESS_DRM_INFO");
CHECK_INTERFACE(IDrmManagerService, data, reply);
const int uniqueId = data.readInt32();
//Filling DRM info
const int infoType = data.readInt32();
const int bufferSize = data.readInt32();
char* buffer = NULL;
if (0 < bufferSize) {
buffer = (char *)data.readInplace(bufferSize);
}
const DrmBuffer drmBuffer(buffer, bufferSize);
DrmInfo* drmInfo = new DrmInfo(infoType, drmBuffer, data.readString8());
const int size = data.readInt32();
for (int index = 0; index < size; ++index) {
const String8 key(data.readString8());
const String8 value(data.readString8());
drmInfo->put(key, (value == String8("NULL")) ? String8("") : value);
}
DrmInfoStatus* drmInfoStatus = processDrmInfo(uniqueId, drmInfo);
if (NULL != drmInfoStatus) {
//Filling DRM Info Status contents
reply->writeInt32(drmInfoStatus->statusCode);
reply->writeString8(drmInfoStatus->mimeType);
if (NULL != drmInfoStatus->drmBuffer) {
const DrmBuffer* drmBuffer = drmInfoStatus->drmBuffer;
const int bufferSize = drmBuffer->length;
reply->writeInt32(bufferSize);
if (0 < bufferSize) {
reply->write(drmBuffer->data, bufferSize);
}
delete [] drmBuffer->data;
delete drmBuffer; drmBuffer = NULL;
}
}
delete drmInfo; drmInfo = NULL;
delete drmInfoStatus; drmInfoStatus = NULL;
return DRM_NO_ERROR;
示例12: onTransact
//.........这里部分代码省略.........
BinderLibTestBundle data2(&data);
if (!data2.isValid()) {
return BAD_VALUE;
}
BinderLibTestBundle reply2;
binder->transact(indirect_code, data2, &reply2);
reply2.appendTo(reply);
}
return NO_ERROR;
}
case BINDER_LIB_TEST_SET_ERROR_TRANSACTION:
reply->setError(data.readInt32());
return NO_ERROR;
case BINDER_LIB_TEST_GET_PTR_SIZE_TRANSACTION:
reply->writeInt32(sizeof(void *));
return NO_ERROR;
case BINDER_LIB_TEST_GET_STATUS_TRANSACTION:
return NO_ERROR;
case BINDER_LIB_TEST_ADD_STRONG_REF_TRANSACTION:
m_strongRef = data.readStrongBinder();
return NO_ERROR;
case BINDER_LIB_TEST_LINK_DEATH_TRANSACTION: {
int ret;
Parcel data2, reply2;
sp<TestDeathRecipient> testDeathRecipient = new TestDeathRecipient();
sp<IBinder> target;
sp<IBinder> callback;
target = data.readStrongBinder();
if (target == NULL) {
return BAD_VALUE;
}
callback = data.readStrongBinder();run_server
if (callback == NULL) {
return BAD_VALUE;
}
ret = target->linkToDeath(testDeathRecipient);
if (ret == NO_ERROR)
ret = testDeathRecipient->waitEvent(5);
data2.writeInt32(ret);
callback->transact(BINDER_LIB_TEST_CALL_BACK, data2, &reply2);
return NO_ERROR;
}
case BINDER_LIB_TEST_WRITE_FILE_TRANSACTION: {
int ret;
int32_t size;
const void *buf;
int fd;
fd = data.readFileDescriptor();
if (fd < 0) {
return BAD_VALUE;
}
ret = data.readInt32(&size);
if (ret != NO_ERROR) {
return ret;
}
buf = data.readInplace(size);
if (buf == NULL) {
return BAD_VALUE;
}
ret = write(fd, buf, size);
if (ret != size)
return UNKNOWN_ERROR;
return NO_ERROR;
}
case BINDER_LIB_TEST_PROMOTE_WEAK_REF_TRANSACTION: {
int ret;
wp<IBinder> weak;
sp<IBinder> strong;
Parcel data2, reply2;
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> server = sm->getService(binderLibTestServiceName);
weak = data.readWeakBinder();
if (weak == NULL) {
return BAD_VALUE;
}
strong = weak.promote();
ret = server->transact(BINDER_LIB_TEST_NOP_TRANSACTION, data2, &reply2);
if (ret != NO_ERROR)
exit(EXIT_FAILURE);
if (strong == NULL) {
reply->setError(1);
}
return NO_ERROR;
}
case BINDER_LIB_TEST_DELAYED_EXIT_TRANSACTION:
alarm(10);
return NO_ERROR;
case BINDER_LIB_TEST_EXIT_TRANSACTION:
while (wait(NULL) != -1 || errno != ECHILD)
;
exit(EXIT_SUCCESS);
default:
return UNKNOWN_TRANSACTION;
};
}
示例13: processSolicited
static int processSolicited(RilClientPrv *prv, Parcel &p) {
int32_t token, err, len;
status_t status;
const void *data = NULL;
RilOnComplete req_func = NULL;
int ret = RIL_CLIENT_ERR_SUCCESS;
uint32_t req_id = 0;
if (DBG) ALOGD("%s()", __FUNCTION__);
status = p.readInt32(&token);
if (status != NO_ERROR) {
ALOGE("%s: Read token fail. Status %d\n", __FUNCTION__, status);
return RIL_CLIENT_ERR_IO;
}
if (IsValidToken(&(prv->token_pool), token) == 0) {
ALOGE("%s: Invalid Token", __FUNCTION__);
return RIL_CLIENT_ERR_INVAL; // Invalid token.
}
status = p.readInt32(&err);
if (status != NO_ERROR) {
ALOGE("%s: Read err fail. Status %d\n", __FUNCTION__, status);
ret = RIL_CLIENT_ERR_IO;
goto error;
}
// Don't go further for error response.
if (err != RIL_CLIENT_ERR_SUCCESS) {
ALOGE("%s: Error %d\n", __FUNCTION__, err);
if (prv->err_cb)
prv->err_cb(prv->err_cb_data, err);
ret = RIL_CLIENT_ERR_SUCCESS;
goto error;
}
status = p.readInt32(&len);
if (status != NO_ERROR) {
/* no length field */
len = 0;
}
if (len)
data = p.readInplace(len);
// Find request handler for the token.
// First, FindReqHandler() searches request history with the token
// and finds out a request ID. Then, it search request handler table
// with the request ID.
req_func = FindReqHandler(prv, token, &req_id);
if (req_func)
{
if (DBG) ALOGD("[*] Call handler");
req_func(prv->parent, data, len);
if(prv->b_del_handler) {
prv->b_del_handler = 0;
RegisterRequestCompleteHandler(prv->parent, req_id, NULL);
}
} else {
if (DBG) ALOGD("%s: No handler for token %d\n", __FUNCTION__, token);
}
error:
FreeToken(&(prv->token_pool), token);
ClearReqHistory(prv, token);
return ret;
}
示例14: onTransact
status_t BnSurfaceTexture::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case REQUEST_BUFFER: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int bufferIdx = data.readInt32();
sp<GraphicBuffer> buffer;
int result = requestBuffer(bufferIdx, &buffer);
reply->writeInt32(buffer != 0);
if (buffer != 0) {
reply->write(*buffer);
}
reply->writeInt32(result);
return NO_ERROR;
} break;
case SET_BUFFER_COUNT: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int bufferCount = data.readInt32();
int result = setBufferCount(bufferCount);
reply->writeInt32(result);
return NO_ERROR;
} break;
case DEQUEUE_BUFFER: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
uint32_t w = data.readInt32();
uint32_t h = data.readInt32();
uint32_t format = data.readInt32();
uint32_t usage = data.readInt32();
int buf;
int result = dequeueBuffer(&buf, w, h, format, usage);
reply->writeInt32(buf);
reply->writeInt32(result);
return NO_ERROR;
} break;
case QUEUE_BUFFER: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int buf = data.readInt32();
QueueBufferInput const* const input =
reinterpret_cast<QueueBufferInput const *>(
data.readInplace(sizeof(QueueBufferInput)));
QueueBufferOutput* const output =
reinterpret_cast<QueueBufferOutput *>(
reply->writeInplace(sizeof(QueueBufferOutput)));
status_t result = queueBuffer(buf, *input, output);
reply->writeInt32(result);
return NO_ERROR;
} break;
case CANCEL_BUFFER: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int buf = data.readInt32();
cancelBuffer(buf);
return NO_ERROR;
} break;
case QUERY: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int value;
int what = data.readInt32();
int res = query(what, &value);
reply->writeInt32(value);
reply->writeInt32(res);
return NO_ERROR;
} break;
case SET_SYNCHRONOUS_MODE: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
bool enabled = data.readInt32();
status_t res = setSynchronousMode(enabled);
reply->writeInt32(res);
return NO_ERROR;
} break;
#ifdef QCOM_HARDWARE
case SET_BUFFERS_SIZE: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int size = data.readInt32();
status_t res = setBuffersSize(size);
reply->writeInt32(res);
return NO_ERROR;
} break;
case SET_MIN_UNDEQUEUED_BUFFER_COUNT: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int size = data.readInt32();
status_t res = setMinUndequeuedBufferCount(size);
reply->writeInt32(res);
return NO_ERROR;
} break;
#endif
case CONNECT: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int api = data.readInt32();
QueueBufferOutput* const output =
reinterpret_cast<QueueBufferOutput *>(
reply->writeInplace(sizeof(QueueBufferOutput)));
status_t res = connect(api, output);
reply->writeInt32(res);
return NO_ERROR;
} break;
case DISCONNECT: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int api = data.readInt32();
status_t res = disconnect(api);
//.........这里部分代码省略.........
示例15: switch
//.........这里部分代码省略.........
CHECK_INTERFACE(IOMX, data, reply);
node_id node = (void*)data.readIntPtr();
OMX_INDEXTYPE index = static_cast<OMX_INDEXTYPE>(data.readInt32());
size_t size = data.readInt32();
// XXX I am not happy with this but Parcel::readInplace didn't work.
void *params = malloc(size);
data.read(params, size);
status_t err = getParameter(node, index, params, size);
reply->writeInt32(err);
if (err == OK) {
reply->write(params, size);
}
free(params);
params = NULL;
return NO_ERROR;
}
case SET_PARAMETER:
{
CHECK_INTERFACE(IOMX, data, reply);
node_id node = (void*)data.readIntPtr();
OMX_INDEXTYPE index = static_cast<OMX_INDEXTYPE>(data.readInt32());
size_t size = data.readInt32();
void *params = const_cast<void *>(data.readInplace(size));
reply->writeInt32(setParameter(node, index, params, size));
return NO_ERROR;
}
case GET_CONFIG:
{
CHECK_INTERFACE(IOMX, data, reply);
node_id node = (void*)data.readIntPtr();
OMX_INDEXTYPE index = static_cast<OMX_INDEXTYPE>(data.readInt32());
size_t size = data.readInt32();
// XXX I am not happy with this but Parcel::readInplace didn't work.
void *params = malloc(size);
data.read(params, size);
status_t err = getConfig(node, index, params, size);
reply->writeInt32(err);
if (err == OK) {
reply->write(params, size);
}
free(params);
params = NULL;
return NO_ERROR;
}