Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
device_hub.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "context.h"
7 #include "device.h"
8 #include <limits>
9 
10 namespace librealsense
11 {
15  class device_hub
16  {
17  public:
18  explicit device_hub(std::shared_ptr<librealsense::context> ctx, int vid = 0, bool register_device_notifications = true);
19 
35  std::shared_ptr<device_interface> wait_for_device(const std::chrono::milliseconds& timeout = std::chrono::milliseconds(std::chrono::hours(1)),
36  bool loop_through_devices = true,
37  const std::string& serial = "");
38 
42  bool is_connected(const device_interface& dev);
43 
45  {
46  _ctx->stop();
47  }
48 
49  private:
50  std::shared_ptr<device_interface> create_device(const std::string& serial, bool cycle_devices = true);
51  std::shared_ptr<librealsense::context> _ctx;
52  std::mutex _mutex;
53  std::condition_variable _cv;
54  std::vector<std::shared_ptr<device_info>> _device_list;
55  int _camera_index = 0;
56  int _vid = 0;
57  bool _register_device_notifications;
58  };
59 }
bool is_connected(const device_interface &dev)
~device_hub()
Definition: device_hub.h:44
Definition: device_hub.h:15
std::shared_ptr< device_interface > wait_for_device(const std::chrono::milliseconds &timeout=std::chrono::milliseconds(std::chrono::hours(1)), bool loop_through_devices=true, const std::string &serial="")
Definition: streaming.h:131
Definition: algo.h:16
device_hub(std::shared_ptr< librealsense::context > ctx, int vid=0, bool register_device_notifications=true)