Skip to content

How to send data via a characteristic as fast as possible / detect lost information #728

Open
@h2zero

Description

@h2zero

Discussed in #707

Originally posted by Tirus42 August 11, 2024
Hello together,

I am working on a BLE remote control interface with a flexible web interface (web bluetooth) to allow to control actions on the ESP via a browser. See https://github.com/Tirus42/Arduino-BLE-Remote for details, the send operation is located there: https://github.com/Tirus42/Arduino-BLE-Remote/blob/6832e6bfcbdc5fab2857ab38abc1bb5b38dc6e3b/arduino-library/src/BLELedController.cpp#L489.

For this, i send some data (in my example about 1,5kb) to the connected client by using
characteristic.notify() inside a loop with 128 byte chunks.

This works, as long as the whole data block is not too large,
but for example 5kb of data, there are many packets lost.
Also i got problems, when multiple clients are connected.

I assume that the BLE stack contains a send queue which will be overloaded by to many packets.
Is there a way to detect this and to handle it properly?

I saw in a example (https://github.com/h2zero/NimBLE-Arduino/blob/master/examples/Refactored_original_examples/BLE_server_multiconnect/BLE_server_multiconnect.ino Line 139) that a simple delay is used. But this seems not to be a reliable solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions