Hi all,
I'm using the Serial library version 1.23 to communicate over Bluetooth with a device.
My application send a byte array and expects to receive 5 bytes from the device.
I'm using AsyncStream. In the callback function (Astream_newdata) the 5 bytes are received sometimes in a single call, sometimes in two calls. I can rebuild the data based on the expected number of bytes to be received. Unfortunately, when I receive the data in two chunks, sometimes the two chunks are reversed (second one is received first) which makes impossible to rebuild the data in the right way.
As an example:
I expect the following byte sequence:
00,19,02,00,00
Sometimes I receive:
00 then 19,02,00,00
but somethimes I receive:
19,02,00,00 then 00
Any idea about the root cause of this behavior?
Thank you,
Dan
I'm using the Serial library version 1.23 to communicate over Bluetooth with a device.
My application send a byte array and expects to receive 5 bytes from the device.
I'm using AsyncStream. In the callback function (Astream_newdata) the 5 bytes are received sometimes in a single call, sometimes in two calls. I can rebuild the data based on the expected number of bytes to be received. Unfortunately, when I receive the data in two chunks, sometimes the two chunks are reversed (second one is received first) which makes impossible to rebuild the data in the right way.
As an example:
I expect the following byte sequence:
00,19,02,00,00
Sometimes I receive:
00 then 19,02,00,00
but somethimes I receive:
19,02,00,00 then 00
Any idea about the root cause of this behavior?
Thank you,
Dan