float OSVRTrackedDeviceHandR::GetFloatTrackedDeviceProperty(vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError* error) { const float default_value = 0.0f; if (isWrongDataType(prop, float())) { if (error) *error = vr::TrackedProp_WrongDataType; return default_value; } if (isWrongDeviceClass(prop, deviceClass_)) { if (error) *error = vr::TrackedProp_WrongDeviceClass; return default_value; } if (vr::TrackedDeviceClass_Invalid == deviceClass_) { if (error) *error = vr::TrackedProp_InvalidDevice; return default_value; } #include "ignore-warning/push" #include "ignore-warning/switch-enum" if (logDebugProps) { const std::string msg = "OSVRTrackedDeviceHandR::GetFloatTrackedDeviceProperty(): Requested property: " + std::to_string(prop) + "\n"; logger_->Log(msg.c_str()); } switch (prop) { case vr::Prop_SecondsFromVsyncToPhotons_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayFrequency_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_UserIpdMeters_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_UserHeadToEyeDepthMeters_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FieldOfViewLeftDegrees_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FieldOfViewRightDegrees_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FieldOfViewTopDegrees_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FieldOfViewBottomDegrees_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_TrackingRangeMinimumMeters_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_TrackingRangeMaximumMeters_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; } #include "ignore-warning/pop" if (error) *error = vr::TrackedProp_UnknownProperty; return default_value; }
int32_t OSVRTrackedDeviceHandR::GetInt32TrackedDeviceProperty(vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError* error) { const int32_t default_value = 0; if (isWrongDataType(prop, int32_t())) { if (error) *error = vr::TrackedProp_WrongDataType; return default_value; } if (isWrongDeviceClass(prop, deviceClass_)) { if (error) *error = vr::TrackedProp_WrongDeviceClass; return default_value; } if (vr::TrackedDeviceClass_Invalid == deviceClass_) { if (error) *error = vr::TrackedProp_InvalidDevice; return default_value; } #include "ignore-warning/push" #include "ignore-warning/switch-enum" if (logDebugProps) { const std::string msg = "OSVRTrackedDeviceHandR::GetInt32TrackedDeviceProperty(): Requested property: " + std::to_string(prop) + "\n"; logger_->Log(msg.c_str()); } switch (prop) { case vr::Prop_DeviceClass_Int32: if (error) *error = vr::TrackedProp_Success; return deviceClass_; case vr::Prop_Axis0Type_Int32: // TODO if (error) *error = vr::TrackedProp_Success; return vr::EVRControllerAxisType::k_eControllerAxis_Joystick; case vr::Prop_Axis1Type_Int32: // TODO if (error) *error = vr::TrackedProp_Success; return vr::EVRControllerAxisType::k_eControllerAxis_Trigger; case vr::Prop_Axis2Type_Int32: // TODO if (error) *error = vr::TrackedProp_Success; return vr::EVRControllerAxisType::k_eControllerAxis_None; case vr::Prop_Axis3Type_Int32: // TODO if (error) *error = vr::TrackedProp_Success; return vr::EVRControllerAxisType::k_eControllerAxis_None; case vr::Prop_Axis4Type_Int32: // TODO if (error) *error = vr::TrackedProp_Success; return vr::EVRControllerAxisType::k_eControllerAxis_None; } #include "ignore-warning/pop" if (error) *error = vr::TrackedProp_UnknownProperty; return default_value; }
bool OSVRTrackedDeviceHandR::GetBoolTrackedDeviceProperty(vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError* error) { const bool default_value = false; if (isWrongDataType(prop, bool())) { if (error) *error = vr::TrackedProp_WrongDataType; return default_value; } if (isWrongDeviceClass(prop, deviceClass_)) { if (error) *error = vr::TrackedProp_WrongDeviceClass; return default_value; } if (vr::TrackedDeviceClass_Invalid == deviceClass_) { if (error) *error = vr::TrackedProp_InvalidDevice; return default_value; } #include "ignore-warning/push" #include "ignore-warning/switch-enum" if (logDebugProps) { const std::string msg = "OSVRTrackedDeviceHandR::GetBoolTrackedDeviceProperty(): Requested property: " + std::to_string(prop) + "\n"; logger_->Log(msg.c_str()); } switch (prop) { case vr::Prop_WillDriftInYaw_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_ReportsTimeSinceVSync_Bool: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; break; case vr::Prop_IsOnDesktop_Bool: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; break; case vr::Prop_HasCamera_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_Firmware_UpdateAvailable_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_DeviceProvidesBatteryStatus_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_DeviceCanPowerOff_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_BlockServerShutdown_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_ContainsProximitySensor_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; } #include "ignore-warning/pop" if (error) *error = vr::TrackedProp_UnknownProperty; return default_value; }
uint64_t OSVRTrackedDevice::GetUint64TrackedDeviceProperty(vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError* error) { const uint64_t default_value = 0; if (isWrongDataType(prop, uint64_t())) { if (error) *error = vr::TrackedProp_WrongDataType; return default_value; } if (isWrongDeviceClass(prop, deviceClass_)) { if (error) *error = vr::TrackedProp_WrongDeviceClass; return default_value; } if (vr::TrackedDeviceClass_Invalid == deviceClass_) { if (error) *error = vr::TrackedProp_InvalidDevice; return default_value; } #include "ignore-warning/push" #include "ignore-warning/switch-enum" #ifdef VERBOSE_LOGGING const std::string msg = "OSVRTrackedDevice::GetUint64TrackedDeviceProperty(): Requested property: " + std::to_string(prop) + "\n"; logger_->Log(msg.c_str()); #endif switch (prop) { // General properties that apply to all device classes case vr::Prop_HardwareRevision_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FirmwareVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FPGAVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_VRCVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_RadioVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DongleVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; // Properties that are unique to TrackedDeviceClass_HMD case vr::Prop_CurrentUniverseId_Uint64: if (error) *error = vr::TrackedProp_Success; return 0; case vr::Prop_PreviousUniverseId_Uint64: if (error) *error = vr::TrackedProp_Success; return 0; case vr::Prop_DisplayFirmwareVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_CameraFirmwareVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayFPGAVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayBootloaderVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayHardwareVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_AudioFirmwareVersion_Uint64: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; // Properties that are unique to TrackedDeviceClass_Controller case vr::Prop_SupportedButtons_Uint64: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; } #include "ignore-warning/pop" if (error) *error = vr::TrackedProp_UnknownProperty; return default_value; }
int32_t OSVRTrackedDevice::GetInt32TrackedDeviceProperty(vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError* error) { const int32_t default_value = 0; if (isWrongDataType(prop, int32_t())) { if (error) *error = vr::TrackedProp_WrongDataType; return default_value; } if (isWrongDeviceClass(prop, deviceClass_)) { if (error) *error = vr::TrackedProp_WrongDeviceClass; return default_value; } if (vr::TrackedDeviceClass_Invalid == deviceClass_) { if (error) *error = vr::TrackedProp_InvalidDevice; return default_value; } #include "ignore-warning/push" #include "ignore-warning/switch-enum" #ifdef VERBOSE_LOGGING const std::string msg = "OSVRTrackedDevice::GetInt32TrackedDeviceProperty(): Requested property: " + std::to_string(prop) + "\n"; logger_->Log(msg.c_str()); #endif switch (prop) { // General properties that apply to all device classes case vr::Prop_DeviceClass_Int32: if (error) *error = vr::TrackedProp_Success; return deviceClass_; // Properties that are unique to TrackedDeviceClass_HMD case vr::Prop_DisplayMCType_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_EdidVendorID_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_EdidProductID_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayGCType_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_CameraCompatibilityMode_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; // Properties that are unique to TrackedDeviceClass_Controller case vr::Prop_Axis0Type_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_Axis1Type_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_Axis2Type_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_Axis3Type_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_Axis4Type_Int32: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; } #include "ignore-warning/pop" if (error) *error = vr::TrackedProp_UnknownProperty; return default_value; }
float OSVRTrackedDevice::GetFloatTrackedDeviceProperty(vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError* error) { const float default_value = 0.0f; if (isWrongDataType(prop, float())) { if (error) *error = vr::TrackedProp_WrongDataType; return default_value; } if (isWrongDeviceClass(prop, deviceClass_)) { if (error) *error = vr::TrackedProp_WrongDeviceClass; return default_value; } if (vr::TrackedDeviceClass_Invalid == deviceClass_) { if (error) *error = vr::TrackedProp_InvalidDevice; return default_value; } #include "ignore-warning/push" #include "ignore-warning/switch-enum" #ifdef VERBOSE_LOGGING const std::string msg = "OSVRTrackedDevice::GetFloatTrackedDeviceProperty(): Requested property: " + std::to_string(prop) + "\n"; logger_->Log(msg.c_str()); #endif switch (prop) { // General properties that apply to all device classes case vr::Prop_DeviceBatteryPercentage_Float: if (error) *error = vr::TrackedProp_Success; return 1.0f; // full battery // Properties that are unique to TrackedDeviceClass_HMD case vr::Prop_SecondsFromVsyncToPhotons_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayFrequency_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_UserIpdMeters_Float: if (error) *error = vr::TrackedProp_Success; return GetIPD(); case vr::Prop_DisplayMCOffset_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayMCScale_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayGCBlackClamp_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayGCOffset_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayGCScale_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_DisplayGCPrescale_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_LensCenterLeftU_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_LensCenterLeftV_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_LensCenterRightU_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_LensCenterRightV_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_UserHeadToEyeDepthMeters_Float: if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; // Properties that are unique to TrackedDeviceClass_TrackingReference case vr::Prop_FieldOfViewLeftDegrees_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FieldOfViewRightDegrees_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FieldOfViewTopDegrees_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_FieldOfViewBottomDegrees_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_TrackingRangeMinimumMeters_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; case vr::Prop_TrackingRangeMaximumMeters_Float: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; } #include "ignore-warning/pop" if (error) *error = vr::TrackedProp_UnknownProperty; return default_value; }
bool OSVRTrackedDevice::GetBoolTrackedDeviceProperty(vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError* error) { const bool default_value = false; if (isWrongDataType(prop, bool())) { if (error) *error = vr::TrackedProp_WrongDataType; return default_value; } if (isWrongDeviceClass(prop, deviceClass_)) { if (error) *error = vr::TrackedProp_WrongDeviceClass; return default_value; } if (vr::TrackedDeviceClass_Invalid == deviceClass_) { if (error) *error = vr::TrackedProp_InvalidDevice; return default_value; } #include "ignore-warning/push" #include "ignore-warning/switch-enum" #ifdef VERBOSE_LOGGING const std::string msg = "OSVRTrackedDevice::GetBoolTrackedDeviceProperty(): Requested property: " + std::to_string(prop) + "\n"; logger_->Log(msg.c_str()); #endif switch (prop) { // Properties that apply to all device classes case vr::Prop_WillDriftInYaw_Bool: if (error) *error = vr::TrackedProp_Success; return true; break; case vr::Prop_DeviceIsWireless_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_DeviceIsCharging_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_Firmware_UpdateAvailable_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_Firmware_ManualUpdate_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_BlockServerShutdown_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_CanUnifyCoordinateSystemWithHmd_Bool: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; break; case vr::Prop_ContainsProximitySensor_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_DeviceProvidesBatteryStatus_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; case vr::Prop_DeviceCanPowerOff_Bool: if (error) *error = vr::TrackedProp_Success; return true; break; case vr::Prop_HasCamera_Bool: if (error) *error = vr::TrackedProp_Success; return false; break; // Properties that apply to HMDs case vr::Prop_ReportsTimeSinceVSync_Bool: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; break; case vr::Prop_IsOnDesktop_Bool: // TODO if (error) *error = vr::TrackedProp_ValueNotProvidedByDevice; return default_value; break; } #include "ignore-warning/pop" if (error) *error = vr::TrackedProp_UnknownProperty; return default_value; }