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