What have I tried?
I read through GATT_Specification_Supplement_v10.pdf
and previous publicly available versions of the document mentioned.
I looked at stack overflow questions and 3rd party bluetooth libraries.
For 3.125 Indoor Bike Data
characteristic in GATT_Specification_Supplement_v10.pdf resistance level is a UInt8
but in practice its a Int16
.
Meaning it take two octets or two array values of types UInt8
to represent the resistance level.
Additionally when browsing stack overflow I found this 3rd party documentation that documents the value as a SInt16
.
https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/ibd-0000001051005923
I also looked at a 3rd party library that parses this value as a Int16
.
https://github.com/FitnessKit/BluetoothMessageProtocol
// File: CharacteristicIndoorBikeData.swift
// Line: 172
var resistanceLevel: Int16?
if flags.contains(.resistanceLevelPresent) {
resistanceLevel = decoder.decodeInt16(data)
}
Do you think I'm misunderstanding something? Is it an issue with the documentation? Which I doubt would be the case.
Raw Data
Here is the raw data as requested.
// Raw Byte Array Data - represented as decimal integers
▿ 19 elements
- 0 : 116
- 1 : 3
- 2 : 0
- 3 : 0
- 4 : 62
- 5 : 0
- 6 : 0
- 7 : 0
- 8 : 0
- 9 : 16
- 10 : 0
- 11 : 0
- 12 : 0
- 13 : 0
- 14 : 0
- 15 : 0
- 16 : 0
- 17 : 0
- 18 : 0
// Here is data I generated while actually riding the bike for a few seconds.
// resistance level in bike was updated during the ride, from 17 to 22.
[116, 3, 0, 0, 96, 0, 163, 0, 0, 19, 0, 0, 0, 2, 0, 0, 0, 0, 0]
[116, 3, 178, 12, 176, 0, 171, 0, 0, 17, 0, 162, 0, 3, 0, 0, 0, 0, 0]
[116, 3, 66, 14, 206, 0, 181, 0, 0, 17, 0, 219, 0, 3, 0, 0, 0, 0, 0]
[116, 3, 126, 14, 226, 0, 192, 0, 0, 16, 0, 229, 0, 3, 0, 0, 0, 0, 0]
[116, 3, 146, 14, 224, 0, 202, 0, 0, 16, 0, 233, 0, 3, 0, 0, 0, 0, 0]
[116, 3, 142, 13, 184, 0, 212, 0, 0, 16, 0, 192, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 78, 12, 154, 0, 221, 0, 0, 18, 0, 150, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 170, 10, 120, 0, 229, 0, 0, 18, 0, 103, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 126, 9, 100, 0, 236, 0, 0, 18, 0, 77, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 152, 8, 84, 0, 236, 0, 0, 19, 0, 57, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 98, 7, 60, 0, 242, 0, 0, 21, 0, 42, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 234, 6, 50, 0, 247, 0, 0, 21, 0, 31, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 114, 6, 40, 0, 252, 0, 0, 21, 0, 22, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 114, 6, 40, 0, 0, 1, 0, 21, 0, 22, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 100, 5, 28, 0, 4, 1, 0, 22, 0, 12, 0, 4, 0, 0, 0, 0, 0]
[116, 3, 100, 5, 28, 0, 8, 1, 0, 22, 0, 12, 0, 4, 0, 0, 0, 0, 0]
// For convenience here is the flags field represented as a 16bit binary number
1101110100