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(), int(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(), int(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(), int(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(), int(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  Wrapper around any callback function that is given to calibration_change_callback.
530  */
531  template< class callback >
533  {
534  //using callback = std::function< void( rs2_calibration_status ) >;
535  callback _callback;
536  public:
537  calibration_change_callback( callback cb ) : _callback( cb ) {}
538 
539  void on_calibration_change( rs2_calibration_status status ) noexcept override
540  {
541  _callback( status );
542  }
543  void release() override { delete this; }
544  };
545 
546  class device_calibration : public device
547  {
548  public:
550  : device( d.get() )
551  {
552  rs2_error* e = nullptr;
554  {
555  _dev.reset();
556  }
557  error::handle( e );
558  }
559 
560  /*
561  Your callback should look like this, for example:
562  sensor.register_calibration_change_callback(
563  []( rs2_calibration_status ) noexcept
564  {
565  ...
566  })
567  */
568  template< typename T >
570  {
571  // We wrap the callback with an interface and pass it to librealsense, who will
572  // now manage its lifetime. Rather than deleting it, though, it will call its
573  // release() function, where (back in our context) it can be safely deleted:
574  rs2_error* e = nullptr;
576  _dev.get(),
577  new calibration_change_callback< T >( std::move( callback )),
578  &e );
579  error::handle( e );
580  }
581 
586  {
587  rs2_error* e = nullptr;
588  rs2_trigger_device_calibration( _dev.get(), type, &e );
589  error::handle( e );
590  }
591  };
592 
593  class debug_protocol : public device
594  {
595  public:
597  : device(d.get())
598  {
599  rs2_error* e = nullptr;
600  if(rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_DEBUG, &e) == 0 && !e)
601  {
602  _dev.reset();
603  }
604  error::handle(e);
605  }
606 
607  std::vector<uint8_t> send_and_receive_raw_data(const std::vector<uint8_t>& input) const
608  {
609  std::vector<uint8_t> results;
610 
611  rs2_error* e = nullptr;
612  std::shared_ptr<const rs2_raw_data_buffer> list(
613  rs2_send_and_receive_raw_data(_dev.get(), (void*)input.data(), (uint32_t)input.size(), &e),
615  error::handle(e);
616 
617  auto size = rs2_get_raw_data_size(list.get(), &e);
618  error::handle(e);
619 
620  auto start = rs2_get_raw_data(list.get(), &e);
621 
622  results.insert(results.begin(), start, start + size);
623 
624  return results;
625  }
626  };
627 
629  {
630  public:
631  explicit device_list(std::shared_ptr<rs2_device_list> list)
632  : _list(move(list)) {}
633 
635  : _list(nullptr) {}
636 
637  operator std::vector<device>() const
638  {
639  std::vector<device> res;
640  for (auto&& dev : *this) res.push_back(dev);
641  return res;
642  }
643 
644  bool contains(const device& dev) const
645  {
646  rs2_error* e = nullptr;
647  auto res = !!(rs2_device_list_contains(_list.get(), dev.get().get(), &e));
648  error::handle(e);
649  return res;
650  }
651 
652  device_list& operator=(std::shared_ptr<rs2_device_list> list)
653  {
654  _list = move(list);
655  return *this;
656  }
657 
658  device operator[](uint32_t index) const
659  {
660  rs2_error* e = nullptr;
661  std::shared_ptr<rs2_device> dev(
662  rs2_create_device(_list.get(), index, &e),
664  error::handle(e);
665 
666  return device(dev);
667  }
668 
669  uint32_t size() const
670  {
671  rs2_error* e = nullptr;
672  auto size = rs2_get_device_count(_list.get(), &e);
673  error::handle(e);
674  return size;
675  }
676 
677  device front() const { return std::move((*this)[0]); }
678  device back() const
679  {
680  return std::move((*this)[size() - 1]);
681  }
682 
684  {
686  const device_list& device_list,
687  uint32_t uint32_t)
688  : _list(device_list),
689  _index(uint32_t)
690  {
691  }
692 
693  public:
695  {
696  return _list[_index];
697  }
698  bool operator!=(const device_list_iterator& other) const
699  {
700  return other._index != _index || &other._list != &_list;
701  }
702  bool operator==(const device_list_iterator& other) const
703  {
704  return !(*this != other);
705  }
707  {
708  _index++;
709  return *this;
710  }
711  private:
712  friend device_list;
713  const device_list& _list;
714  uint32_t _index;
715  };
716 
718  {
719  return device_list_iterator(*this, 0);
720  }
722  {
723  return device_list_iterator(*this, size());
724  }
725  const rs2_device_list* get_list() const
726  {
727  return _list.get();
728  }
729 
730  operator std::shared_ptr<rs2_device_list>() { return _list; };
731 
732  private:
733  std::shared_ptr<rs2_device_list> _list;
734  };
735 
745  class tm2 : public calibrated_device // TODO: add to wrappers [Python done]
746  {
747  public:
749  : calibrated_device(d)
750  {
751  rs2_error* e = nullptr;
752  if (rs2_is_device_extendable_to(_dev.get(), RS2_EXTENSION_TM2, &e) == 0 && !e)
753  {
754  _dev.reset();
755  }
756  error::handle(e);
757  }
758 
763  void enable_loopback(const std::string& from_file)
764  {
765  rs2_error* e = nullptr;
766  rs2_loopback_enable(_dev.get(), from_file.c_str(), &e);
767  error::handle(e);
768  }
769 
774  {
775  rs2_error* e = nullptr;
776  rs2_loopback_disable(_dev.get(), &e);
777  error::handle(e);
778  }
779 
784  bool is_loopback_enabled() const
785  {
786  rs2_error* e = nullptr;
787  int is_enabled = rs2_loopback_is_enabled(_dev.get(), &e);
788  error::handle(e);
789  return is_enabled != 0;
790  }
791 
796  void connect_controller(const std::array<uint8_t, 6>& mac_addr)
797  {
798  rs2_error* e = nullptr;
799  rs2_connect_tm2_controller(_dev.get(), mac_addr.data(), &e);
800  error::handle(e);
801  }
802 
808  {
809  rs2_error* e = nullptr;
810  rs2_disconnect_tm2_controller(_dev.get(), id, &e);
811  error::handle(e);
812  }
813 
819  void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics& intrinsics)
820  {
821  rs2_error* e = nullptr;
822  auto fisheye_sensor = get_sensor_profile(RS2_STREAM_FISHEYE, fisheye_sensor_id);
823  rs2_set_intrinsics(fisheye_sensor.first.get().get(), fisheye_sensor.second.get(), &intrinsics, &e);
824  error::handle(e);
825  }
826 
835  void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics& extrinsics)
836  {
837  rs2_error* e = nullptr;
838  auto from_sensor = get_sensor_profile(from_stream, from_id);
839  auto to_sensor = get_sensor_profile(to_stream, to_id);
840  rs2_set_extrinsics(from_sensor.first.get().get(), from_sensor.second.get(), to_sensor.first.get().get(), to_sensor.second.get(), &extrinsics, &e);
841  error::handle(e);
842  }
843 
849  void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic& motion_intriniscs)
850  {
851  rs2_error* e = nullptr;
852  auto motion_sensor = get_sensor_profile(stream_type, 0);
853  rs2_set_motion_device_intrinsics(motion_sensor.first.get().get(), motion_sensor.second.get(), &motion_intriniscs, &e);
854  error::handle(e);
855  }
856 
857  private:
858 
859  std::pair<sensor, stream_profile> get_sensor_profile(rs2_stream stream_type, int stream_index) {
860  for (auto s : query_sensors()) {
861  for (auto p : s.get_stream_profiles()) {
862  if (p.stream_type() == stream_type && p.stream_index() == stream_index)
863  return std::pair<sensor, stream_profile>(s, p);
864  }
865  }
866  return std::pair<sensor, stream_profile>();
867  }
868  };
869 }
870 #endif // LIBREALSENSE_RS2_DEVICE_HPP
Definition: rs_device.hpp:316
auto_calibrated_device(device d)
Definition: rs_device.hpp:318
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
calibration_table get_calibration_table()
Definition: rs_device.hpp:496
calibration_table run_on_chip_calibration(std::string json_content, float *health, int timeout_ms=5000) const
Definition: rs_device.hpp:389
void set_calibration_table(const calibration_table &calibration)
Definition: rs_device.hpp:520
calibration_table run_tare_calibration(float ground_truth_mm, std::string json_content, int timeout_ms=5000) const
Definition: rs_device.hpp:472
calibration_table run_on_chip_calibration(std::string json_content, float *health, T callback, int timeout_ms=5000) const
Definition: rs_device.hpp:350
Definition: rs_device.hpp:288
calibrated_device(device d)
Definition: rs_device.hpp:290
void write_calibration() const
Definition: rs_device.hpp:297
void reset_to_factory_calibration()
Definition: rs_device.hpp:307
Definition: rs_device.hpp:533
calibration_change_callback(callback cb)
Definition: rs_device.hpp:537
void on_calibration_change(rs2_calibration_status status) noexcept override
Definition: rs_device.hpp:539
void release() override
Definition: rs_device.hpp:543
Definition: rs_context.hpp:97
Definition: rs_device.hpp:594
debug_protocol(device d)
Definition: rs_device.hpp:596
std::vector< uint8_t > send_and_receive_raw_data(const std::vector< uint8_t > &input) const
Definition: rs_device.hpp:607
Definition: rs_device.hpp:547
void trigger_device_calibration(rs2_calibration_type type)
Definition: rs_device.hpp:585
device_calibration(device d)
Definition: rs_device.hpp:549
void register_calibration_change_callback(T callback)
Definition: rs_device.hpp:569
Definition: rs_context.hpp:225
Definition: rs_device.hpp:684
device operator*() const
Definition: rs_device.hpp:694
device_list_iterator & operator++()
Definition: rs_device.hpp:706
bool operator==(const device_list_iterator &other) const
Definition: rs_device.hpp:702
bool operator!=(const device_list_iterator &other) const
Definition: rs_device.hpp:698
Definition: rs_device.hpp:629
device_list(std::shared_ptr< rs2_device_list > list)
Definition: rs_device.hpp:631
device back() const
Definition: rs_device.hpp:678
const rs2_device_list * get_list() const
Definition: rs_device.hpp:725
device operator[](uint32_t index) const
Definition: rs_device.hpp:658
bool contains(const device &dev) const
Definition: rs_device.hpp:644
device_list & operator=(std::shared_ptr< rs2_device_list > list)
Definition: rs_device.hpp:652
uint32_t size() const
Definition: rs_device.hpp:669
device_list_iterator end() const
Definition: rs_device.hpp:721
device front() const
Definition: rs_device.hpp:677
device_list_iterator begin() const
Definition: rs_device.hpp:717
device_list()
Definition: rs_device.hpp:634
Definition: rs_device.hpp:19
device(std::shared_ptr< rs2_device > dev)
Definition: rs_device.hpp:139
virtual ~device()
Definition: rs_device.hpp:134
const char * get_info(rs2_camera_info info) const
Definition: rs_device.hpp:79
void hardware_reset()
Definition: rs_device.hpp:90
T as() const
Definition: rs_device.hpp:129
T first() const
Definition: rs_device.hpp:52
const std::shared_ptr< rs2_device > & get() const
Definition: rs_device.hpp:116
device & operator=(const device &dev)
Definition: rs_device.hpp:104
bool is() const
Definition: rs_device.hpp:122
std::shared_ptr< rs2_device > _dev
Definition: rs_device.hpp:146
device()
Definition: rs_device.hpp:110
std::vector< sensor > query_sensors() const
Definition: rs_device.hpp:25
device & operator=(const std::shared_ptr< rs2_device > dev)
Definition: rs_device.hpp:98
bool supports(rs2_camera_info info) const
Definition: rs_device.hpp:66
Definition: rs_types.hpp:93
static void handle(rs2_error *e)
Definition: rs_types.hpp:144
Definition: rs_sensor.hpp:406
Definition: rs_sensor.hpp:390
Definition: rs_pipeline.hpp:19
Definition: rs_sensor.hpp:103
const std::shared_ptr< rs2_sensor > & get() const
Definition: rs_sensor.hpp:320
Definition: rs_device.hpp:746
void disconnect_controller(int id)
Definition: rs_device.hpp:807
void set_motion_device_intrinsics(rs2_stream stream_type, const rs2_motion_device_intrinsic &motion_intriniscs)
Definition: rs_device.hpp:849
void connect_controller(const std::array< uint8_t, 6 > &mac_addr)
Definition: rs_device.hpp:796
void disable_loopback()
Definition: rs_device.hpp:773
bool is_loopback_enabled() const
Definition: rs_device.hpp:784
void enable_loopback(const std::string &from_file)
Definition: rs_device.hpp:763
void set_extrinsics(rs2_stream from_stream, int from_id, rs2_stream to_stream, int to_id, rs2_extrinsics &extrinsics)
Definition: rs_device.hpp:835
void set_intrinsics(int fisheye_sensor_id, const rs2_intrinsics &intrinsics)
Definition: rs_device.hpp:819
tm2(device d)
Definition: rs_device.hpp:748
Definition: rs_device.hpp:167
updatable()
Definition: rs_device.hpp:169
std::vector< uint8_t > create_flash_backup(T callback) const
Definition: rs_device.hpp:212
void enter_update_state() const
Definition: rs_device.hpp:182
void update_unsigned(const std::vector< uint8_t > &image, int update_mode=RS2_UNSIGNED_UPDATE_MODE_UPDATE) const
Definition: rs_device.hpp:233
updatable(device d)
Definition: rs_device.hpp:170
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
std::vector< uint8_t > create_flash_backup() const
Definition: rs_device.hpp:191
Definition: rs_device.hpp:251
update_device()
Definition: rs_device.hpp:253
update_device(device d)
Definition: rs_device.hpp:254
void update(const std::vector< uint8_t > &fw_image) const
Definition: rs_device.hpp:267
void update(const std::vector< uint8_t > &fw_image, T callback) const
Definition: rs_device.hpp:277
Definition: rs_device.hpp:152
void release() override
Definition: rs_device.hpp:163
update_progress_callback(T callback)
Definition: rs_device.hpp:156
void on_update_progress(const float progress) override
Definition: rs_device.hpp:158
Definition: rs_context.hpp:12
std::vector< uint8_t > calibration_table
Definition: rs_device.hpp:285
const unsigned char * rs2_get_raw_data(const rs2_raw_data_buffer *buffer, rs2_error **error)
int rs2_get_raw_data_size(const rs2_raw_data_buffer *buffer, rs2_error **error)
void rs2_delete_raw_data(const rs2_raw_data_buffer *buffer)
int rs2_get_device_count(const rs2_device_list *info_list, 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)
rs2_calibration_type
Definition: rs_device.h:319
void rs2_trigger_device_calibration(rs2_device *dev, rs2_calibration_type type, 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)
void rs2_reset_to_factory_calibration(const rs2_device *device, rs2_error **e)
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)
rs2_device * rs2_create_device(const rs2_device_list *info_list, int index, rs2_error **error)
#define RS2_UNSIGNED_UPDATE_MODE_UPDATE
Definition: rs_device.h:206
void rs2_set_calibration_table(const rs2_device *device, const void *calibration, int calibration_size, rs2_error **error)
void rs2_delete_device(rs2_device *device)
int rs2_is_device_extendable_to(const rs2_device *device, rs2_extension extension, rs2_error **error)
void rs2_write_calibration(const rs2_device *device, rs2_error **e)
void rs2_enter_update_state(const rs2_device *device, rs2_error **error)
void rs2_connect_tm2_controller(const rs2_device *device, const unsigned char *mac_addr, rs2_error **error)
const rs2_raw_data_buffer * rs2_get_calibration_table(const rs2_device *dev, rs2_error **error)
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)
int rs2_loopback_is_enabled(const rs2_device *device, rs2_error **error)
int rs2_supports_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
int rs2_device_list_contains(const rs2_device_list *info_list, const rs2_device *device, rs2_error **error)
void rs2_hardware_reset(const rs2_device *device, rs2_error **error)
void rs2_loopback_disable(const rs2_device *device, rs2_error **error)
void rs2_loopback_enable(const rs2_device *device, const char *from_file, rs2_error **error)
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 rs2_register_calibration_change_callback_cpp(rs2_device *dev, rs2_calibration_change_callback *callback, rs2_error **error)
rs2_calibration_status
Definition: rs_device.h:330
rs2_sensor_list * rs2_query_sensors(const rs2_device *device, rs2_error **error)
const char * rs2_get_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
const rs2_raw_data_buffer * rs2_create_flash_backup_cpp(const rs2_device *device, rs2_update_progress_callback *callback, rs2_error **error)
void rs2_disconnect_tm2_controller(const rs2_device *device, int id, rs2_error **error)
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:43
@ RS2_STREAM_FISHEYE
Definition: rs_sensor.h:48
rs2_sensor * rs2_create_sensor(const rs2_sensor_list *list, int index, rs2_error **error)
void rs2_delete_sensor_list(rs2_sensor_list *info_list)
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)
void rs2_delete_sensor(rs2_sensor *sensor)
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
void rs2_set_motion_device_intrinsics(const rs2_sensor *sensor, const rs2_stream_profile *profile, const rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
void rs2_set_intrinsics(const rs2_sensor *sensor, const rs2_stream_profile *profile, const rs2_intrinsics *intrinsics, rs2_error **error)
@ RS2_EXTENSION_DEBUG
Definition: rs_types.h:163
@ RS2_EXTENSION_UPDATABLE
Definition: rs_types.h:199
@ RS2_EXTENSION_AUTO_CALIBRATED_DEVICE
Definition: rs_types.h:203
@ RS2_EXTENSION_TM2
Definition: rs_types.h:184
@ RS2_EXTENSION_DEVICE_CALIBRATION
Definition: rs_types.h:211
@ RS2_EXTENSION_UPDATE_DEVICE
Definition: rs_types.h:200
struct rs2_device_list rs2_device_list
Definition: rs_types.h:258
struct rs2_error rs2_error
Definition: rs_types.h:250
Definition: rs_types.hpp:63
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
Definition: rs_sensor.h:96
Video stream intrinsics.
Definition: rs_types.h:59
Motion device intrinsics: scale, bias, and variances.
Definition: rs_types.h:98
Definition: rs_types.hpp:84