Replies: 2 comments 3 replies
-
@iot49 I'm having a little bit of trouble understanding the WebBluetooth API. Does Also, what does it mean for a "value changed" event to fire on a characteristic? There is no such thing in a GATT client... only notifications and indications sent by the server. Anyway... When you send a notification from a server to a client, there is no guaranteed delivery... it's just fire and forget. If you attempt to send more notifications than can be queued for the underlying L2CAP channel, then they are dropped.
I suspect this is due to the above -- your PC/Phone running Chrome has essentially unlimited memory to buffer pending notifications, whereas on MicroPython the queue length is very small. For indications though, that's why the characteristic.indicate function is async (where as notify isn't). You can safely do:
with no delays. However, the problem here is that there's no equivalent awaitable version of
There's a missing function name there... did you mean
Do you need to use subscription? Could you instead just send direct notifications/indications without using |
Beta Was this translation helpful? Give feedback.
-
Works reliably with new version |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using aioble essentially as a
UART
- hence I need to capture all packets. An ESP32-S3 (with 8MB psram) acts as peripheral, Google Chrome (on MacOS) as central.The
rx
andtx
characteristics are both declared withindicate=True
:To send messages to connected centrals:
The Micropython doc states
On the central side (Web Bluetooth on Chrome):
this.valueChanged
gets called as expected, but unless I use a delay (100ms?) on the peripheral, messages get dropped.The other direction (central to peripheral) works correctly without delay between writes (
await rx_characteristic.writeValue(data);
), suggesting (?) that Chrome correctly waits for theindicate
response.I've tried
await self._tx_characteristic(...)
in Micropython, but then data gets sent twice and after a while a get a memory error.So the question is:
Beta Was this translation helpful? Give feedback.
All reactions