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 mask = RS2_PRODUCT_LINE_ANY, int vid = 0, bool register_device_notifications = true);
19 
20  ~device_hub();
21 
37  std::shared_ptr<device_interface> wait_for_device(const std::chrono::milliseconds& timeout = std::chrono::milliseconds(std::chrono::hours(1)),
38  bool loop_through_devices = true,
39  const std::string& serial = "");
40 
44  bool is_connected(const device_interface& dev);
45 
46  std::shared_ptr<librealsense::context> get_context();
47 
48  private:
49  std::shared_ptr<device_interface> create_device(const std::string& serial, bool cycle_devices = true);
50  std::shared_ptr<librealsense::context> _ctx;
51  std::mutex _mutex;
52  std::condition_variable _cv;
53  std::vector<std::shared_ptr<device_info>> _device_list;
54  int _camera_index = 0;
55  int _vid = 0;
58  };
59 }
device_hub(std::shared_ptr< librealsense::context > ctx, int mask=RS2_PRODUCT_LINE_ANY, int vid=0, bool register_device_notifications=true)
Definition: device_hub.cpp:43
bool is_connected(const device_interface &dev)
Definition: device_hub.cpp:153
GLint GLuint mask
GLsizei const GLchar *const * string
std::condition_variable _cv
Definition: device_hub.h:52
std::shared_ptr< device_interface > create_device(const std::string &serial, bool cycle_devices=true)
Definition: device_hub.cpp:76
unsigned __int64 uint64_t
Definition: stdint.h:90
std::shared_ptr< librealsense::context > _ctx
Definition: device_hub.h:50
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: device_hub.cpp:120
#define RS2_PRODUCT_LINE_ANY
Definition: rs_context.h:91
uint64_t _device_changes_callback_id
Definition: device_hub.h:56
GLbitfield GLuint64 timeout
std::vector< std::shared_ptr< device_info > > _device_list
Definition: device_hub.h:53
std::shared_ptr< librealsense::context > get_context()
Definition: device_hub.cpp:159


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:12