如何使Windows(10)记住BLE配对保护级别?

时间:2019-08-07 11:59:29

标签: c# bluetooth-lowenergy

我制作了一个程序,该程序发布一个BLE服务+特性,该特性使我的设备连接到我的PC。连接后,我用以下命令将2台设备配对:

DevicePairingResult pairingResult = await customPairing.PairAsync(DevicePairingKinds.ConfirmOnly, DevicePairingProtectionLevel.Encryption);

这很好用。

这是问题所在:下次我的设备连接时,Windows已存储了配对信息并记住了该设备。但是在我的事件处理程序中……:

private async void ConnectionWatcher_Added(DeviceWatcher sender, DeviceInformation args)

...the args.Pairing.ProtectionLevel-必须为加密!我可以使Windows记住吗?还是提前告诉Windows,新连接必须与此ProtectionLevel建立联系?

我现在要做的是取消设备的配对,并再次使用正确的ProtectionLevel对其进行配对,但这并不美观,也不容易控制。

0 个答案:

没有答案