我想知道,UWP 蓝牙 API 和指示是否有问题。如果我正确理解文档,UWP 将处理收到的指示包的确认。但由于某种原因,示例代码适用于通知,但不适用于指示。我正在尝试使用 Myo 腕带。我可以通过通知特性接收通知,但不能通过指示特性接收通知。不幸的是,我必须使用指示。
我将示例代码稍作更改,但它不起作用:
GattCommunicationStatus status = await selectedCharacteristic.WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.Indicate);
if(status == GattCommunicationStatus.Success)
{
// Server has been informed of clients interest.
}
处理程序保持不变:
characteristic.ValueChanged += Characteristic_ValueChanged;
// ...
void Characteristic_ValueChanged(GattCharacteristic sender,
GattValueChangedEventArgs args)
{
// An Indicate or Notify reported that the value has changed.
var reader = DataReader.FromBuffer(args.CharacteristicValue)
// Parse the data however required.
}
任何想法我做错了什么?设备已连接并正确编程,它会发送通知。
提前感谢您的帮助
马塞尔