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;
13  rs2_config *rv = rs2_create_config(&e);
14  handle_error(env, e);
15  return (jlong) rv;
16 }
17 
18 extern "C" JNIEXPORT void JNICALL
20  rs2_delete_config((rs2_config *) handle);
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 }
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableDevice(JNIEnv *env, jclass type, jlong handle, jstring serial_)
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:1928
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_Config_nCreate(JNIEnv *env, jclass type)
rs2_pipeline_profile * rs2_config_resolve(rs2_config *config, rs2_pipeline *pipe, rs2_error **error)
Definition: rs.cpp:2007
JNIEXPORT jboolean JNICALL Java_com_intel_realsense_librealsense_Config_nCanResolve(JNIEnv *env, jclass type, jlong handle, jlong pipelineHandle)
GLuint64 GLenum void * handle
Definition: glext.h:7785
rs2_config * rs2_create_config(rs2_error **error)
Definition: rs.cpp:1914
void rs2_config_enable_record_to_file(rs2_config *config, const char *file, rs2_error **error)
Definition: rs.cpp:1977
void handle_error(JNIEnv *env, rs2_error *error)
Definition: error.cpp:6
e
Definition: rmse.py:177
void rs2_config_enable_all_stream(rs2_config *config, rs2_error **error)
Definition: rs.cpp:1942
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nDelete(JNIEnv *env, jclass type, jlong handle)
GLuint index
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableRecordToFile(JNIEnv *env, jclass type, jlong handle, jstring filePath_)
void rs2_config_disable_all_streams(rs2_config *config, rs2_error **error)
Definition: rs.cpp:2000
void rs2_config_enable_device_from_file(rs2_config *config, const char *file, rs2_error **error)
Definition: rs.cpp:1968
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_Config_nResolve(JNIEnv *env, jclass type, jlong handle, jlong pipelineHandle)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableAllStreams(JNIEnv *env, jclass type, jlong handle)
GLint GLsizei GLsizei height
int rs2_config_can_resolve(rs2_config *config, rs2_pipeline *pipe, rs2_error **error)
Definition: rs.cpp:2015
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nDisableStream(JNIEnv *env, jclass type, jlong handle, jint streamType)
GLint GLint GLsizei GLint GLenum format
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nEnableDeviceFromFile(JNIEnv *env, jclass type, jlong handle, jstring filePath_)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Config_nDisableAllStreams(JNIEnv *env, jclass type, jlong handle)
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)
GLenum type
void rs2_delete_config(rs2_config *config)
Definition: rs.cpp:1920
#define NULL
Definition: tinycthread.c:47
void rs2_config_enable_device(rs2_config *config, const char *serial, rs2_error **error)
Definition: rs.cpp:1949
GLint GLsizei width
void rs2_config_disable_stream(rs2_config *config, rs2_stream stream, rs2_error **error)
Definition: rs.cpp:1986


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:12