What is the most used way to understand what is last packet with ble?

Hi all,

maybe a dumb question, but here to listen any advice. I am using nus to receive data from a phone, packets are in chuncks of 256 bytes, which is the "most used" way to understand when last packet is received?

From what I saw it's responsablity of the application so using a byte counter and check that len is the same? Using a terminator?

Is there a way with protocol?

Thanks!

Parents
  • Depends on how you are receiving the data? Normally the API you use to receive data have callbacks which have the argument of length (size of data sent) of the data received. The packets that is sent as chunks from peer are normally packed within this size. If the last packet is very specific to your application or the sender, then ofcourse yes, you need to remember this in your application by implementing a reverse counter. You decrement the reverse counter by the amount of data you received until the counter reaches 0.

Reply
  • Depends on how you are receiving the data? Normally the API you use to receive data have callbacks which have the argument of length (size of data sent) of the data received. The packets that is sent as chunks from peer are normally packed within this size. If the last packet is very specific to your application or the sender, then ofcourse yes, you need to remember this in your application by implementing a reverse counter. You decrement the reverse counter by the amount of data you received until the counter reaches 0.

Children
No Data
Related