backend.cpp
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 #if defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND) && !defined(RS2_USE_WINUSB_UVC_BACKEND) && !defined(RS2_USE_ANDROID_BACKEND)
5 // UVC support will be provided via libuvc / libusb backend
6 #elif !defined(RS2_USE_LIBUVC_BACKEND) && defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND) && !defined(RS2_USE_WINUSB_UVC_BACKEND) && !defined(RS2_USE_ANDROID_BACKEND)
7 // UVC support will be provided via Windows Media Foundation / WinUSB backend
8 #elif !defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND) && defined(RS2_USE_WINUSB_UVC_BACKEND)&&!defined(RS2_USE_ANDROID_BACKEND)
9 // UVC support will be provided via WinUSB / WinUSB backend
10 #elif !defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && defined(RS2_USE_V4L2_BACKEND) && !defined(RS2_USE_WINUSB_UVC_BACKEND)&&!defined(RS2_USE_ANDROID_BACKEND)
11 // UVC support will be provided via Video 4 Linux 2 / libusb backend
12 #elif !defined(RS2_USE_LIBUVC_BACKEND) && !defined(RS2_USE_WMF_BACKEND) && !defined(RS2_USE_V4L2_BACKEND) && !defined(RS2_USE_WINUSB_UVC_BACKEND) && defined(RS2_USE_ANDROID_BACKEND)
13 // UVC support will be provided via Android backend
14 #else
15 #error No UVC backend selected. Please #define exactly one of RS2_USE_LIBUVC_BACKEND, RS2_USE_WMF_BACKEND, RS2_USE_WINUSB_UVC_BACKEND or RS2_USE_V4L2_BACKEND
16 #endif
17 
18 #include "backend.h"
19 #include "platform/uvc-device.h"
20 
21 #include <iomanip>
22 
23 
24 namespace librealsense {
25 namespace platform {
26 
27 
28 void control_range::populate_raw_data(std::vector<uint8_t>& vec, int32_t value)
29 {
30  vec.resize(sizeof(value));
31  auto data = reinterpret_cast<const uint8_t*>(&value);
32  std::copy(data, data + sizeof(value), vec.data());
33 }
34 
35 
36 std::ostream & operator<<( std::ostream & os, guid const & g )
37 {
38  std::ios_base::fmtflags f( os.flags() );
39  os << std::hex;
40  auto prev_fill = os.fill();
41  os.fill( '0' );
42  os << g.data1 << '-' << g.data2 << '-' << g.data3 << '-';
43  for( auto b : g.data4 )
44  os << std::setw(2) << (int)b;
45  os.flags( f );
46  os.fill( prev_fill );
47  return os;
48 }
49 
50 
51 } // namespace platform
52 
53 
54 double monotonic_to_realtime(double monotonic)
55 {
56  auto realtime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
57  auto time_since_epoch = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
58  return monotonic + (realtime - time_since_epoch);
59 }
60 
61 
62 } // namespace librealsense
librealsense::platform::operator<<
std::ostream & operator<<(std::ostream &os, guid const &g)
Definition: backend.cpp:36
librealsense
Definition: algo.h:18
uint8_t
unsigned char uint8_t
Definition: stdint.h:78
librealsense::platform::guid
Definition: platform/uvc-device.h:36
uvc-device.h
b
GLboolean GLboolean GLboolean b
Definition: glad/glad/glad.h:3064
data
Definition: parser.hpp:153
value
GLfloat value
Definition: glad/glad/glad.h:2099
f
GLdouble f
Definition: glad/glad/glad.h:1517
librealsense::platform::value
@ value
Definition: platform/hid-device.h:67
g
GLboolean GLboolean g
Definition: glad/glad/glad.h:3064
librealsense::monotonic_to_realtime
double monotonic_to_realtime(double monotonic)
Definition: backend.cpp:54
backend.h
opencv_pointcloud_viewer.now
now
Definition: opencv_pointcloud_viewer.py:314
int32_t
signed int int32_t
Definition: stdint.h:77
librealsense::platform::control_range::populate_raw_data
void populate_raw_data(std::vector< uint8_t > &vec, int32_t value)
Definition: backend.cpp:28


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Mon Apr 22 2024 02:12:55