Skip to content

Send signed byte array with Bleak #465

Discussion options

You must be logged in to vote

Coming from Bluetooth development in Java, I sent bytearrays like this byte[] array = new byte[-90, 118, 92, 0, 0, -12
I need to this in Python too, and I came across the module array.

You can do array = array('b, [-90, 118, 92, 0, 0, -12]) instead of bytearray([-90, 118, 92, 0, 0, -12]), because bytearray in Python can only contain 0-256.

So, I create an object with array = array('b, [-90, 118, 92, 0, 0, -12]) and try to do await client_write_gatt_char(uuid_write, array).
This returns an MarshallingError like this: List, Tuple, Bytearray, or Dictionary required for Dbus array.

My question is, how can I send a signed bytearray with Bleak?

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@dlech
Comment options

@bastianpedersen
Comment options

Answer selected by hbldh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #464 on February 25, 2021 17:07.