80 SampleCount = buffer[1];
83 for (
UByte i = 0; i < SampleCount; i++)
85 UnpackSamples(buffer + 4 + (3 * i), &Samples[i].Value[0], &Samples[i].Value[1], &Samples[i].Value[2]);
138 memcpy(TriggerValue, buffer + 7, 3);
139 memcpy(TargetValue, buffer + 10, 3);
188 memcpy(TargetValue, buffer + 5, 3);
273 enum { PacketSize = 5 };
279 : Configuration(configuration)
287 Buffer[1] =
UByte(Configuration.SendSamples);
288 Buffer[2] = Configuration.Threshold.R;
289 Buffer[3] = Configuration.Threshold.G;
290 Buffer[4] = Configuration.Threshold.B;
295 Configuration.SendSamples = Buffer[1] != 0 ?
true :
false;
296 Configuration.Threshold.R = Buffer[2];
297 Configuration.Threshold.G = Buffer[3];
298 Configuration.Threshold.B = Buffer[4];
304 enum { PacketSize = 4 };
310 : CalibrationColor(calibrationColor)
318 Buffer[1] = CalibrationColor.R;
319 Buffer[2] = CalibrationColor.G;
320 Buffer[3] = CalibrationColor.B;
325 CalibrationColor.R = Buffer[1];
326 CalibrationColor.G = Buffer[2];
327 CalibrationColor.B = Buffer[3];
333 enum { PacketSize = 6 };
339 : TargetColor(targetColor)
350 Buffer[3] = TargetColor.R;
351 Buffer[4] = TargetColor.G;
352 Buffer[5] = TargetColor.B;
358 TargetColor.R = Buffer[3];
359 TargetColor.G = Buffer[4];
360 TargetColor.B = Buffer[5];
366 enum { PacketSize = 6 };
380 Buffer[1] = Display.Mode;
386 Display.Mode = Buffer[1];
406 void operator = (
const LatencyTestEnumerator&) { }
412 : pFactory(factory), ExternalVisitor(externalVisitor) { }
414 virtual bool MatchVendorProduct(
UInt16 vendorId,
UInt16 productId)
416 return pFactory->MatchVendorProduct(vendorId, productId);
424 ExternalVisitor.Visit(createDesc);
428 LatencyTestEnumerator latencyTestEnumerator(
this, visitor);
429 GetManagerImpl()->GetHIDDeviceManager()->Enumerate(&latencyTestEnumerator);
465 info->
Version = HIDDesc.VersionNumber;
496 LogText(
"OVR::LatencyTestDevice initialized.\n");
513 bool processed =
false;
bool PushCall(R(C::*fn)(), bool wait=false)
void LogText(const char *fmt,...) OVR_LOG_VAARG_ATTRIBUTE(1
virtual bool SetCalibrate(const Color &calibrationColor, bool waitFlag=false)
void onLatencyTestColorDetectedMessage(LatencyTestColorDetectedMessage *message)
virtual DeviceBase * NewDeviceInstance()
const DeviceType InfoClassType
OVR::LatencyTestConfiguration Configuration
void EncodeUInt32(UByte *buffer, UInt32 val)
bool setCalibrate(const Color &calibrationColor)
bool setConfiguration(const OVR::LatencyTestConfiguration &configuration)
LatencyTestStartTestImpl(const Color &targetColor)
virtual bool DetectHIDDevice(DeviceManager *pdevMgr, const HIDDeviceDesc &desc)
virtual void EnumerateDevices(EnumerateVisitor &visitor)
void onLatencyTestStartedMessage(LatencyTestStartedMessage *message)
__BEGIN_NAMESPACE_STD void * memcpy(void *__restrict __dest, const void *__restrict __src, size_t __n) __THROW __nonnull((1
void EncodeUInt16(UByte *buffer, UInt16 val)
virtual ThreadCommandQueue * GetThreadQueue()=0
static LatencyTestDeviceFactory & GetInstance()
Ptr< DeviceCreateDesc > pCreateDesc
void onLatencyTestSamplesMessage(LatencyTestSamplesMessage *message)
UInt32 DecodeUInt32(const UByte *buffer)
bool DecodeLatencyTestSamplesMessage(LatencyTestSamplesMessage *message, UByte *buffer, int size)
LatencyTestMessageType Decode(const UByte *buffer, int size)
bool DecodeLatencyTestColorDetectedMessage(LatencyTestColorDetectedMessage *message, UByte *buffer, int size)
UInt16 DecodeUInt16(const UByte *buffer)
bool setDisplay(const OVR::LatencyTestDisplay &display)
void onLatencyTestButtonMessage(LatencyTestButtonMessage *message)
LatencyTestMessageType Type
virtual bool SetStartTest(const Color &targetColor, bool waitFlag=false)
LatencyTestDeviceImpl(LatencyTestDeviceCreateDesc *createDesc)
virtual bool GetDeviceInfo(DeviceInfo *info) const
virtual bool SetDisplay(const LatencyTestDisplay &display, bool waitFlag=false)
LatencyTestMessageType Type
bool getConfiguration(OVR::LatencyTestConfiguration *configuration)
bool DecodeLatencyTestStartedMessage(LatencyTestStartedMessage *message, UByte *buffer, int size)
HIDDeviceDesc * getHIDDesc() const
LatencyTestSample Samples[20]
virtual void OnInputReport(UByte *pData, UInt32 length)
MessageHandlerRef HandlerRef
bool DecodeLatencyTestButtonMessage(LatencyTestButtonMessage *message, UByte *buffer, int size)
LatencyTestMessageType Decode(const UByte *buffer, int size)
LatencyTestStarted TestStarted
bool GetFeatureReport(UByte *data, UInt32 length)
DeviceManagerImpl * GetManagerImpl() const
virtual Ptr< DeviceCreateDesc > AddDevice_NeedsLock(const DeviceCreateDesc &createDesc)=0
virtual bool MatchVendorProduct(UInt16 vendorId, UInt16 productId) const
bool setStartTest(const Color &targetColor)
HIDDevice * GetInternalDevice() const
virtual bool GetConfiguration(OVR::LatencyTestConfiguration *configuration)
__BEGIN_NAMESPACE_STD void void __END_NAMESPACE_STD void __BEGIN_NAMESPACE_STD void * memset(void *__s, int __c, size_t __n) __THROW __nonnull((1))
LatencyTestMessageType Decode(const UByte *buffer, int size)
LatencyTestMessageType Type
LatencyTestSamples Samples
LatencyTestMessageType Type
virtual bool SetFeatureReport(UByte *data, UInt32 length)=0
virtual bool SetConfiguration(const OVR::LatencyTestConfiguration &configuration, bool waitFlag=false)
LatencyTestDisplayImpl(const OVR::LatencyTestDisplay &display)
LatencyTestCalibrateImpl(const Color &calibrationColor)
virtual bool Initialize(DeviceBase *parent)
static void UnpackSamples(const UByte *buffer, UByte *r, UByte *g, UByte *b)
void Call(const Message &msg)
LatencyTestConfigurationImpl(const OVR::LatencyTestConfiguration &configuration)
ThreadId GetCurrentThreadId()
OVR::LatencyTestDisplay Display
LatencyTestColorDetected ColorDetected
bool PushCallAndWaitResult(R(C::*fn)(), R *ret)