UWP蓝牙LEAdvertisementWatcherTrigger没有通过服务uuid​​过滤器触发

时间:2019-05-17 13:14:41

标签: uwp bluetooth bluetooth-lowenergy

正在注册带有触发器的正在进行的后台任务:

var trigger = new BluetoothLEAdvertisementWatcherTrigger();
trigger.AdvertisementFilter.Advertisement.ServiceUuids.Add(GattServiceUuids.CyclingSpeedAndCadence);

... more background code left out for simplicity ...

不幸的是,当我在Do not launch, but debug my code when it starts选项中运行应用程序时,永远不会触发该事件。

每当我使用广告观察程序正常运行该应用程序时,都会得到此信息(因此我正在过滤的服务ID是正确的):

Local name:  'mydevice1234'
Company:     ''
Service ids: '00001816-0000-1000-8000-00805f9b34fb;0000180f-0000-1000-8000-00805f9b34fb'

很遗憾,我无法在过滤器中使用公司ID,因为公司在广告中没有任何内容...

有什么想法为什么不触发?该文档仅提及公司过滤器,但我不能使用它。

1 个答案:

答案 0 :(得分:1)

根据蓝牙规范,制造商数据不是必需的。在我看来,这没关系。

@geertvanhorrik,您提到“前景观察者”工作正常。我怀疑问题出在不要启动,而是在启动选项时调试我的代码。要确认这一点,是否可以使用任何类似wireshark的蓝牙协议数据包分析器来验证BackgroundWatcher是否正在接收数据?

至少可以确认Backgroundwatcher正在接收数据。

相关问题