Python BLE issues

Post questions and issues with Concept2 PM3 SDK
Post Reply
marcoam95
Paddler
Posts: 3
Joined: August 9th, 2018, 6:04 pm

Python BLE issues

Post by marcoam95 » February 15th, 2021, 5:15 pm

I've started to creating a BLE customized driver for my concept2 machine using python's bleak library, which allows bluetooth discovering devices and exchanging information with them.

Following the Concept2 Documentation PDF, I've got information about my rowing machine, connected to it and stay connected while one of both peers close connection. I've achieved this using BLE available service UUID 0x0010 (C2_DEVINFO_SERVICE_UUID) and getting its characteristic 0x0012 (Serial number).

I want to expose my issues when I tried to use other functionalities:

1) When I try to get data from strokes (0X0031) or from heartrate belt (0x003B), concept machine always returns the same bytes,. In case of heartrate belt this happens even after connecting it to rowing machine, where it should be change from "nothing" (bytes array with "I think random" values) to my heartrate belt data. When I print bytes returned by machine always see the same numbers.

2) How can I control machine status through BLE UUIDs?
3) In UUID 0x0031 for example, when reading right cell notes some field are enum types, theory says every attribute "has" associated enumeration values in appendix A. When I see the appendix related enumerations I can't see values for all attributes.

For example, when I see notes of 0x0031 appears *workout type* attribute which refers to an enumeration. When I try to find it in appendix the only information I see is:

typedef enum {
WORKOUTTYPE_JUSTROW_NOSPLITS = 0,
WORKOUTTYPE_JUSTROW_SPLITS,
WORKOUTTYPE_FIXEDDIST_NOSPLITS,
WORKOUTTYPE_FIXEDDIST_SPLITS,
WORKOUTTYPE_FIXEDTIME_NOSPLITS,
WORKOUTTYPE_FIXEDTIME_SPLITS,
WORKOUTTYPE_FIXEDTIME_INTERVAL,
WORKOUTTYPE_FIXEDDIST_INTERVAL,
WORKOUTTYPE_VARIABLE_INTERVAL,
WORKOUTTYPE_VARIABLE_UNDEFINEDREST_INTERVAL,
WORKOUTTYPE_FIXED_CALORIE,
WORKOUTTYPE_FIXED_WATTMINUTES,
WORKOUTTYPE_FIXEDCALS_INTERVAL,
WORKOUTTYPE_NUM
} OBJ_WORKOUTTYPE_T;

0x0031 UUID returns me a byte array with Workout Type with value 39, how can I see relation between byte value and enumeration options?

User avatar
tijmenvangulik
500m Poster
Posts: 61
Joined: November 25th, 2012, 10:24 am

Re: Python BLE issues

Post by tijmenvangulik » February 18th, 2021, 4:39 pm

Hi

If you look at the following code in ergometerjs:

https://github.com/tijmenvangulik/Ergom ... itorBle.ts

And search on the following script functions..

protected handleRowingGeneralStatus(data:DataView) {

protected handleRowingAdditionalStatus1(data:DataView) {

protected handleRowingAdditionalStatus2(data:DataView) {

... there are more

You can find in these routines how to decode the ble data.


Tijmen

mrverrall
Paddler
Posts: 7
Joined: June 25th, 2020, 2:25 pm

Re: Python BLE issues

Post by mrverrall » February 25th, 2021, 4:53 am

Enums are zero indexed (unless specified) so a value of 39 means you are probably reading it incorrectly.

Post Reply