如何从十六进制获取正确的葡萄糖测量值 [英] How to get the correct glucose measurement value from HEX

查看:62
本文介绍了如何从十六进制获取正确的葡萄糖测量值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用android应用,该应用用于在有新数据时从BLE设备(任何Glocometer)读取糖水平.每当我通过连接到应用程序的设备检查血糖水平时,其读数都低于十六进制值.我无法解析或识别此十六进制值的格式.每当我解码此十六进制值t字符串得到值1时,实际糖水平为104 mg/dLNhø

I am working on android app which is used to read sugar level from BLE device (Any Glocometer) whenever new data available. Whenever i check my sugar level through device which is connected to the app, its reads below HEX value. I am unable to parse or identify the format of this HEX value. Actual sugar level was 104 mg/dL whenever i decode this HEX value t string i get value 1 Nhø

0B 04 00 E4 07 05 0E 0C 31 1D 4E 01 68 B0 F8 00 00

0B 04 00 E4 07 05 0E 0C 31 1D 4E 01 68 B0 F8 00 00

// For all other profiles, writes the data formatted in HEX.
            final byte[] data = characteristic.getValue();
            if (data != null && data.length > 0) {
                final StringBuilder stringBuilder = new StringBuilder(data.length);
                for(byte byteChar : data)
                    stringBuilder.append(String.format("%02X ", byteChar));
                intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
            }

推荐答案

如果您的设备使用了采用的Glucose服务/特性,则根据蓝牙网站,您的测量结果如下:-

If your device uses the adopted Glucose service/characteristic, then according to the Bluetooth website, your measurement is divided as follows:-

  • 字段1:标志(8位):0B(1011:存在时间偏移,类型和样品为TRUE,kg/L,传感器状态为True)
  • 字段2:序列号(16位):04 00
  • 字段3:
  • Field1: Flags (8bits): 0B (1011: time offset present, type and sample TRUE, kg/L, Sensor Status True)
  • Field2: Sequence number (16bits): 04 00
  • Field3: Date Time (54 bits): E4 07 05 0E 0C 31 1D
  • Field4: Time offset (16 bits): 4E 01
  • Field5: Units kg/L: (16 bits SFLOAT): 68 0B
  • Field6: Units mol/L: (16 bits SFLOAT): NOT PRESENT
  • Field7: Type: (4bits): F
  • Field8: Location: (4bit): 8
  • Field9: Status: (16bit): 00 00

因此您的测量值为68 0B.68是104,这与您的测量结果一致.不确定0B的用途和用途,但是现在可以将其丢弃.

So your measurement is 68 0B. 68 is 104 which is in line with your measurement. Not sure what the 0B is for and how it is used, but it can be discarded for now.

我希望这会有所帮助.

这篇关于如何从十六进制获取正确的葡萄糖测量值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆