android/jni/config.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
4 #include <jni.h>
5 #include "error.h"
6 
7 #include "../../../include/librealsense2/rs.h"
8 #include "../../../include/librealsense2/h/rs_config.h"
9 
10 extern "C" JNIEXPORT jlong JNICALL
12  rs2_error *e = NULL;
14  handle_error(env, e);
15  return (jlong) rv;
16 }
17 
18 extern "C" JNIEXPORT void JNICALL
21 }
22 
23 extern "C" JNIEXPORT void JNICALL
25  jint type, jint index, jint width,
26  jint height, jint format,
27  jint framerate) {
28  rs2_error *e = NULL;
29  rs2_config_enable_stream(reinterpret_cast<rs2_config *>(handle), static_cast<rs2_stream>(type), index, width, height,
30  static_cast<rs2_format>(format), framerate, &e);
31  handle_error(env, e);
32 }
33 
34 extern "C" JNIEXPORT void JNICALL
36  jlong handle,
37  jstring filePath_) {
38  const char *filePath = env->GetStringUTFChars(filePath_, 0);
39 
40  rs2_error *e = NULL;
41  rs2_config_enable_device_from_file(reinterpret_cast<rs2_config *>(handle), filePath, &e);
42  handle_error(env, e);
43 
44  env->ReleaseStringUTFChars(filePath_, filePath);
45 }
46 
47 extern "C" JNIEXPORT void JNICALL
49  jlong handle,
50  jstring serial_) {
51  const char *serial = env->GetStringUTFChars(serial_, 0);
52 
53  rs2_error *e = NULL;
54  rs2_config_enable_device(reinterpret_cast<rs2_config *>(handle), serial, &e);
55  handle_error(env, e);
56 
57  env->ReleaseStringUTFChars(serial_, serial);
58 }
59 
60 extern "C" JNIEXPORT void JNICALL
62  jlong handle, jstring filePath_) {
63  const char *filePath = env->GetStringUTFChars(filePath_, 0);
64 
65  rs2_error *e = NULL;
66  rs2_config_enable_record_to_file(reinterpret_cast<rs2_config *>(handle), filePath, &e);
67  handle_error(env, e);
68 
69  env->ReleaseStringUTFChars(filePath_, filePath);
70 }
71 
72 extern "C" JNIEXPORT void JNICALL
74  jint streamType) {
75  rs2_error *e = NULL;
76  rs2_config_disable_stream(reinterpret_cast<rs2_config *>(handle),
77  static_cast<rs2_stream>(streamType), &e);
78  handle_error(env, e);
79 }
80 
81 extern "C" JNIEXPORT void JNICALL
83  jlong handle) {
84  rs2_error *e = NULL;
85  rs2_config_enable_all_stream(reinterpret_cast<rs2_config *>(handle), &e);
86  handle_error(env, e);
87 }
88 
89 extern "C" JNIEXPORT void JNICALL
91  jlong handle) {
92  rs2_error *e = NULL;
93  rs2_config_disable_all_streams(reinterpret_cast<rs2_config *>(handle), &e);
94  handle_error(env, e);
95 }
96 
97 extern "C"
98 JNIEXPORT jlong JNICALL
100  jlong pipelineHandle) {
101  rs2_error *e = NULL;
102  rs2_pipeline_profile* rv = rs2_config_resolve(reinterpret_cast<rs2_config *>(handle),
103  reinterpret_cast<rs2_pipeline *>(pipelineHandle), &e);
104  handle_error(env, e);
105  return reinterpret_cast<jlong>(rv);
106 }
107 
108 extern "C"
109 JNIEXPORT jboolean JNICALL
111  jlong pipelineHandle) {
112  rs2_error *e = NULL;
113  auto rv = rs2_config_can_resolve(reinterpret_cast<rs2_config *>(handle),
114  reinterpret_cast<rs2_pipeline *>(pipelineHandle), &e);
115  handle_error(env, e);
116  return rv > 0;
117 }
format
GLint GLint GLsizei GLint GLenum format
Definition: glad/glad/glad.h:1412
rs2_pipeline_profile
Definition: rs.cpp:190
Java_com_intel_realsense_librealsense_Config_nDisableAllStreams
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nDisableAllStreams(JNIEnv *env, jclass type, jlong handle)
Definition: android/jni/config.cpp:90
Java_com_intel_realsense_librealsense_Config_nEnableStream
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableStream(JNIEnv *env, jclass type_, jlong handle, jint type, jint index, jint width, jint height, jint format, jint framerate)
Definition: android/jni/config.cpp:24
rs2_config_enable_device_from_file
void rs2_config_enable_device_from_file(rs2_config *config, const char *file, rs2_error **error)
Definition: rs.cpp:2380
rs2_config_disable_all_streams
void rs2_config_disable_all_streams(rs2_config *config, rs2_error **error)
Definition: rs.cpp:2412
rs2_create_config
rs2_config * rs2_create_config(rs2_error **error)
Definition: rs.cpp:2326
rs2_config_enable_stream
void rs2_config_enable_stream(rs2_config *config, rs2_stream stream, int index, int width, int height, rs2_format format, int framerate, rs2_error **error)
Definition: rs.cpp:2340
index
GLuint index
Definition: glad/glad/glad.h:2777
rs2_error
Definition: rs.cpp:227
rs2_config_resolve
rs2_pipeline_profile * rs2_config_resolve(rs2_config *config, rs2_pipeline *pipe, rs2_error **error)
Definition: rs.cpp:2419
rs2_delete_config
void rs2_delete_config(rs2_config *config)
Definition: rs.cpp:2332
Java_com_intel_realsense_librealsense_Config_nCreate
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_Config_nCreate(JNIEnv *env, jclass type)
Definition: android/jni/config.cpp:11
type
GLenum type
Definition: glad/glad/glad.h:135
width
GLint GLsizei width
Definition: glad/glad/glad.h:1397
rs2_format
rs2_format
A stream's format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:61
NULL
#define NULL
Definition: tinycthread.c:47
height
GLint GLsizei GLsizei height
Definition: glad/glad/glad.h:1397
Java_com_intel_realsense_librealsense_Config_nCanResolve
JNIEXPORT jboolean JNICALL Java_com_intel_realsense_librealsense_Config_nCanResolve(JNIEnv *env, jclass type, jlong handle, jlong pipelineHandle)
Definition: android/jni/config.cpp:110
handle_error
void handle_error(JNIEnv *env, rs2_error *error)
Definition: error.cpp:6
error.h
rs2_pipeline
Definition: rs.cpp:180
Java_com_intel_realsense_librealsense_Config_nEnableDevice
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableDevice(JNIEnv *env, jclass type, jlong handle, jstring serial_)
Definition: android/jni/config.cpp:48
rs2_config_enable_device
void rs2_config_enable_device(rs2_config *config, const char *serial, rs2_error **error)
Definition: rs.cpp:2361
rs2_config_enable_all_stream
void rs2_config_enable_all_stream(rs2_config *config, rs2_error **error)
Definition: rs.cpp:2354
Java_com_intel_realsense_librealsense_Config_nResolve
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_Config_nResolve(JNIEnv *env, jclass type, jlong handle, jlong pipelineHandle)
Definition: android/jni/config.cpp:99
Java_com_intel_realsense_librealsense_Config_nEnableDeviceFromFile
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableDeviceFromFile(JNIEnv *env, jclass type, jlong handle, jstring filePath_)
Definition: android/jni/config.cpp:35
rs2_config_disable_stream
void rs2_config_disable_stream(rs2_config *config, rs2_stream stream, rs2_error **error)
Definition: rs.cpp:2398
rmse.e
e
Definition: rmse.py:177
rs2_config_can_resolve
int rs2_config_can_resolve(rs2_config *config, rs2_pipeline *pipe, rs2_error **error)
Definition: rs.cpp:2427
Java_com_intel_realsense_librealsense_Config_nEnableRecordToFile
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableRecordToFile(JNIEnv *env, jclass type, jlong handle, jstring filePath_)
Definition: android/jni/config.cpp:61
Java_com_intel_realsense_librealsense_Config_nDelete
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nDelete(JNIEnv *env, jclass type, jlong handle)
Definition: android/jni/config.cpp:19
unit-test-config.handle
handle
Definition: unit-test-config.py:371
Java_com_intel_realsense_librealsense_Config_nEnableAllStreams
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableAllStreams(JNIEnv *env, jclass type, jlong handle)
Definition: android/jni/config.cpp:82
rs2_config
Definition: rs.cpp:185
rs2_stream
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:43
Java_com_intel_realsense_librealsense_Config_nDisableStream
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nDisableStream(JNIEnv *env, jclass type, jlong handle, jint streamType)
Definition: android/jni/config.cpp:73
rs2_config_enable_record_to_file
void rs2_config_enable_record_to_file(rs2_config *config, const char *file, rs2_error **error)
Definition: rs.cpp:2389


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01