我有一个医疗设备,可以使用蓝牙BLE,让我可以测量以BPM为单位的心电信号和脉搏.当我通过蓝牙将我的设备与Flutter 应用程序集成并读取负责心电测量的特征时,以下是我收到的数据:值:(0x):C8-44-80-8E-37-C9

是否有方法解释这些数值并从中绘制心电图?

推荐答案

简短版本:你must知道设备如何编码数据,以便正确地解释你接收的数据,假设那是数据而不是某些接口特殊命令.否则,您可以猜测并try 从字节转换为数据.

Long version: that piece of data you pasted (I assume it's not the complete) looks like some byte or hex value, but without having a precise idea of what that means, you won't go anywhere. Those bytes may be the bytes of an image you need to reconstruct, or maybe of a PDF file, or numeric values of a curve, or almost anything else. They may even be some special commands the instrument uses to communicate (something like telling "the measure has started").
I just have faced a similar problem: a medical device was sending me a string that could be long up to 70000 or more characters. I had to contact the manufacturer to have a description of their outgoing protocol, because the string itself had no meaning: I suspected it was a base64-encoded string because sometimes there were some '=' at the end, but I could not be sure. In the end, the string, after being decoded was to be interpreted as a set of bytes representing a PNG image, but I could be sure of this only by looking at the instrument documentation. Otherwise, you just have to try different interpretations and hope to get it right.
Just to give you an idea, once I had to work on a similar instrument: that time the string was not meant as a PNG image converted to bytes, but it was a chart. Each pair of bytes represented the value of the Nth value in the X axis: I just had to build a bar chart, with the bar at the N/2 position being as high as the value of Nth pair of bytes. Another example would be an instrument that measured Covid-19 antigenes reaction over a 15-minutes time: that instrument enveloped the real data in headers, while sending other information encoded with special characters. Using your data string as example, it was sending this kind of messages:

  • C8—44—80是每个报文的报头
  • C8—44—80—01后面是另一个字节,代表测量开始、停止或暂停等特殊命令
  • C8—44—80—0A代表真实数据,后面是10字节数据

我希望这能给你一个概念,让你知道你有多少可能错误地解释你正在接收的数据.你最好还是带上一些制造商的文件.

Flutter相关问答推荐

我遇到了一个问题,从showDialogue()调用Navigator.pop()两次导致屏幕空白

在Flutter中,CachedNetworks Image不工作(不从CachedData加载)

如何从模型列表中生成DropdownButtonFormField?

如何使用新的Riverpod语法将依赖传递给AsyncNotifier?

Flutter AppBar Animation反向调试

如何在用Ffltter成功登录后重定向下一页?

使用 Firebase Realtime 实现高效流式传输

如何使自动焦点位于已经有一些文本的 TextField 的第一行?

Flutter 未处理的异常 - 对 null 值使用 Null 判断运算符

有没有办法在 google_map 上移动标记(向左或向右移动一些像素)?

在允许屏幕 Select 和点击的同时保持通用对话框显示

在 flutter 中获取最喜欢的文档

Freezed+BLoc 如何从 BLoc Listener 查看当前状态和特定状态的变量

Flutter - 展开图标无法正常工作

Flutter - 如何将按钮对齐到行的右侧

有什么办法可以消除Flutter 中的传递依赖?

如何建立最近的文件列表?

Flutter :RangeError(索引):无效值:不在包含范围内0..3:4使用IndexedListView.builder

使用 hydrad_bloc 的预览包

用于空值 FirebaseFirestore 的空值判断运算符