尝试使用 C++/winRT UWP 发现蓝牙低功耗设备并应用合理的过滤器。在 git hub 示例中,代码如下:
hstring aqsAllBluetoothLEDevices = L"(System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\")";
auto requestedProperties = single_threaded_vector<hstring>
({ L"System.Devices.Aep.DeviceAddress", L"System.Devices.Aep.Bluetooth.Le.IsConnectable",
L"System.Devices.Aep.IsPresent" });
deviceWatcher = DeviceInformation::CreateWatcher(aqsAllBluetoothLEDevices,
requestedProperties,
DeviceInformationKind::AssociationEndpoint
);
只要我使用上面的,我发现所有直播的 BTLE 设备;我还发现了一些没有主动做广告的设备,所以使用
System.Devices.Aep.IsPresent
但是,我想只过滤遵循某些 BTLE 健康配置文件的 BTLE 设备。这些配置文件具有以下服务
GATT - Blood pressure 18100000-0000-1000-8000-00805F9B34FB
GATT - Body composition 181B0000-0000-1000-8000-00805F9B34FB
GATT - Glucose 18080000-0000-1000-8000-00805F9B34FB
GATT - Health thermometer 18090000-0000-1000-8000-00805F9B34FB
GATT - Heart rate 180D0000-0000-1000-8000-00805F9B34FB
GATT - Pulse oximeter 18220000-0000-1000-8000-00805F9B34FB
GATT - Weight scale 181D0000-0000-1000-8000-00805F9B34FB
任何人都知道如何配置 deviceWatcher() 以仅报告那些宣传上述服务 UUID 之一的设备?
我曾尝试在 protocolId 中使用它们,但什么也没发现。