Events¶
System Events¶
VIVE Wave™ XR plugin defines system events in the native package (refer to Wave XR Plugin Packages) as below:
public enum WVR_EventType
{
/** common event region */
WVR_EventType_Quit = 1000, /**< Application Quit. */
WVR_EventType_SystemInteractionModeChanged = 1001, /**< @ref WVR_InteractionMode changed; using @ref WVR_GetInteractionMode to get interaction mode. */
WVR_EventType_SystemGazeTriggerTypeChanged = 1002, /**< @ref WVR_GazeTriggerType changed; using @ref WVR_GetGazeTriggerType to get gaze trigger type. */
WVR_EventType_TrackingModeChanged = 1003, /**< Notification of changing tracking mode (3 Dof/6 Dof); using @ref WVR_GetDegreeOfFreedom can get current tracking mode.*/
WVR_EventType_RecommendedQuality_Lower = 1004, /**< Notification recommended quality to Lower from runtime. */
WVR_EventType_RecommendedQuality_Higher = 1005, /**< Notification recommended quality to Higher from runtime. */
WVR_EventType_HandGesture_Changed = 1006, /**< Notification gesture changed. */
WVR_EventType_HandGesture_Abnormal = 1007, /**< Notification gesture abnormal. */
WVR_EventType_HandTracking_Abnormal = 1008, /**< Notification hand tracking abnormal. */
WVR_EventType_ArenaChanged = 1009, /**< Notification arena changed. */
WVR_EventType_RenderingToBePaused = 1010,
WVR_EventType_RenderingToBeResumed = 1011,
WVR_EventType_DeviceConnected = 2000, /**< @ref WVR_DeviceType connected. */
WVR_EventType_DeviceDisconnected = 2001, /**< @ref WVR_DeviceType disconnected. */
WVR_EventType_DeviceStatusUpdate = 2002, /**< @ref WVR_DeviceType configure changed. */
WVR_EventType_DeviceSuspend = 2003, /**< When user takes off HMD*/
WVR_EventType_DeviceResume = 2004, /**< When user puts on HMD*/
WVR_EventType_IpdChanged = 2005, /**< The interpupillary distance has been changed; using @ref WVR_GetRenderProps can get current ipd. */
WVR_EventType_DeviceRoleChanged = 2006, /**< @ref WVR_DeviceType controller roles are switched. */
WVR_EventType_BatteryStatusUpdate = 2007, /**< @ref WVR_DeviceType the battery status of device has changed; using @ref WVR_GetBatteryStatus to check the current status of the battery. */
WVR_EventType_ChargeStatusUpdate = 2008, /**< @ref WVR_DeviceType the charged status of device has changed; using @ref WVR_GetChargeStatus to check the current status of the battery in use. */
WVR_EventType_DeviceErrorStatusUpdate = 2009, /**< @ref WVR_DeviceType device occurs some warning; using @ref WVR_GetDeviceErrorState to get the current error status from device service. */
WVR_EventType_BatteryTemperatureStatusUpdate = 2010, /**< @ref WVR_DevcieType battery temperature of device has changed; using @ref WVR_GetBatteryTemperatureStatus to get the current battery temperature. */
WVR_EventType_RecenterSuccess = 2011, /**< Notification of recenter success for 6 DoF device*/
WVR_EventType_RecenterFail = 2012, /**< Notification of recenter fail for 6 DoF device*/
WVR_EventType_RecenterSuccess3DoF = 2013, /**< Notification of recenter success for 3 DoF device*/
WVR_EventType_RecenterFail3DoF = 2014, /**< Notification of recenter fail for 3 DoF device*/
WVR_EventType_ClearHmdTrackingMapDone = 2015, /**< Notification of the finish of clearing operation of HMD tracking map from device service*/
WVR_EventType_InputDevMappingChanged = 2016, /**< Notification for input device mapping table changed.*/
WVR_EventType_BatteryPercentageUpdate = 2017, /**< Notification for battery percentage update.*/
WVR_EventType_DeviceInfoUpdate = 2018,
WVR_EventType_PassThroughOverlayShownBySystem = 2100, /**< Notification for passthrough overlay is shown by the system.*/
WVR_EventType_PassThroughOverlayHiddenBySystem = 2101, /**< Notification for passthrough overlay is hidden by the system. */
WVR_EventType_ControllerPoseModeChanged = 2102,
WVR_EventType_ControllerPoseModeOffsetReady = 2103,
/** Input Event region */
WVR_EventType_ButtonPressed = 3000, /**< @ref WVR_InputId status change to pressed. */
WVR_EventType_ButtonUnpressed = 3001, /**< @ref WVR_InputId status change to unpressed */
WVR_EventType_TouchTapped = 3002, /**< @ref WVR_InputId status change to touched. */
WVR_EventType_TouchUntapped = 3003, /**< @ref WVR_InputId status change to untouched. */
WVR_EventType_LeftToRightSwipe = 3004, /**< Notification of swipe motion (move Left to Right) on touchpad */
WVR_EventType_RightToLeftSwipe = 3005, /**< Notification of swipe motion (move Right to Left) on touchpad */
WVR_EventType_DownToUpSwipe = 3006, /**< Notification of swipe motion (move Down to Up) on touchpad */
WVR_EventType_UpToDownSwipe = 3007, /**< Notification of swipe motion (move Up to Down) on touchpad */
/** Accessory events region */
WVR_EventType_TrackerConnected = 4000, /**< @ref WVR_TrackerId is connected. */
WVR_EventType_TrackerDisconnected = 4001, /**< @ref WVR_TrackerId is disconnected. */
WVR_EventType_TrackerBatteryLevelUpdate = 4002, /**< The battery level of @ref WVR_TrackerId has changed. Use @ref WVR_GetAcceBatteryLevel to check the current battery level. */
/** Input Event of the accessory region */
WVR_EventType_TrackerButtonPressed = 5000, /**< @ref WVR_InputId status of @ref WVR_TrackerId changed to pressed. */
WVR_EventType_TrackerButtonUnpressed = 5001, /**< @ref WVR_InputId status of @ref WVR_TrackerId changed to not pressed */
WVR_EventType_TrackerTouchTapped = 5002, /**< @ref WVR_InputId status of @ref WVR_TrackerId changed to touched. */
WVR_EventType_TrackerTouchUntapped = 5003, /**< @ref WVR_InputId status of @ref WVR_TrackerId changed to untouched. */
}
You can listen to a “button pressed” system event by using the following code:
using Wave.Native;
using Wave.Essence;
void OnEnable()
{
SystemEvent.Listen(WVR_EventType.WVR_EventType_ButtonPressed, OnEventButtonPressed);
}
void OnDisable()
{
SystemEvent.Remove(WVR_EventType.WVR_EventType_ButtonPressed, OnEventButtonPressed);
}
private void OnEventButtonPressed(WVR_Event_t systemEvent)
{
Debug.Log("OnEventButtonPressed() " + systemEvent.device.type + ", " + systemEvent.input.inputId);
}