WVR_PollEventQueue¶
-
WVR_EXPORT bool WVR_PollEventQueue(WVR_Event_t * event)
Function to get the next event in the event queue.
- Return
- True means fill the event struct with the next event in the queue; false means there are no events in the queue
- Version
- API Level 1
- Parameters
event
: A struct of the event information
The Wave SDK has 4 categories for WVR_Event
-
union
WVR_Event
¶ - #include <wvr_events.h>
WVR_Event is an event type that is designed as a union type to provide an efficient way of using the same memory location for different event types. Developers can get the same member type to know the retrieved event belongs to which WVR_Event type, then get the specific memory region.
- WVR_CommonEvent
-
struct
WVR_CommonEvent
¶ Common Event that includes WVR_EventType and timestamp.
- WVR_DeviceEvent
-
struct
WVR_DeviceEvent
¶ Device Event that includes WVR_EventType, timestamp, and WVR_DeviceType.
- WVR_InputEvent
-
struct
WVR_InputEvent
¶ Input Event that includes WVR_EventType, timestamp, WVR_DeviceType, and WVR_InputId.
The following table shows the WVR_EventType enum range values that belongs to Which kind of WVR_Event.
WVR_EventType enum value | WVR_Event |
---|---|
1000~1999 | WVR_CommonEvent |
2000~2999 | WVR_DeviceEvent |
3000~3999 | WVR_InputEvent |
-
enum
WVR_EventType
event type
Values:
-
WVR_EventType_Quit
= 1000 common event region Application Quit.
-
WVR_EventType_SystemInteractionModeChanged
= 1001 WVR_InteractionMode changed. Use WVR_GetInteractionMode to get the interaction mode.
-
WVR_EventType_SystemGazeTriggerTypeChanged
= 1002 WVR_GazeTriggerType changed. Use WVR_GetGazeTriggerType to get the gaze trigger type.
-
WVR_EventType_TrackingModeChanged
= 1003 Notification for tracking mode change(3 DoF/6 DoF). Use WVR_GetDegreeOfFreedom to get the current tracking mode.
-
WVR_EventType_RecommendedQuality_Lower
= 1004 Notification for recommended quality to be Lower from runtime.
-
WVR_EventType_RecommendedQuality_Higher
= 1005 Notification for recommended quality to be Higher from runtime.
-
WVR_EventType_HandGesture_Changed
= 1006 Notification for changed gesture.
-
WVR_EventType_HandGesture_Abnormal
= 1007 Notification for abnormal gesture.
-
WVR_EventType_HandTracking_Abnormal
= 1008 Notification for abnormal hand tracking.
-
WVR_EventType_DeviceConnected
= 2000 Device events region WVR_DeviceType is connected.
-
WVR_EventType_DeviceDisconnected
= 2001 WVR_DeviceType is disconnected.
-
WVR_EventType_DeviceStatusUpdate
= 2002 WVR_DeviceType configuration has changed.
-
WVR_EventType_DeviceSuspend
= 2003 When user takes off the HMD
-
WVR_EventType_DeviceResume
= 2004 When user puts the HMD back on
-
WVR_EventType_IpdChanged
= 2005 The interpupillary distance has changed; Use WVR_GetRenderProps to get the current IPD.
-
WVR_EventType_DeviceRoleChanged
= 2006 WVR_DeviceType controller roles have switched.
-
WVR_EventType_BatteryStatusUpdate
= 2007 The battery status of WVR_DeviceType device has changed. Use WVR_GetBatteryStatus to check the current battery status.
-
WVR_EventType_ChargeStatusUpdate
= 2008 The charged status of WVR_DeviceType device has changed. Use WVR_GetChargeStatus to check the current battery charge status.
-
WVR_EventType_DeviceErrorStatusUpdate
= 2009 WVR_DeviceType device error occurs. Use WVR_GetDeviceErrorState to get the current error status from the device service.
-
WVR_EventType_BatteryTemperatureStatusUpdate
= 2010 The battery temperature status of WVR_DeviceType device has changed. Use WVR_GetBatteryTemperatureStatus to check the current battery temperature.
-
WVR_EventType_RecenterSuccess
= 2011 Notification for successful recenter for the 6 DoF device
-
WVR_EventType_RecenterFail
= 2012 Notification for recenter failed for the 6 DoF device
-
WVR_EventType_RecenterSuccess3DoF
= 2013 Notification for recenter successful for the 3 DoF device
-
WVR_EventType_RecenterFail3DoF
= 2014 Notification for recenter failed for the 3 DoF device
-
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_ButtonPressed
= 3000 Input Event region WVR_InputId status changed to pressed.
-
WVR_EventType_ButtonUnpressed
= 3001 WVR_InputId status changed to not pressed
-
WVR_EventType_TouchTapped
= 3002 WVR_InputId status changed to touched.
-
WVR_EventType_TouchUntapped
= 3003 WVR_InputId status changed to untouched.
-
WVR_EventType_LeftToRightSwipe
= 3004 Notification for swipe motion (left to right) on the touchpad
-
WVR_EventType_RightToLeftSwipe
= 3005 Notification for swipe motion (right to left) on the touchpad
-
WVR_EventType_DownToUpSwipe
= 3006 Notification for swipe motion (down to up) on the touchpad
-
WVR_EventType_UpToDownSwipe
= 3007 Notification for swipe motion (up to down) on the touchpad
-
How to use¶
Here is an example for the function:
#include <wvr/wvr_events.h>
void ProcessEvent() {
WVR_Event_t event;
while(WVR_PollEventQueue(&event)) {
switch (event.common.type) {
case WVR_EventType_Quit: {
return;
}
case WVR_EventType_DeviceConnected: {
if (event.device.deviceType == WVR_DeviceType_HMD)
HideWelcome();
else if (event.device.deviceType == WVR_DeviceType_Controller_Right)
ShowRightHand();
else if (event.device.deviceType == WVR_DeviceType_Controller_Left)
ShowLeftHand();
break;
}
case WVR_EventType_DeviceDisconnected: {
if (event.device.deviceType == WVR_DeviceType_HMD)
return;
else if (event.device.deviceType == WVR_DeviceType_Controller_Right)
HideRightHand();
else if (event.device.deviceType == WVR_DeviceType_Controller_Left)
HideLeftHand();
break;
}
case WVR_EventType_TouchTapped: {
StartGetAxis(event.device.deviceType, event.input.inputId);
break;
}
case WVR_EventType_TouchUntapped: {
StopGetAxis(event.device.deviceType, event.input.inputId);
break;
}
case WVR_EventType_ButtonPressed: {
if (event.input.inputId == WVR_InputId_Alias1_Touchpad)
StartShoot();
else if (event.input.inputId == WVR_InputId_Alias1_Menu)
ShowMenu();
break;
}
case WVR_EventType_ButtonUnpressed: {
if (event.input.inputId == WVR_InputId_Alias1_Touchpad)
StopShoot();
else if (event.input.inputId == WVR_InputId_Alias1_Menu)
HideMenu();
break;
}
case WVR_EventType_TrackingModeChanged
// Get notification for the changed tracking mode(0: WVR_NumDoF_3DoF, 1: WVR_NumDoF_6DoF)
WVR_NumDoF numDof;
// Get the changed DoF (Degree Of Freedom) of the HMD pose
numDof = WVR_GetDegreeOfFreedom(WVR_DeviceType_HMD);
break;
case WVR_EventType_IpdChanged: {
WVR_RenderProps_t props;
bool ret = WVR_GetRenderProps(&props);
break;
}
case WVR_EventType_BatteryStatusUpdate: {
WVR_BatteryStatus status = WVR_GetBatteryStatus(event.device.deviceType);
float value = WVR_GetDeviceBatteryPercentage(event.device.deviceType);
break;
}
case WVR_EventType_BatteryTemperatureStatusUpdate: {
WVR_BatteryTemperatureStatus status = WVR_GetBatteryTemperatureStatus(event.device.deviceType);
float value = WVR_GetBatteryTemperature(event.device.deviceType);
break;
}
case WVR_EventType_ChargeStatusUpdate: {
WVR_ChargeStatus status = WVR_GetChargeStatus(event.device.deviceType);
float value = WVR_GetDeviceBatteryPercentage(event.device.deviceType);
break;
}
case WVR_EventType_InteractionModeChanged: {
WVR_InteractionMode mode = WVR_GetInteractionMode();
break;
}
case WVR_EventType_GazeTriggerTypeChanged: {
WVR_GazeTriggerType type = WVR_GetGazeTriggerType();
break;
}
default:
break;
}
}
}
Note
- The WVR_EventType_DeviceSuspend and WVR_EventType_DeviceResume events are obsolete. Developer do not to listen to these events.