This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How does sd_ble_gatts_hvx() queue messages?

Does `sd_ble_gatts_hvx()` queue indications and if so then when does the next message get sent; after the previous one is sent or after the receiver acks the previous one?

We are using `sd_ble_gatts_hvx()` in our application to send BLE indications to connected devices.
The documentation for this function mentions that there is a queue for sending these messages set by `ble_gatts_conn_cfg_t::hvn_tx_queue_size`.
However, when calling `sd_ble_gatts_hvx()` multiple times we just get back a NRF_ERROR_BUSY response until the previous message has been acknowledged no matter how large we make the queue.

From the documentation I was under the impression that we could call `sd_ble_gatts_hvx()` and the messages will be added to the queue and SD would handle the sending of the indications once the previous one has been sent, this does not seem to be the case.

Parents
  • Adding my relevant points here,

    If you use S140 or S132 you have the option of using the nrf_ble_qwr library, which AFAIK can queue the messages.

    This is what being used in the throughput examples.

    Further more, if you use enable BLE_COMMON_OPT_CONN_EVT_EXT

    void conn_evt_len_ext_set(bool status)
    {
        ret_code_t err_code;
        ble_opt_t  opt = {0};
    
        opt.common_opt.conn_evt_ext.enable = status ? 1 : 0;
    
        err_code = sd_ble_opt_set(BLE_COMMON_OPT_CONN_EVT_EXT, &opt);
        APP_ERROR_CHECK(err_code);
    }

    You can chain multiple packets into the same connection

  • Thanks for your input.

    I thought that nrf_ble_qwr is for queuing messages written to our characteristic (Rx) whereas I'm talking about us sending a message to other devices (Tx). Is this not the case?

    Also, as we are using indications then I'm not sure that this normal write functionality works for us. We have to use sd_ble_gatts_hvx() to send.

    Unfortunately I don't think that option will help much either as we want to send messages to multiple devices and I think that chaining them only works for sending multiple messages to the same connection.

Reply
  • Thanks for your input.

    I thought that nrf_ble_qwr is for queuing messages written to our characteristic (Rx) whereas I'm talking about us sending a message to other devices (Tx). Is this not the case?

    Also, as we are using indications then I'm not sure that this normal write functionality works for us. We have to use sd_ble_gatts_hvx() to send.

    Unfortunately I don't think that option will help much either as we want to send messages to multiple devices and I think that chaining them only works for sending multiple messages to the same connection.

Children
No Data
Related