Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
android
device_watcher.cpp
Go to the documentation of this file.
1
// License: Apache 2.0. See LICENSE file in root directory.
2
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3
#include "
device_watcher.h
"
4
#include <vector>
5
#include <sstream>
6
#include <jni.h>
7
#include "../usb/usb-device.h"
8
#include "../usbhost/device-usbhost.h"
9
#include "../backend.h"
10
#include "../usb/usb-enumerator.h"
11
#include "../hid/hid-device.h"
12
#include "../uvc/uvc-device.h"
13
14
using namespace
std
;
15
using namespace
librealsense
;
16
using namespace
librealsense::platform
;
17
18
std::shared_ptr<device_watcher_usbhost> device_watcher_usbhost::instance()
19
{
20
static
std::shared_ptr<device_watcher_usbhost> instance = std::make_shared<device_watcher_usbhost>();
21
return
instance;
22
}
23
24
void
device_watcher_usbhost::notify()
25
{
26
backend_device_group
curr;
27
backend_device_group
prev;
28
librealsense::platform::device_changed_callback
callback
;
29
30
curr.
uvc_devices
=
query_uvc_devices_info
();
31
curr.
hid_devices
=
query_hid_devices_info
();
32
33
{
34
std::lock_guard<std::mutex> lk(_mutex);
35
prev = _prev_group;
36
_prev_group = curr;
37
callback = _callback;
38
}
39
40
if
(callback)
41
callback
(prev, curr);
42
}
43
44
void
device_watcher_usbhost::start
(
librealsense::platform::device_changed_callback
callback
)
45
{
46
std::lock_guard<std::mutex> lk(_mutex);
47
_callback =
callback
;
48
}
49
50
void
device_watcher_usbhost::stop
()
51
{
52
std::lock_guard<std::mutex> lk(_mutex);
53
_callback =
nullptr
;
54
}
librealsense::platform::backend_device_group
Definition:
backend.h:510
librealsense::platform::query_uvc_devices_info
std::vector< uvc_device_info > query_uvc_devices_info()
Definition:
uvc-device.cpp:40
device_watcher.h
std
Definition:
android_helpers.h:13
rs2::textual_icons::stop
static const textual_icon stop
Definition:
model-views.h:225
librealsense
Definition:
calibration-model.h:6
librealsense::platform::backend_device_group::hid_devices
std::vector< hid_device_info > hid_devices
Definition:
backend.h:527
librealsense::platform::query_hid_devices_info
std::vector< hid_device_info > query_hid_devices_info()
Definition:
hid-device.cpp:13
librealsense::platform::device_changed_callback
std::function< void(backend_device_group old, backend_device_group curr)> device_changed_callback
Definition:
backend.h:574
t265_stereo.callback
def callback(frame)
Definition:
t265_stereo.py:91
start
GLuint start
Definition:
glad/glad/glad.h:2396
librealsense::platform
Definition:
device_watcher.h:13
librealsense::platform::backend_device_group::uvc_devices
std::vector< uvc_device_info > uvc_devices
Definition:
backend.h:525
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:47:12