Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Public Member Functions | List of all members
librealsense::device_hub Class Reference

#include <device_hub.h>

Public Member Functions

 device_hub (std::shared_ptr< librealsense::context > ctx, int vid=0, bool register_device_notifications=true)
 
std::shared_ptr< device_interfacewait_for_device (const std::chrono::milliseconds &timeout=std::chrono::milliseconds(std::chrono::hours(1)), bool loop_through_devices=true, const std::string &serial="")
 
bool is_connected (const device_interface &dev)
 
 ~device_hub ()
 

Detailed Description

device_hub class - encapsulate the handling of connect and disconnect events

Constructor & Destructor Documentation

§ device_hub()

librealsense::device_hub::device_hub ( std::shared_ptr< librealsense::context ctx,
int  vid = 0,
bool  register_device_notifications = true 
)
explicit

§ ~device_hub()

librealsense::device_hub::~device_hub ( )
inline

Member Function Documentation

§ is_connected()

bool librealsense::device_hub::is_connected ( const device_interface dev)

Checks if device is still connected

§ wait_for_device()

std::shared_ptr<device_interface> librealsense::device_hub::wait_for_device ( const std::chrono::milliseconds &  timeout = std::chrono::milliseconds(std::chrono::hours(1)),
bool  loop_through_devices = true,
const std::string &  serial = "" 
)

The function implements both blocking and non-blocking device generation functionality based on the input parameters: Calling the function with zero timeout results in searching and fetching the device specified by the serial parameter from a list of connected devices. Calling the function with a valid timeout will block till the resulted device is found or the timeout expires.

Parameters
[in]timeout_msThe waiting period for the requested device to be reconnected (milliseconds). Due to an implementation issue both in MSVC and GCC the timeout equals to 1 hour to avoid generation of negative durations. .
[in]loop_through_devices- promote internal index to the next available device that will be retrieved on successive call Note that selection of the next device is deterministic but not predictable, and therefore is recommended for specific use-cases only , such as tutorials or unit-tests where no assumptions as to the device ordering are made.
[in]serialThe serial number of the requested device. Use empty pattern ("") to request for "any RealSense" device.
Returns
a shared pointer to the device_interface that satisfies the search criteria. In case the request was not resloved the call will throw an exception

The documentation for this class was generated from the following file: