4#ifndef LIBREALSENSE_RS2_CONTEXT_HPP
5#define LIBREALSENSE_RS2_CONTEXT_HPP
17 :_removed(removed), _added(added) {}
90 class software_device;
103 context(
char const * json_settings =
nullptr )
106 _context = std::shared_ptr<rs2_context>(
112 :
context( json_settings.c_str() )
125 std::shared_ptr<rs2_device_list> list(
140 std::shared_ptr<rs2_device_list> list(
154 std::vector<sensor> results;
157 auto sensors = dev.query_sensors();
158 std::copy(sensors.begin(), sensors.end(), std::back_inserter(results));
167 std::shared_ptr<rs2_device> dev(
197 auto device = std::shared_ptr<rs2_device>(
231 [](
const float progress,
void* user) { (*static_cast<T*>(user))(progress); },
239 explicit operator std::shared_ptr<rs2_context>() {
return _context; };
257 _device_hub = std::shared_ptr<rs2_device_hub>(
270 std::shared_ptr<rs2_device> dev(
289 return res > 0 ? true :
false;
293 explicit operator std::shared_ptr<rs2_device_hub>() {
return _device_hub; }
294 explicit device_hub(std::shared_ptr<rs2_device_hub> hub) : _device_hub(std::move(hub)) {}
296 std::shared_ptr<rs2_device_hub> _device_hub;
Definition rs_context.hpp:97
void set_devices_changed_callback(T callback)
Definition rs_context.hpp:179
context(std::string const &json_settings)
Definition rs_context.hpp:111
device_list query_devices() const
Definition rs_context.hpp:122
context(uninitialized_t)
Definition rs_context.hpp:100
context(char const *json_settings=nullptr)
Definition rs_context.hpp:103
uninitialized_t
Definition rs_context.hpp:99
@ uninitialized
Definition rs_context.hpp:99
void unload_device(const std::string &file)
Definition rs_context.hpp:205
device_list query_devices(int mask) const
Definition rs_context.hpp:137
void unload_tracking_module()
Definition rs_context.hpp:212
std::vector< sensor > query_all_sensors() const
Generate a flat list of all available sensors from all RealSense devices.
Definition rs_context.hpp:152
std::shared_ptr< rs2_context > _context
Definition rs_context.hpp:245
playback load_device(const std::string &file)
Definition rs_context.hpp:194
device get_sensor_parent(const sensor &s) const
Definition rs_context.hpp:164
void convert_bag_to_db3(const std::string &input, const std::string &output)
Definition rs_context.hpp:219
void convert_bag_to_db3(const std::string &input, const std::string &output, T callback)
Definition rs_context.hpp:227
context(std::shared_ptr< rs2_context > ctx)
Definition rs_context.hpp:236
Definition rs_context.hpp:252
device wait_for_device() const
Definition rs_context.hpp:267
bool is_connected(const device &dev) const
Definition rs_context.hpp:283
device_hub(std::shared_ptr< rs2_device_hub > hub)
Definition rs_context.hpp:294
device_hub(context ctx)
Definition rs_context.hpp:254
Definition rs_device.hpp:1058
Definition rs_device.hpp:20
const std::shared_ptr< rs2_device > & get() const
Definition rs_device.hpp:164
std::shared_ptr< rs2_device > _dev
Definition rs_device.hpp:209
Definition rs_context.hpp:69
void release() override
Definition rs_context.hpp:85
void on_devices_changed(rs2_device_list *removed, rs2_device_list *added) override
Definition rs_context.hpp:75
devices_changed_callback(T callback)
Definition rs_context.hpp:73
static void handle(rs2_error *e)
Definition rs_types.hpp:167
Definition rs_pipeline.hpp:363
Definition rs_record_playback.hpp:28
Definition rs_sensor.hpp:104
std::shared_ptr< rs2_sensor > _sensor
Definition rs_sensor.hpp:388
Definition rs_internal.hpp:234
Definition rs_processing_gl.hpp:13
#define RS2_API_VERSION
Definition rs.h:44
void rs2_delete_context(rs2_context *context)
Frees the relevant context object.
rs2_device * rs2_device_hub_wait_for_device(const rs2_device_hub *hub, rs2_error **error)
void rs2_delete_device_hub(const rs2_device_hub *hub)
Frees the relevant device hub object.
int rs2_device_hub_is_device_connected(const rs2_device_hub *hub, const rs2_device *device, rs2_error **error)
rs2_context * rs2_create_context_ex(int api_version, const char *json_settings, rs2_error **error)
Creates RealSense context that is required for the rest of the API, and accepts a settings JSON.
void rs2_context_unload_tracking_module(rs2_context *ctx, rs2_error **error)
void rs2_convert_bag_to_db3(const char *input_bag_path, const char *output_db3_path, const rs2_context *ctx, rs2_update_progress_callback_ptr callback, void *client_data, rs2_error **error)
rs2_device_hub * rs2_create_device_hub(const rs2_context *context, rs2_error **error)
Creates RealSense device_hub .
void rs2_context_remove_device(rs2_context *ctx, const char *file, rs2_error **error)
rs2_device * rs2_context_add_device(rs2_context *ctx, const char *file, rs2_error **error)
void rs2_set_devices_changed_callback_cpp(rs2_context *context, rs2_devices_changed_callback *callback, rs2_error **error)
rs2_device_list * rs2_query_devices_ex(const rs2_context *context, int product_mask, rs2_error **error)
rs2_device_list * rs2_query_devices(const rs2_context *context, rs2_error **error)
void rs2_delete_device(rs2_device *device)
int rs2_device_list_contains(const rs2_device_list *info_list, const rs2_device *device, rs2_error **error)
void rs2_delete_device_list(rs2_device_list *info_list)
rs2_device * rs2_create_device_from_sensor(const rs2_sensor *sensor, rs2_error **error)
struct rs2_device_list rs2_device_list
Definition rs_types.h:301
struct rs2_error rs2_error
Definition rs_types.h:293
Definition rs_types.hpp:82