Rs2Device.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Rs2Stream.h"
4 
5 namespace oni { namespace driver {
6 
7 class Rs2Device : public DeviceBase
8 {
9  friend class Rs2Driver;
10 
11 public:
12 
13  Rs2Device(class Rs2Driver* driver, rs2_device* device);
14  virtual ~Rs2Device();
15 
16  virtual OniStatus getSensorInfoList(OniSensorInfo** sensors, int* numSensors);
17  virtual StreamBase* createStream(OniSensorType sensorType);
18  virtual void destroyStream(StreamBase* streamBase);
19 
20  virtual OniStatus setProperty(int propertyId, const void* data, int dataSize);
21  virtual OniStatus getProperty(int propertyId, void* data, int* dataSize);
22  virtual OniBool isPropertySupported(int propertyId);
23 
24  virtual OniStatus invoke(int commandId, void* data, int dataSize);
25  virtual OniBool isCommandSupported(int commandId);
26  virtual OniStatus tryManualTrigger();
27 
28  virtual OniBool isImageRegistrationModeSupported(OniImageRegistrationMode mode);
29 
30  inline class Rs2Driver* getDriver() { return m_driver; }
31  inline rs2_device* getRsDevice() { return m_device; }
32  inline OniDeviceInfo* getInfo() { return &m_info; }
33  inline OniImageRegistrationMode getRegistrationMode() const { return m_registrationMode; }
34 
35  void updateConfiguration();
36 
37 protected:
38 
39  Rs2Device(const Rs2Device&);
40  void operator=(const Rs2Device&);
41 
42  OniStatus initialize();
43  void shutdown();
44 
45  static OniStatus queryDeviceInfo(rs2_device* device, OniDeviceInfo* deviceInfo);
46 
47  OniStatus initializeStreams();
48  OniStatus addStream(rs2_sensor* sensor, OniSensorType sensorType, int sensorId, int streamId, std::vector<Rs2StreamProfileInfo>* profiles);
49  void findStreamProfiles(std::vector<Rs2StreamProfileInfo>* dst, OniSensorType sensorType, int streamId);
50  Rs2Stream* findStream(OniSensorType sensorType, int streamId);
51  bool hasEnabledStreams();
52 
53  OniStatus startPipeline();
54  void stopPipeline();
55  void restartPipeline();
56 
57  void mainLoop();
58  void waitForFrames();
59  void processFrame(rs2_frame* frame);
60  void waitAlignedDepth();
61 
63  void submitOniFrame(OniFrame* oniFrame, Rs2Stream* stream);
64 
66  void releaseFrame(rs2_frame* frame);
67 
68 protected:
69 
72 
75  OniImageRegistrationMode m_registrationMode;
76 
80 
83 
84  std::unique_ptr<std::thread> m_thread;
85  volatile int m_runFlag;
86  volatile int m_configId;
88 
89  OniDeviceInfo m_info;
90  std::vector<Rs2StreamProfileInfo> m_profiles;
91  std::vector<OniSensorInfo> m_sensorInfo;
92  std::list<class Rs2Stream*> m_streams;
93  std::list<class Rs2Stream*> m_createdStreams;
94 };
95 
96 }} // namespace
class Rs2Driver * m_driver
Definition: Rs2Device.h:73
rs2_processing_block * m_alignProcessor
Definition: Rs2Device.h:82
rs2_frame_queue * m_alignQueue
Definition: Rs2Device.h:81
void findStreamProfiles(std::vector< Rs2StreamProfileInfo > *dst, OniSensorType sensorType, int streamId)
Definition: Rs2Device.cpp:860
virtual OniBool isCommandSupported(int commandId)
Definition: Rs2Device.cpp:223
virtual OniStatus invoke(int commandId, void *data, int dataSize)
Definition: Rs2Device.cpp:200
static OniStatus queryDeviceInfo(rs2_device *device, OniDeviceInfo *deviceInfo)
Definition: Rs2Device.cpp:118
volatile int m_runFlag
Definition: Rs2Device.h:85
Rs2Device(class Rs2Driver *driver, rs2_device *device)
Definition: Rs2Device.cpp:12
OniStatus startPipeline()
Definition: Rs2Device.cpp:247
OniStatus initialize()
Definition: Rs2Device.cpp:36
std::list< class Rs2Stream * > m_createdStreams
Definition: Rs2Device.h:93
GLenum GLsizei dataSize
Definition: glext.h:5691
virtual OniStatus getProperty(int propertyId, void *data, int *dataSize)
void operator=(const Rs2Device &)
GLenum GLenum dst
Definition: glext.h:1751
OniFrame * createOniFrame(rs2_frame *frame, Rs2Stream *stream, Rs2StreamProfileInfo *spi)
Definition: Rs2Device.cpp:591
virtual OniBool isPropertySupported(int propertyId)
GLuint GLuint stream
Definition: glext.h:1790
rs2_pipeline * m_pipeline
Definition: Rs2Device.h:78
Rs2Stream * getFrameStream(rs2_frame *frame, Rs2StreamProfileInfo *spi)
Definition: Rs2Device.cpp:679
OniDeviceInfo m_info
Definition: Rs2Device.h:89
Definition: Rs2Base.cpp:3
virtual void destroyStream(StreamBase *streamBase)
Definition: Rs2Device.cpp:184
GLenum mode
std::vector< Rs2StreamProfileInfo > m_profiles
Definition: Rs2Device.h:90
void submitOniFrame(OniFrame *oniFrame, Rs2Stream *stream)
Definition: Rs2Device.cpp:655
void processFrame(rs2_frame *frame)
Definition: Rs2Device.cpp:533
virtual OniStatus getSensorInfoList(OniSensorInfo **sensors, int *numSensors)
Definition: Rs2Device.cpp:152
volatile int m_configId
Definition: Rs2Device.h:86
Definition: api.h:28
unsigned __int64 uint64_t
Definition: stdint.h:90
void releaseFrame(rs2_frame *frame)
Definition: Rs2Device.cpp:701
virtual StreamBase * createStream(OniSensorType sensorType)
Definition: Rs2Device.cpp:164
rs2_device * getRsDevice()
Definition: Rs2Device.h:31
std::vector< OniSensorInfo > m_sensorInfo
Definition: Rs2Device.h:91
OniImageRegistrationMode getRegistrationMode() const
Definition: Rs2Device.h:33
OniDeviceInfo * getInfo()
Definition: Rs2Device.h:32
class Rs2Driver * getDriver()
Definition: Rs2Device.h:30
OniImageRegistrationMode m_registrationMode
Definition: Rs2Device.h:75
OniStatus addStream(rs2_sensor *sensor, OniSensorType sensorType, int sensorId, int streamId, std::vector< Rs2StreamProfileInfo > *profiles)
Definition: Rs2Device.cpp:831
std::list< class Rs2Stream * > m_streams
Definition: Rs2Device.h:92
std::mutex Rs2Mutex
Definition: Rs2Base.h:47
rs2_device * m_device
Definition: Rs2Device.h:74
virtual OniStatus setProperty(int propertyId, const void *data, int dataSize)
virtual OniStatus tryManualTrigger()
Definition: Rs2Device.cpp:233
auto device
Definition: pyrs_net.cpp:17
Definition: parser.hpp:150
OniStatus initializeStreams()
Definition: Rs2Device.cpp:711
rs2_pipeline_profile * m_pipelineProfile
Definition: Rs2Device.h:79
struct rs2_frame rs2_frame
Definition: rs_types.h:261
std::unique_ptr< std::thread > m_thread
Definition: Rs2Device.h:84
Rs2Stream * findStream(OniSensorType sensorType, int streamId)
Definition: Rs2Device.cpp:874
virtual OniBool isImageRegistrationModeSupported(OniImageRegistrationMode mode)
Definition: Rs2Device.cpp:238
rs2_config * m_config
Definition: Rs2Device.h:77


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