taks / esp32-nimble

A wrapper for the ESP32 NimBLE Bluetooth stack.
Apache License 2.0
103 stars 32 forks source link

How do handle large reads (larger than MAX MTU)? #132

Open juliankrieger opened 1 month ago

juliankrieger commented 1 month ago

How would I go on about handling reading values that are larger than the maximum MTU from a characteristic? My characteristic just returns a value of "0" if I write a large string into it.

taks commented 1 month ago

Please provide the following information:

juliankrieger commented 1 month ago

My current WIP solution writes MTU - 3 bytes onto read‘s value inside the on_read callback, therefore sending the data in chunks.

taks commented 1 month ago

My current WIP solution writes MTU - 3 bytes onto read‘s value inside the on_read callback, therefore sending the data in chunks.

Could you paste the code?

taks commented 1 month ago

I checked the specifications, the maximum length of characteristic appears to be 512 bytes. (3.2.9 of the specification)

I have checked communication from esp32 to esp32. It was possible to read 800 bytes larger than the specification. But when I increased the size to 1600 bytes, the connection was broken during the read.