9 #include "../../../include/librealsense2/rs.h" 10 #include "../../../include/librealsense2/hpp/rs_device.hpp" 11 #include "../../api.h" 13 extern "C" JNIEXPORT jboolean JNICALL
18 static_cast<rs2_camera_info>(info), &e);
23 extern "C" JNIEXPORT jstring JNICALL
28 static_cast<rs2_camera_info>(info), &e);
32 return env->NewStringUTF(rv);
35 extern "C" JNIEXPORT
void JNICALL
41 JNIEXPORT jlongArray JNICALL
44 std::shared_ptr<rs2_sensor_list> list(
52 std::vector<rs2_sensor*> sensors;
59 jlongArray rv = env->NewLongArray(sensors.size());
61 for (
auto i = 0;
i < sensors.size();
i++)
63 env->SetLongArrayRegion(rv,
i, 1, reinterpret_cast<const jlong *>(&sensors[
i]));
70 JNIEXPORT
void JNICALL
79 JNIEXPORT
void JNICALL
85 jbyte *
image = env->GetByteArrayElements(image_,
NULL);
86 auto length = env->GetArrayLength(image_);
88 jclass cls = env->GetObjectClass(instance);
89 jmethodID
id = env->GetMethodID(cls,
"onProgress",
"(F)V");
90 auto cb = [&](
float progress){ env->CallVoidMethod(instance,
id,
progress); };
94 env->ReleaseByteArrayElements(image_, image, 0);
98 JNIEXPORT jbyteArray JNICALL
102 jclass cls = env->GetObjectClass(instance);
103 jmethodID
id = env->GetMethodID(cls,
"onProgress",
"(F)V");
104 auto cb = [&](
float progress){ env->CallVoidMethod(instance,
id,
progress); };
106 std::shared_ptr<const rs2_raw_data_buffer> raw_data_buffer(
111 jbyteArray rv = env->NewByteArray(raw_data_buffer->buffer.size());
112 env->SetByteArrayRegion(rv, 0, raw_data_buffer->buffer.size(),
113 reinterpret_cast<const jbyte *
>(raw_data_buffer->buffer.data()));
118 JNIEXPORT
void JNICALL
122 jbyte *
image = env->GetByteArrayElements(image_,
NULL);
123 auto length = env->GetArrayLength(image_);
125 jclass cls = env->GetObjectClass(instance);
126 jmethodID
id = env->GetMethodID(cls,
"onProgress",
"(F)V");
127 auto cb = [&](
float progress){ env->CallVoidMethod(instance,
id,
progress); };
131 env->ReleaseByteArrayElements(image_, image, 0);
135 JNIEXPORT
void JNICALL
144 JNIEXPORT jboolean JNICALL
146 jlong
handle, jint extension) {
149 static_cast<rs2_extension>(extension), &e);
int rs2_get_sensors_count(const rs2_sensor_list *info_list, rs2_error **error)
rs2_sensor * rs2_create_sensor(const rs2_sensor_list *list, int index, rs2_error **error)
GLuint64 GLenum void * handle
void rs2_delete_device(rs2_device *device)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Updatable_nEnterUpdateState(JNIEnv *env, jclass type, jlong handle)
JNIEXPORT jboolean JNICALL Java_com_intel_realsense_librealsense_Device_nSupportsInfo(JNIEnv *env, jclass type, jlong handle, jint info)
void handle_error(JNIEnv *env, rs2_error *error)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Device_nRelease(JNIEnv *env, jclass type, jlong handle)
GLenum GLenum GLsizei void * image
def info(name, value, persistent=False)
int rs2_supports_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
int rs2_is_device_extendable_to(const rs2_device *device, rs2_extension extension, rs2_error **error)
void rs2_hardware_reset(const rs2_device *device, rs2_error **error)
JNIEXPORT jboolean JNICALL Java_com_intel_realsense_librealsense_Device_nIsDeviceExtendableTo(JNIEnv *env, jclass type, jlong handle, jint extension)
rs2_sensor_list * rs2_query_sensors(const rs2_device *device, rs2_error **error)
void rs2_update_firmware_cpp(const rs2_device *device, const void *fw_image, int fw_image_size, rs2_update_progress_callback *callback, rs2_error **error)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Updatable_nUpdateFirmwareUnsigned(JNIEnv *env, jobject instance, jlong handle, jbyteArray image_, jint update_mode)
const rs2_raw_data_buffer * rs2_create_flash_backup_cpp(const rs2_device *device, rs2_update_progress_callback *callback, rs2_error **error)
void rs2_enter_update_state(const rs2_device *device, rs2_error **error)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_UpdateDevice_nUpdateFirmware(JNIEnv *env, jobject instance, jlong handle, jbyteArray image_)
void rs2_update_firmware_unsigned_cpp(const rs2_device *device, const void *fw_image, int fw_image_size, rs2_update_progress_callback *callback, int update_mode, rs2_error **error)
void rs2_delete_sensor_list(rs2_sensor_list *info_list)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Device_nHardwareReset(JNIEnv *env, jclass type, jlong handle)
GLenum GLuint GLenum GLsizei length
JNIEXPORT jstring JNICALL Java_com_intel_realsense_librealsense_Device_nGetInfo(JNIEnv *env, jclass type, jlong handle, jint info)
JNIEXPORT jbyteArray JNICALL Java_com_intel_realsense_librealsense_Updatable_nCreateFlashBackup(JNIEnv *env, jobject instance, jlong handle)
JNIEXPORT jlongArray JNICALL Java_com_intel_realsense_librealsense_Device_nQuerySensors(JNIEnv *env, jclass type, jlong handle)
const char * rs2_get_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)