不能实例化一个新的GattDeviceService

本文关键字:一个 GattDeviceService 实例化 不能 | 更新日期: 2023-09-27 18:06:18

我是蓝牙LE新手,我正在尝试写入蓝牙HID设备。

我正在使用Visual studio 2015,并正在构建一个WPF应用程序。

目前我的代码是这样的:

var hidDevices = await DeviceInformation
    .FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(
        GattServiceUuids.HumanInterfaceDevice));
GattDeviceService bleDevice = await GattDeviceService.FromIdAsync(hidDevices[0].Id);

我有一些代码之后,但我的代码停止后,我试图创建一个新的GattDeviceService

我知道hidDevices[0]被占用了,但是生成的ID显示如下:

''?/BTHLEDEVICE#{00001812-xxxx-xxxx-xxxx-xxxxxxxxxxxx}_Dev_VID&.........

不能实例化一个新的GattDeviceService

GATT API不允许访问HID服务

我找到了关于你的问题的信息:蓝牙关贸总协定 -Windows.Device.Bluetooth.Gatt

  • API允许Windows Store应用程序开发人员实现GATT客户端从低能量(LE)传感器收集数据的配置文件。
  • 使用GATT API需要蓝牙4.0无线电。
  • GATT API禁止访问以下收件箱,无效服务:(蓝牙SIG名称)0x1812 HID Over GATT Service

更多信息:https://msdn.microsoft.com/en-us/library/windows/apps/bg182882.aspx

相关文章: