You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2023/01/16 16:13:27 UTC

[GitHub] [mynewt-nimble] Rubeer commented on issue #1170: GAP callback when receiving HCI completed packets

Rubeer commented on issue #1170:
URL: https://github.com/apache/mynewt-nimble/issues/1170#issuecomment-1384268778

   I have a similar application. One problem is that BLE_GAP_EVENT_NOTIFY_TX  is not called at a helpful time.
   It seems to be called directly from inside the send function (e.g. `ble_gattc_notify_custom`), and not when the actual data is sent. This can even cause crashes due to recursion if you try to send more data from that callback.
   
   For example, if you naively implement a stream using this event as feedback, you could get a callstack looking something like this:
   ble_gattc_notify_custom -> ble_gap_event -> ble_gattc_notify_custom -> ble_gap_event -> ble_gattc_notify_custom -> (stack overflow)
   
   Ideally there should be a separate "application tx flow control" callback that would:
   
   - Always be called _just before_ the connection interval.
   - Supply information about how much data is already queued in the controller and host. We want to keep these buffers/queues mostly empty to get the lowest latency.
   
   The goal here is that after receiving this callback, the application can fill up a packet up to the MTU size, and have it be sent right away. This setup would give you the lowest latency while maintaining decent throughput.
   
   Right now I am thinking of just hacking in my own callback somewhere around `ble_hs_hci_evt_num_completed_pkts` as well.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org