Here:devzone.nordicsemi.com/.../group__ble__api.html
Choose to simply not keep track of available buffers at all, and instead handle the BLE_ERROR_NO_TX_BUFFERS error by queueing the packet to be transmitted and try again as soon as a BLE_EVT_TX_COMPLETE event arrives.
I want to know how do I wait for BLE_EVT_TX_COMPLETE?
This is what I did but BLE_EVT_TX_COMPLETE never got triggered at all:
FLAG: if(notification_buffer_is_free ==true)
{
data_cache+=i;
logger_gatt_value_set(LOG_DATA_DATA, (uint8_t*)data_cache,sizeof(log_data_t));
}
else
{
goto FLAG;
}
in the relevant event handler:
case BLE_EVT_TX_COMPLETE:
notification_buffer_is_free = true;
break;
Like I said BLE_EVT_TX_COMPLETE never got triggered at all. I'm suspecting that my code turned into an infinite loop and the BLE_EVT_TX_COMPLETE isn't a high priority interrupt so it never got the chance to change the notification_buffer_is_free flag.
How am I supposed to do it? And please don't tell me in order to use BLE_EVT_TX_COMPLETE, I need to get all the other 999,998 of 999,999 things necessary right to be successfully using BLE_EVT_TX_COMPLETE, lol.