BluetoothLEDevice 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
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
- 继承
- 属性
- 实现
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 |
获取蓝牙设备 ID。 |
| ConnectionStatus |
获取设备的连接状态。 |
| DeviceAccessInformation |
获取 DeviceAccessInformation。 |
| DeviceId |
获取设备 ID。 |
| DeviceInformation |
获取蓝牙 LE 设备的设备信息。 |
| GattServices |
获取设备支持的 GATT 服务的只读列表。 重要 GattServices API 已弃用,将来的 Windows 版本中可能不可用。 请改用 GetGattServicesAsync。 |
| Name |
获取蓝牙 LE 设备的名称。 |
| WasSecureConnectionUsedForPairing |
获取一个布尔值,指示 BluetoothLEDevice 是否使用安全连接进行配对。 |
方法
| Close() |
关闭此蓝牙 LE 设备。 如果这是唯一具有连接的应用,这可能会关闭与设备的连接。 |
| Dispose() |
执行与释放或重置非托管资源关联的应用程序定义的任务。 |
| FromBluetoothAddressAsync(UInt64) |
返回一个 BluetoothLEDevice 对象,该对象表示具有给定地址的对等蓝牙 LE 设备。 请参阅此成员主题) 中的 备注 (。 |
| FromBluetoothAddressAsync(UInt64, BluetoothAddressType) |
返回一个 BluetoothLEDevice 对象,该对象表示具有给定地址和地址类型的对等设备。 请参阅此成员主题) 中的 备注 (。 |
| FromIdAsync(String) |
返回给定 ID 的 BluetoothLEDevice 对象。请参阅成员主题中的 备注 。 |
| GetConnectionParameters() |
检索远程设备的连接参数。 如果多个应用或其他系统方案也请求这些参数,则系统会根据系统优先级自动合并这些参数(在兼容的情况下)。 注意 当设备未连接时,连接参数 (所有零) 无效。 |
| GetConnectionPhy() |
检索有关蓝牙 LE 物理层的信息 (PHY) 。 注意 设备未连接时,连接 PHY 无效, (所有 false) |
| GetDeviceSelector() |
获取高级查询语法 (AQS) 字符串,用于标识所有蓝牙低功耗 (LE) 设备。 此字符串将传递到 FindAllAsync 或 CreateWatcher 方法,以获取蓝牙 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) |
返回具有给定服务 ID 的 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 |
在设备名称更改时发生。 |