Bike-X  0.8
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OVR_Sensor2Impl.h
Go to the documentation of this file.
1 /************************************************************************************
2 
3 Filename : OVR_Sensor2Impl.h
4 Content : DK2 sensor device specific implementation.
5 Created : January 21, 2013
6 Authors : Lee Cooper
7 
8 Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
9 
10 Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License");
11 you may not use the Oculus VR Rift SDK except in compliance with the License,
12 which is provided at the time of installation or download, or which
13 otherwise accompanies this software in either electronic or hard copy form.
14 
15 You may obtain a copy of the License at
16 
17 http://www.oculusvr.com/licenses/LICENSE-3.1
18 
19 Unless required by applicable law or agreed to in writing, the Oculus VR SDK
20 distributed under the License is distributed on an "AS IS" BASIS,
21 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 See the License for the specific language governing permissions and
23 limitations under the License.
24 
25 *************************************************************************************/
26 
27 #ifndef OVR_Sensor2Impl_h
28 #define OVR_Sensor2Impl_h
29 
30 #include "OVR_SensorImpl.h"
31 #include "OVR_SensorCalibration.h"
32 
33 namespace OVR {
34 
35 struct Tracker2Message;
36 
37 //-------------------------------------------------------------------------------------
38 // Used to convert DK2 Mks timestamps to system TimeSeconds
40 {
42  double TimeSeconds;
43  const char* DebugTag;
44 
45  SensorTimestampMapping(const char* debugTag)
46  : TimestampMks(0), TimeSeconds(0.0), DebugTag(debugTag) { }
47 };
48 
49 //-------------------------------------------------------------------------------------
50 // ***** OVR::Sensor2DeviceImpl
51 
52 // Oculus Sensor2 interface.
54 {
55 public:
58 
59  // HIDDevice::Notifier interface.
60  virtual void OnInputReport(UByte* pData, UInt32 length);
61  virtual double OnTicks(double tickSeconds);
62 
63  // Get/set feature reports added for DK2. See 'DK2 Firmware Specification' document details.
64  virtual bool SetTrackingReport(const TrackingReport& data);
65  virtual bool GetTrackingReport(TrackingReport* data);
66 
67  virtual bool SetDisplayReport(const DisplayReport& data);
68  virtual bool GetDisplayReport(DisplayReport* data);
69 
70  virtual bool SetMagCalibrationReport(const MagCalibrationReport& data);
72 
75 
76  virtual bool SetCustomPatternReport(const CustomPatternReport& data);
77  virtual bool GetCustomPatternReport(CustomPatternReport* data);
78 
79  virtual bool SetKeepAliveMuxReport(const KeepAliveMuxReport& data);
80  virtual bool GetKeepAliveMuxReport(KeepAliveMuxReport* data);
81 
82  virtual bool SetManufacturingReport(const ManufacturingReport& data);
83  virtual bool GetManufacturingReport(ManufacturingReport* data);
84 
85  virtual bool SetUUIDReport(const UUIDReport& data);
86  virtual bool GetUUIDReport(UUIDReport* data);
87 
88  virtual bool SetTemperatureReport(const TemperatureReport& data);
90 
91  virtual bool GetGyroOffsetReport(GyroOffsetReport* data);
92 
93  virtual bool SetLensDistortionReport(const LensDistortionReport& data);
95 
96 protected:
97  virtual void openDevice();
98 
99  bool decodeTracker2Message(Tracker2Message* message, UByte* buffer, int size);
100 
101  bool setTrackingReport(const TrackingReport& data);
102  bool getTrackingReport(TrackingReport* data);
103 
104  bool setDisplayReport(const DisplayReport& data);
105  bool getDisplayReport(DisplayReport* data);
106 
109 
113 
116 
117  bool setKeepAliveMuxReport(const KeepAliveMuxReport& data);
119 
122 
123  bool setUUIDReport(const UUIDReport& data);
124  bool getUUIDReport(UUIDReport* data);
125 
126  bool setTemperatureReport(const TemperatureReport& data);
129 
131 
134 
135  // Called for decoded messages
136  void onTrackerMessage(Tracker2Message* message);
137 
141 
145  // Record last frame timestamp to know when to send pixelRead messages.
147 
149 };
150 
151 } // namespace OVR
152 
153 #endif // OVR_Sensor2Impl_h
bool setManufacturingReport(const ManufacturingReport &data)
bool setMagCalibrationReport(const MagCalibrationReport &data)
SensorCalibration * pCalibration
SensorTimestampMapping LastFrameTime
virtual bool SetUUIDReport(const UUIDReport &data)
virtual bool SetManufacturingReport(const ManufacturingReport &data)
bool getLensDistortionReport(LensDistortionReport *data)
bool getKeepAliveMuxReport(KeepAliveMuxReport *data)
virtual bool GetLensDistortionReport(LensDistortionReport *data)
uint64_t UInt64
Definition: OVR_Types.h:255
virtual bool GetGyroOffsetReport(GyroOffsetReport *data)
bool setTrackingReport(const TrackingReport &data)
virtual bool SetMagCalibrationReport(const MagCalibrationReport &data)
uint16_t UInt16
Definition: OVR_Types.h:251
virtual bool GetAllPositionCalibrationReports(Array< PositionCalibrationReport > *data)
uint32_t UInt32
Definition: OVR_Types.h:253
virtual bool SetTrackingReport(const TrackingReport &data)
bool getTemperatureReport(TemperatureReport *data)
virtual bool SetCustomPatternReport(const CustomPatternReport &data)
virtual double OnTicks(double tickSeconds)
uint8_t UByte
Definition: OVR_Types.h:249
virtual bool SetLensDistortionReport(const LensDistortionReport &data)
bool getGyroOffsetReport(GyroOffsetReport *data)
bool getDisplayReport(DisplayReport *data)
bool getCustomPatternReport(CustomPatternReport *data)
bool setTemperatureReport(const TemperatureReport &data)
bool setCustomPatternReport(const CustomPatternReport &data)
Sensor2DeviceImpl(SensorDeviceCreateDesc *createDesc)
bool getMagCalibrationReport(MagCalibrationReport *data)
virtual bool GetCustomPatternReport(CustomPatternReport *data)
bool setPositionCalibrationReport(const PositionCalibrationReport &data)
SensorTimestampMapping LastCameraTime
SensorTimestampMapping LastSensorTime
virtual bool SetPositionCalibrationReport(const PositionCalibrationReport &data)
virtual bool GetTrackingReport(TrackingReport *data)
virtual bool SetKeepAliveMuxReport(const KeepAliveMuxReport &data)
bool setKeepAliveMuxReport(const KeepAliveMuxReport &data)
virtual void OnInputReport(UByte *pData, UInt32 length)
bool getUUIDReport(UUIDReport *data)
bool getPositionCalibrationReport(PositionCalibrationReport *data)
virtual bool GetUUIDReport(UUIDReport *data)
bool getAllPositionCalibrationReports(Array< PositionCalibrationReport > *data)
virtual bool GetDisplayReport(DisplayReport *data)
virtual bool GetKeepAliveMuxReport(KeepAliveMuxReport *data)
bool getAllTemperatureReports(Array< Array< TemperatureReport > > *)
bool setLensDistortionReport(const LensDistortionReport &data)
bool decodeTracker2Message(Tracker2Message *message, UByte *buffer, int size)
virtual bool SetTemperatureReport(const TemperatureReport &data)
bool setUUIDReport(const UUIDReport &data)
SensorTimestampMapping(const char *debugTag)
virtual bool GetMagCalibrationReport(MagCalibrationReport *data)
void onTrackerMessage(Tracker2Message *message)
virtual bool GetAllTemperatureReports(Array< Array< TemperatureReport > > *)
bool getTrackingReport(TrackingReport *data)
virtual bool SetDisplayReport(const DisplayReport &data)
bool getManufacturingReport(ManufacturingReport *data)
bool setDisplayReport(const DisplayReport &data)
virtual bool GetManufacturingReport(ManufacturingReport *data)