jboolean
initializeStaticFieldIds(jfieldID* dest, JNIEnv* env, jclass classHandle, 
                         const FieldDesc* fields) {
    jboolean retVal = JNI_TRUE;

    while (fields->name != NULL) {
        *dest = (*env)->GetStaticFieldID(env, classHandle, fields->name,
                                         fields->signature);
        checkAndClearException(env);
        if (*dest == NULL) {
            retVal = JNI_FALSE;
            break;
        }
        ++fields;
        ++dest;
    }

    return retVal;
}
void DeviceCallback::onDeviceGetReport(uint32_t requestId, uint8_t reportId) {
    JNIEnv* env = getJNIEnv();
    env->CallVoidMethod(mCallbackObject, gDeviceCallbackClassInfo.onDeviceGetReport,
            requestId, reportId);
    checkAndClearException(env, "onDeviceGetReport");
}
void DeviceCallback::onDeviceOpen() {
    JNIEnv* env = getJNIEnv();
    env->CallVoidMethod(mCallbackObject, gDeviceCallbackClassInfo.onDeviceOpen);
    checkAndClearException(env, "onDeviceOpen");
}