コード例 #1
0
void QCameraThermalAdapter::deinit()
{
    LOGD("E");
    if (mUnregister) {
        if (mCameraHandle) {
            mUnregister(mCameraHandle);
            mCameraHandle = 0;
        }
        if (mCamcorderHandle) {
            mUnregister(mCamcorderHandle);
            mCamcorderHandle = 0;
        }
    }
    if (mHandle)
        dlclose(mHandle);

    mHandle = NULL;
    mRegister = NULL;
    mUnregister = NULL;
    mCallback = NULL;
    LOGD("X");
}
コード例 #2
0
void QCameraThermalAdapter::deinit()
{
    ALOGV("%s E", __func__);
    if (mUnregister) {
        if (mCameraHandle) {
            mUnregister(mCameraHandle);
            mCameraHandle = 0;
        }
        if (mCamcorderHandle) {
            mUnregister(mCamcorderHandle);
            mCamcorderHandle = 0;
        }
    }
    if (mHandle)
        dlclose(mHandle);

    mHandle = NULL;
    mRegister = NULL;
    mUnregister = NULL;
    mCallback = NULL;
    ALOGV("%s X", __func__);
}
コード例 #3
0
int QCameraThermalAdapter::init(QCameraThermalCallback *thermalCb)
{
    const char *error = NULL;
    int rc = NO_ERROR;

    LOGD("E");
    mHandle = dlopen("/vendor/lib/libthermalclient.so", RTLD_NOW);
    if (!mHandle) {
        error = dlerror();
        LOGE("dlopen failed with error %s",
                     error ? error : "");
        rc = UNKNOWN_ERROR;
        goto error;
    }
    *(void **)&mRegister = dlsym(mHandle, "thermal_client_register_callback");
    if (!mRegister) {
        error = dlerror();
        LOGE("dlsym failed with error code %s",
                     error ? error: "");
        rc = UNKNOWN_ERROR;
        goto error2;
    }
    *(void **)&mUnregister = dlsym(mHandle, "thermal_client_unregister_callback");
    if (!mUnregister) {
        error = dlerror();
        LOGE("dlsym failed with error code %s",
                     error ? error: "");
        rc = UNKNOWN_ERROR;
        goto error2;
    }

    mCallback = thermalCb;

    // Register camera and camcorder callbacks
    mCameraHandle = mRegister(mStrCamera, thermalCallback, NULL);
    if (mCameraHandle < 0) {
        LOGE("thermal_client_register_callback failed %d",
                         mCameraHandle);
        rc = UNKNOWN_ERROR;
        goto error2;
    }
    mCamcorderHandle = mRegister(mStrCamcorder, thermalCallback, NULL);
    if (mCamcorderHandle < 0) {
        LOGE("thermal_client_register_callback failed %d",
                         mCamcorderHandle);
        rc = UNKNOWN_ERROR;
        goto error3;
    }

    LOGD("X");
    return rc;

error3:
    mCamcorderHandle = 0;
    mUnregister(mCameraHandle);
error2:
    mCameraHandle = 0;
    dlclose(mHandle);
    mHandle = NULL;
error:
    LOGD("X");
    return rc;
}