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>(
222 explicit operator std::shared_ptr<rs2_context>() {
return _context; };
240 _device_hub = std::shared_ptr<rs2_device_hub>(
253 std::shared_ptr<rs2_device> dev(
272 return res > 0 ? true :
false;
276 explicit operator std::shared_ptr<rs2_device_hub>() {
return _device_hub; }
277 explicit device_hub(std::shared_ptr<rs2_device_hub> hub) : _device_hub(std::move(hub)) {}
279 std::shared_ptr<rs2_device_hub> _device_hub;
283 #endif // LIBREALSENSE_RS2_CONTEXT_HPP Definition: rs_record_playback.hpp:27
Definition: rs_sensor.hpp:102
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 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
int rs2_device_list_contains(const rs2_device_list *info_list, const rs2_device *device, rs2_error **error)
#define RS2_API_VERSION
Definition: rs.h:42
bool is_connected(const device &dev) const
Definition: rs_context.hpp:266
rs2_device_list * rs2_query_devices(const rs2_context *context, rs2_error **error)
void unload_device(const std::string &file)
Definition: rs_context.hpp:205
rs2_device_hub * rs2_create_device_hub(const rs2_context *context, rs2_error **error)
Creates RealSense device_hub .
context(std::string const &json_settings)
Definition: rs_context.hpp:111
context(uninitialized_t)
Definition: rs_context.hpp:100
playback load_device(const std::string &file)
Definition: rs_context.hpp:194
rs2_device * rs2_create_device_from_sensor(const rs2_sensor *sensor, rs2_error **error)
void rs2_delete_device(rs2_device *device)
void rs2_delete_context(rs2_context *context)
Frees the relevant context object.
rs2_device * rs2_context_add_device(rs2_context *ctx, const char *file, rs2_error **error)
Definition: rs_context.hpp:11
void unload_tracking_module()
Definition: rs_context.hpp:212
Definition: rs_context.hpp:96
device_list query_devices() const
Definition: rs_context.hpp:122
device wait_for_device() const
Definition: rs_context.hpp:250
std::shared_ptr< rs2_sensor > _sensor
Definition: rs_sensor.hpp:352
rs2_device_list * rs2_query_devices_ex(const rs2_context *context, int product_mask, rs2_error **error)
std::shared_ptr< rs2_context > _context
Definition: rs_context.hpp:228
context(char const *json_settings=nullptr)
Definition: rs_context.hpp:103
int rs2_device_hub_is_device_connected(const rs2_device_hub *hub, const rs2_device *device, rs2_error **error)
const std::shared_ptr< rs2_device > & get() const
Definition: rs_device.hpp:162
context(std::shared_ptr< rs2_context > ctx)
Definition: rs_context.hpp:219
void rs2_delete_device_hub(const rs2_device_hub *hub)
Frees the relevant device hub object.
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_device > _dev
Definition: rs_device.hpp:207
device_hub(std::shared_ptr< rs2_device_hub > hub)
Definition: rs_context.hpp:277
device get_sensor_parent(const sensor &s) const
Definition: rs_context.hpp:164
Definition: rs_context.hpp:99
Definition: rs_internal.hpp:217
device_list query_devices(int mask) const
Definition: rs_context.hpp:137
static void handle(rs2_error *e)
Definition: rs_types.hpp:162
Definition: rs_pipeline.hpp:362
void rs2_context_unload_tracking_module(rs2_context *ctx, rs2_error **error)
Definition: rs_device.hpp:1088
Definition: rs_context.hpp:234
void set_devices_changed_callback(T callback)
Definition: rs_context.hpp:179
void rs2_set_devices_changed_callback_cpp(rs2_context *context, rs2_devices_changed_callback *callback, rs2_error **error)
devices_changed_callback(T callback)
Definition: rs_context.hpp:73
uninitialized_t
Definition: rs_context.hpp:99
void rs2_context_remove_device(rs2_context *ctx, const char *file, rs2_error **error)
struct rs2_device_list rs2_device_list
Definition: rs_types.h:237
Definition: rs_context.hpp:68
Definition: rs_types.hpp:76
struct rs2_error rs2_error
Definition: rs_types.h:229
void rs2_delete_device_list(rs2_device_list *info_list)
rs2_device * rs2_device_hub_wait_for_device(const rs2_device_hub *hub, rs2_error **error)
Definition: rs_device.hpp:19
const rs2_device_list * get_list() const
Definition: rs_device.hpp:1185
device_hub(context ctx)
Definition: rs_context.hpp:237