I add the SPS profile to BLE example ANCS to send data over TX attribute when button is pressed. I use the "sps_tx_data" function to send data.
The data is correctly receive on an android device connected to BLE. But after few transfers (not a fix number of send and not dependent of the number of byte sent) no more data are sent with the "sps_tx_data" function. The function "sps_tx_data" return before sending data because the function "get_tx_lenght" differ from 0.
The last sent before blocking, the tx done callback is called with 0 bytes sent. This is caused by an error in "handle_event_sent" function, the "get_tx_lenght" function return error because the function "generic_get_cmd" return BLE_ERROR_NOT_FOUND.
I found a temporary workaround : In function "sps_tx_data", i moved the call to function "set_tx_lenght" before the call of "send_tx_data".
This seems to be timing issue, do you have any clues of miss configurations that could lead to such error ?