private async void Characteristic_ValueChanged(GattCharacteristic sender, GattValueChangedEventArgs args) { // BT_Code: An Indicate or Notify reported that the value has changed. // Display the new value with a timestamp. var newValue = FormatValueByPresentation(args.CharacteristicValue, presentationFormat); var message = $"Value at {DateTime.Now:hh:mm:ss}: {newValue}"; await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => CharacteristicLatestValue.Text = message); }這是值更改的設(shè)置。^ private async void CharacteristicReadButton_Click() { // BT_Code: Read the actual value from the device by using Uncached. GattReadResult result = await selectedCharacteristic.ReadValueAsync(BluetoothCacheMode.Uncached); if (result.Status == GattCommunicationStatus.Success) { string formattedResult = FormatValueByPresentation(result.Value, presentationFormat); rootPage.NotifyUser($"Read result: {formattedResult}", NotifyType.StatusMessage); } else { rootPage.NotifyUser($"Read failed: {result.Status}", NotifyType.ErrorMessage); } }這是讀取值的設(shè)置。所以當(dāng)我點(diǎn)擊“閱讀”按鈕時。它捕獲當(dāng)時的數(shù)據(jù)。但是我希望在值更改時刷新此數(shù)據(jù),因此我訂閱了值更改?,F(xiàn)在的問題是,在我點(diǎn)擊訂閱后,它說的是“未知格式”。所以我需要弄清楚如何更改我的格式以讀取我的 rfduino 值。
- 2 回答
- 0 關(guān)注
- 327 瀏覽
添加回答
舉報
0/150
提交
取消