共用方式為


LegacyGipGameControllerProvider.GetDeviceFirmwareCorruptionState 方法

定義

擷取裝置韌體是否損毀的狀態,如果是的話,則以何種方式擷取。

public:
 virtual GameControllerFirmwareCorruptReason GetDeviceFirmwareCorruptionState() = GetDeviceFirmwareCorruptionState;
GameControllerFirmwareCorruptReason GetDeviceFirmwareCorruptionState();
public GameControllerFirmwareCorruptReason GetDeviceFirmwareCorruptionState();
function getDeviceFirmwareCorruptionState()
Public Function GetDeviceFirmwareCorruptionState () As GameControllerFirmwareCorruptReason

傳回

裝置韌體是否損毀的狀態,如果是的話,以何種方式執行。

範例

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

備註

這應該用於大部分裝置,而不是 IsFirmwareCorrupted 用於大部分裝置。 IsFirmwareCorrupted 只有較舊的裝置才支援,而且只有在不支援時才 GetDeviceFirmwareCorruptionState 使用。

警告

為了避免損壞裝置,韌體損毀和更新 API 應該只與您開發的硬體搭配使用。

適用於

另請參閱