4 #ifndef LIBREALSENSE_RS2_DEVICE_HPP 5 #define LIBREALSENSE_RS2_DEVICE_HPP 28 std::shared_ptr<rs2_sensor_list> list(
36 std::vector<sensor> results;
39 std::shared_ptr<rs2_sensor>
dev(
45 results.push_back(rs2_dev);
56 if (
auto t =
s.as<
T>())
return t;
58 throw rs2::error(
"Could not find requested sensor type!");
71 return is_supported > 0;
112 operator bool()
const 114 return _dev !=
nullptr;
116 const std::shared_ptr<rs2_device>&
get()
const 138 explicit operator std::shared_ptr<rs2_device>() {
return _dev; };
146 std::shared_ptr<rs2_device>
_dev;
193 std::vector<uint8_t> results;
196 std::shared_ptr<const rs2_raw_data_buffer> list(
214 std::vector<uint8_t> results;
217 std::shared_ptr<const rs2_raw_data_buffer> list(
267 void update(
const std::vector<uint8_t>& fw_image)
const 365 std::vector<uint8_t> results;
417 std::vector<uint8_t> results;
420 std::shared_ptr<const rs2_raw_data_buffer> list(
459 std::vector<uint8_t> results;
462 std::shared_ptr<const rs2_raw_data_buffer> list(
500 std::vector<uint8_t> results;
503 std::shared_ptr<const rs2_raw_data_buffer> list(
524 std::vector<uint8_t> results;
527 std::shared_ptr<const rs2_raw_data_buffer> list(
557 template<
class callback >
595 template<
typename T >
651 std::vector<uint8_t> results;
654 std::shared_ptr<const rs2_raw_data_buffer> list(
674 : _list(
move(list)) {}
679 operator std::vector<device>()
const 681 std::vector<device>
res;
682 for (
auto&&
dev : *
this) res.push_back(
dev);
703 std::shared_ptr<rs2_device>
dev(
730 : _list(device_list),
738 return _list[_index];
742 return other.
_index != _index || &other.
_list != &_list;
746 return !(*
this != other);
772 operator std::shared_ptr<rs2_device_list>() {
return _list; };
775 std::shared_ptr<rs2_device_list> _list;
831 return is_enabled != 0;
880 auto from_sensor = get_sensor_profile(from_stream, from_id);
881 auto to_sensor = get_sensor_profile(to_stream, to_id);
882 rs2_set_extrinsics(from_sensor.first.get().get(), from_sensor.second.get(), to_sensor.first.get().get(), to_sensor.second.get(), &
extrinsics, &
e);
903 for (
auto p :
s.get_stream_profiles()) {
904 if (
p.stream_type() == stream_type &&
p.stream_index() == stream_index)
905 return std::pair<sensor, stream_profile>(
s,
p);
908 return std::pair<sensor, stream_profile>();
912 #endif // LIBREALSENSE_RS2_DEVICE_HPP const std::shared_ptr< rs2_sensor > & get() const
void rs2_set_calibration_table(const rs2_device *device, const void *calibration, int calibration_size, rs2_error **error)
int rs2_get_sensors_count(const rs2_sensor_list *info_list, rs2_error **error)
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
int rs2_device_list_contains(const rs2_device_list *info_list, const rs2_device *device, rs2_error **error)
bool is_loopback_enabled() const
const device_list & _list
int rs2_loopback_is_enabled(const rs2_device *device, rs2_error **error)
::realsense_legacy_msgs::extrinsics_< std::allocator< void > > extrinsics
device_list(std::shared_ptr< rs2_device_list > list)
std::vector< sensor > query_sensors() const
auto_calibrated_device(device d)
const std::shared_ptr< rs2_device > & get() const
device & operator=(const device &dev)
void rs2_register_calibration_change_callback_cpp(rs2_device *dev, rs2_calibration_change_callback *callback, rs2_error **error)
void rs2_trigger_device_calibration(rs2_device *dev, rs2_calibration_type type, rs2_error **error)
const rs2_raw_data_buffer * rs2_get_calibration_table(const rs2_device *dev, rs2_error **error)
void rs2_set_intrinsics(const rs2_sensor *sensor, const rs2_stream_profile *profile, const rs2_intrinsics *intrinsics, rs2_error **error)
rs2_sensor * rs2_create_sensor(const rs2_sensor_list *list, int index, rs2_error **error)
calibrated_device(device d)
device operator[](uint32_t index) const
void set_calibration_table(const calibration_table &calibration)
void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics &intrinsics)
void rs2_delete_device(rs2_device *device)
void connect_controller(const std::array< uint8_t, 6 > &mac_addr)
const unsigned char * rs2_get_raw_data(const rs2_raw_data_buffer *buffer, rs2_error **error)
void rs2_write_calibration(const rs2_device *device, rs2_error **e)
void disconnect_controller(int id)
rs2_device * rs2_create_device(const rs2_device_list *info_list, int index, rs2_error **error)
device_list & operator=(std::shared_ptr< rs2_device_list > list)
const rs2_device_list * get_list() const
void update(const std::vector< uint8_t > &fw_image, T callback) const
void update_unsigned(const std::vector< uint8_t > &image, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
calibration_change_device(device d)
calibration_table run_on_chip_calibration(std::string json_content, float *health, T callback, int timeout_ms=5000) const
GLsizei const GLchar *const * string
void rs2_delete_raw_data(const rs2_raw_data_buffer *buffer)
std::vector< uint8_t > create_flash_backup(T callback) const
void update_unsigned(const std::vector< uint8_t > &image, T callback, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
void reset_to_factory_calibration()
GLenum GLenum GLsizei void * image
status
Defines return codes that SDK interfaces use. Negative values indicate errors, a zero value indicates...
int rs2_get_raw_data_size(const rs2_raw_data_buffer *buffer, rs2_error **error)
GLenum GLuint GLenum GLsizei const GLchar * buf
device_calibration(device d)
void rs2_connect_tm2_controller(const rs2_device *device, const unsigned char *mac_addr, rs2_error **error)
def info(name, value, persistent=False)
void rs2_loopback_enable(const rs2_device *device, const char *from_file, rs2_error **error)
std::vector< uint8_t > calibration_table
void rs2_disconnect_tm2_controller(const rs2_device *device, int id, rs2_error **error)
void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic &motion_intriniscs)
void update(const std::vector< uint8_t > &fw_image) const
std::pair< sensor, stream_profile > get_sensor_profile(rs2_stream stream_type, int stream_index)
int rs2_supports_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
#define RS2_UNSIGNED_UPDATE_MODE_UPDATE
void rs2_delete_sensor(rs2_sensor *sensor)
int rs2_is_device_extendable_to(const rs2_device *device, rs2_extension extension, rs2_error **error)
void trigger_device_calibration(rs2_calibration_type type)
void rs2_set_extrinsics(const rs2_sensor *from_sensor, const rs2_stream_profile *from_profile, rs2_sensor *to_sensor, const rs2_stream_profile *to_profile, const rs2_extrinsics *extrinsics, rs2_error **error)
const char * get_info(rs2_camera_info info) const
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, int timeout_ms=5000) const
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, T callback, int timeout_ms=5000) const
std::shared_ptr< rs2_device > _dev
void rs2_hardware_reset(const rs2_device *device, rs2_error **error)
rs2_sensor_list * rs2_query_sensors(const rs2_device *device, rs2_error **error)
std::vector< uint8_t > send_and_receive_raw_data(const std::vector< uint8_t > &input) const
void rs2_update_firmware_cpp(const rs2_device *device, const void *fw_image, int fw_image_size, rs2_update_progress_callback *callback, rs2_error **error)
calibration_table get_calibration_table()
bool operator==(const device_list_iterator &other) const
void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics &extrinsics)
static void handle(rs2_error *e)
rs2_stream
Streams are different types of data provided by RealSense devices.
bool supports(rs2_camera_info info) const
void rs2_reset_to_factory_calibration(const rs2_device *device, rs2_error **e)
void rs2_set_motion_device_intrinsics(const rs2_sensor *sensor, const rs2_stream_profile *profile, const rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
calibration_change_callback(callback cb)
void write_calibration() const
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
const rs2_raw_data_buffer * rs2_create_flash_backup_cpp(const rs2_device *device, rs2_update_progress_callback *callback, rs2_error **error)
const rs2_raw_data_buffer * rs2_send_and_receive_raw_data(rs2_device *device, void *raw_data_to_send, unsigned size_of_raw_data_to_send, rs2_error **error)
std::vector< uint8_t > create_flash_backup() const
update_progress_callback(T callback)
device & operator=(const std::shared_ptr< rs2_device > dev)
GLenum GLenum GLenum input
device_list_iterator end() const
device_list_iterator & operator++()
void rs2_enter_update_state(const rs2_device *device, rs2_error **error)
bool operator!=(const device_list_iterator &other) const
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
device_list_iterator(const device_list &device_list, uint32_t uint32_t)
void rs2_update_firmware_unsigned_cpp(const rs2_device *device, const void *fw_image, int fw_image_size, rs2_update_progress_callback *callback, int update_mode, rs2_error **error)
Motion device intrinsics: scale, bias, and variances.
void rs2_delete_sensor_list(rs2_sensor_list *info_list)
void enable_loopback(const std::string &from_file)
void on_update_progress(const float progress) override
device_list_iterator begin() const
void enter_update_state() const
void register_calibration_change_callback(T callback)
void rs2_loopback_disable(const rs2_device *device, rs2_error **error)
int rs2_get_device_count(const rs2_device_list *info_list, rs2_error **error)
const rs2_raw_data_buffer * rs2_run_on_chip_calibration_cpp(rs2_device *device, const void *json_content, int content_size, float *health, rs2_update_progress_callback *progress_callback, int timeout_ms, rs2_error **error)
calibration_table run_on_chip_calibration(std::string json_content, float *health, int timeout_ms=5000) const
const rs2_raw_data_buffer * rs2_run_tare_calibration_cpp(rs2_device *dev, float ground_truth_mm, const void *json_content, int content_size, rs2_update_progress_callback *progress_callback, int timeout_ms, rs2_error **error)
void on_calibration_change(rs2_calibration_status status) noexceptoverride
bool contains(const device &dev) const
device(std::shared_ptr< rs2_device > dev)
const char * rs2_get_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)