BLE GATT Queue in server for Notifications

Hello,

I'm trying to understand if I can use BLE GATT Queue in my peripheral for sending Notifications. All the example and documentation about BLE GATT Queue seem to be for central rather than peripherals  

my ultimate goal is to have a tx queue in SoftDevice as big as possible, I have already tried increasing NRF_SDH_BLE_GAP_EVENT_LENGTH and NRF_SDH_BLE_GATT_MAX_MTU_SIZE, but it doesn't seem to have the desired effect and it seems that changing directly ble_gatts_conn_cfg_t::hvn_tx_queue_size is not allowed/recommended

Parents
  • Hello,

    Yes, you may use the gatt queue to send notifications. But please note that this is not the intended use case for gatt queue. The Gatt queue is intended for use if you want to send multiple notifications on several characteristics at once. Say for example that you have a navigation system, and you want to update the direction on the next turn as well as the distance to the next turn after a turn has been executed. 

    However, if you intend to stream a lot of data, I suggest you just queue up the packets using sd_ble_gatts_hvx(). As long as you keep this queue full, you will get the maximum throughput that your connection is set up to handle. 

    The size of the softdevice queue is set up automatically, and increasing it will not have any effect. As long as you queue up all the packets that can fit (until it returns NRF_ERROR_RESOURCES), then you can wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event, which means that one or more of your queued packets have been successfully transmitted. Then you can fill up your queue with new packets. 

    The queue length is set up to be long enough to not run out during one connection interval.

    Best regards,

    Edvin

Reply
  • Hello,

    Yes, you may use the gatt queue to send notifications. But please note that this is not the intended use case for gatt queue. The Gatt queue is intended for use if you want to send multiple notifications on several characteristics at once. Say for example that you have a navigation system, and you want to update the direction on the next turn as well as the distance to the next turn after a turn has been executed. 

    However, if you intend to stream a lot of data, I suggest you just queue up the packets using sd_ble_gatts_hvx(). As long as you keep this queue full, you will get the maximum throughput that your connection is set up to handle. 

    The size of the softdevice queue is set up automatically, and increasing it will not have any effect. As long as you queue up all the packets that can fit (until it returns NRF_ERROR_RESOURCES), then you can wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event, which means that one or more of your queued packets have been successfully transmitted. Then you can fill up your queue with new packets. 

    The queue length is set up to be long enough to not run out during one connection interval.

    Best regards,

    Edvin

Children
Related