我想知道,如果UWP蓝牙API和指示有问题。 如果我正确理解documentation,UWP将处理收到的指示包的确认。 但由于某些原因,示例代码适用于notifys,但不适用于指示。我正在用Myo腕带尝试此操作。 我可以通过通知特征接收通知,但不能通过指示通知。不幸的是我必须使用指示。BLE指示UWP GATT客户端
我改变了代码示例一点点这一点,但它不工作:
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.
}
任何想法我做错了吗?该设备连接并正确编程,它发送通知。
在此先感谢您的帮助
马塞尔
是的,忘记了。谢谢 – Marcel