GameControllerBatteryLevel 枚举

定义

控制器中剩余的电池电量。

public enum class GameControllerBatteryLevel
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Gaming.Input.GamingInputPreviewContract, 131072)]
enum class GameControllerBatteryLevel
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Gaming.Input.GamingInputPreviewContract), 131072)]
public enum GameControllerBatteryLevel
var value = Windows.Gaming.Input.Preview.GameControllerBatteryLevel.unknown
Public Enum GameControllerBatteryLevel
继承
GameControllerBatteryLevel
属性

Windows 要求

设备系列
Windows Desktop Extension SDK (在 10.0.23665.0 中引入)
API contract
Windows.Gaming.Input.GamingInputPreviewContract (在 v2.0 中引入)

字段

Critical 1

电池电量非常低。

Full 4

电池已充满电。

Low 2

电池电量较低。

Medium 3

电池已部分充电。

Unknown 0

电池电量未知。

示例

public void SetupHeadset(IGameControllerProvider headsetProvider)
{
    LegacyGipGameControllerProvider legacyGipGameControllerProvider =
        LegacyGipGameControllerProvider.FromGameControllerProvider(headsetProvider);

    // Reset the device
    legacyGipGameControllerProvider.ExecuteCommand(DeviceCommand.Reset);

    // Check the smart mute level
    byte[] smartMuteBuffer =
        legacyGipGameControllerProvider.GetHeadsetOperation(HeadsetOperation.SmartMute);
    HeadsetLevel smartMuteValue = (HeadsetLevel)smartMuteBuffer[0];

    // Set bass boost to 3db
    byte[] bassBuffer = BitConverter.GetBytes((UInt32)3);
    legacyGipGameControllerProvider.SetHeadsetOperation(HeadsetOperation.BassBoostGain,
        bassBuffer);
}

适用于