Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Bluetooth notification message from byte string to byte array? First byte missing? #754

Open
kami83 opened this issue Jan 14, 2025 · 1 comment

Comments

@kami83
Copy link

kami83 commented Jan 14, 2025

Hi,

i am recieving from a rowing machine BT Messages. If i capture them with a PC and bleak i get this Messages:

00002ad1-0000-1000-8000-00805f9b34fb (Handle: 65): Rower Data: [44, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 5, 0]

If i capture the same messages as notification with cb i get this:

b',\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x05\x00'

There is in the beginning the 44 (Hex:2C) missing.
How can i convert the byte string to a normal byte array. And why is the first byte missing?

Thx a lot.

BR kami

@cclauss
Copy link
Contributor

cclauss commented Jan 14, 2025

>>> from array import array
>>> array('b', b',\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x05\x00')
array('b', [44, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 5, 0])

The Rower Data is unsigned (255) while the array is signed (-1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants