dotintent / FlutterBleLib

Bluetooth Low Energy library for Flutter with support for simulating peripherals
Apache License 2.0
540 stars 199 forks source link

About MTU #464

Closed xandros6 closed 4 years ago

xandros6 commented 4 years ago

Hi, can you give more information about auto sending multiple chunk of data with MTU=20byte?

Thanks.

mikolak commented 4 years ago

Hi!

What do you mean auto sending?

iOS by default tries to negotiate MTU to ~186 bytes, on Android you have to specify it manually, either by passing optional argument to peripheral.connect(), or by calling peripheral.requestMtu() after connecting.

xandros6 commented 4 years ago

Yes ok, but if I need to send more than MTU bytes, I need to manage it manually or there is some feature of the lib that automates the sending of the chunk of bytes.

In native Android implementations there are 3 options how you can achieve it:

mikolak commented 4 years ago

We're not handling it automatically and do not support long write.

peripheral.requestMtu() returns the negotiated mtu and you can use that info for splitting chunks of data.

xandros6 commented 4 years ago

Ok, thanks!