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

Does the BLE stack resend a packet if response is not received?

Hi, I was wondering If I need to wait for a response from the server that a command was executed before executing another command or if the BLE stack takes care of this under the hood so to speak.

For example, I want to write to a characteristic and then read from it. Should I execute these commands in tandem or should I wait for the onWriteRequest callback method to fire before I send a read request?

If yes to former question, how many resend attempts will the BLE stack make, and how long does it wait for a response before resending a packet?

  • This is more complex as you seems to be living on top of GATT/GAP layers but BLE stack has more layers under the hood ans and some functions are handled there. First of all Link Layer will make sure that each packet will arrive to the peer (otherwise it will be repeated as long as it is either acknowledged or link timeouts and is terminated). Upper layers like L2CAP and (G)ATT will only "stack" PDUs down to LL and that's what Soft Device is doing for you. So in case that you want to do GATT Write Command (without response) and Read then you can push them to SD GATT API and they will go through. LL will guarantee that sequence will remain. But in case that you want to do certain Request - Response GATT sequence or if Read rely on fact that data pushed by Write were processed by the GATT Server then you probably want to wait for BLE_EVT_TX_COMPLETE signalling that PDUs left during previous connection event and you are free to push next through SD GATT API.

    Does it make sense?

Related