Search code examples
androidflutterhexbluetooth-lowenergydevice

Interpreting Bluetooth BLE Data from Flutter App: Understanding Systolic Pressure Values


I connected my device with Bluetooth BLE using a Flutter application, and this is what I obtained: 'indication received from 00002a35-0000-1000-8000-00805f9b34fb, value :(0x) DE-F6-F4-16-F3-FF-07-E4-07-01-14-08-2B-00-B2-F2-01-80-00'. How do I interpret these results? When I used nRF Connect, the interpreted values of systolic pressure are: 127.0 mmHg. How was the systolic value obtained? Considering that the format of the systolic pressure is sfloat (2 bytes) and 'The value of 1 equals 1.0 mmHg. The valid range is 0-300.' However, I was unable to determine how the systolic and diastolic values were obtained in mmHg. How can I demonstrate that it is equal to 127.0 mmHg?


Solution

  • The GATT Specification Supplement documents the definitions for all GATT characteristics. I your case you will find the information for Blood Pressure Measurement on page 43 of GATT Specification Supplement, Version Date: 2024-02-21

    With regard to the Flags field, the Blood Pressure Measurement Compound Value - Systolic in mmHg is found in byte 1 and 2 as medfloat16.

    medfloat16 is an IEEE-11073 16-bit SFLOAT value. You can find lots of information on Stack Overflow about how to convert it to a float value in your preferred programming language. Examples:

    How to convert IEEE-11073 16-bit SFLOAT to simple float in Java?

    Converting two bytes to an IEEE-11073 16-bit SFLOAT in C#

    For your measurement 0xF4F6, the mantissa value is 1270 and the exponent value is -1.

    Addition, SFLOAT (16-bit) representation:

    Bits 0-11 represent the mantissa, Bits 12-15 represent the exponent

    mantissa: 0x04F6 -> 2's complement -> 1270
    exponent: 0x000F -> 2's complement -> -1