Go Down

Topic: serial readbytes until (Read 930 times) previous topic - next topic

G3RIR

Using readbytesuntil works fine but doesn't transfer the terminator to the buffer. I need to examine the contents of the buffer and often send it on by another serial port but I want it terminated by the same terminator. I can add this to the buffer easily enough but is there some way of the original terminator being transferred to the buffer on read so it is already in the right place to send on. The application reads data from a PC and sends it on to my amateur radio transmitter (TS2000X).  Neil, G3RIR

Cybernetician

Quote
Using readbytesuntil works fine but doesn't transfer the terminator to the buffer. I need to examine the contents of the buffer and often send it on by another serial port but I want it terminated by the same terminator. I can add this to the buffer easily enough but is there some way of the original terminator being transferred to the buffer on read so it is already in the right place to send on. The application reads data from a PC and sends it on to my amateur radio transmitter (TS2000X).  Neil, G3RIR


Posting a question is also an Art 8). First describe you TASK, Post your CODE, and then where you STUCK.
From Idea To Invention

PaulS

Quote
Using readbytesuntil works fine but doesn't transfer the terminator to the buffer.

Of course not. That's by design.

Quote
I can add this to the buffer easily enough

Then you've figured out what you need to do.

Quote
but is there some way of the original terminator being transferred to the buffer on read so it is already in the right place to send on.

Sure. Rewrite the readBytesUntil() method of the Stream class to suit your unique needs.

Go Up