This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Notify is safe?

I'am using notify continues to send large amounts of data,i want to know that notify whether can guarantee package serial number not random sequence and ensure that each data to arrive.whether it's send logic is similar to UDP(In network communication).thanks!!!

  • if i want guarantee that package number is ordered and every packet must arrive,do i need to add processing logic code in in the app layer

  • No, there is no "package serial number":) The trick is on lower layer called Link Layer which in BLE is 100% safe meaning that:

    • Always keeps sequence of queued packets (only one is being transported and no other packet goes out until the previous is acknowledged by the peer).
    • Either packet is transported reliably (acked by peer) or repeated until link is lost (then it is considered lost;).

    However Notifications live on higher (G)ATT layer where nothing is guaranteed by the protocol until you use Identify (with explicit ACK on (G)ATT layer) or Write with Response in the opposite direction. So the fact that all Notifications come from BLE stack to your application and in correct order is good will of lower BLE stack. Luckily in real implementation all the stacks keep "good" behavior so all of us are using Notifications and rely on lower LL in order to have 100% proper sequencing and reliability. The problems happen in certain scenarios on certain buggy devices (e.g. some Android phones can miss delivery of few initial Notify packets if they come too early after LL establishment = before higher layers of that crappy architecture are ready to forward packets to APP layer on top).

    In the end it's up to you. If your requirements are really high in terms of reliability then you should include some sequence number into your custom protocol header (which lowers effective bandwidth on top of GATT). Otherwise you can be fine as all of us are.

  • (no problem, just mark correct answers and close all your questions which are considered answered;)

  • if Link Layer which in BLE is 100% safe,why add indicate in ble.what different between notify and indicate,thx.

Related