Hi all,
I can use some help for a designing my COMport connection classes.
I have a device with a microcontroller (which I programmed) connected to my comport. Whenever I send a message to it, it should send an acknowledge.
So whenever I send something over the comport, it should wait for an acknowledge before continuing.
Ofcourse, I dont want something like a while(!ack) wait()
.
When a ack is not received in 1 second or so, it should send the command again. The Ack looks different for each type of command (note: only the type, no message-specific id). The connected device also sends messages (apart from ACKs), which need to be handled by the application itself.
Does anybody has suggestions about an easy and flexible way (a design pattern maybe? a sample?) to fix this?