node-serialport icon indicating copy to clipboard operation
node-serialport copied to clipboard

Best practices for sequences of events

Open reconbot opened this issue 8 years ago • 4 comments

We should have more documentation and examples around handling sequences of events that parsers doesn't quite cover.

For example.

  • Waiting for a ready byte or bytes before switching to a parser.
  • Using serialport to implement simple protocols (eg, data encapsulation and command passing)
  • Using serialport to implement more complex protocols like firmata
  • Modem commands that respond with an OK
  • Manage a queue of requests (writes) and expected response lengths. and send each request sequentially

reconbot avatar May 16 '16 01:05 reconbot

Yes, I can't figure out how to handle a sequence of commands. I'm able to send the first one and read it's response data, but how can I send a second command and read it's response?

edmont avatar Dec 09 '16 10:12 edmont

Hi @edmont! Had any success sending a second command? I'm managing to create a simple protocol, to send a big message from one device to another. The idea is to divide the message. In this case the slave must sent some info to signal that the first message was received allowing the master to send the second part.

arthurmoises avatar Oct 17 '17 11:10 arthurmoises

@arthurmoises, I managed to make it work with await, but I finally moved to Python :)

edmont avatar Oct 17 '17 14:10 edmont

I use seq-queue for this

erikkallen avatar Feb 14 '18 09:02 erikkallen