1

编辑

这是一些微软安全问题的已知问题 https://social.msdn.microsoft.com/Forums/en-US/58da3fdb-a0e1-4161-8af3-778b6839f4e1/bluetooth-bluetoothledevicefromidasync-does-not-complete-on-10015063 ?论坛=wdk

如上所述添加注册 CoInitializeSecurity 值解决了问题!

我正在尝试使用广告观察者读取 BLE 设备服务。我已经实现了在侦听器中读取的服务,代码:

   private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs args)
    {

        if (!gotSignal)
        {
            gotSignal = true;
            device = await Windows.Devices.Bluetooth.BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
            service = await GattDeviceService.FromIdAsync(device.DeviceId);

        }
          ...
     }

问题是我无法获取 BluetoothLEDevice 对象,当我到达这一行时,它没有取回任何值,它会跳过侦听器内的下一行。注意:我已经安装了 windows creators update 并且在安装之前,功能 BluetoothLEDevice.FromBluetoothAddressAsync 已经工作。

4

1 回答 1

1

解决方案

这是一些微软安全问题的已知问题https://social.msdn.microsoft.com/Forums/en-US/58da3fdb-a0e1-4161-8af3-778b6839f4e1/bluetooth-bluetoothledevicefromidasync-does-not-complete-on-10015063 ?论坛=wdk

如上所述添加注册 CoInitializeSecurity 值解决了问题!

于 2017-06-25T15:47:34.453 回答