我正在使用 Nordic Thingy:52 在 UWP 应用程序中记录环境数据,并按照 Windows 通用示例应用程序中的示例连接到 BT LE 设备。
到目前为止,我已经能够连接到设备以检索服务和特征信息,但是当从传感器接收实际数据时,我无法将字节数组转换为可用数据。
async void Characteristic_ValueChanged(GattCharacteristic sender, GattValueChangedEventArgs args)
{
// An Indicate or Notify reported that the value has changed.
var reader = DataReader.FromBuffer(args.CharacteristicValue);
byte[] input = new byte[reader.UnconsumedBufferLength];
reader.ReadBytes(input);
}
检查字节数组的内容时,您可以看到已收到某些内容,但在知道如何将此数组转换为有用数据时,我感到很困惑。