GameControllerBatteryKind 枚举

定义

控制器中的电池种类。

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

Windows 要求

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

字段

None 1

控制器没有电池。

Rechargeable 3

控制器具有可充电电池。

Standard 2

控制器有一个不可充电的电池。

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);
}

适用于