GameControllerFirmwareCorruptReason 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
设备的固件损坏状态。
public enum class GameControllerFirmwareCorruptReason
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Gaming.Input.GamingInputPreviewContract, 131072)]
enum class GameControllerFirmwareCorruptReason
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Gaming.Input.GamingInputPreviewContract), 131072)]
public enum GameControllerFirmwareCorruptReason
var value = Windows.Gaming.Input.Preview.GameControllerFirmwareCorruptReason.unknown
Public Enum GameControllerFirmwareCorruptReason
- 继承
-
GameControllerFirmwareCorruptReason
- 属性
Windows 要求
设备系列 |
Windows Desktop Extension SDK (在 10.0.23665.0 中引入)
|
API contract |
Windows.Gaming.Input.GamingInputPreviewContract (在 v2.0 中引入)
|
字段
AppCorrupt | 3 | 应用固件已损坏。 |
EepromCorrupt | 5 | EEPROM 已损坏。 |
NotCorrupt | 1 | 固件未损坏。 |
RadioCorrupt | 4 | 无线电固件已损坏。 |
SafeToUpdate | 6 | 可以安全地更新固件以从损坏中恢复。 |
TwoUpCorrupt | 2 | 2Up 固件已损坏。 |
Unknown | 0 | 目前还不清楚固件是否损坏。 |
示例
public void EnumerateControllerProperties()
{
foreach (Gamepad gamepad in Gamepad.Gamepads)
{
// Create the provider
LegacyGipGameControllerProvider legacyGipGameControllerProvider =
LegacyGipGameControllerProvider.FromGameController(gamepad);
if (legacyGipGameControllerProvider == null)
{
// Not every gamepad is a legacy GIP game controller, continue enumerating
continue;
}
// Check properties
GameControllerBatteryChargingState chargeState =
legacyGipGameControllerProvider.BatteryChargingState;
GameControllerBatteryKind batteryKind =
legacyGipGameControllerProvider.BatteryKind;
GameControllerBatteryLevel batteryLevel =
legacyGipGameControllerProvider.BatteryLevel;
bool isOldFirmwareCorrupted =
legacyGipGameControllerProvider.IsFirmwareCorrupted;
bool isNewFirmwareCorrupted =
legacyGipGameControllerProvider.GetDeviceFirmwareCorruptionState()
!= GameControllerFirmwareCorruptReason.NotCorrupt;
bool isSynthetic = legacyGipGameControllerProvider.IsSyntheticDevice;
byte[] extendedDeviceInfo = legacyGipGameControllerProvider.GetExtendedDeviceInfo();
// Check for a particular GIP interface
bool supportsSomeCustomInterface =
legacyGipGameControllerProvider.IsInterfaceSupported(
new Guid(
0xaaaaaaaa, 0xbbbb, 0xcccc, 0xe, 0xf, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6));
IReadOnlyList<string> preferredTypes =
legacyGipGameControllerProvider.PreferredTypes;
bool isGamepad = preferredTypes.Contains("Windows.Xbox.Input.Gamepad");
bool isHeadset = preferredTypes.Contains("Windows.Xbox.Input.Headset");
// Change the LED to half brightness
legacyGipGameControllerProvider.SetHomeLedIntensity(50);
}
}
注解
注意
为了避免损坏设备,固件损坏和更新 API 应仅用于你开发的硬件。