Поделиться через


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 повреждения встроенного ПО и обновления следует использовать только с оборудованием, которое вы разработали.

Применяется к

См. также раздел