Share via


BluetoothLEDevice 類別

定義

代表藍牙 LE 裝置。

如需程式碼範例,請參閱 藍牙低能源範例裝置列舉和配對範例

public ref class BluetoothLEDevice sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BluetoothLEDevice final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BluetoothLEDevice : System.IDisposable
Public NotInheritable Class BluetoothLEDevice
Implements IDisposable
繼承
Object Platform::Object IInspectable BluetoothLEDevice
屬性
實作

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
應用程式功能
bluetooth

備註

版本歷程記錄

Windows 版本 SDK 版本 新增值
1511 10586 外觀
1511 10586 BluetoothAddressType
1511 10586 DeviceInformation
1511 10586 FromBluetoothAddressAsync (UInt64,BluetoothAddressType)
1511 10586 GetDeviceSelectorFromAppearance
1511 10586 GetDeviceSelectorFromBluetoothAddress (UInt64)
1511 10586 GetDeviceSelectorFromBluetoothAddress (UInt64,BluetoothAddressType)
1511 10586 GetDeviceSelectorFromConnectionStatus
1511 10586 GetDeviceSelectorFromDeviceName
1511 10586 GetDeviceSelectorFromPairingState
1703 15063 DeviceAccessInformation
1703 15063 GetGattServicesAsync
1703 15063 GetGattServicesAsync (BluetoothCacheMode)
1703 15063 GetGattServicesForUuidAsync (Guid)
1703 15063 GetGattServicesForUuidAsync (Guid,BluetoothCacheMode)
1703 15063 RequestAccessAsync
1709 16299 BluetoothDeviceId
1803 17134 WasSecureConnectionUsedForPairing

屬性

Appearance

取得藍牙 LE 裝置的 BluetoothLEAppearance 物件。

BluetoothAddress

取得裝置位址。

BluetoothAddressType

取得藍牙 LE 裝置的網址類別型。

BluetoothDeviceId

取得藍牙裝置識別碼。

ConnectionStatus

取得裝置的線上狀態。

DeviceAccessInformation

取得 DeviceAccessInformation。

DeviceId

取得裝置識別碼。

DeviceInformation

取得藍牙 LE 裝置的裝置資訊。

GattServices

取得裝置所支援之 GATT 服務的唯讀清單。

重要

GattServices API 已被取代,未來版本的 Windows 可能無法使用。 請改用 GetGattServicesAsync

Name

取得藍牙 LE 裝置的名稱。

WasSecureConnectionUsedForPairing

取得布林值,指出藍牙LEDevice 是否已使用安全連線配對。

方法

Close()

關閉此藍牙 LE 裝置。 如果這是唯一具有連線的應用程式,這可能會關閉裝置的連線。

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

FromBluetoothAddressAsync(UInt64)

會傳回 BluetoothLEDevice 物件,代表具有指定位址的對等藍牙 LE 裝置。 See Remarks (in this member topic).

FromBluetoothAddressAsync(UInt64, BluetoothAddressType)

會傳回 BluetoothLEDevice 物件,代表具有指定位址和網址類別型的對等裝置。 See Remarks (in this member topic).

FromIdAsync(String)

會傳回指定識別碼的BluetoothLEDevice物件。請參閱成員主題中的

GetConnectionParameters()

擷取遠端裝置的連線參數。 如果多個應用程式或其他系統案例也要求這些參數,則系統會根據系統優先順序自動合併相容參數。

注意

當裝置未連線時,連線參數無效, (所有零) 。

GetConnectionPhy()

擷取藍牙 LE 實體層的相關資訊, (PHY) 。

注意

當裝置未連線時,連線 PHY 會無效, (所有 false)

GetDeviceSelector()

取得進階查詢語法 (AQS) 字串,用於識別所有藍牙低能源 (LE) 裝置。 此字串會傳遞至 FindAllAsyncCreateWatcher 方法,以取得藍牙 LE 裝置的清單。

GetDeviceSelectorFromAppearance(BluetoothLEAppearance)

BluetoothLEAppearance 物件建立 AQS) 篩選字串 (進階查詢語法。 AQS 字串會傳遞至 CreateWatcher 方法,以傳回具有指定外觀的 DeviceInformation 物件集合。

GetDeviceSelectorFromBluetoothAddress(UInt64)

從代表藍牙 LE 裝置的 64 位位址建立進階查詢語法 (AQS) 篩選字串。 AQS 字串會傳遞至 CreateWatcher 方法,以傳回 DeviceInformation 物件的集合。

GetDeviceSelectorFromBluetoothAddress(UInt64, BluetoothAddressType)

從代表藍牙 LE 裝置的 64 位位址和網址類別型,建立 AQS) 篩選字串 (進階查詢語法。 AQS 字串會傳遞至 CreateWatcher 方法。

GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus)

建立進階查詢語法 (AQS) 篩選字串,其中包含具有指定 BluetoothConnectionStatus 的藍牙LE 裝置查詢。 AQS 字串會傳遞至 CreateWatcher 方法,以傳回具有指定藍牙線上狀態的 DeviceInformation 物件集合。

GetDeviceSelectorFromDeviceName(String)

建立進階查詢語法 (AQS) 篩選字串,其中包含藍牙 LE 裝置名稱的查詢。 AQS 字串會傳遞至 CreateWatcher 方法,以傳回包含指定藍牙 LE 裝置名稱的 DeviceInformation 物件集合。

GetDeviceSelectorFromPairingState(Boolean)

建立進階查詢語法 (AQS) 篩選字串,其中包含配對或未配對藍牙 LE 裝置的查詢。 AQS 字串會傳遞至 CreateWatcher 方法,以傳回 DeviceInformation 物件的集合。

GetGattService(Guid)

傳回具有指定服務識別碼的 GATT 服務。

重要

GetGattService API 已被取代,未來版本的 Windows 可能無法使用。 請改用 GetGattServicesAsync

GetGattServicesAsync()

取得這個藍牙 LowEnergy 裝置的 GattDeviceServices。

GetGattServicesAsync(BluetoothCacheMode)

傳回此藍牙 LowEnergy 裝置具有指定快取模式的 GattDeviceServices。

GetGattServicesForUuidAsync(Guid)

傳回具有指定 UUID 之藍牙 LowEnergy 裝置的 GattDeviceServices。

GetGattServicesForUuidAsync(Guid, BluetoothCacheMode)

傳回具有指定 UUID 之藍牙 LowEnergy 裝置的 GattDeviceServices。

RequestAccessAsync()

要求存取藍牙 LowEnergy 裝置。

RequestPreferredConnectionParameters(BluetoothLEPreferredConnectionParameters)

擷取指定藍牙 LE 慣用連接參數物件的藍牙 LE 慣用連接參數要求物件。

事件

ConnectionParametersChanged

當裝置的目前連接參數變更時所引發的事件。 只有在建立裝置的連線之後,參數才會更新。

ConnectionPhyChanged

裝置目前 PHY 變更時所引發的事件。 只有在建立裝置的連線之後,PHY 才會更新。

ConnectionStatusChanged

發生于裝置的線上狀態變更時。

GattServicesChanged

當裝置支援的 GATT 服務清單已變更時引發。

NameChanged

發生于裝置的名稱變更時。

適用於

另請參閱