WaveVR System Events

Contents

Introduction

Important: do NOT use API WVR_PollEventQueue, we provide broadcast of events those can be used for developers.

In WaveVR, there are some system events can be received in Unity.

enum WVR_EventType

event type

Values:

WVR_EventType_Quit = 1000

common event region Application Quit.

WVR_EventType_SystemInteractionModeChanged = 1001

WVR_InteractionMode changed; using WVR_GetInteractionMode to get interaction mode.

WVR_EventType_SystemGazeTriggerTypeChanged = 1002

WVR_GazeTriggerType changed; using WVR_GetGazeTriggerType to get gaze trigger type.

WVR_EventType_TrackingModeChanged = 1003

Notification of changing tracking mode (3 Dof/6 Dof); using WVR_GetDegreeOfFreedom can get current tracking mode.

WVR_EventType_DeviceConnected = 2000

Device events region WVR_DeviceType connected.

WVR_EventType_DeviceDisconnected = 2001

WVR_DeviceType disconnected.

WVR_EventType_DeviceStatusUpdate = 2002

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 WVR_GetRenderProps can get current ipd.

WVR_EventType_DeviceRoleChanged = 2006

WVR_DeviceType controller roles are switched.

WVR_EventType_BatteryStatusUpdate = 2007

WVR_DeviceType the battery status of device has changed; using WVR_GetBatteryStatus to check the current status of the battery.

WVR_EventType_ChargeStatusUpdate = 2008

WVR_DeviceType the charged status of device has changed; using WVR_GetChargeStatus to check the current status of the battery in use.

WVR_EventType_DeviceErrorStatusUpdate = 2009

WVR_DeviceType device occurs some warning; using WVR_GetDeviceErrorState to get the current error status from device service.

WVR_EventType_BatteryTemperatureStatusUpdate = 2010

WVR_DevcieType battery temperature of device has changed; using 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_ButtonPressed = 3000

Input Event region WVR_InputId status change to pressed.

WVR_EventType_ButtonUnpressed = 3001

WVR_InputId status change to unpressed

WVR_EventType_TouchTapped = 3002

WVR_InputId status change to touched.

WVR_EventType_TouchUntapped = 3003

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

All Events

In MonoBehaviour script, use sample code below to listen to broadcasts of events:

void OnEnable()
{   // Listen to event
    WaveVR_Utils.Event.Listen (WaveVR_Utils.Event.ALL_VREVENT, OnEvent);
}

/// Event handling function
void OnEvent(params object[] args)
{
    WVR_Event_t _event = (WVR_Event_t)args[0];
    // Check the event, e.g. WVR_EventType_RecenterSuccess
    if (_event.common.type == WVR_EventType.WVR_EventType_RecenterSuccess)
    {
    }
}

DPad Operation Events

Developer can listen to ALL_VREVENT to check DPad operation events.

Here introducing another broadcast for DPad operation evetns.

Description

  • WVR_EventType_LeftToRightSwipe: triggered when swiping from left to right on touchpad.
  • WVR_EventType_RightToLeftSwipe: triggered when swiping from right to left on touchpad.
  • WVR_EventType_DownToUpSwipe: triggered when swiping from down to up on touchpad.
  • WVR_EventType_UpToDownSwipe: triggered when swiping from up to down on touchpad.

Resources

Sample scene Event_Test is located under Assets/Samples/Event_Test

Sample script Event_Test.cs is located under Assets/Samples/Event_Test

Sample Code

Event_Test listens to broadcast SWIPE_EVENT

void OnEnable()
{
    WaveVR_Utils.Event.Listen ("SWIPE_EVENT", OnEvent);
}

void OnDisable()
{
    WaveVR_Utils.Event.Remove ("SWIPE_EVENT", OnEvent);
}

After receiving event, handling event in OnEvent.

switch (_event)
{
case WVR_EventType.WVR_EventType_LeftToRightSwipe:
    transform.Rotate (0, 180 * (10 * Time.deltaTime), 0);
    break;
case WVR_EventType.WVR_EventType_RightToLeftSwipe:
    transform.Rotate (0, -180 * (10 * Time.deltaTime), 0);
    break;
case WVR_EventType.WVR_EventType_DownToUpSwipe:
    transform.Rotate (0, 0, 180 * (10 * Time.deltaTime));
    break;
case WVR_EventType.WVR_EventType_UpToDownSwipe:
    transform.Rotate (0, 0, -180 * (10 * Time.deltaTime));
    break;
}