共用方式為


GameControllerFirmwareCorruptReason 列舉

定義

裝置的韌體損毀狀態。

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 應該只與您開發的硬體搭配使用。

適用於