共用方式為


LegacyGipGameControllerProvider.IsFirmwareCorrupted 屬性

定義

傳回控制器韌體是否損毀。

public:
 property bool IsFirmwareCorrupted { bool get(); };
bool IsFirmwareCorrupted();
public bool IsFirmwareCorrupted { get; }
var boolean = legacyGipGameControllerProvider.isFirmwareCorrupted;
Public ReadOnly Property IsFirmwareCorrupted As Boolean

屬性值

Boolean

bool

控制器的電池充電狀態。

GetDeviceFirmwareCorruptionState 應該使用 ,而不是 IsFirmwareCorrupted 因為大部分裝置都支援它。 IsFirmwareCorrupted 只有較舊的裝置才支援,只有在 不支援時才 GetDeviceFirmwareCorruptionState 應該使用。

警告

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

範例

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

適用於

另請參閱