11-08-2020 08:02 PM
I'm using the Bluetooth Low Energy (BLE) Toolkit with BLED112 dongle and have successfully run the Heart Rate Monitor example. I'm working on connecting to a Bike Trainer using the Bluetooth Service ID 1826 and Characteristic 2AD2. The following table outlines what should be in the data payload for 2ADA.
Field | Format | Byte Index | Unit(Exponent) |
---|---|---|---|
Flags | 16 bit | 0,1 | |
Instantaneous Speed | uint 16 | 2,3 | km/h ( Decimal, -2 ) |
Average Speed | uint 16 | 4,5 | km/h ( Decimal, -2 ) |
Instantaneous Cadence | uint 16 | 6,7 | rpm ( Binary, -1 ) |
Average Cadence | uint 16 | 8,9 | rpm ( Binary, -1 ) |
Total Distance | uint 24 | 10,11,12 | meter |
Resistance Level | sint 16 | 13,14 | |
Instantaneous Power | sint 16 | 15,16 | watt |
Average Power | sint 16 | 17,18 | watt |
Total Energy | uint 16 | 19,20 | calorie |
Energy Per Hour | uint 16 | 21,22 | calorie |
Energy Per Minute | uint 8 | 23 | calorie |
Heart Rate | uint 8 | 24 | bpm |
Metabolic Equivalent | uint 8 | 25 | ( Decimal, -1 ) |
Elapsed Time | uint 16 | 26,27 | second |
Remaining Time | uint 16 | 28,29 | second |
I've connected to the Bike Trainer and can read instantaneous and average power and see values change as I pedal. I can't however, read any speed data. The speed value remains at "16" and I am wondering if it is a data type issue. When I dig into the payload generation I see everything is coming as a U8. Do I need to change anything in the package acquisition vi? (this is the "ble_evt_attclient_attribute_value" vi in the toolkit)
The trainer only sends an array of 13 in the payload, while there are 16 listed above. If the trainer doesn't support certain fields does it leave them as a blank value or not send them at all? Should I be combining parts of the array to make a larger data type? How do I know what fields are what if some aren't supported?
VI's are very similar to the Toolkit examples. I only made the "ble_parse_fitness_equipment" vi and made small changes to the top level. I'm at the edge of my understanding so any help would be appreciated.