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_InteractionModeChanged
= 1001¶ WVR_InteractionMode changed. Use WVR_GetInteractionMode to get the interaction mode.
-
WVR_EventType_GazeTriggerTypeChanged
= 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_ArenaChanged
= 1009¶ Notification for arena have been changed.
-
WVR_EventType_RenderingToBePaused
= 1010¶ Notification for the rendering is going to be paused due to user take off HMD and display off.
-
WVR_EventType_RenderingToBeResumed
= 1011¶ Notification for the rendering is going to be resumed due to user put on HMD and display on.
-
WVR_EventType_SpectatingStarted
= 1012¶ Notification for the spectating started.
-
WVR_EventType_SpectatingStopped
= 1013¶ Notification for the spectating stopped.
-
WVR_EventType_SpatialAnchor_Changed
= 1101¶ Notification for the spatial anchor changed.
-
WVR_EventType_CachedAnchor_Changed
= 1102¶ Notification for the cached anchor changed.
-
WVR_EventType_PersistedAnchor_Changed
= 1103¶ Notification for the persisted anchor changed.
-
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¶ (deprecated)
-
WVR_EventType_DeviceResume
= 2004¶ (deprecated)
-
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_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¶ The battery percentage of WVR_DeviceType device has changed. Use WVR_GetDeviceBatteryPercentage to check the current battery level.
-
WVR_EventType_DeviceInfoUpdate
= 2018¶ The device information of WVR_DeviceType device has changed.
-
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¶
-
WVR_EventType_DeviceTableStaticLocked
= 2104¶ WVR_DeviceType is on table static state.
-
WVR_EventType_DeviceTableStaticUnlocked
= 2105¶ WVR_DeviceType is not on table static state.
-
WVR_EventType_ManualFocusChanged
= 2106¶ Notification for manual focus is changed.
-
WVR_EventType_Hand_EnhanceStable
= 2900¶ Hand and Wrist Tracker event Notification for Enhanced Hand Stability ON or OFF
-
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
-
WVR_EventType_TrackerConnected
= 4000¶ Tracker events region WVR_TrackerId is connected.
-
WVR_EventType_TrackerDisconnected
= 4001¶ WVR_TrackerId is disconnected.
-
WVR_EventType_TrackerBatteryLevelUpdate
= 4002¶ The battery level of WVR_TrackerId has changed. Use WVR_GetTrackerBatteryLevel to check the current battery level.
-
WVR_EventType_TrackerRoleChanged
= 4003¶ WVR_TrackerId is role changed.
-
WVR_EventType_TrackerButtonPressed
= 5000¶ Tracker input events region WVR_InputId status of WVR_TrackerId changed to pressed.
-
WVR_EventType_TrackerButtonUnpressed
= 5001¶ WVR_InputId status of WVR_TrackerId changed to not pressed
-
WVR_EventType_TrackerTouchTapped
= 5002¶ WVR_InputId status of WVR_TrackerId changed to touched.
-
WVR_EventType_TrackerTouchUntapped
= 5003¶ WVR_InputId status of WVR_TrackerId changed to untouched.
-
WVR_EventType_TrackerLeftToRightSwipe
= 5004¶ Notification for swipe motion (left to right) on the touchpad of Tracker
-
WVR_EventType_TrackerRightToLeftSwipe
= 5005¶ Notification for swipe motion (right to left) on the touchpad of Tracker
-
WVR_EventType_TrackerDownToUpSwipe
= 5006¶ Notification for swipe motion (down to up) on the touchpad of Tracker
-
WVR_EventType_TrackerUpToDownSwipe
= 5007¶ Notification for swipe motion (up to down) on the touchpad of Tracker
-
WVR_EventType_BodyTrackingCalibrationChanged
= 6000¶ BodyTracking events region Notification for BodyTracking calibration parameters change
-
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.