NordicSemiconductor / Android-nRF-Toolbox

The nRF Toolbox is a container app that stores your Nordic Semiconductor apps for Bluetooth Low Energy in one location.
https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Toolbox
BSD 3-Clause "New" or "Revised" License
1.1k stars 464 forks source link

Uart is sending very small packed to the peripheral device #93

Open ethanHuntoo7 opened 4 years ago

ethanHuntoo7 commented 4 years ago

I managed to connect this app with a peripheral and now I can easily send and receive data from this app. This app is sending only 600 characters to other end how can I change the size of packet transfer??

I saw in your code you are using writeResquest.split to send long write but again in split method (inside your library) you are using datasplitter of fixed size that seems like I can't change.

can you give me a solution for sending big data as I heard I can easily send 20 bytes data in ble and also after some changes like request.mtu I can change it to 520 bytes... please help!

philips77 commented 4 years ago

Hello, When you use write with response, the app will use long write, which is limited to around 512 (?) bytes. When write without response, using split() will cut your data in MTU-3 bytes long packets and send all of them. There's not limit. On android devices running Android 6 and older, the outgoing buffer may get overflowed. You need to come up with some synchronization mechanism, like a notification (like we have Package Receipt Notification in DFU), or write with response every now and then.