示例#1
0
status_t CameraAcc::waitForAndExecuteMessage()
{
    LOG2("@%s", __FUNCTION__);

    status_t status = NO_ERROR;
    Message msg;
    mMessageQueue.receive(&msg);

    switch (msg.id) {
        case MESSAGE_ID_EXIT:
            status = handleExit();
            break;
        case MESSAGE_ID_HOST_ALLOC:
            status = handleMessageHostAlloc(msg.data.alloc);
            break;
        case MESSAGE_ID_MAP:
            status = handleMessageMap(msg.data.map);
            break;
        case MESSAGE_ID_WAIT_STANDALONE:
            status = handleMessageWaitStandalone();
            break;
        default:
            status = INVALID_OPERATION;
            break;
    }
    if (status != NO_ERROR) {
        ALOGE("operation failed, ID = %d, status = %d", msg.id, status);
    }
    return status;
}
status_t AccManagerThread::waitForAndExecuteMessage()
{
    LOG2("@%s", __FUNCTION__);

    status_t status = NO_ERROR;
    Message msg;
    mMessageQueue.receive(&msg);

    switch (msg.id) {
        case MESSAGE_ID_EXIT:
            status = handleExit();
            break;
        case MESSAGE_ID_LOAD:
            status = handleMessageLoad(msg.data.fw);
            break;
        case MESSAGE_ID_ALLOC:
            status = handleMessageAlloc(msg.data.alloc);
            break;
        case MESSAGE_ID_FREE:
            status = handleMessageFree(msg.data.buffer);
            break;
        case MESSAGE_ID_MAP:
            status = handleMessageMap(msg.data.map);
            break;
        case MESSAGE_ID_UNMAP:
            status = handleMessageUnmap(msg.data.map);
            break;
        case MESSAGE_ID_SEND_ARG:
            status = handleMessageSetArgToBeSend(msg.data.map);
            break;
        case MESSAGE_ID_CONFIGURE_ISP_STANDALONE:
            status = handleMessageConfigureIspStandalone(msg.data.configureIspStandalone);
            break;
        case MESSAGE_ID_RETURN_BUFFER:
            status = handleMessageReturnBuffer(msg.data.ret);
            break;
        case MESSAGE_ID_LOAD_ISP_EXTENSIONS:
            status = handleMessageLoadIspExtensions();
            break;
        case MESSAGE_ID_UNLOAD_ISP_EXTENSIONS:
            status = handleMessageUnloadIspExtensions();
            break;
        case MESSAGE_ID_FRAME:
            status = handleMessageFrame(msg.data.frame);
            break;
        default:
            status = INVALID_OPERATION;
            break;
    }
    if (status != NO_ERROR) {
        LOGE("operation failed, ID = %d, status = %d", msg.id, status);
    }
    return status;
}