summaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/OVR_Sensor2Impl.cpp
diff options
context:
space:
mode:
authorBrad Davis <[email protected]>2014-05-23 01:49:32 -0700
committerBrad Davis <[email protected]>2014-05-23 01:49:32 -0700
commit46acc0e194ff3c1f120199eeca8324b4502118e9 (patch)
treeb1030198d3ee4698445d1fc5161cebe4158e45d1 /LibOVR/Src/OVR_Sensor2Impl.cpp
parent07d0f4d0bbf3477ac6a9584f726e8ec6ab285707 (diff)
Updating to 0.3.2 (windows version)
Diffstat (limited to 'LibOVR/Src/OVR_Sensor2Impl.cpp')
-rw-r--r--LibOVR/Src/OVR_Sensor2Impl.cpp96
1 files changed, 46 insertions, 50 deletions
diff --git a/LibOVR/Src/OVR_Sensor2Impl.cpp b/LibOVR/Src/OVR_Sensor2Impl.cpp
index fa5d6e9..95d486c 100644
--- a/LibOVR/Src/OVR_Sensor2Impl.cpp
+++ b/LibOVR/Src/OVR_Sensor2Impl.cpp
@@ -386,9 +386,7 @@ bool Sensor2DeviceImpl::getMagCalibrationReport(MagCalibrationReport* data)
bool Sensor2DeviceImpl::SetPositionCalibrationReport(const PositionCalibrationReport& data)
{
- Lock::Locker lock(&IndexedReportLock);
-
- bool result;
+ bool result;
if (!GetManagerImpl()->GetThreadQueue()->
PushCallAndWaitResult(this, &Sensor2DeviceImpl::setPositionCalibrationReport, &result, data))
{
@@ -411,20 +409,6 @@ bool Sensor2DeviceImpl::setPositionCalibrationReport(const PositionCalibrationRe
return GetInternalDevice()->SetFeatureReport(pci.Buffer, PositionCalibrationImpl::PacketSize);
}
-bool Sensor2DeviceImpl::GetPositionCalibrationReport(PositionCalibrationReport* data)
-{
- Lock::Locker lock(&IndexedReportLock);
-
- bool result;
- if (!GetManagerImpl()->GetThreadQueue()->
- PushCallAndWaitResult(this, &Sensor2DeviceImpl::getPositionCalibrationReport, &result, data))
- {
- return false;
- }
-
- return result;
-}
-
bool Sensor2DeviceImpl::getPositionCalibrationReport(PositionCalibrationReport* data)
{
UByte version = GetDeviceInterfaceVersion();
@@ -454,10 +438,20 @@ bool Sensor2DeviceImpl::getPositionCalibrationReport(PositionCalibrationReport*
bool Sensor2DeviceImpl::GetAllPositionCalibrationReports(Array<PositionCalibrationReport>* data)
{
- Lock::Locker lock(&IndexedReportLock);
+ bool result;
+ if (!GetManagerImpl()->GetThreadQueue()->
+ PushCallAndWaitResult(this, &Sensor2DeviceImpl::getAllPositionCalibrationReports, &result, data))
+ {
+ return false;
+ }
+
+ return result;
+}
+bool Sensor2DeviceImpl::getAllPositionCalibrationReports(Array<PositionCalibrationReport>* data)
+{
PositionCalibrationReport pc;
- bool result = GetPositionCalibrationReport(&pc);
+ bool result = getPositionCalibrationReport(&pc);
if (!result)
return false;
@@ -467,7 +461,7 @@ bool Sensor2DeviceImpl::GetAllPositionCalibrationReports(Array<PositionCalibrati
for (int i = 0; i < positions; i++)
{
- result = GetPositionCalibrationReport(&pc);
+ result = getPositionCalibrationReport(&pc);
if (!result)
return false;
OVR_ASSERT(pc.NumPositions == positions);
@@ -697,8 +691,6 @@ bool Sensor2DeviceImpl::getKeepAliveMuxReport(KeepAliveMuxReport* data)
bool Sensor2DeviceImpl::SetTemperatureReport(const TemperatureReport& data)
{
- Lock::Locker lock(&IndexedReportLock);
-
// direct call if we are already on the device manager thread
if (GetCurrentThreadId() == GetManagerImpl()->GetThreadId())
{
@@ -721,32 +713,41 @@ bool Sensor2DeviceImpl::setTemperatureReport(const TemperatureReport& data)
return GetInternalDevice()->SetFeatureReport(ti.Buffer, TemperatureImpl::PacketSize);
}
-bool Sensor2DeviceImpl::GetTemperatureReport(TemperatureReport* data)
+bool Sensor2DeviceImpl::getTemperatureReport(TemperatureReport* data)
{
- Lock::Locker lock(&IndexedReportLock);
+ TemperatureImpl ti;
+ if (GetInternalDevice()->GetFeatureReport(ti.Buffer, TemperatureImpl::PacketSize))
+ {
+ ti.Unpack();
+ *data = ti.Settings;
+ return true;
+ }
+ return false;
+}
+
+bool Sensor2DeviceImpl::GetAllTemperatureReports(Array<Array<TemperatureReport> >* data)
+{
// direct call if we are already on the device manager thread
if (GetCurrentThreadId() == GetManagerImpl()->GetThreadId())
{
- return getTemperatureReport(data);
+ return getAllTemperatureReports(data);
}
- bool result;
- if (!GetManagerImpl()->GetThreadQueue()->
- PushCallAndWaitResult(this, &Sensor2DeviceImpl::getTemperatureReport, &result, data))
- {
- return false;
- }
+ bool result;
+ if (!GetManagerImpl()->GetThreadQueue()->
+ PushCallAndWaitResult(this, &Sensor2DeviceImpl::getAllTemperatureReports, &result, data))
+ {
+ return false;
+ }
- return result;
+ return result;
}
-bool Sensor2DeviceImpl::GetAllTemperatureReports(Array<Array<TemperatureReport> >* data)
+bool Sensor2DeviceImpl::getAllTemperatureReports(Array<Array<TemperatureReport> >* data)
{
- Lock::Locker lock(&IndexedReportLock);
-
TemperatureReport t;
- bool result = GetTemperatureReport(&t);
+ bool result = getTemperatureReport(&t);
if (!result)
return false;
@@ -759,7 +760,7 @@ bool Sensor2DeviceImpl::GetAllTemperatureReports(Array<Array<TemperatureReport>
for (int i = 0; i < bins; i++)
for (int j = 0; j < samples; j++)
{
- result = GetTemperatureReport(&t);
+ result = getTemperatureReport(&t);
if (!result)
return false;
OVR_ASSERT(t.NumBins == bins && t.NumSamples == samples);
@@ -769,19 +770,6 @@ bool Sensor2DeviceImpl::GetAllTemperatureReports(Array<Array<TemperatureReport>
return true;
}
-bool Sensor2DeviceImpl::getTemperatureReport(TemperatureReport* data)
-{
- TemperatureImpl ti;
- if (GetInternalDevice()->GetFeatureReport(ti.Buffer, TemperatureImpl::PacketSize))
- {
- ti.Unpack();
- *data = ti.Settings;
- return true;
- }
-
- return false;
-}
-
bool Sensor2DeviceImpl::GetGyroOffsetReport(GyroOffsetReport* data)
{
// direct call if we are already on the device manager thread
@@ -1125,4 +1113,12 @@ double Sensor2DeviceImpl::OnTicks(double tickSeconds)
return NextKeepAliveTickSeconds - tickSeconds;
}
+/*
+// TBD: don't report calibration for now, until we figure out the logic between camera and mag yaw correction
+bool Sensor2DeviceImpl::IsMagCalibrated()
+{
+ return pCalibration->IsMagCalibrated();
+}
+*/
+
} // namespace OVR