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-unsubscr...@mynewt.apache.org

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

Reply via email to