BluetoothDevice.GetDeviceSelectorFromClassOfDevice 方法

定义

BluetoothClassOfDevice 对象 (AQS) 筛选器字符串创建高级查询语法。 AQS 字符串将传递到 CreateWatcher 方法,以返回 DeviceInformation 对象的集合。

public:
 static Platform::String ^ GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice ^ classOfDevice);
 static winrt::hstring GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice const& classOfDevice);
public static string GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice classOfDevice);
function getDeviceSelectorFromClassOfDevice(classOfDevice)
Public Shared Function GetDeviceSelectorFromClassOfDevice (classOfDevice As BluetoothClassOfDevice) As String

参数

classOfDevice
BluetoothClassOfDevice

用于构造 AQS 字符串的设备类。

返回

String

Platform::String

winrt::hstring

可作为参数传递到 CreateWatcher 方法的 AQS 字符串。

Windows 要求

设备系列
Windows 10 (在 10.0.10586.0 - for Xbox, see UWP features that aren't yet supported on Xbox 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v2.0 中引入)
应用功能
bluetooth

注解

classOfDevice 参数的每个部分都是可选的。 但是,如果设置了次要设备类,则还必须设置设备的主要类。 下面是与所设置内容相关的行为。

  • 如果未设置设备的主要/次要类,则将返回与所提供的服务功能匹配的所有设备。
  • 如果未设置次要设备类别,则将返回与主要设备类别匹配的所有设备以及所提供的服务功能。
  • 如果设置了服务功能,则将返回至少与所提供的服务功能和主要/次要设备类别匹配的所有设备。
  • 如果未设置任何服务功能,则将返回与设备的主要/次要类匹配的所有设备。
  • 如果未设置设备的主要/次要类,并且未设置任何服务功能,则将返回所有设备。 此 AQS 筛选器字符串将请求发出查询。

适用于