我想知道,如果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