Serial data over bluetooth - getting chopped up?

4.1k Views Asked by At

Is there more detailed information available on the serial library? The reason I'm asking is that the serial data I'm receiving is getting chopped up into seemingly random sized chunks. I know it's fairly continuous, but perhaps small time delays are causing the receiving data event to be fired multiple times. I'm using asyncstreams. Is a method to allow for time delays in the asyncstream before starting another stream? Or maybe it's just a function of bluetooth that sends the data in packets???? If I had to, I could probably use a timer rather than asyncstreams and pile the data up, but I'd rather not if I dont' have to. The data I'm receiving does look right, if it was all merged back into one stream.

1

There are 1 best solutions below

0
On

AsyncStreams in regular mode just transfers the data as it becomes available. As the data is buffered by the serial device it is your responsibility to split and merge the messages correctly.

If you have control on both sides then you can use AsyncStreams in prefix mode. In this mode AsyncStreams is responsible for splitting and merging the messages internally which significantly simplifies your work. See this link for more information.