Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef OVR_DeviceMessages_h
00018 #define OVR_DeviceMessages_h
00019
00020 #include "OVR_DeviceConstants.h"
00021 #include "OVR_DeviceHandle.h"
00022
00023 #include "Kernel/OVR_Math.h"
00024 #include "Kernel/OVR_Array.h"
00025 #include "Kernel/OVR_Color.h"
00026
00027 namespace OVR {
00028
00029 class DeviceBase;
00030 class DeviceHandle;
00031
00032
00033 #define OVR_MESSAGETYPE(devName, msgIndex) ((Device_##devName << 8) | msgIndex)
00034
00035
00036
00037 enum MessageType
00038 {
00039
00040 Message_None = 0,
00041
00042
00043 Message_DeviceAdded = OVR_MESSAGETYPE(Manager, 0),
00044 Message_DeviceRemoved = OVR_MESSAGETYPE(Manager, 1),
00045
00046 Message_BodyFrame = OVR_MESSAGETYPE(Sensor, 0),
00047
00048 Message_LatencyTestSamples = OVR_MESSAGETYPE(LatencyTester, 0),
00049 Message_LatencyTestColorDetected = OVR_MESSAGETYPE(LatencyTester, 1),
00050 Message_LatencyTestStarted = OVR_MESSAGETYPE(LatencyTester, 2),
00051 Message_LatencyTestButton = OVR_MESSAGETYPE(LatencyTester, 3),
00052
00053 };
00054
00055
00056
00057 class Message
00058 {
00059 public:
00060 Message(MessageType type = Message_None,
00061 DeviceBase* pdev = 0) : Type(type), pDevice(pdev)
00062 { }
00063
00064 MessageType Type;
00065 DeviceBase* pDevice;
00066 };
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 class MessageBodyFrame : public Message
00082 {
00083 public:
00084 MessageBodyFrame(DeviceBase* dev)
00085 : Message(Message_BodyFrame, dev), Temperature(0.0f), TimeDelta(0.0f)
00086 {
00087 }
00088
00089 Vector3f Acceleration;
00090 Vector3f RotationRate;
00091 Vector3f MagneticField;
00092 float Temperature;
00093 float TimeDelta;
00094 };
00095
00096
00097
00098 class MessageDeviceStatus : public Message
00099 {
00100 public:
00101 MessageDeviceStatus(MessageType type, DeviceBase* dev, const DeviceHandle &hdev)
00102 : Message(type, dev), Handle(hdev) { }
00103
00104 DeviceHandle Handle;
00105 };
00106
00107
00108
00109
00110
00111 class MessageLatencyTestSamples : public Message
00112 {
00113 public:
00114 MessageLatencyTestSamples(DeviceBase* dev)
00115 : Message(Message_LatencyTestSamples, dev)
00116 {
00117 }
00118
00119 Array<Color> Samples;
00120 };
00121
00122
00123 class MessageLatencyTestColorDetected : public Message
00124 {
00125 public:
00126 MessageLatencyTestColorDetected(DeviceBase* dev)
00127 : Message(Message_LatencyTestColorDetected, dev)
00128 {
00129 }
00130
00131 UInt16 Elapsed;
00132 Color DetectedValue;
00133 Color TargetValue;
00134 };
00135
00136
00137 class MessageLatencyTestStarted : public Message
00138 {
00139 public:
00140 MessageLatencyTestStarted(DeviceBase* dev)
00141 : Message(Message_LatencyTestStarted, dev)
00142 {
00143 }
00144
00145 Color TargetValue;
00146 };
00147
00148
00149 class MessageLatencyTestButton : public Message
00150 {
00151 public:
00152 MessageLatencyTestButton(DeviceBase* dev)
00153 : Message(Message_LatencyTestButton, dev)
00154 {
00155 }
00156
00157 };
00158
00159
00160 }
00161
00162 #endif