bool Sensor2DeviceImpl::GetGyroOffsetReport(GyroOffsetReport* data) { // direct call if we are already on the device manager thread if (GetCurrentThreadId() == GetManagerImpl()->GetThreadId()) { return getGyroOffsetReport(data); } bool result; if (!GetManagerImpl()->GetThreadQueue()-> PushCallAndWaitResult(this, &Sensor2DeviceImpl::getGyroOffsetReport, &result, data)) { return false; } return result; }
bool Sensor2DeviceImpl::GetAllTemperatureReports(Array<Array<TemperatureReport> >* data) { // direct call if we are already on the device manager thread if (GetCurrentThreadId() == GetManagerImpl()->GetThreadId()) { return getAllTemperatureReports(data); } bool result; if (!GetManagerImpl()->GetThreadQueue()-> PushCallAndWaitResult(this, &Sensor2DeviceImpl::getAllTemperatureReports, &result, data)) { return false; } return result; }
bool Sensor2DeviceImpl::SetTemperatureReport(const TemperatureReport& data) { // direct call if we are already on the device manager thread if (GetCurrentThreadId() == GetManagerImpl()->GetThreadId()) { return setTemperatureReport(data); } bool result; if (!GetManagerImpl()->GetThreadQueue()-> PushCallAndWaitResult(this, &Sensor2DeviceImpl::setTemperatureReport, &result, data)) { return false; } return result; }
bool Sensor2DeviceImpl::GetKeepAliveMuxReport(KeepAliveMuxReport* data) { bool result; if (!GetManagerImpl()->GetThreadQueue()-> PushCallAndWaitResult(this, &Sensor2DeviceImpl::getKeepAliveMuxReport, &result, data)) { return false; } return result; }
bool Sensor2DeviceImpl::SetUUIDReport(const UUIDReport& data) { bool result; if (!GetManagerImpl()->GetThreadQueue()-> PushCallAndWaitResult(this, &Sensor2DeviceImpl::setUUIDReport, &result, data)) { return false; } return result; }
bool Sensor2DeviceImpl::GetAllPositionCalibrationReports(Array<PositionCalibrationReport>* data) { bool result; if (!GetManagerImpl()->GetThreadQueue()-> PushCallAndWaitResult(this, &Sensor2DeviceImpl::getAllPositionCalibrationReports, &result, data)) { return false; } return result; }
Profile* HMDDeviceCreateDesc::GetProfileAddRef() const { // Create device may override profile name, so get it from there is possible. ProfileManager* profileManager = GetManagerImpl()->GetProfileManager(); ProfileType profileType = GetProfileType(); const char * profileName = pDevice ? ((HMDDevice*)pDevice)->GetProfileName() : profileManager->GetDefaultProfileName(profileType); return profileName ? profileManager->LoadProfile(profileType, profileName) : profileManager->GetDeviceDefaultProfile(profileType); }
void DeviceCreateDesc::Release() { while(1) { UInt32 handleCount = HandleCount; // HandleCount must obviously be >= 1, since we are releasing it. OVR_ASSERT(handleCount > 0); // {1 -> 0} transition may cause us to be destroyed, so require a lock. if (handleCount == 1) { Ptr<DeviceManagerLock> lockKeepAlive; Lock::Locker deviceLockScope(GetLock()); if (!HandleCount.CompareAndSet_NoSync(handleCount, 0)) continue; OVR_ASSERT(pDevice == 0); // Destroy *this if the manager was destroyed already, or Enumerated // is false (device no longer available). if (!GetManagerImpl() || !Enumerated) { lockKeepAlive = pLock; // Remove from manager list (only matters for !Enumerated). if (pNext) { RemoveNode(); pNext = pPrev = 0; } delete this; } // Available DeviceCreateDesc may survive with { HandleCount == 0 }, // in case it might be enumerated again later. break; } else if (HandleCount.CompareAndSet_NoSync(handleCount, handleCount-1)) { break; } } }