RKH
|
Prev: Declaring the pseudostates
Next: Declaring the actions
The "my.h" file contains the definitions of objet structures (state machine, states, and pseudostates) and other facilities shared among the components of the application. See the "my.h" file. The following listing shows the "my.h" header file, which illuminates some important aspects of implementing state machines with RKH.
In my.h: active object specification file.
In my.c: active object implementation file.
my
state machine have been identified in the state diagram in fig1 Figure 1. Note that events consist really of two parts. The part of the event called the signal conveys the type of the occurrence (what happened). For example, the ONE signal conveys the arrival of a press key '1'. An event can also contain additional quantitative information about the occurrence in form of event parameters. In my
state machine, all signals are accompanied by the parameter (ts) that contain the quantitative information as to timestamp. In RKH, events are represented as instances of the RKH_EVT_T structure provided by the framework. Specifically, the RKH_EVT_T structure contains the member e, to represent the signal of that event. Event parameters are added in the process of inheritance. Because events are explicitly shared among most of the application components, it is convenient to declare them in the separate header file "my.h".my
SMA to be used as a global object.my
. On the other hand, almost every SMA must also store other "extended-state" information. You supply this additional information by means of data members enlisted after the base structure member sm. Please note that the RKH_SMA_T member sm is defined as the FIRST member of the derived struct. RKH_SMA_T is not intended to be instantiated directly, but rather serves as the base structure for derivation of state machines in the application code.
Prev: Declaring the pseudostates
Next: Declaring the actions