api call failed, not waiting for ('onCharacteristicRead', 42) #1662
-
Hi.
thanks. Edit:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
So, maybe because a notify characteristic i have to use BleakClient.start_notify
My code send that values, that are strings: b1, b2. What is telling me with Unknown, what is expected to be know? and why i get (b'b2') instead of 'b2'? thank you very much! |
Beta Was this translation helpful? Give feedback.
-
Welll... i get it... lol. Sorry, yes, im a super beginner. |
Beta Was this translation helpful? Give feedback.
-
No, wait. Lol, i dont fix it as i want.
And well, yes, in that way i get my string clean. |
Beta Was this translation helpful? Give feedback.
-
Python is a dynamically typed language, that means in contrast to C# or Java or .... you are not defining variables statically. |
Beta Was this translation helpful? Give feedback.
Python is a dynamically typed language, that means in contrast to C# or Java or .... you are not defining variables statically.
The syntax you are using in your function definitions shows 'type hints' and these are indeed only hints for someone who reads the code or code linters
So it doesn't matter if you write
data: bytearray
ordata: str
, you can even omit it and just write(sender, data)
.Also, the variables which are received by the callback function have the type that they have. You cannot magically convert them by just writing another type hint to them.
So the data come in as bytestring, and if you want them to be strings, you must decode them (as you did).