当前位置: 首页>>代码示例>>C++>>正文


C++ Parcel::setData方法代码示例

本文整理汇总了C++中Parcel::setData方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::setData方法的具体用法?C++ Parcel::setData怎么用?C++ Parcel::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parcel的用法示例。


在下文中一共展示了Parcel::setData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: unpackStrings

char * unpackRILResponseFull(char *inRsp, size_t length, int32_t *out_ril_errno, int32_t *out_token)
{
    Parcel p;
    int32_t type;
    int32_t token;
    status_t status;
    RIL_Errno e;
    
    p.setData((uint8_t *) inRsp, length);

    // status checked at end
    status = p.readInt32(&type);

    if (type == RESPONSE_UNSOLICITED) {
        status = p.readInt32(&token);
        LOGD("unpackRILResponse: Discard UNSOLICITED response:%d\n",token);
        return NULL;
    }
    
    status = p.readInt32(&token);
    if (out_token != NULL) {
        
        *out_token = token;
    }
    
    status = p.readInt32((int32_t *)&e);
    if ((NO_ERROR != status)) {
        
        LOGE("unpackRILResponse: Error!");
        return NULL;
    }
    
    if (out_ril_errno != NULL) {
        
        *out_ril_errno = e;
        LOGD("unpackRILResponse: Return error cause: %d", e);
    }
    if (RIL_E_SUCCESS != e) {
    
        return NULL;
    }
    
    return  unpackStrings(p);
}
开发者ID:SiddheshK15,项目名称:j608_fly_4511-master,代码行数:44,代码来源:ril_pupack.cpp

示例2: notify

void JNIDrmListener::notify(DrmPlugin::EventType eventType, int extra,
                            const Parcel *obj)
{
    jint jeventType;

    // translate DrmPlugin event types into their java equivalents
    switch(eventType) {
        case DrmPlugin::kDrmPluginEventProvisionRequired:
            jeventType = gEventTypes.kEventProvisionRequired;
            break;
        case DrmPlugin::kDrmPluginEventKeyNeeded:
            jeventType = gEventTypes.kEventKeyRequired;
            break;
        case DrmPlugin::kDrmPluginEventKeyExpired:
            jeventType = gEventTypes.kEventKeyExpired;
            break;
        case DrmPlugin::kDrmPluginEventVendorDefined:
            jeventType = gEventTypes.kEventVendorDefined;
            break;
        default:
            ALOGE("Invalid event DrmPlugin::EventType %d, ignored", (int)eventType);
            return;
    }

    JNIEnv *env = AndroidRuntime::getJNIEnv();
    if (obj && obj->dataSize() > 0) {
        jobject jParcel = createJavaParcelObject(env);
        if (jParcel != NULL) {
            Parcel* nativeParcel = parcelForJavaObject(env, jParcel);
            nativeParcel->setData(obj->data(), obj->dataSize());
            env->CallStaticVoidMethod(mClass, gFields.post_event, mObject,
                    jeventType, extra, jParcel);
            env->DeleteLocalRef(jParcel);
        }
    }

    if (env->ExceptionCheck()) {
        ALOGW("An exception occurred while notifying an event.");
        LOGW_EX(env);
        env->ExceptionClear();
    }
}
开发者ID:pkdevboxy,项目名称:platform_frameworks_base,代码行数:42,代码来源:android_media_MediaDrm.cpp

示例3: processRxBuffer

static int processRxBuffer(RilClientPrv *prv, void *buffer, size_t buflen) {
    Parcel p;
    int32_t response_type;
    status_t status;
    int ret = RIL_CLIENT_ERR_SUCCESS;

    acquire_wake_lock(PARTIAL_WAKE_LOCK, RIL_CLIENT_WAKE_LOCK);

    p.setData((uint8_t *)buffer, buflen);

    status = p.readInt32(&response_type);
    if (DBG) ALOGD("%s: status %d response_type %d", __FUNCTION__, status, response_type);

    if (status != NO_ERROR) {
     ret = RIL_CLIENT_ERR_IO;
        goto EXIT;
    }

    // FOr unsolicited response.
    if (response_type == RESPONSE_UNSOLICITED) {
        ret = processUnsolicited(prv, p);
    }
    // For solicited response.
    else if (response_type == RESPONSE_SOLICITED) {
        ret = processSolicited(prv, p);
        if (ret != RIL_CLIENT_ERR_SUCCESS && prv->err_cb) {
            prv->err_cb(prv->err_cb_data, ret);
        }
    }
    else {
        ret =  RIL_CLIENT_ERR_INVAL;
    }

EXIT:
    release_wake_lock(RIL_CLIENT_WAKE_LOCK);
    return ret;
}
开发者ID:TeamEOS,项目名称:hardware_samsung,代码行数:37,代码来源:secril-client.cpp


注:本文中的Parcel::setData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。