【发布时间】:2021-04-07 11:43:34
【问题描述】:
我没有搜索感兴趣的服务,而是尝试了以下方法
auto f = leDev.GetGattServicesForUuidAsync(servUuid).get(); // returns a GattDeviceServicesResult
auto g = f.Services().GetAt(0); // There is only one such service on the device that I am using
auto h = g.GetCharacteristicsAsync().get(); // Use the service to obtain all the characteristics of the service
auto j = h.Characteristics(); // Size of j is 0 despite there are 4 services
我构造servUuid的方式是使用具有服务UUID的字符串
guid servGUIDstruct = make_guid(servID);
winrt::guid servUuid = reinterpret_cast<winrt::guid&>(servGUIDstruct);
我还尝试了其他方法来获取服务 Uuid,例如,枚举所有服务并存储感兴趣的服务的 Uuid,然后在 GetGattServicesForUuidAsync 中使用它,但看到同样的问题。
知道我做错了什么会非常有用,谢谢
【问题讨论】:
-
我发现对
GetCharacteristicsAsync的调用返回状态为Access denied
标签: bluetooth-lowenergy windows-10-universal c++-winrt