コード例 #1
0
status_t BnCameraDeviceCallbacks::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    ALOGV("onTransact - code = %d", code);
    switch(code) {
        case CAMERA_ERROR: {
            ALOGV("onDeviceError");
            CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply);
            CameraErrorCode errorCode =
                    static_cast<CameraErrorCode>(data.readInt32());
            onDeviceError(errorCode);
            data.readExceptionCode();
            return NO_ERROR;
        } break;
        case CAMERA_IDLE: {
            ALOGV("onDeviceIdle");
            CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply);
            onDeviceIdle();
            data.readExceptionCode();
            return NO_ERROR;
        } break;
        case CAPTURE_STARTED: {
            ALOGV("onCaptureStarted");
            CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply);
            int32_t requestId = data.readInt32();
            int64_t timestamp = data.readInt64();
            onCaptureStarted(requestId, timestamp);
            data.readExceptionCode();
            return NO_ERROR;
        } break;
        case RESULT_RECEIVED: {
            ALOGV("onResultReceived");
            CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply);
            int32_t requestId = data.readInt32();
            CameraMetadata result;
            if (data.readInt32() != 0) {
                result.readFromParcel(const_cast<Parcel*>(&data));
            } else {
                ALOGW("No metadata object is present in result");
            }
            onResultReceived(requestId, result);
            data.readExceptionCode();
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
コード例 #2
0
status_t BnPeriperalManagerCb::onTransact(uint32_t code, const Parcel &data,
                                               Parcel *reply, uint32_t flags) {
    switch (code) {
    case NOTIFY_CALLBACK: {
        CHECK_INTERFACE(IPeriperalManagerCb, data, reply);
        int32_t event = data.readInt32();
        notifyCallback(event);
        data.readExceptionCode();
        return NO_ERROR;
    }
    break;

    default:
        return BBinder::onTransact(code, data, reply, flags);
    }
}