aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/OVR_DeviceMessages.h
diff options
context:
space:
mode:
Diffstat (limited to 'LibOVR/Src/OVR_DeviceMessages.h')
-rw-r--r--LibOVR/Src/OVR_DeviceMessages.h115
1 files changed, 105 insertions, 10 deletions
diff --git a/LibOVR/Src/OVR_DeviceMessages.h b/LibOVR/Src/OVR_DeviceMessages.h
index 6d525b3..0fe0a3c 100644
--- a/LibOVR/Src/OVR_DeviceMessages.h
+++ b/LibOVR/Src/OVR_DeviceMessages.h
@@ -6,16 +6,16 @@ Content : Definition of messages generated by devices
Created : February 5, 2013
Authors : Lee Cooper
-Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved.
+Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
-Licensed under the Oculus VR SDK License Version 2.0 (the "License");
-you may not use the Oculus VR SDK except in compliance with the License,
+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-2.0
+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,
@@ -35,10 +35,12 @@ limitations under the License.
#include "Kernel/OVR_Array.h"
#include "Kernel/OVR_Color.h"
+
namespace OVR {
class DeviceBase;
class DeviceHandle;
+class String;
#define OVR_MESSAGETYPE(devName, msgIndex) ((Device_##devName << 8) | msgIndex)
@@ -55,12 +57,17 @@ enum MessageType
Message_DeviceRemoved = OVR_MESSAGETYPE(Manager, 1), // Existing device has been plugged/unplugged.
// Sensor Messages
Message_BodyFrame = OVR_MESSAGETYPE(Sensor, 0), // Emitted by sensor at regular intervals.
+ Message_ExposureFrame = OVR_MESSAGETYPE(Sensor, 1),
+ Message_PixelRead = OVR_MESSAGETYPE(Sensor, 2),
+
// Latency Tester Messages
Message_LatencyTestSamples = OVR_MESSAGETYPE(LatencyTester, 0),
Message_LatencyTestColorDetected = OVR_MESSAGETYPE(LatencyTester, 1),
Message_LatencyTestStarted = OVR_MESSAGETYPE(LatencyTester, 2),
Message_LatencyTestButton = OVR_MESSAGETYPE(LatencyTester, 3),
-
+
+ Message_CameraFrame = OVR_MESSAGETYPE(Camera, 0),
+ Message_CameraAdded = OVR_MESSAGETYPE(Camera, 1),
};
//-------------------------------------------------------------------------------------
@@ -89,19 +96,37 @@ public:
// - Yaw is rotation around Y, positive for turning left.
// - Pitch is rotation around X, positive for pitching up.
+//-------------------------------------------------------------------------------------
+// ***** Sensor
+
class MessageBodyFrame : public Message
{
public:
MessageBodyFrame(DeviceBase* dev)
- : Message(Message_BodyFrame, dev), Temperature(0.0f), TimeDelta(0.0f)
+ : Message(Message_BodyFrame, dev), Temperature(0.0f), TimeDelta(0.0f), MagCalibrated(false)
{
}
Vector3f Acceleration; // Acceleration in m/s^2.
- Vector3f RotationRate; // Angular velocity in rad/s^2.
+ Vector3f RotationRate; // Angular velocity in rad/s.
Vector3f MagneticField; // Magnetic field strength in Gauss.
float Temperature; // Temperature reading on sensor surface, in degrees Celsius.
float TimeDelta; // Time passed since last Body Frame, in seconds.
+
+ bool MagCalibrated; // True if MagneticField is calibrated, false if raw
+
+ // The absolute time from the host computers perspective that the message should be
+ // interpreted as. This is based on incoming timestamp and processed by a filter
+ // that syncs the clocks while attempting to keep the distance between messages
+ // device clock matching.
+ //
+ // Integration should use TimeDelta, but prediction into the future should derive
+ // the delta time from PredictToSeconds - AbsoluteTimeSeconds.
+ //
+ // This value will generally be <= the return from a call to ovr_GetTimeInSeconds(),
+ // but could be greater by under 1 ms due to system time update interrupt delays.
+ //
+ double AbsoluteTimeSeconds;
};
// Sent when we receive a device status changes (e.g.:
@@ -109,10 +134,36 @@ public:
class MessageDeviceStatus : public Message
{
public:
- MessageDeviceStatus(MessageType type, DeviceBase* dev, const DeviceHandle &hdev)
- : Message(type, dev), Handle(hdev) { }
+ MessageDeviceStatus(MessageType type, DeviceBase* dev, const DeviceHandle &hdev)
+ : Message(type, dev), Handle(hdev) { }
- DeviceHandle Handle;
+ DeviceHandle Handle;
+};
+
+class MessageExposureFrame : public Message
+{
+public:
+ MessageExposureFrame(DeviceBase* dev)
+ : Message(Message_ExposureFrame, dev),
+ CameraPattern(0), CameraFrameCount(0), CameraTimeSeconds(0) { }
+
+ UByte CameraPattern;
+ UInt32 CameraFrameCount;
+ double CameraTimeSeconds;
+};
+
+class MessagePixelRead : public Message
+{
+public:
+ MessagePixelRead(DeviceBase* dev)
+ : Message(Message_PixelRead, dev),
+ PixelReadValue(0), SensorTimeSeconds(0), FrameTimeSeconds(0) { }
+
+ UByte PixelReadValue;
+ UInt32 RawSensorTime;
+ UInt32 RawFrameTime;
+ double SensorTimeSeconds;
+ double FrameTimeSeconds;
};
//-------------------------------------------------------------------------------------
@@ -167,6 +218,50 @@ public:
};
+//-------------------------------------------------------------------------------------
+// ***** Camera
+
+// Sent by camera, frame.
+class MessageCameraFrame : public Message
+{
+public:
+ MessageCameraFrame(DeviceBase* dev)
+ : Message(Message_CameraFrame, dev)
+ {
+ LostFrames = 0;
+ }
+
+ void SetInfo(UInt32 frameNumber, double timeSeconds, UInt32 width, UInt32 height, UInt32 format)
+ {
+ FrameNumber = frameNumber;
+ ArrivalTimeSeconds = timeSeconds;
+ Width = width;
+ Height = height;
+ Format = format;
+ }
+
+ void SetData(const UByte* pdata, UInt32 sizeInBytes)
+ {
+ pFrameData = pdata;
+ FrameSizeInBytes = sizeInBytes;
+ }
+
+ UInt32 FrameNumber; // an index of the frame
+ double ArrivalTimeSeconds; // frame time in seconds, as recorded by the host computer
+ const UByte* pFrameData; // a ptr to frame data.
+ UInt32 FrameSizeInBytes; // size of the data in the pFrameData.
+ UInt32 Width, Height; // width & height in pixels.
+ UInt32 Format; // format of pixel, see CameraDevice::PixelFormat enum
+ UInt32 LostFrames; // number of lost frames before this frame
+};
+
+// Sent when a new camera is connected
+class MessageCameraAdded : public Message
+{
+public:
+ MessageCameraAdded(DeviceBase* dev)
+ : Message(Message_CameraAdded, dev) { }
+};
} // namespace OVR