Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
rs_device.hpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 
4 #ifndef LIBREALSENSE_RS2_DEVICE_HPP
5 #define LIBREALSENSE_RS2_DEVICE_HPP
6 
7 #include "rs_types.hpp"
8 #include "rs_sensor.hpp"
9 #include <array>
10 
11 namespace rs2
12 {
13  class context;
14  class device_list;
15  class pipeline_profile;
16  class device_hub;
17 
18  class device
19  {
20  public:
25  std::vector<sensor> query_sensors() const
26  {
27  rs2_error* e = nullptr;
28  std::shared_ptr<rs2_sensor_list> list(
29  rs2_query_sensors(_dev.get(), &e),
31  error::handle(e);
32 
33  auto size = rs2_get_sensors_count(list.get(), &e);
34  error::handle(e);
35 
36  std::vector<sensor> results;
37  for (auto i = 0; i < size; i++)
38  {
39  std::shared_ptr<rs2_sensor> dev(
40  rs2_create_sensor(list.get(), i, &e),
42  error::handle(e);
43 
44  sensor rs2_dev(dev);
45  results.push_back(rs2_dev);
46  }
47 
48  return results;
49  }
50 
51  template<class T>
52  T first() const
53  {
54  for (auto&& s : query_sensors())
55  {
56  if (auto t = s.as<T>()) return t;
57  }
58  throw rs2::error("Could not find requested sensor type!");
59  }
60 
66  bool supports(rs2_camera_info info) const
67  {
68  rs2_error* e = nullptr;
69  auto is_supported = rs2_supports_device_info(_dev.get(), info, &e);
70  error::handle(e);
71  return is_supported > 0;
72  }
73 
79  const char* get_info(rs2_camera_info info) const
80  {
81  rs2_error* e = nullptr;
82  auto result = rs2_get_device_info(_dev.get(), info, &e);
83  error::handle(e);
84  return result;
85  }
86 
91  {
92  rs2_error* e = nullptr;
93 
94  rs2_hardware_reset(_dev.get(), &e);
95  error::handle(e);
96  }
97 
98  device& operator=(const std::shared_ptr<rs2_device> dev)
99  {
100  _dev.reset();
101  _dev = dev;
102  return *this;
103  }
104  device& operator=(const device& dev)
105  {
106  *this = nullptr;
107  _dev = dev._dev;
108  return *this;
109  }
110  device() : _dev(nullptr) {}
111 
112  operator bool() const
113  {
114  return _dev != nullptr;
115  }
116  const std::shared_ptr<rs2_device>& get() const
117  {
118  return _dev;
119  }
120 
121  template<class T>
122  bool is() const
123  {
124  T extension(*this);
125  return extension;
126  }
127 
128  template<class T>
129  T as() const
130  {
131  T extension(*this);
132  return extension;
133  }
134  virtual ~device()
135  {
136  }
137 
138  explicit operator std::shared_ptr<rs2_device>() { return _dev; };
139  explicit device(std::shared_ptr<rs2_device> dev) : _dev(dev) {}
140  protected:
141  friend class rs2::context;
142  friend class rs2::device_list;
143  friend class rs2::pipeline_profile;
144  friend class rs2::device_hub;
145 
146  std::shared_ptr<rs2_device> _dev;
147 
148  };
149 
150  template<class T>
152  {
153  T _callback;
154 
155  public:
156  explicit update_progress_callback(T callback) : _callback(callback) {}
157 
158  void on_update_progress(const float progress) override
159  {
160  _callback(progress);
161  }
162 
163  void release() override { delete this; }
164  };
165 
166  class updatable : public device
167  {
168  public:
169  updatable() : device() {}
171  : device(d.get())
172  {
173  rs2_error* e = nullptr;
174  if (rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_UPDATABLE, &e) == 0 && !e)
175  {
176  _dev.reset();
177  }
178  error::handle(e);
179  }
180 
181  // Move the device to update state, this will cause the updatable device to disconnect and reconnect as an update device.
182  void enter_update_state() const
183  {
184  rs2_error* e = nullptr;
185  rs2_enter_update_state(_dev.get(), &e);
186  error::handle(e);
187  }
188 
189  // Create backup of camera flash memory. Such backup does not constitute valid firmware image, and cannot be
190  // loaded back to the device, but it does contain all calibration and device information."
191  std::vector<uint8_t> create_flash_backup() const
192  {
193  std::vector<uint8_t> results;
194 
195  rs2_error* e = nullptr;
196  std::shared_ptr<const rs2_raw_data_buffer> list(
197  rs2_create_flash_backup_cpp(_dev.get(), nullptr, &e),
199  error::handle(e);
200 
201  auto size = rs2_get_raw_data_size(list.get(), &e);
202  error::handle(e);
203 
204  auto start = rs2_get_raw_data(list.get(), &e);
205 
206  results.insert(results.begin(), start, start + size);
207 
208  return results;
209  }
210 
211  template<class T>
212  std::vector<uint8_t> create_flash_backup(T callback) const
213  {
214  std::vector<uint8_t> results;
215 
216  rs2_error* e = nullptr;
217  std::shared_ptr<const rs2_raw_data_buffer> list(
218  rs2_create_flash_backup_cpp(_dev.get(), new update_progress_callback<T>(std::move(callback)), &e),
220  error::handle(e);
221 
222  auto size = rs2_get_raw_data_size(list.get(), &e);
223  error::handle(e);
224 
225  auto start = rs2_get_raw_data(list.get(), &e);
226 
227  results.insert(results.begin(), start, start + size);
228 
229 return results;
230  }
231 
232  // Update an updatable device to the provided unsigned firmware. This call is executed on the caller's thread.
233  void update_unsigned(const std::vector<uint8_t>& image, int update_mode = RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
234  {
235  rs2_error* e = nullptr;
236  rs2_update_firmware_unsigned_cpp(_dev.get(), image.data(), (int)image.size(), nullptr, update_mode, &e);
237  error::handle(e);
238  }
239 
240  // Update an updatable device to the provided unsigned firmware. This call is executed on the caller's thread and it supports progress notifications via the callback.
241  template<class T>
242  void update_unsigned(const std::vector<uint8_t>& image, T callback, int update_mode = RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
243  {
244  rs2_error* e = nullptr;
245  rs2_update_firmware_unsigned_cpp(_dev.get(), image.data(), image.size(), new update_progress_callback<T>(std::move(callback)), update_mode, &e);
246  error::handle(e);
247  }
248  };
249 
250  class update_device : public device
251  {
252  public:
255  : device(d.get())
256  {
257  rs2_error* e = nullptr;
259  {
260  _dev.reset();
261  }
262  error::handle(e);
263  }
264 
265  // Update an updatable device to the provided firmware.
266  // This call is executed on the caller's thread.
267  void update(const std::vector<uint8_t>& fw_image) const
268  {
269  rs2_error* e = nullptr;
270  rs2_update_firmware_cpp(_dev.get(), fw_image.data(), (int)fw_image.size(), NULL, &e);
271  error::handle(e);
272  }
273 
274  // Update an updatable device to the provided firmware.
275  // This call is executed on the caller's thread and it supports progress notifications via the callback.
276  template<class T>
277  void update(const std::vector<uint8_t>& fw_image, T callback) const
278  {
279  rs2_error* e = nullptr;
280  rs2_update_firmware_cpp(_dev.get(), fw_image.data(), fw_image.size(), new update_progress_callback<T>(std::move(callback)), &e);
281  error::handle(e);
282  }
283  };
284 
285  typedef std::vector<uint8_t> calibration_table;
286 
287  class calibrated_device : public device
288  {
289  public:
291  : device(d.get())
292  {}
293 
297  void write_calibration() const
298  {
299  rs2_error* e = nullptr;
300  rs2_write_calibration(_dev.get(), &e);
301  error::handle(e);
302  }
303 
308  {
309  rs2_error* e = nullptr;
311  error::handle(e);
312  }
313  };
314 
316  {
317  public:
319  : calibrated_device(d)
320  {
321  rs2_error* e = nullptr;
323  {
324  _dev.reset();
325  }
326  error::handle(e);
327  }
328 
349  template<class T>
350  calibration_table run_on_chip_calibration(std::string json_content, float* health, T callback, int timeout_ms = 5000) const
351  {
352  std::vector<uint8_t> results;
353 
354  rs2_error* e = nullptr;
355  std::shared_ptr<const rs2_raw_data_buffer> list(
356  rs2_run_on_chip_calibration_cpp(_dev.get(), json_content.data(), json_content.size(), health, new update_progress_callback<T>(std::move(callback)), timeout_ms, &e),
358  error::handle(e);
359 
360  auto size = rs2_get_raw_data_size(list.get(), &e);
361  error::handle(e);
362 
363  auto start = rs2_get_raw_data(list.get(), &e);
364 
365  results.insert(results.begin(), start, start + size);
366 
367  return results;
368  }
369 
389  calibration_table run_on_chip_calibration(std::string json_content, float* health, int timeout_ms = 5000) const
390  {
391  std::vector<uint8_t> results;
392 
393  rs2_error* e = nullptr;
394  std::shared_ptr<const rs2_raw_data_buffer> list(
395  rs2_run_on_chip_calibration_cpp(_dev.get(), json_content.data(), static_cast< int >( json_content.size() ), health, nullptr, timeout_ms, &e),
397  error::handle(e);
398  auto size = rs2_get_raw_data_size(list.get(), &e);
399  error::handle(e);
400 
401  auto start = rs2_get_raw_data(list.get(), &e);
402 
403  results.insert(results.begin(), start, start + size);
404 
405  return results;
406  }
407 
430  template<class T>
431  calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, T callback, int timeout_ms = 5000) const
432  {
433  std::vector<uint8_t> results;
434 
435  rs2_error* e = nullptr;
436  std::shared_ptr<const rs2_raw_data_buffer> list(
437  rs2_run_tare_calibration_cpp(_dev.get(), ground_truth_mm, json_content.data(), json_content.size(), new update_progress_callback<T>(std::move(callback)), timeout_ms, &e),
439  error::handle(e);
440 
441  auto size = rs2_get_raw_data_size(list.get(), &e);
442  error::handle(e);
443 
444  auto start = rs2_get_raw_data(list.get(), &e);
445 
446  results.insert(results.begin(), start, start + size);
447 
448  return results;
449  }
450 
472  calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, int timeout_ms = 5000) const
473  {
474  std::vector<uint8_t> results;
475 
476  rs2_error* e = nullptr;
477  std::shared_ptr<const rs2_raw_data_buffer> list(
478  rs2_run_tare_calibration_cpp(_dev.get(), ground_truth_mm, json_content.data(), static_cast< int >( json_content.size() ), nullptr, timeout_ms, &e),
480  error::handle(e);
481 
482  auto size = rs2_get_raw_data_size(list.get(), &e);
483  error::handle(e);
484 
485  auto start = rs2_get_raw_data(list.get(), &e);
486 
487  results.insert(results.begin(), start, start + size);
488 
489  return results;
490  }
491 
497  {
498  std::vector<uint8_t> results;
499 
500  rs2_error* e = nullptr;
501  std::shared_ptr<const rs2_raw_data_buffer> list(
502  rs2_get_calibration_table(_dev.get(), &e),
504  error::handle(e);
505 
506  auto size = rs2_get_raw_data_size(list.get(), &e);
507  error::handle(e);
508 
509  auto start = rs2_get_raw_data(list.get(), &e);
510 
511  results.insert(results.begin(), start, start + size);
512 
513  return results;
514  }
515 
520  void set_calibration_table(const calibration_table& calibration)
521  {
522  rs2_error* e = nullptr;
523  rs2_set_calibration_table(_dev.get(), calibration.data(), static_cast< int >( calibration.size() ), &e);
524  error::handle(e);
525  }
526 
527 
528  };
529 
530  class debug_protocol : public device
531  {
532  public:
534  : device(d.get())
535  {
536  rs2_error* e = nullptr;
537  if(rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_DEBUG, &e) == 0 && !e)
538  {
539  _dev.reset();
540  }
541  error::handle(e);
542  }
543 
544  std::vector<uint8_t> send_and_receive_raw_data(const std::vector<uint8_t>& input) const
545  {
546  std::vector<uint8_t> results;
547 
548  rs2_error* e = nullptr;
549  std::shared_ptr<const rs2_raw_data_buffer> list(
550  rs2_send_and_receive_raw_data(_dev.get(), (void*)input.data(), (uint32_t)input.size(), &e),
552  error::handle(e);
553 
554  auto size = rs2_get_raw_data_size(list.get(), &e);
555  error::handle(e);
556 
557  auto start = rs2_get_raw_data(list.get(), &e);
558 
559  results.insert(results.begin(), start, start + size);
560 
561  return results;
562  }
563  };
564 
566  {
567  public:
568  explicit device_list(std::shared_ptr<rs2_device_list> list)
569  : _list(move(list)) {}
570 
572  : _list(nullptr) {}
573 
574  operator std::vector<device>() const
575  {
576  std::vector<device> res;
577  for (auto&& dev : *this) res.push_back(dev);
578  return res;
579  }
580 
581  bool contains(const device& dev) const
582  {
583  rs2_error* e = nullptr;
584  auto res = !!(rs2_device_list_contains(_list.get(), dev.get().get(), &e));
585  error::handle(e);
586  return res;
587  }
588 
589  device_list& operator=(std::shared_ptr<rs2_device_list> list)
590  {
591  _list = move(list);
592  return *this;
593  }
594 
595  device operator[](uint32_t index) const
596  {
597  rs2_error* e = nullptr;
598  std::shared_ptr<rs2_device> dev(
599  rs2_create_device(_list.get(), index, &e),
601  error::handle(e);
602 
603  return device(dev);
604  }
605 
606  uint32_t size() const
607  {
608  rs2_error* e = nullptr;
609  auto size = rs2_get_device_count(_list.get(), &e);
610  error::handle(e);
611  return size;
612  }
613 
614  device front() const { return std::move((*this)[0]); }
615  device back() const
616  {
617  return std::move((*this)[size() - 1]);
618  }
619 
621  {
623  const device_list& device_list,
624  uint32_t uint32_t)
625  : _list(device_list),
626  _index(uint32_t)
627  {
628  }
629 
630  public:
632  {
633  return _list[_index];
634  }
635  bool operator!=(const device_list_iterator& other) const
636  {
637  return other._index != _index || &other._list != &_list;
638  }
639  bool operator==(const device_list_iterator& other) const
640  {
641  return !(*this != other);
642  }
644  {
645  _index++;
646  return *this;
647  }
648  private:
649  friend device_list;
650  const device_list& _list;
651  uint32_t _index;
652  };
653 
655  {
656  return device_list_iterator(*this, 0);
657  }
659  {
660  return device_list_iterator(*this, size());
661  }
662  const rs2_device_list* get_list() const
663  {
664  return _list.get();
665  }
666 
667  operator std::shared_ptr<rs2_device_list>() { return _list; };
668 
669  private:
670  std::shared_ptr<rs2_device_list> _list;
671  };
672 
682  class tm2 : public calibrated_device // TODO: add to wrappers [Python done]
683  {
684  public:
686  : calibrated_device(d)
687  {
688  rs2_error* e = nullptr;
689  if (rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_TM2, &e) == 0 && !e)
690  {
691  _dev.reset();
692  }
693  error::handle(e);
694  }
695 
700  void enable_loopback(const std::string& from_file)
701  {
702  rs2_error* e = nullptr;
703  rs2_loopback_enable(_dev.get(), from_file.c_str(), &e);
704  error::handle(e);
705  }
706 
711  {
712  rs2_error* e = nullptr;
713  rs2_loopback_disable(_dev.get(), &e);
714  error::handle(e);
715  }
716 
721  bool is_loopback_enabled() const
722  {
723  rs2_error* e = nullptr;
724  int is_enabled = rs2_loopback_is_enabled(_dev.get(), &e);
725  error::handle(e);
726  return is_enabled != 0;
727  }
728 
733  void connect_controller(const std::array<uint8_t, 6>& mac_addr)
734  {
735  rs2_error* e = nullptr;
736  rs2_connect_tm2_controller(_dev.get(), mac_addr.data(), &e);
737  error::handle(e);
738  }
739 
745  {
746  rs2_error* e = nullptr;
747  rs2_disconnect_tm2_controller(_dev.get(), id, &e);
748  error::handle(e);
749  }
750 
756  void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics& intrinsics)
757  {
758  rs2_error* e = nullptr;
759  auto fisheye_sensor = get_sensor_profile(RS2_STREAM_FISHEYE, fisheye_sensor_id);
760  rs2_set_intrinsics(fisheye_sensor.first.get().get(), fisheye_sensor.second.get(), &intrinsics, &e);
761  error::handle(e);
762  }
763 
772  void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics& extrinsics)
773  {
774  rs2_error* e = nullptr;
775  auto from_sensor = get_sensor_profile(from_stream, from_id);
776  auto to_sensor = get_sensor_profile(to_stream, to_id);
777  rs2_set_extrinsics(from_sensor.first.get().get(), from_sensor.second.get(), to_sensor.first.get().get(), to_sensor.second.get(), &extrinsics, &e);
778  error::handle(e);
779  }
780 
786  void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic& motion_intriniscs)
787  {
788  rs2_error* e = nullptr;
789  auto motion_sensor = get_sensor_profile(stream_type, 0);
790  rs2_set_motion_device_intrinsics(motion_sensor.first.get().get(), motion_sensor.second.get(), &motion_intriniscs, &e);
791  error::handle(e);
792  }
793 
794  private:
795 
796  std::pair<sensor, stream_profile> get_sensor_profile(rs2_stream stream_type, int stream_index) {
797  for (auto s : query_sensors()) {
798  for (auto p : s.get_stream_profiles()) {
799  if (p.stream_type() == stream_type && p.stream_index() == stream_index)
800  return std::pair<sensor, stream_profile>(s, p);
801  }
802  }
803  return std::pair<sensor, stream_profile>();
804  }
805  };
806 }
807 #endif // LIBREALSENSE_RS2_DEVICE_HPP
Definition: rs_types.hpp:85
device operator*() const
Definition: rs_device.hpp:631
void rs2_set_calibration_table(const rs2_device *device, const void *calibration, int calibration_size, rs2_error **error)
device back() const
Definition: rs_device.hpp:615
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...
Definition: rs_sensor.h:22
Definition: rs_sensor.hpp:103
update_device()
Definition: rs_device.hpp:253
bool is() const
Definition: rs_device.hpp:122
int rs2_device_list_contains(const rs2_device_list *info_list, const rs2_device *device, rs2_error **error)
int rs2_loopback_is_enabled(const rs2_device *device, rs2_error **error)
device_list(std::shared_ptr< rs2_device_list > list)
Definition: rs_device.hpp:568
std::vector< uint8_t > send_and_receive_raw_data(const std::vector< uint8_t > &input) const
Definition: rs_device.hpp:544
std::vector< uint8_t > create_flash_backup() const
Definition: rs_device.hpp:191
void release() override
Definition: rs_device.hpp:163
std::vector< sensor > query_sensors() const
Definition: rs_device.hpp:25
auto_calibrated_device(device d)
Definition: rs_device.hpp:318
device()
Definition: rs_device.hpp:110
const char * get_info(rs2_camera_info info) const
Definition: rs_device.hpp:79
device & operator=(const device &dev)
Definition: rs_device.hpp:104
Definition: rs_pipeline.hpp:18
bool operator==(const device_list_iterator &other) const
Definition: rs_device.hpp:639
void update_unsigned(const std::vector< uint8_t > &image, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
Definition: rs_device.hpp:233
void update(const std::vector< uint8_t > &fw_image) const
Definition: rs_device.hpp:267
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)
Definition: rs_device.hpp:290
Definition: rs_sensor.hpp:407
void set_calibration_table(const calibration_table &calibration)
Definition: rs_device.hpp:520
void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics &intrinsics)
Definition: rs_device.hpp:756
void update_unsigned(const std::vector< uint8_t > &image, T callback, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
Definition: rs_device.hpp:242
void rs2_delete_device(rs2_device *device)
void connect_controller(const std::array< uint8_t, 6 > &mac_addr)
Definition: rs_device.hpp:733
Definition: rs_sensor.h:48
const unsigned char * rs2_get_raw_data(const rs2_raw_data_buffer *buffer, rs2_error **error)
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, int timeout_ms=5000) const
Definition: rs_device.hpp:472
void rs2_write_calibration(const rs2_device *device, rs2_error **e)
void disconnect_controller(int id)
Definition: rs_device.hpp:744
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)
Definition: rs_device.hpp:589
Definition: rs_device.hpp:151
Definition: rs_context.hpp:11
void rs2_delete_raw_data(const rs2_raw_data_buffer *buffer)
Definition: rs_context.hpp:96
void reset_to_factory_calibration()
Definition: rs_device.hpp:307
Definition: rs_sensor.hpp:391
int rs2_get_raw_data_size(const rs2_raw_data_buffer *buffer, rs2_error **error)
Definition: rs_device.hpp:166
T as() const
Definition: rs_device.hpp:129
void enter_update_state() const
Definition: rs_device.hpp:182
void rs2_connect_tm2_controller(const rs2_device *device, const unsigned char *mac_addr, rs2_error **error)
device_list_iterator begin() const
Definition: rs_device.hpp:654
void rs2_loopback_enable(const rs2_device *device, const char *from_file, rs2_error **error)
std::vector< uint8_t > calibration_table
Definition: rs_device.hpp:285
void rs2_disconnect_tm2_controller(const rs2_device *device, int id, rs2_error **error)
Definition: rs_device.hpp:530
void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic &motion_intriniscs)
Definition: rs_device.hpp:786
bool is_loopback_enabled() const
Definition: rs_device.hpp:721
device operator[](uint32_t index) const
Definition: rs_device.hpp:595
int rs2_supports_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
#define RS2_UNSIGNED_UPDATE_MODE_UPDATE
Definition: rs_device.h:206
void rs2_delete_sensor(rs2_sensor *sensor)
int rs2_is_device_extendable_to(const rs2_device *device, rs2_extension extension, rs2_error **error)
device front() const
Definition: rs_device.hpp:614
uint32_t size() const
Definition: rs_device.hpp:606
void hardware_reset()
Definition: rs_device.hpp:90
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 std::shared_ptr< rs2_device > & get() const
Definition: rs_device.hpp:116
void update(const std::vector< uint8_t > &fw_image, T callback) const
Definition: rs_device.hpp:277
std::shared_ptr< rs2_device > _dev
Definition: rs_device.hpp:146
std::vector< uint8_t > create_flash_backup(T callback) const
Definition: rs_device.hpp:212
void rs2_hardware_reset(const rs2_device *device, rs2_error **error)
Definition: rs_types.h:173
rs2_sensor_list * rs2_query_sensors(const rs2_device *device, rs2_error **error)
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()
Definition: rs_device.hpp:496
void write_calibration() const
Definition: rs_device.hpp:297
update_device(device d)
Definition: rs_device.hpp:254
void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics &extrinsics)
Definition: rs_device.hpp:772
static void handle(rs2_error *e)
Definition: rs_types.hpp:137
calibration_table run_on_chip_calibration(std::string json_content, float *health, T callback, int timeout_ms=5000) const
Definition: rs_device.hpp:350
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:42
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)
Definition: rs_types.h:158
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
Definition: rs_sensor.h:95
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, T callback, int timeout_ms=5000) const
Definition: rs_device.hpp:431
const rs2_raw_data_buffer * rs2_create_flash_backup_cpp(const rs2_device *device, rs2_update_progress_callback *callback, rs2_error **error)
bool contains(const device &dev) const
Definition: rs_device.hpp:581
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)
Definition: rs_types.h:177
Definition: rs_types.hpp:76
Definition: rs_types.h:137
bool supports(rs2_camera_info info) const
Definition: rs_device.hpp:66
update_progress_callback(T callback)
Definition: rs_device.hpp:156
device & operator=(const std::shared_ptr< rs2_device > dev)
Definition: rs_device.hpp:98
device_list_iterator & operator++()
Definition: rs_device.hpp:643
device_list()
Definition: rs_device.hpp:571
Definition: rs_device.hpp:315
updatable()
Definition: rs_device.hpp:169
Definition: rs_device.hpp:565
Definition: rs_device.hpp:287
updatable(device d)
Definition: rs_device.hpp:170
void rs2_enter_update_state(const rs2_device *device, rs2_error **error)
Definition: rs_context.hpp:224
bool operator!=(const device_list_iterator &other) const
Definition: rs_device.hpp:635
Video stream intrinsics.
Definition: rs_types.h:58
Definition: rs_types.h:174
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.
Definition: rs_types.h:71
void rs2_delete_sensor_list(rs2_sensor_list *info_list)
void enable_loopback(const std::string &from_file)
Definition: rs_device.hpp:700
void on_update_progress(const float progress) override
Definition: rs_device.hpp:158
struct rs2_device_list rs2_device_list
Definition: rs_types.h:225
debug_protocol(device d)
Definition: rs_device.hpp:533
void disable_loopback()
Definition: rs_device.hpp:710
tm2(device d)
Definition: rs_device.hpp:685
device_list_iterator end() const
Definition: rs_device.hpp:658
Definition: rs_device.hpp:682
const std::shared_ptr< rs2_sensor > & get() const
Definition: rs_sensor.hpp:322
struct rs2_error rs2_error
Definition: rs_types.h:217
Definition: rs_device.hpp:620
void rs2_loopback_disable(const rs2_device *device, rs2_error **error)
Definition: rs_device.hpp:18
int rs2_get_device_count(const rs2_device_list *info_list, rs2_error **error)
Definition: rs_device.hpp:250
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)
const rs2_device_list * get_list() const
Definition: rs_device.hpp:662
T first() const
Definition: rs_device.hpp:52
virtual ~device()
Definition: rs_device.hpp:134
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)
calibration_table run_on_chip_calibration(std::string json_content, float *health, int timeout_ms=5000) const
Definition: rs_device.hpp:389
device(std::shared_ptr< rs2_device > dev)
Definition: rs_device.hpp:139
const char * rs2_get_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)