From 191e7d62696ea8d862c756dc2e661a57c9859adc Mon Sep 17 00:00:00 2001 From: quic_zhozhan Date: Mon, 17 Jul 2023 14:10:07 +0800 Subject: [PATCH] xrt: Add OPPO MR controller --- src/xrt/auxiliary/bindings/bindings.json | 134 +++++++++++++++++++++++ src/xrt/include/xrt/xrt_defines.h | 23 ++++ 2 files changed, 157 insertions(+) diff --git a/src/xrt/auxiliary/bindings/bindings.json b/src/xrt/auxiliary/bindings/bindings.json index 506cf6272..64c9873a5 100644 --- a/src/xrt/auxiliary/bindings/bindings.json +++ b/src/xrt/auxiliary/bindings/bindings.json @@ -1569,6 +1569,140 @@ } } } + }, + + "/interaction_profiles/oppo/mr_controller_oppo": { + "title": "OPPO MR Controller", + "type": "tracked_controller", + "monado_device": "XRT_DEVICE_OPPO_MR_CONTROLLER", + "subaction_paths": [ + "/user/hand/left", + "/user/hand/right" + ], + "subpaths": { + "/input/x": { + "type": "button", + "localized_name": "X", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_OPPO_MR_X_CLICK", + "touch": "XRT_INPUT_OPPO_MR_X_TOUCH" + } + }, + "/input/y": { + "type": "button", + "localized_name": "Y", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_OPPO_MR_Y_CLICK", + "touch": "XRT_INPUT_OPPO_MR_Y_TOUCH" + } + }, + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_OPPO_MR_MENU_CLICK" + } + }, + "/input/heartrate_oppo": { + "type": "heartrate", + "localized_name": "HeartRate", + "components": ["value"], + "side": "left", + "monado_bindings": { + "value": "XRT_INPUT_OPPO_MR_HEART_RATE_VALUE" + } + }, + "/input/a": { + "type": "button", + "localized_name": "A", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_OPPO_MR_A_CLICK", + "touch": "XRT_INPUT_OPPO_MR_A_TOUCH" + } + }, + "/input/b": { + "type": "button", + "localized_name": "B", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_OPPO_MR_B_CLICK", + "touch": "XRT_INPUT_OPPO_MR_B_TOUCH" + } + }, + "/input/home": { + "type": "button", + "localized_name": "Home", + "components": ["click"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_OPPO_MR_HOME_CLICK" + } + }, + "/input/squeeze": { + "type": "trigger", + "localized_name": "Squeeze", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_OPPO_MR_SQUEEZE_VALUE" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["touch", "value"], + "monado_bindings": { + "touch": "XRT_INPUT_OPPO_MR_TRIGGER_TOUCH", + "value": "XRT_INPUT_OPPO_MR_TRIGGER_VALUE" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_OPPO_MR_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_OPPO_MR_AIM_POSE" + } + }, + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "touch", "position"], + "dpad_emulation": { + "position": "position", + "center": false + }, + "monado_bindings": { + "click": "XRT_INPUT_OPPO_MR_THUMBSTICK_CLICK", + "touch": "XRT_INPUT_OPPO_MR_THUMBSTICK_TOUCH", + "position": "XRT_INPUT_OPPO_MR_THUMBSTICK" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_OPPO_MR_HAPTIC" + } + } + } } } } diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h index 6743e855a..adf2244e3 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -629,6 +629,7 @@ enum xrt_device_name XRT_DEVICE_HP_REVERB_G2_CONTROLLER, XRT_DEVICE_SAMSUNG_ODYSSEY_CONTROLLER, XRT_DEVICE_ML2_CONTROLLER, + XRT_DEVICE_OPPO_MR_CONTROLLER, XRT_DEVICE_HAND_INTERACTION, @@ -980,6 +981,26 @@ enum xrt_input_name XRT_INPUT_HAND_PINCH_READY = XRT_INPUT_NAME(0x0406, BOOLEAN), XRT_INPUT_HAND_AIM_ACTIVATE_READY = XRT_INPUT_NAME(0x0407, BOOLEAN), XRT_INPUT_HAND_GRASP_READY = XRT_INPUT_NAME(0x0408, BOOLEAN), + + XRT_INPUT_OPPO_MR_X_CLICK = XRT_INPUT_NAME(0x0500, BOOLEAN), + XRT_INPUT_OPPO_MR_X_TOUCH = XRT_INPUT_NAME(0x0501, BOOLEAN), + XRT_INPUT_OPPO_MR_Y_CLICK = XRT_INPUT_NAME(0x0502, BOOLEAN), + XRT_INPUT_OPPO_MR_Y_TOUCH = XRT_INPUT_NAME(0x0503, BOOLEAN), + XRT_INPUT_OPPO_MR_MENU_CLICK = XRT_INPUT_NAME(0x0504, BOOLEAN), + XRT_INPUT_OPPO_MR_HEART_RATE_VALUE = XRT_INPUT_NAME(0x0505, VEC1_ZERO_TO_ONE), + XRT_INPUT_OPPO_MR_A_CLICK = XRT_INPUT_NAME(0x0506, BOOLEAN), + XRT_INPUT_OPPO_MR_A_TOUCH = XRT_INPUT_NAME(0x0507, BOOLEAN), + XRT_INPUT_OPPO_MR_B_CLICK = XRT_INPUT_NAME(0x0508, BOOLEAN), + XRT_INPUT_OPPO_MR_B_TOUCH = XRT_INPUT_NAME(0x0509, BOOLEAN), + XRT_INPUT_OPPO_MR_HOME_CLICK = XRT_INPUT_NAME(0x050A, BOOLEAN), + XRT_INPUT_OPPO_MR_SQUEEZE_VALUE = XRT_INPUT_NAME(0x050B, VEC1_ZERO_TO_ONE), + XRT_INPUT_OPPO_MR_TRIGGER_TOUCH = XRT_INPUT_NAME(0x050C, BOOLEAN), + XRT_INPUT_OPPO_MR_TRIGGER_VALUE = XRT_INPUT_NAME(0x050D, VEC1_ZERO_TO_ONE), + XRT_INPUT_OPPO_MR_GRIP_POSE = XRT_INPUT_NAME(0x050E, POSE), + XRT_INPUT_OPPO_MR_AIM_POSE = XRT_INPUT_NAME(0x050F, POSE), + XRT_INPUT_OPPO_MR_THUMBSTICK_CLICK = XRT_INPUT_NAME(0x0510, BOOLEAN), + XRT_INPUT_OPPO_MR_THUMBSTICK_TOUCH = XRT_INPUT_NAME(0x0511, BOOLEAN), + XRT_INPUT_OPPO_MR_THUMBSTICK = XRT_INPUT_NAME(0x0512, VEC2_MINUS_ONE_TO_ONE), // clang-format on }; @@ -1159,6 +1180,8 @@ enum xrt_output_name XRT_OUTPUT_NAME_PSSENSE_VIBRATION = XRT_OUTPUT_NAME(0x00C0, VIBRATION), XRT_OUTPUT_NAME_VIVE_TRACKER_HAPTIC = XRT_OUTPUT_NAME(0x00D0, VIBRATION), + + XRT_OUTPUT_NAME_OPPO_MR_HAPTIC = XRT_OUTPUT_NAME(0x00E0, VIBRATION), // clang-format on };