Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
tools
rs-server
RsDevice.cpp
Go to the documentation of this file.
1
// License: Apache 2.0. See LICENSE file in root directory.
2
// Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3
4
#include "
RsDevice.hh
"
5
#include "
RsUsageEnvironment.h
"
6
#include <iostream>
7
#include <thread>
8
9
int
RsDevice::getPhysicalSensorUniqueKey
(
rs2_stream
stream_type,
int
sensors_index)
10
{
11
return
stream_type * 10 + sensors_index;
12
}
13
14
RsDevice::RsDevice
(UsageEnvironment* t_env)
15
:
env
(t_env)
16
{
17
//get LRS device
18
// The context represents the current platform with respect to connected devices
19
20
bool
found =
false
;
21
bool
first
=
true
;
22
do
23
{
24
rs2::context
ctx
;
25
rs2::device_list
devices
= ctx.
query_devices
();
26
rs2::device
dev
;
27
if
(devices.
size
())
28
{
29
try
30
{
31
m_device
= devices[0];
// Only one device is supported
32
*
env
<<
"RealSense Device Connected\n"
;
33
34
found =
true
;
35
}
36
catch
(
const
std::exception&
e
)
37
{
38
std::cerr
<< e.what() <<
'\n'
;
39
}
40
}
41
if
(!found)
42
{
43
if
(first)
44
{
45
std::cerr
<<
"Waiting for Device..."
<< std::endl;
46
first =
false
;
47
}
48
std::this_thread::sleep_for(std::chrono::seconds(1));
49
}
50
}
while
(!found);
51
52
//get RS sensors
53
for
(
auto
&
sensor
:
m_device
.
query_sensors
())
54
{
55
m_sensors
.push_back(
RsSensor
(
env
,
sensor
,
m_device
));
56
}
57
}
58
59
RsDevice::~RsDevice
()
60
{
61
std::cerr
<<
"RsDevice destructor"
<< std::endl;
62
}
rs2::device::query_sensors
std::vector< sensor > query_sensors() const
Definition:
rs_device.hpp:25
test-bad-conditions.dev
dev
Definition:
test-bad-conditions.py:16
RsDevice::m_sensors
std::vector< RsSensor > m_sensors
Definition:
RsDevice.hh:36
rs2::context::query_devices
device_list query_devices() const
Definition:
rs_context.hpp:112
rs2::device_list::size
uint32_t size() const
Definition:
rs_device.hpp:711
RsDevice::~RsDevice
~RsDevice()
Definition:
RsDevice.cpp:59
test-got-playback-frames.ctx
ctx
Definition:
test-got-playback-frames.py:165
rmse.e
e
Definition:
rmse.py:177
rs2::context
Definition:
rs_context.hpp:96
RsDevice::getPhysicalSensorUniqueKey
static int getPhysicalSensorUniqueKey(rs2_stream stream_type, int sensors_index)
Definition:
RsDevice.cpp:9
test-fg.devices
devices
Definition:
test-fg.py:9
RsDevice::m_device
rs2::device m_device
Definition:
RsDevice.hh:35
RsDevice::RsDevice
RsDevice(UsageEnvironment *t_env)
Definition:
RsDevice.cpp:14
first
GLint first
Definition:
glad/glad/glad.h:2302
RsDevice.hh
convert_to_bag.sensor
sensor
Definition:
convert_to_bag.py:70
rs2_stream
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition:
rs_sensor.h:42
RsDevice::env
UsageEnvironment * env
Definition:
RsDevice.hh:38
rs2::device_list
Definition:
rs_device.hpp:670
Catch::cerr
std::ostream & cerr()
rs2::device
Definition:
rs_device.hpp:18
RsUsageEnvironment.h
RsSensor
Definition:
RsSensor.hh:19
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:47:41