RealSense Cross Platform API
RealSense Cross-platform API
rs_rum.hpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2026 RealSense, Inc. All Rights Reserved.
3 
4 #ifndef LIBREALSENSE_RS2_RUM_HPP
5 #define LIBREALSENSE_RS2_RUM_HPP
6 
7 #include "rs_types.hpp"
8 #include "../h/rs_rum.h"
9 
10 #include <string>
11 #include <memory>
12 
13 namespace rs2
14 {
15  namespace rum
16  {
17  // Path of the on-disk RUM report file (read that file to inspect or upload the report).
18  inline std::string get_report_path()
19  {
20  rs2_error* e = nullptr;
21  std::shared_ptr<const rs2_raw_data_buffer> buffer(
23  error::handle(e);
24  if (!buffer)
25  return std::string();
26  auto size = rs2_get_raw_data_size(buffer.get(), &e);
27  error::handle(e);
28  auto data = rs2_get_raw_data(buffer.get(), &e);
29  error::handle(e);
30  if (!data)
31  return std::string();
32  return std::string(reinterpret_cast<const char*>(data), size);
33  }
34 
35  // Set the cloud-upload consent flag; persists to the per-user config file.
36  inline void set_cloud_enabled(bool enabled)
37  {
38  rs2_error* e = nullptr;
39  rs2_rum_set_cloud_enabled(enabled ? 1 : 0, &e);
40  error::handle(e);
41  }
42 
43  // Resolved cloud-upload consent (env var overrides the config file).
44  inline bool is_cloud_enabled()
45  {
46  rs2_error* e = nullptr;
47  auto enabled = rs2_rum_is_cloud_enabled(&e);
48  error::handle(e);
49  return enabled != 0;
50  }
51  }
52 }
53 
54 #endif // LIBREALSENSE_RS2_RUM_HPP
const rs2_raw_data_buffer * rs2_rum_get_report_path(rs2_error **error)
const unsigned char * rs2_get_raw_data(const rs2_raw_data_buffer *buffer, rs2_error **error)
Definition: rs_context.hpp:11
void rs2_delete_raw_data(const rs2_raw_data_buffer *buffer)
int rs2_get_raw_data_size(const rs2_raw_data_buffer *buffer, rs2_error **error)
void set_cloud_enabled(bool enabled)
Definition: rs_rum.hpp:36
int rs2_rum_is_cloud_enabled(rs2_error **error)
std::string get_report_path()
Definition: rs_rum.hpp:18
static void handle(rs2_error *e)
Definition: rs_types.hpp:162
bool is_cloud_enabled()
Definition: rs_rum.hpp:44
void rs2_rum_set_cloud_enabled(int enabled, rs2_error **error)
struct rs2_error rs2_error
Definition: rs_types.h:296