Read/write 20 bytes limitation in aoible (bluetooth) #11945
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Have you tried changing the mtu parameter? With the connection object returned by device.connect() try: aioble_conn.exchange_mtu(new_mtu_length) According to the BLE specs, this should be done by central, but it might also work as peripheral, that depends on the specific central implementation. |
Beta Was this translation helpful? Give feedback.
-
Thank you @bixb922 and @jimmo ! I knew it was possible but I couldn't figure out how. In the meantime, I programmed some code for splitting messages in 20-bytes packages and a header with the number of packets. But the way you suggest it's much easier! |
Beta Was this translation helpful? Give feedback.
@dst10 -- The 20 bytes comes from two things, the GATT channel's MTU and the characteristic storage on the server.
The central can initiate mtu exchange as @bixb922 has described. A peripheral can set the default mtu using
This method wraps the underlying config method on the bluetooth.BLE object -- see https://docs.micropython.org/en/latest/library/bluetooth.html#bluetooth.BLE.config for more details about this.
You also need to consider the storage for the characteristics, which defaults to 20 bytes. There are two ways to resize this, the easiest is just to write a larger value to the characteristic when your server starts, which will grow the interna…