Rs2DeviceProps.cpp
Go to the documentation of this file.
1 #include "Rs2Driver.h"
2 #include "PS1080.h"
3 
4 namespace oni { namespace driver {
5 
6 OniStatus Rs2Device::setProperty(int propertyId, const void* data, int dataSize)
7 {
9 
10  rsTraceFunc("propertyId=%d dataSize=%d", propertyId, dataSize);
11 
12  switch (propertyId)
13  {
14  case ONI_DEVICE_PROPERTY_IMAGE_REGISTRATION:
15  {
16  if (data && (dataSize == sizeof(OniImageRegistrationMode)))
17  {
18  m_registrationMode = *((OniImageRegistrationMode*)data);
19  rsLogDebug("registrationMode=%d", (int)m_registrationMode);
20  //updateConfiguration();
21  return ONI_STATUS_OK;
22  }
23  break;
24  }
25 
26  default:
27  {
28  #if defined(RS2_TRACE_NOT_SUPPORTED_PROPS)
29  rsTraceError("Not supported: propertyId=%d", propertyId);
30  #endif
31  return ONI_STATUS_NOT_SUPPORTED;
32  }
33  }
34 
35  rsTraceError("propertyId=%d dataSize=%d", propertyId, dataSize);
36  return ONI_STATUS_ERROR;
37 }
38 
39 OniStatus Rs2Device::getProperty(int propertyId, void* data, int* dataSize)
40 {
42 
43  switch (propertyId)
44  {
45  case ONI_DEVICE_PROPERTY_SERIAL_NUMBER:
46  {
47  if (data && dataSize && *dataSize > 0)
48  {
49  Rs2Error e;
51  if (e.success())
52  {
53  int n = snprintf((char*)data, *dataSize - 1, "%s", info);
54  *dataSize = n + 1;
55  return ONI_STATUS_OK;
56  }
57  }
58  break;
59  }
60 
61  case ONI_DEVICE_PROPERTY_IMAGE_REGISTRATION:
62  {
63  if (data && dataSize && *dataSize == sizeof(OniImageRegistrationMode))
64  {
65  *((OniImageRegistrationMode*)data) = m_registrationMode;
66  return ONI_STATUS_OK;
67  }
68  break;
69  }
70 
71  #ifdef RS2_EMULATE_PRIMESENSE_HARDWARE
72  case XN_MODULE_PROPERTY_AHB:
73  {
74  if (data && dataSize && *dataSize == 12)
75  {
76  unsigned char hack[] = {0x40, 0x0, 0x0, 0x28, 0x6A, 0x26, 0x54, 0x4F, 0xFF, 0xFF, 0xFF, 0xFF};
77  memcpy(data, hack, sizeof(hack));
78  return ONI_STATUS_OK;
79  }
80  break;
81  }
82  #endif
83 
84  default:
85  {
86  #if defined(RS2_TRACE_NOT_SUPPORTED_PROPS)
87  rsTraceError("Not supported: propertyId=%d", propertyId);
88  #endif
89  return ONI_STATUS_NOT_SUPPORTED;
90  }
91  }
92 
93  rsTraceError("propertyId=%d dataSize=%d", propertyId, *dataSize);
94  return ONI_STATUS_ERROR;
95 }
96 
97 OniBool Rs2Device::isPropertySupported(int propertyId)
98 {
99  switch (propertyId)
100  {
101  case ONI_DEVICE_PROPERTY_SERIAL_NUMBER:
102  case ONI_DEVICE_PROPERTY_IMAGE_REGISTRATION:
103  return true;
104 
105  default:
106  return false;
107  }
108 }
109 
110 }} // namespace
GLenum GLsizei dataSize
Definition: glext.h:5691
virtual OniStatus getProperty(int propertyId, void *data, int *dataSize)
virtual OniBool isPropertySupported(int propertyId)
GLdouble n
Definition: glext.h:1966
e
Definition: rmse.py:177
#define rsTraceError(format,...)
Definition: Rs2Base.h:41
Definition: Rs2Base.cpp:3
def info(name, value, persistent=False)
Definition: test.py:301
#define SCOPED_PROFILER
Definition: Rs2Base.h:32
#define rsLogDebug(format,...)
Definition: Rs2Base.h:43
#define rsTraceFunc(format,...)
Definition: Rs2Base.h:42
bool success() const
Definition: Rs2Base.h:58
OniImageRegistrationMode m_registrationMode
Definition: Rs2Device.h:75
rs2_device * m_device
Definition: Rs2Device.h:74
virtual OniStatus setProperty(int propertyId, const void *data, int dataSize)
Definition: parser.hpp:150
const char * rs2_get_device_info(const rs2_device *device, rs2_camera_info info, rs2_error **error)
Definition: rs.cpp:703


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