Incoming message processing
Rule to keep in mind: Don't Overlap Triggers, Buffers are cleared on match
If your regular expression trigger for Sequence1 is "Hello" , and you received a string below
blahblahblah... Hello World....blahblahblah
Your match would match correctly and Sequence1 would trigger.
If your regular expression trigger for Sequence1 is "Hello" , AND a trigger for Sequence 2 of "Hello World", and you received a string below
blahblahblah... Hello World....blahblahblah
Your FIRST match would match correctly ("Hello") and Sequence1 would trigger. Sequence 2 would NOT trigger since the only remaining data in the buffer is now:
" World....blahblahblah"
Why is done this way you ask? Because data is never cleared from the buffer based on "Time". It is based on a match only. This is so a human could type "H" "e" "l" "l" "o" into a terminal as slow as they'd like and it would still work.
UDP Packets:
Once they're there, the entire contents of the packet are reviewed for a possible match. If any portion of the UDP string matches, it is considered "a match". The rest of the packet is discarded after checks are complete. If no match occurs on the packet, the entire packet is discarded.
TCP and Serial Messages
For TCP and Serial messages are like a "stream." Each character must be checked before it is discarded. Buffers for TCP and Serial are only cleared when a match occurs. Buffer is circular, and has a max of 4096 bytes.
Flow Diagram:
The flow diagram below shows how each incoming message is processed. If an outgoing message has just been sent, that takes priority until that message "times out" or receives a valid response. For UDP, the only difference is after the single UDP packet is evaluated, the entire contents of the UDP packet are discarded. This is not true for TCP or Serial.