Sequence with two Monitors
In the EEROS library you will find a directory with examples. For this example see SequencerTest40.cpp.
Open a shell in the build directory of your EEROS library and run
$ ./examples/sequencer/sequencerTest40
This example shows a sequence with two associated monitors. The Main Sequence
tries to run several steps called Step A
. After each step a counter is incremented. A monitor checks for this count to reach a given level (MyMonitor
). As soon as this happens an exception sequence is started. After termination of the exception sequence the original sequence resumes because the monitor property is set to resume
. The Main Sequence
continues and is soon interrupted by its timeout monitor because its timeout limit has expired. The timeout monitor has no exception sequence assigned to it and immediately aborts the Main Sequence
and with it the application because its monitor property is set to abort.
Altering the Monitor Behavior
Change the behavior of My Monitor
to restart
, recompile, and observe what happens. After the exception sequence the Main Sequence
restarts. This causes the counter to start with 0 and the timeout will be reset as well. Hence, the timeout monitor will never fire.
If you change the behavior of the timeout monitor to restart
, things get more complicated. MyMonitor
will fire, the exception sequence will run, the Main Sequence
will resume, and the timeout monitor will fire. This monitor has no exception sequence but will simply restart the whole procedure.
Monitor Checking two Sequences
The next example is SequencerTest41.cpp. Open a shell in the build directory of your EEROS library and run
$ ./examples/sequencer/sequencerTest41
This example shows a sequence with two associated monitors. The Main Sequence
tries to run several steps called Step A
. After each step a counter is incremented. A monitor checks for this count to reach a given level (MyMonitor
). As soon as this happens an exception sequence is started. After termination of the exception sequence the original sequence resumes because the monitor property is set to resume
. The Main Sequence
continues and is soon interrupted by its timeout monitor because its timeout limit has expired. The timeout monitor also has an exception sequence assigned to it. After this the sequence continues because its monitor behavior is set to resume as well. Both monitors will fire again as their conditions are met again before the sequence finally terminates