WVR_EXPORT bool WVR_GetDeviceErrorState(WVR_DeviceType dev_type, WVR_DeviceErrorStatus error_type)

Function to get the current states of device errors from the specified device.

WVR_DeviceErrorState is the bitmask that records all the of current states of device errors that which has occurred on the specified device.
API Level 3
Effective with Runtime version 3 or higher
  • type: Device type to get the InputDeviceState.

How to use

Here is an example for the function:

#include <wvr/wvr_device.h>
#include <wvr/wvr_types.h>

// Get the current error states of the device.

if (WVR_GetDeviceErrorState(WVR_DeviceType_HMD, WVR_DeviceErrorStatus_BatteryOverheat)) {
    LOGW("The HMD battery temperature is hot.");
} else if (WVR_GetDeviceErrorState(WVR_DeviceType_HMD, WVR_DeviceErrorStatus_BatteryOvervoltage)) {
    LOGW("The battery is overvoltage when charging.");
} else if (WVR_GetDeviceErrorState(WVR_DeviceType_HMD, WVR_DeviceErrorStatus_DeviceConnectFail)) {
    LOGW("Cannot connect to the HMD.");
} else if (WVR_GetDeviceErrorState(WVR_DeviceType_HMD, WVR_DeviceErrorStatus_ChargeFail)) {
    LOGW("The HMD battery cannot be charged.");
} else if (WVR_GetDeviceErrorState(WVR_DeviceType_HMD, WVR_DeviceErrorStatus_DeviceLostTracking)) {
    LOGW("HMD has lost tracking.");
} else {
    LOGI("HMD is normal.");

Device error status includes the following:

enum WVR_DeviceErrorStatus

The error status of the specified device from the device service.

The device service uses bitmask to record the device error, because many errors might occur at the same time. Each error status represents a hardware exception for the device. The restore status means that the error status has been fixed.


WVR_DeviceErrorStatus_None = 0

Status of the device service is normal.

WVR_DeviceErrorStatus_BatteryOverheat = 1

Battery temperature is too hot.

WVR_DeviceErrorStatus_BatteryOverheatRestore = 1 << 1

Battery temperature has cooled down.

WVR_DeviceErrorStatus_BatteryOvervoltage = 1 << 2

Battery is overvoltage when charging.

WVR_DeviceErrorStatus_BatteryOvervoltageRestore = 1 << 3

Overvoltage has been fixed.

WVR_DeviceErrorStatus_DeviceConnectFail = 1 << 4

Failed to connect to the USB device.

WVR_DeviceErrorStatus_DeviceConnectRestore = 1 << 5

Connection failure has been fixed.

WVR_DeviceErrorStatus_DeviceLostTracking = 1 << 6

The device being tracked might be out of range.

WVR_DeviceErrorStatus_DeviceTrackingRestore = 1 << 7

Lost tracking has been fixed.

WVR_DeviceErrorStatus_ChargeFail = 1 << 8

The consumed voltage is larger than the charging voltage when the device is charging.

WVR_DeviceErrorStatus_ChargeRestore = 1 << 9

Charging failure has been fixed.