Hello.
I have one multirole device (device A) and three peripherals (devices B, C, D).
Device A connects to devices B, C, and D as a central role, and connects to the phone as a peripheral role.
Device A transfers the connection status of devices B, C and D to the phone.
But there is a problem.
When devices B, C and D disconnect from device A at the same time, disconnect event occurs 3 times in device A.
In the disconnect event, sd_ble_gatts_hvx() is called and sometimes NRF_ERROR_RESOURCES is acquired. In this case, while() waits until the BLE_GATTS_EVT_HVN_TX_COMPLETE event occurs, it retransmits.
It has been confirmed that this method is working properly. When sd_ble_gatts_hvx() is called from the normal routine instead of the event routine, the resend processing is performed normally using this method.
However, when calling sd_ble_gatts_hvx() from the softdevice event (disconnect event), the BLE_GATTS_EVT_HVN_TX_COMPLETE event is blocked and loops forever.
The cause is that BLE_GAP_EVT_DISCONNECTED and BLE_GATTS_EVT_HVN_TX_COMPLETE are the same event handler, so we recognize that the resending process when NRF_ERROR_RESOURCES occurs cannot be performed. (Referenced below: devzone.nordicsemi.com/.../153271
In the disconnect event, sd_ble_gatts_hvx() is not called only by performing a flag operation, but it is modified to check the flag in the normal routine and call sd_ble_gatts_hvx().
I have a question.
1. Is it appropriate to call sd_ble_gatts_hvx(), sd_ble_gatts_write(), etc. in the softdevice event (disconnect etc.)? (When resending is performed when NRF_ERROR_RESOURCES is acquired)
2. I increased NRF_SDH_BLE_GAP_EVENT_LENGTH to suppress the occurrence of NRF_ERROR_RESOURCES. Is there a way to actually know the number of tx_buffer?
3. I can't find the location updating hvn_tx_queue_size in ble_gatts_conn_cfg_t. It seems that BLE_GATTS_HVN_TX_QUEUE_SIZE_DEFAULT is not referenced either. Do these have any meaning?
Thank you.