Share via


LegacyGipGameControllerProvider.GetDeviceFirmwareCorruptionState Method

Definition

Retrieves the state of whether the device's firmware is corrupted and if so, in what way.

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

Returns

The state of whether the device's firmware is corrupted and if so, in what way.

Examples

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

Remarks

This should be used rather than **IsFirmwareCorrupted** for most devices as it is supported by most devices. IsFirmwareCorrupted is only supported by older devices and should only be used if **GetDeviceFirmwareCorruptionState** is not supported.

Caution

To avoid damaging devices, the firmware corruption and update APIs should only be used with hardware you have developed.

Applies to

See also