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;
300 #endif // LIBREALSENSE_RS2_CONTEXT_HPP Definition: rs_record_playback.hpp:27
Definition: rs_sensor.hpp:103
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:44
bool is_connected(const device &dev) const
Definition: rs_context.hpp:283
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:267
std::shared_ptr< rs2_sensor > _sensor
Definition: rs_sensor.hpp:388
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:245
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)
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:164
context(std::shared_ptr< rs2_context > ctx)
Definition: rs_context.hpp:236
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:209
device_hub(std::shared_ptr< rs2_device_hub > hub)
Definition: rs_context.hpp:294
device get_sensor_parent(const sensor &s) const
Definition: rs_context.hpp:164
Definition: rs_context.hpp:99
Definition: rs_internal.hpp:233
device_list query_devices(int mask) const
Definition: rs_context.hpp:137
static void handle(rs2_error *e)
Definition: rs_types.hpp:167
Definition: rs_pipeline.hpp:362
void rs2_context_unload_tracking_module(rs2_context *ctx, rs2_error **error)
Definition: rs_device.hpp:1057
Definition: rs_context.hpp:251
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)
void convert_bag_to_db3(const std::string &input, const std::string &output)
Definition: rs_context.hpp:219
devices_changed_callback(T callback)
Definition: rs_context.hpp:73
void convert_bag_to_db3(const std::string &input, const std::string &output, T callback)
Definition: rs_context.hpp:227
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:301
Definition: rs_context.hpp:68
Definition: rs_types.hpp:81
struct rs2_error rs2_error
Definition: rs_types.h:293
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:1154
device_hub(context ctx)
Definition: rs_context.hpp:254