From 728bc036aa72a83080e933722f8ad409ede69f70 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Wed, 18 Apr 2018 16:26:58 +0200 Subject: Fix after feedback --- system/doc/design_principles/statem.xml | 121 ++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 45 deletions(-) (limited to 'system/doc') diff --git a/system/doc/design_principles/statem.xml b/system/doc/design_principles/statem.xml index ed6338e306..80ee9c992f 100644 --- a/system/doc/design_principles/statem.xml +++ b/system/doc/design_principles/statem.xml @@ -62,7 +62,8 @@ State(S) x Event(E) -> Actions(A), State(S')

These relations are interpreted as follows: if we are in state S and event E occurs, we are to perform actions A and make a transition to - state S'. Notice that S' can be equal to S. + state S'. Notice that S' can be equal to S + and that A can be empty.

As A and S' depend only on @@ -108,6 +109,7 @@ State(S) x Event(E) -> Actions(A), State(S') Inserted Events + that is: events from the state machine to itself (in particular purely internal events) @@ -115,7 +117,7 @@ State(S) x Event(E) -> Actions(A), State(S') State Enter Calls (callback on state entry co-located with the rest - of the state callback code) + of each state's callback code) Easy-to-use timeouts @@ -185,7 +187,7 @@ State(S) x Event(E) -> Actions(A), State(S')

- Events are handled by one callback functions per state. + Events are handled by one callback function per state.

@@ -209,7 +211,8 @@ State(S) x Event(E) -> Actions(A), State(S') that describes the event handling callback function(s).

- The callback mode is selected by implementing a callback function + The callback mode is selected by implementing + a mandatory callback function Module:callback_mode() @@ -233,16 +236,15 @@ State(S) x Event(E) -> Actions(A), State(S') The short version: choose state_functions - it is the one most like gen_fsm. But if you do not want the restriction that the state - must be an atom, or if having to write an event handler function - per state is not as you like it; please read on... + must be an atom, or if you do not want to write + one event handler function per state; please read on...

The two Callback Modes - give different possibilities - and restrictions, but one goal remains: - you want to handle all possible combinations of - events and states. + give different possibilities and restrictions, + with one common goal: + to handle all possible combinations of events and states.

This can be done, for example, by focusing on one state at the time @@ -386,7 +388,7 @@ State(S) x Event(E) -> Actions(A), State(S')

Same as the next_state values with - NextState =:= State, that is no state change. + NextState =:= State, that is, no state change.

@@ -396,7 +398,7 @@ State(S) x Event(E) -> Actions(A), State(S')

Same as the keep_state values with - NextData =:= Data, that is no change in server data. + NextData =:= Data, that is, no change in server data.

@@ -412,7 +414,8 @@ State(S) x Event(E) -> Actions(A), State(S') State Enter Calls - are enabled, repeat that call. + are enabled, repeat the state enter call + as if this state was entered again.

@@ -752,7 +755,7 @@ StateName(EventType, EventContent, Data) -> an event is generated. The pressed buttons are collected, up to the number of buttons in the correct code. - If correct, the door is unlocked for 10 seconds (10,000 milliseconds). + If correct, the door is unlocked for 10 seconds. If not correct, we wait for a new button to be pressed.