fw_logger.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 #include "../../../include/librealsense2/h/rs_internal.h"
7 
8 // Fw Logger methods
9 
10 extern "C"
11 JNIEXPORT jlong JNICALL
13  jlong fw_logger_handle) {
14  rs2_error* e = NULL;
15  rs2_firmware_log_message* log_msg = rs2_create_fw_log_message(reinterpret_cast<rs2_device*>(fw_logger_handle), &e);
16  handle_error(env, e);
17 
18  int result = rs2_get_fw_log(reinterpret_cast<rs2_device*>(fw_logger_handle), log_msg, &e);
19  handle_error(env, e);
20 
21  bool result_bool = (result != 0);
22  jclass clazz = env->GetObjectClass(instance);
23  jfieldID resultField = env->GetFieldID(clazz, "mFwLogPullingStatus", "Z");
24  env->SetBooleanField(instance, resultField, result_bool);
25 
26  return (jlong)log_msg;
27 }
28 
29 extern "C"
30 JNIEXPORT jlong JNICALL
32  jlong fw_logger_handle) {
33  rs2_error* e = NULL;
34  rs2_firmware_log_message* log_msg = rs2_create_fw_log_message(reinterpret_cast<rs2_device*>(fw_logger_handle), &e);
35  handle_error(env, e);
36 
37  int result = rs2_get_flash_log(reinterpret_cast<rs2_device*>(fw_logger_handle), log_msg, &e);
38  handle_error(env, e);
39 
40  bool result_bool = (result != 0);
41  jclass clazz = env->GetObjectClass(instance);
42  jfieldID resultField = env->GetFieldID(clazz, "mFwLogPullingStatus", "Z");
43  env->SetBooleanField(instance, resultField, result_bool);
44 
45  return (jlong)log_msg;
46 }
47 
48 extern "C"
49 JNIEXPORT jlong JNICALL
51  jlong fw_logger_handle) {
52  rs2_error* e = NULL;
53  unsigned int numOfFwLogsPolledFromDevice = rs2_get_number_of_fw_logs(reinterpret_cast<rs2_device*>(fw_logger_handle), &e);
54  handle_error(env, e);
55 
56  return (jlong)(unsigned long long)numOfFwLogsPolledFromDevice;
57 }
58 
59 extern "C"
60 JNIEXPORT jboolean JNICALL
62  jlong fw_logger_handle,
63  jstring xml_content) {
64  const char* xml_content_arr = env->GetStringUTFChars(xml_content, 0);
65 
66  rs2_error* e = NULL;
67  int result = rs2_init_fw_log_parser(reinterpret_cast<rs2_device*>(fw_logger_handle), xml_content_arr, &e);
68  handle_error(env, e);
69 
70  env->ReleaseStringUTFChars(xml_content, xml_content_arr);
71 
72  bool resultBool = (result != 0);
73  return (jboolean)resultBool;
74 }
75 
76 extern "C"
77 JNIEXPORT jlong JNICALL
79  jlong fw_logger_handle, jlong fw_log_msg_handle) {
80  rs2_error* e = NULL;
81  rs2_firmware_log_parsed_message* parsed_msg = rs2_create_fw_log_parsed_message(reinterpret_cast<rs2_device*>(fw_logger_handle), &e);
82  handle_error(env, e);
83 
84  int result = rs2_parse_firmware_log(reinterpret_cast<rs2_device*>(fw_logger_handle),
85  reinterpret_cast<rs2_firmware_log_message*>(fw_log_msg_handle),
86  parsed_msg, &e);
87  handle_error(env, e);
88 
89  return (jlong)parsed_msg;
90 }
91 
92 // Fw Log Msg methods
93 
94 extern "C" JNIEXPORT void JNICALL
96  rs2_delete_fw_log_message(reinterpret_cast<rs2_firmware_log_message*>(handle));
97 }
98 
99 extern "C" JNIEXPORT jint JNICALL
101  rs2_error* e = NULL;
102  rs2_log_severity severity = rs2_fw_log_message_severity(reinterpret_cast<rs2_firmware_log_message*>(handle), &e);
103  handle_error(env, e);
104  return (jint)severity;
105 }
106 
107 extern "C" JNIEXPORT jstring JNICALL
109  rs2_error* e = NULL;
110  rs2_log_severity severity = rs2_fw_log_message_severity(reinterpret_cast<rs2_firmware_log_message*>(handle), &e);
111  handle_error(env, e);
112 
113  const char* severity_string = rs2_log_severity_to_string(severity);
114  return env->NewStringUTF(severity_string);
115 }
116 
117 extern "C" JNIEXPORT jlong JNICALL
119  rs2_error* e = NULL;
120  unsigned int timestamp = rs2_fw_log_message_timestamp(reinterpret_cast<rs2_firmware_log_message*>(handle), &e);
121  handle_error(env, e);
122  return (jlong)(unsigned long long)timestamp;
123 }
124 
125 extern "C" JNIEXPORT jint JNICALL
127  rs2_error* e = NULL;
128  int size = rs2_fw_log_message_size(reinterpret_cast<rs2_firmware_log_message*>(handle), &e);
129  handle_error(env, e);
130  return (jint)size;
131 }
132 
133 extern "C" JNIEXPORT jbyteArray JNICALL
135  jlong handle,jbyteArray input_buffer) {
136  jbyte *buffer = env->GetByteArrayElements(input_buffer, NULL);
137 
138  rs2_error* e = NULL;
139  int size = rs2_fw_log_message_size(reinterpret_cast<rs2_firmware_log_message*>(handle), &e);
140  handle_error(env, e);
141 
142  const unsigned char* message_data = rs2_fw_log_message_data(reinterpret_cast<rs2_firmware_log_message*>(handle), &e);
143  handle_error(env, e);
144 
145  env->ReleaseByteArrayElements(input_buffer, buffer, 0);
146  jbyteArray rv = env->NewByteArray(size);
147  env->SetByteArrayRegion (rv, 0, size, reinterpret_cast<const jbyte *>(message_data));
148  return rv;
149 }
150 
151 
152 //Parsed Fw Log Msg methods
153 
154 extern "C" JNIEXPORT void JNICALL
156  rs2_delete_fw_log_parsed_message(reinterpret_cast<rs2_firmware_log_parsed_message*>(handle));
157 }
158 
159 
160 extern "C" JNIEXPORT jstring JNICALL
162  rs2_error* e = NULL;
163  const char* message = rs2_get_fw_log_parsed_message(reinterpret_cast<rs2_firmware_log_parsed_message*>(handle), &e);
164  handle_error(env, e);
165 
166  return env->NewStringUTF(message);
167 }
168 
169 extern "C" JNIEXPORT jstring JNICALL
171  rs2_error* e = NULL;
172  const char* file_name = rs2_get_fw_log_parsed_file_name(reinterpret_cast<rs2_firmware_log_parsed_message*>(handle), &e);
173  handle_error(env, e);
174 
175  return env->NewStringUTF(file_name);
176 }
177 
178 extern "C" JNIEXPORT jstring JNICALL
180  rs2_error* e = NULL;
181  const char* thread_name = rs2_get_fw_log_parsed_thread_name(reinterpret_cast<rs2_firmware_log_parsed_message*>(handle), &e);
182  handle_error(env, e);
183 
184  return env->NewStringUTF(thread_name);
185 }
186 
187 extern "C" JNIEXPORT jstring JNICALL
189  rs2_error* e = NULL;
190  rs2_log_severity severity = rs2_get_fw_log_parsed_severity(reinterpret_cast<rs2_firmware_log_parsed_message*>(handle), &e);
191  handle_error(env, e);
192 
193  const char* severity_string = rs2_log_severity_to_string(severity);
194  return env->NewStringUTF(severity_string);
195 }
196 
197 extern "C" JNIEXPORT jint JNICALL
199  rs2_error* e = NULL;
200  int line = rs2_get_fw_log_parsed_line(reinterpret_cast<rs2_firmware_log_parsed_message*>(handle), &e);
201  handle_error(env, e);
202  return (jint)line;
203 }
204 
205 extern "C" JNIEXPORT jlong JNICALL
207  rs2_error* e = NULL;
208  unsigned int timestamp = rs2_get_fw_log_parsed_timestamp(reinterpret_cast<rs2_firmware_log_parsed_message*>(handle), &e);
209  handle_error(env, e);
210  return (jlong)(unsigned long long)timestamp;
211 }
212 
213 extern "C" JNIEXPORT jint JNICALL
215  rs2_error* e = NULL;
216  unsigned int sequence = rs2_get_fw_log_parsed_sequence_id(reinterpret_cast<rs2_firmware_log_parsed_message*>(handle), &e);
217  handle_error(env, e);
218  return (jint)sequence;
219 }
220 
GLenum GLuint GLenum GLsizei const GLchar * message
GLenum GLuint GLenum severity
JNIEXPORT jstring JNICALL Java_com_intel_realsense_librealsense_FwLogMsg_nGetSeverityStr(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:108
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_FwLogger_nGetNumberOfFwLogs(JNIEnv *env, jobject instance, jlong fw_logger_handle)
Definition: fw_logger.cpp:50
GLuint64 GLenum void * handle
Definition: glext.h:7785
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_FwLogParsedMsg_nGetLine(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:198
const char * rs2_get_fw_log_parsed_thread_name(rs2_firmware_log_parsed_message *fw_log_parsed_msg, rs2_error **error)
Gets RealSense firmware log parsed message thread name.
Definition: rs.cpp:3325
int rs2_fw_log_message_size(rs2_firmware_log_message *msg, rs2_error **error)
Gets RealSense firmware log message size.
Definition: rs.cpp:3240
unsigned int rs2_get_fw_log_parsed_sequence_id(rs2_firmware_log_parsed_message *fw_log_parsed_msg, rs2_error **error)
Gets RealSense firmware log parsed message sequence id - cyclic number of FW log with [0...
Definition: rs.cpp:3353
unsigned int rs2_fw_log_message_timestamp(rs2_firmware_log_message *msg, rs2_error **error)
Gets RealSense firmware log message timestamp.
Definition: rs.cpp:3253
void handle_error(JNIEnv *env, rs2_error *error)
Definition: error.cpp:6
e
Definition: rmse.py:177
GLenum GLfloat * buffer
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_FwLogMsg_nRelease(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:95
JNIEXPORT jstring JNICALL Java_com_intel_realsense_librealsense_FwLogParsedMsg_nGetSeverity(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:188
void rs2_delete_fw_log_parsed_message(rs2_firmware_log_parsed_message *fw_log_parsed_msg)
Deletes RealSense firmware log parsed message.
Definition: rs.cpp:3304
unsigned int rs2_get_fw_log_parsed_line(rs2_firmware_log_parsed_message *fw_log_parsed_msg, rs2_error **error)
Gets RealSense firmware log parsed message relevant line (in the file that is returned by rs2_get_fw_...
Definition: rs.cpp:3339
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_FwLogParsedMsg_nGetTimestamp(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:206
int rs2_get_flash_log(rs2_device *dev, rs2_firmware_log_message *fw_log_msg, rs2_error **error)
Gets RealSense flash log - this is a fw log that has been written in the device during the previous s...
Definition: rs.cpp:3211
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_FwLogParsedMsg_nRelease(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:155
GLsizeiptr size
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_FwLogger_nGetFwLog(JNIEnv *env, jobject instance, jlong fw_logger_handle)
Definition: fw_logger.cpp:12
rs2_log_severity rs2_fw_log_message_severity(const rs2_firmware_log_message *msg, rs2_error **error)
Gets RealSense firmware log message severity.
Definition: rs.cpp:3247
JNIEXPORT jstring JNICALL Java_com_intel_realsense_librealsense_FwLogParsedMsg_nGetFileName(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:170
JNIEXPORT jstring JNICALL Java_com_intel_realsense_librealsense_FwLogParsedMsg_nGetThreadName(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:179
const char * rs2_get_fw_log_parsed_message(rs2_firmware_log_parsed_message *fw_log_parsed_msg, rs2_error **error)
Gets RealSense firmware log parsed message.
Definition: rs.cpp:3311
unsigned int rs2_get_fw_log_parsed_timestamp(rs2_firmware_log_parsed_message *fw_log_parsed_msg, rs2_error **error)
Gets RealSense firmware log parsed message timestamp.
Definition: rs.cpp:3346
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_FwLogParsedMsg_nGetSequenceId(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:214
JNIEXPORT jstring JNICALL Java_com_intel_realsense_librealsense_FwLogParsedMsg_nGetMessage(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:161
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_FwLogger_nParseFwLog(JNIEnv *env, jclass clazz, jlong fw_logger_handle, jlong fw_log_msg_handle)
Definition: fw_logger.cpp:78
int rs2_init_fw_log_parser(rs2_device *dev, const char *xml_content, rs2_error **error)
Initializes RealSense firmware logs parser in device.
Definition: rs.cpp:3260
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_FwLogMsg_nGetSeverity(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:100
void rs2_delete_fw_log_message(rs2_firmware_log_message *msg)
Definition: rs.cpp:3226
JNIEXPORT jbyteArray JNICALL Java_com_intel_realsense_librealsense_FwLogMsg_nGetData(JNIEnv *env, jclass clazz, jlong handle, jbyteArray input_buffer)
Definition: fw_logger.cpp:134
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_FwLogMsg_nGetSize(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:126
rs2_log_severity rs2_get_fw_log_parsed_severity(rs2_firmware_log_parsed_message *fw_log_parsed_msg, rs2_error **error)
Gets RealSense firmware log parsed message severity.
Definition: rs.cpp:3332
rs2_firmware_log_message * rs2_create_fw_log_message(rs2_device *dev, rs2_error **error)
Creates RealSense firmware log message.
Definition: rs.cpp:3186
#define NULL
Definition: tinycthread.c:47
JNIEXPORT jboolean JNICALL Java_com_intel_realsense_librealsense_FwLogger_nInitParser(JNIEnv *env, jclass clazz, jlong fw_logger_handle, jstring xml_content)
Definition: fw_logger.cpp:61
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_FwLogger_nGetFlashLog(JNIEnv *env, jobject instance, jlong fw_logger_handle)
Definition: fw_logger.cpp:31
const char * rs2_log_severity_to_string(rs2_log_severity info)
Definition: rs.cpp:1271
const char * rs2_get_fw_log_parsed_file_name(rs2_firmware_log_parsed_message *fw_log_parsed_msg, rs2_error **error)
Gets RealSense firmware log parsed message file name.
Definition: rs.cpp:3318
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_FwLogMsg_nGetTimestamp(JNIEnv *env, jclass clazz, jlong handle)
Definition: fw_logger.cpp:118
int rs2_parse_firmware_log(rs2_device *dev, rs2_firmware_log_message *fw_log_msg, rs2_firmware_log_parsed_message *parsed_msg, rs2_error **error)
Gets RealSense firmware log parser.
Definition: rs.cpp:3280
const unsigned char * rs2_fw_log_message_data(rs2_firmware_log_message *msg, rs2_error **error)
Gets RealSense firmware log message data.
Definition: rs.cpp:3233
rs2_firmware_log_parsed_message * rs2_create_fw_log_parsed_message(rs2_device *dev, rs2_error **error)
Creates RealSense firmware log parsed message.
Definition: rs.cpp:3270
rs2_log_severity
Severity of the librealsense logger.
Definition: rs_types.h:153
GLuint64EXT * result
Definition: glext.h:10921
unsigned int rs2_get_number_of_fw_logs(rs2_device *dev, rs2_error **error)
Returns number of fw logs already polled from device but not by user yet.
Definition: rs.cpp:3295
int rs2_get_fw_log(rs2_device *dev, rs2_firmware_log_message *fw_log_msg, rs2_error **error)
Gets RealSense firmware log.
Definition: rs.cpp:3195


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