Timex M851 Watch User Manual


 
M851 WristApp Design Guide Rev 1.2
Timex Corporation 16
4.4.2.3 Implementing The Application State Transition Diagram
The State Transition Diagram will serve as a guide to develop the application template for all the state
handlers. With the template ready, the actual code to implement the function can be added to the
appropriate sections.
Guidelines in the implementation:
The arrows pointing from a state indicates the events that occurred while in the state is active.
This will be processed inside a state.
The arrow pointing into a state from another state will be processed in the new state as a state
entry event.
The actions are initialized inside the state handler when the event is processed.
The code template below shows the actual code to implement the application state transition diagram
shown in the previous section. The macro code shown below are not the actual macros used in the M851
Kernel, but are used here for purposes of facilitating explanation of the operation of the code. The code
below uses C syntax for discussion purposes only.
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// ; DEFAULT STATE HANDLER
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
AppDefaultStateManager()
{
switch(CORECurrentEvent)
{
case STATEENTRY:
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// ; STATE ENTRY PROCESSING
// ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
//