| 3 | ControllerDevice::ControllerDevice(vr::ETrackedControllerRole role) : role_(role), device_id_(vr::k_unTrackedDeviceIndexInvalid) {}; |
| 4 | |
| 5 | vr::EVRInitError ControllerDevice::Activate(uint32_t unObjectId) { |
| 6 | vr::VRDriverLog()->Log("ControllerDevice::Activate"); |
| 7 | |
| 8 | const vr::PropertyContainerHandle_t container = vr::VRProperties()->TrackedDeviceToPropertyContainer(unObjectId); |
| 9 | vr::VRProperties()->SetInt32Property(container, vr::Prop_ControllerRoleHint_Int32, role_); |
| 10 | |
| 11 | vr::VRProperties()->SetStringProperty(container, vr::Prop_ModelNumber_String, "MySampleControllerModel_1"); |
| 12 | |
| 13 | vr::VRProperties()->SetStringProperty(container, vr::Prop_InputProfilePath_String, |
| 14 | "{sample}/resources/input/sample_profile.json"); |
| 15 | |
| 16 | vr::VRDriverInput()->CreateBooleanComponent(container, "/input/a/click", &input_handles_[kInputHandle_A_click]); |
| 17 | vr::VRDriverInput()->CreateBooleanComponent(container, "/input/a/touch", &input_handles_[kInputHandle_A_touch]); |
| 18 | |
| 19 | vr::VRDriverInput()->CreateScalarComponent(container, "/input/trigger/value", &input_handles_[kInputHandle_trigger_value], |
| 20 | vr::VRScalarType_Absolute, vr::VRScalarUnits_NormalizedOneSided); |
| 21 | vr::VRDriverInput()->CreateBooleanComponent(container, "/input/trigger/click", &input_handles_[kInputHandle_trigger_click]); |
| 22 | |
| 23 | vr::VRDriverInput()->CreateScalarComponent(container, "/input/joystick/x", &input_handles_[kInputHandle_joystick_x], |
| 24 | vr::VRScalarType_Absolute, vr::VRScalarUnits_NormalizedTwoSided); |
| 25 | vr::VRDriverInput()->CreateScalarComponent(container, "/input/joystick/y", &input_handles_[kInputHandle_joystick_y], |
| 26 | vr::VRScalarType_Absolute, vr::VRScalarUnits_NormalizedTwoSided); |
| 27 | vr::VRDriverInput()->CreateBooleanComponent(container, "/input/joystick/click", &input_handles_[kInputHandle_joystick_click]); |
| 28 | |
| 29 | vr::VRDriverInput()->CreateHapticComponent(container, "/output/haptic", &input_handles_[kInputHandle_haptic]); |
| 30 | |
| 31 | device_id_ = unObjectId; |
| 32 | return vr::VRInitError_None; |
| 33 | } |
| 34 | |
| 35 | void ControllerDevice::RunFrame() { |
| 36 | vr::VRServerDriverHost()->TrackedDevicePoseUpdated(device_id_, GetPose(), sizeof(vr::DriverPose_t)); |
nothing calls this directly
no test coverage detected