SyncSM04: implement processMessage function

After this change, all synchronous state machine functions are
implemented.
There are some intentional limiations:
1. Allow setup states before machine thread started or inside machine
   thread but states can only be setup once before calling #start.
2. The behavior of transitionTo is defined so that the destination
   state can never change during state transitions. Once a destination
   has been specified, it cannot be changed until the previous state
   transition is complete. In other words, SyncStateMachine does not
   support calling transitionTo in State enter or exit.
3. Support sendSelfMessage in State#processMessage(), #enter() and
   #exit(). This allow automaton to decide the follow up action by
   itself. For example: if something wrong happens during state
   transition, the implementation can enqueue an error message then
   process the error message after finishing the current state
   transition.

Test: atest SynStateMachineTest
Change-Id: I0790df4eeab2dccdb9f407d9131a62c3c12d123b
1 file changed