Closed PapoKarlo closed 3 years ago
This is is from another library, this project is not related to micropython.
im trying to connect android kivy app with your lib to ESP32 with micropython on board, then i connect directly i get limit 20 bytes. if i at same time connecting with Bluetooth Terminal (app from play market) limit got off
i think Bluetooth Terminal send some command to gatt server to insrease limit,
It is necessary to negotiate on the MTU value with the server device.
Negotiation could be started by calling requestMTU
function of the BluetoothGatt ( https://developer.android.com/reference/android/bluetooth/BluetoothGatt#requestMtu(int) )
BluetoothGatt Java object is accessible via the able.BluetoothDispatcher.gatt
attribute
# ble: BluetoothDispatcher object
ble.gatt.requestMtu(103) # Need to request 3 extra bytes for ATT packet header
# wait for the MTU response from the server ...
# Now it is possible to send 100 bytes at once
# characteristic: BluetoothGattCharacteristic Java object
ble.write_characteristic(characteristic, range(100))
There is no onMtuChanged
callback in able
, I think it is worth to add it. Thanks for raising this.
on_mtu_changed
callback is added. Usage example: https://able.readthedocs.io/en/latest/#change-mtu
thanks, it work :)
in micropython off docs
Characteristics and descriptors have a default maximum size of 20 bytes. Anything written to them by a client will be truncated to this length. However, any local write will increase the maximum size, so if you want to allow larger writes from a client to a given characteristic, use gatts_write after registration. e.g. gatts_write(char_handle, bytes(100))
how can i send gatts_write(char_handle, bytes(100)) ?