Skip to content Skip to sidebar Skip to footer

Need Help To Parse Mealtype On Glucometer Android Ble

Need help to parse mealtype on glucometer android BLE. https://github.com/oesmith/gatt-xml/blob/master/org.bluetooth.characteristic.glucose_measurement_context.xml Here's my data:

Solution 1:

The data you have shared is 17 bytes long.

I've used this xml to get the fields.

The first byte is flags and in your data that is decimal 27 which is binary 00011011

So the flags are set as follows:

<Bitindex="0"size="1"name="Carbohydrate ID And Carbohydrate Present"> = True
<Bitindex="1"size="1"name="Meal Present"> = True
<Bitindex="2"size="1"name="Tester-Health Present"> = False
<Bitindex="3"size="1"name="Exercise Duration And Exercise Intensity Present"> = True
<Bitindex="4"size="1"name="Medication ID And Medication Present"> = True
<Bitindex="5"size="1"name="Medication Value Units"> = kilograms
<Bitindex="6"size="1"name="HbA1c Present"> = False
<Bitindex="7"size="1"name="Extended Flags Present"> = False

I make this that the data should be:

<Fieldname="Flags"> = 1 byte
<Fieldname="Sequence Number"> = 2 bytes
<Fieldname="Extended Flags "> = 1 byte
<Fieldname="Carbohydrate ID"> = 1 byte
<Fieldname="Carbohydrate - units of kilograms"> = 2 bytes
<Fieldname="Meal"> = 1 byte
<Fieldname="Exercise Duration"> = 2 bytes
<Fieldname="Exercise Intensity"> = 1 byte
<Fieldname="Medication ID"> = 1 byte
<Fieldname="Medication - units of kilograms"> = 2 bytes
<Fieldname="Medication - units of liters"> = 2 bytes

Which is 16 bytes long whereas the example data is 17 bytes long. In addition none of the values look like they would make sensible values for the Meal field.

The org.bluetooth.characteristic.glucose_measurement [0x2A18] is 17 bytes long. Could it be that you have mixed the two characteristics up?

Post a Comment for "Need Help To Parse Mealtype On Glucometer Android Ble"