====== Example with Blocking Sequence ====== The following example all have a main sequence which calls a few steps and a another sequence. This second sequence is a blocking sequence. That means that the main sequence pauses while the second sequence runs. A timeout monitor either supervises the main sequence or the second sequence. ===== Main Sequence Calls Blocking Sequence ===== In the EEROS library you will find a directory with examples. For this example see [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest20.cpp|SequencerTest20.cpp]]. Open a shell in the build directory of your EEROS library and run $ ./examples/sequencer/sequencerTest20 The main sequences starts with three ''Step A'' after which the ''Sequence B'' is called. ''Sequence B'' is blocking, that means, that the main sequence pauses while it runs. The main sequence will subsequently do three more ''Step A'' before finishing. [{{ :getting_started:tutorials:sequencetest20.png?250 | //Calling a blocking sequence// }}] \\ ===== Main Sequence Has Timeout Monitor ===== The next example can be found under [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest21.cpp|SequencerTest21.cpp]]. It demonstrates what happens if the main sequence is interrupted by a monitor while a subsequence is called. Run $ examples/sequencer/sequencerTest21 The main sequence does its steps and starts the second sequence. The timeout monitor of the main sequence fires while the second sequence still runs. The monitor causes an exception sequence to run. After that the main sequence together with the second sequence immediately stop as the timeout behavior is set to ''abort''. [{{ :getting_started:tutorials:sequencetest21.png?500 | //Aborting both sequences// }}] \\ ===== Main Sequence Has Timeout Monitor with Resume ===== The next example can be found under [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest22.cpp|SequencerTest22.cpp]]. It demonstrates what happens if the main sequence is interrupted by a monitor while a subsequence is called. Run $ examples/sequencer/sequencerTest22 The main sequence does its steps and starts the second sequence. The timeout monitor of the main sequence fires while the second sequence still runs. The monitor causes an exception sequence to run. After that the main sequence together with the second sequence continue from their previous state as the timeout behavior is set to ''resume''. [{{ :getting_started:tutorials:sequencetest22.png?500 | //Resuming both sequences// }}] \\ ===== Main Sequence Has Timeout Monitor with Restart ===== The next example can be found under [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest23.cpp|SequencerTest23.cpp]]. It demonstrates what happens if the main sequence is interrupted by a monitor while a subsequence is called. Run $ examples/sequencer/sequencerTest23 The main sequence does its steps and starts the second sequence. The timeout monitor of the main sequence fires while the second sequence still runs. The monitor causes an exception sequence to run. After that both sequences stop immediately and the main starts again as the timeout behavior is set to ''resume''. The timeout monitor will fire again with the same consequences. This would go on forever. After three restarts the timeout behavior is set to ''abort'' and the example terminates. [{{ :getting_started:tutorials:sequencetest23.png?500 | //Restarting the main sequence// }}] \\ ===== Subsequence Has Timeout Monitor ===== The next example can be found under [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest24.cpp|SequencerTest24.cpp]]. It demonstrates what happens if the subsequence is interrupted by a monitor. Run $ examples/sequencer/sequencerTest24 The main sequence does its steps and starts the second sequence. The timeout monitor of the subsequence fires. The monitor causes an exception sequence to run. After that the sugsequence stops immediately as the timeout behavior is set to ''abort''. The main sequence will continue to run until it is done. [{{ :getting_started:tutorials:sequencetest24.png?500 | //Aborting the subsequence// }}] \\ ===== Subsequence Has Timeout Monitor with Resume ===== The next example can be found under [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest25.cpp|SequencerTest25.cpp]]. It demonstrates what happens if the subsequence is interrupted by a monitor. Run $ examples/sequencer/sequencerTest25 The main sequence does its steps and starts the second sequence. The timeout monitor of the subsequence fires. The monitor causes an exception sequence to run. After that the subsequence continues from where it was interrupted as its timeout behavior is set to ''resume''. After the subsequence has terminated the main sequence will continue until it is done. [{{ :getting_started:tutorials:sequencetest25.png?500 | //Resuming the subsequence// }}] \\ ===== Subsequence Has Timeout Monitor with Restart ===== The next example can be found under [[https://github.com/eeros-project/eeros-framework/blob/master/examples/sequencer/SequencerTest26.cpp|SequencerTest26.cpp]]. It demonstrates what happens if the subsequence is interrupted by a monitor. Run $ examples/sequencer/sequencerTest26 The main sequence does its steps and starts the second sequence. The timeout monitor of the subsequence fires. The monitor causes an exception sequence to run. After that the subsequence restarts from the beginning as its timeout behavior is set to ''restart''. This would go on forever. After three restarts the behavior is set to ''abort'' which causes the subsequence to terminate. After this, the main sequence will continue until it is done. [{{ :getting_started:tutorials:sequencetest26.png?500 | //Resuming the subsequence// }}] \\