Timex M851 Watch User Manual


 
M851 WristApp Design Guide Rev 1.2
Timex Corporation 15
4.4 Application State Handlers
4.4.1 Application Framework
The application is based on the state machine concept. Only one state is active at one time and processes
all the external events. When a state becomes active, it will first initialize all required data and status prior
to receiving and processing external events.
The M851 Kernel provides the mechanism to implement the state machine architecture. The applications
are basically made up of a number of states, where each state handles a specific function of an application.
For example, there is always a banner state, default state, a set state and a popup state.
The Kernel will only know the address of the Application State Manager located in the Application Control
Block. The State Manager will use the system variable CORECurrentState to determine the actual state
handler to execute.
For EEPROM based application, only one state handler is located in the overlay area in heap. There is no
need to have a state manager. The entry in the Application Control block will be the address of the state
handler.
4.4.2 State Transition Diagram
The State Transition Diagram (STD) facilitates the creation of an application in a state machine framework.
The STD shows in a graphic format the available application states, the events the state will be processing
and the associated action and state transitions resulting from the event being processed. With the STD, the
application can be analyzed at this stage for commonality and optimization. Once the STD is complete and
optimized, it becomes the template in coding the state handlers.
4.4.2.1 A State Transition Diagram
The state is represented as a circle. The name of the state describes the general function of the state. The
lines and arrows indicate the events that have occurred and the action to be taken.
4.4.2.2 Application State Transition Diagram
The diagram below shows the state transition diagram for an entire application. This diagram shows the
relationships and interaction between states.