i have some problems by understanding the flag field in Bluetooth characteristics.
For example the heart rate measurement characteristic:
And its flags:
According to my understanding, the first part of the value must contain the flags. For example 0x06 for:
- Heart Rate Value Format is set to uint8
- Sensor Contact detected = true
- Sensor Contact Supported = true
The second part of the value is then byte(Heartrate).
In Python i fill the value like this:
value = []
value.append(dbus.Byte(0x06))
value.append(dbus.Byte(randint(90, 130)))
The whole thing also works perfectly. When I connect to the server with the app nRF connect I get all the info perfectly displayed with all the info.
Now about my problem:
I tried to implement the Weight Measurement Characteristic.
I want Weight in kg, BMI and height. So for my understanding i have to fill flag field with 0x08 for 00001000.
In Python it will look like this:
value = []
value.append(dbus.Byte(0x08))
value.append(dbus.Byte(randint(1, 13))) #weight
value.append(dbus.Byte(randint(1, 25))) #BMI
value.append(dbus.Byte(randint(1, 25))) #height
Now i get in nRF Connect App the message Invalid Data Syntax.
My Questions are:
- How to handle with the resolution 0.0001? Value = Height/0.0001 or Height*0.0001?
- What is meant by represented values M = 1, d=-1, ...?
- Why is my Value in the second python code invalid?
Thank you very very much for your help!
I'm using bluez5.63/test/example-gatt-server.py for my Server!