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

ble send data fail

now, i have a question: i have a buffer 100byte data to send, when i send data package via sd_ble_hvx() continus,delay 20ms after each send ,but it will lost some data , i must keep the speed to send ,because my buffer is refresh. now , i want send data according the ruturn value ,to know the iphone is receive success, if success i will send the next package,if not i will send the current packag again until timeout. so now must to know the struct's context ,what the member of the struct replace send data unsuccessful and which channel id of the data .

typedef struct { uint16_t conn_handle; union { ble_gatts_evt_write_t write; ble_gatts_evt_rw_authorize_request authorize_request; ... } params; } ble_gatts_evt_t;

how to found the information about send fail and the send fail occure which channel id.... if send success , it will return BLE_EVT_TX_COMPLETE ,but how i can know this return value respect which channel, because many place send data at the same time ,and return many times the BLE_EVT_TX_COMPLETE value, how i can know the which ruturn is my 100byte buffer-sending-data's return.

  • Sorry, this still doesn't make sense with how BLE normally works on GATT layer. There should be no "delays" as your application is living out of sync from what is happening on lower (LL) layer with it's own timing (connection interval). Simply put as many (G)ATT packets through SD API to the stack as possible and let it do its job to transfer it over the link (reliably). Once you are running out of buffers in the stack you need to wait for TX_COMPLETE event and then try it again. If you are starting to have bigger queue in your application data buffer than in SD buffers then you have problem with bandwidth and there is not much you could do. Use all tricks to increase it (MTU extension, PDU extension, connection interval as short as possible) but indeed it relies on your peer. If peer device (mobile phone?) doesn't support it there is no help.

Related