Information Technology Reference
Fig. 3.2 Block view of a TinyOS component
The interface consists of registered commands and events, through which
components communicate. The main difference between the two is in the fact that
events propagate upward in the connection chain (from device driver components,
such as aforementioned rfm , through bottom-level user components up to the
top-level user components) and commands propagate downward in the connection
chain. One component may choose to implement several interfaces, each consisting
of a number of commands and events. More on this will be mentioned later, in the
chapter on component interconnection.
The code contained in an individual TinyOS component consists of
• Command handling routines , which they execute in response to commands
issued from other connected components
• Event handling routines , which they execute in response to events signaled by
• Tasks , which components themselves schedule for later execution
System Components and Predefined Events
TinyOS comes with a certain number of system components which perform
the function of device drivers. Examples include the already mentioned rfm
transceiver-operating component [ 2 ], Photo and Temperature - the components
for manipulating photo and temperature sensors, and so on.
In addition to predefined system components, there is also a predefined interface
StdControl, consisting of events Init, Start, and Stop . Each TinyOS component
has to implement this interface by providing handlers. For example, an Init event
handler defines the response of the component to the event of system initialization.
A component could use this handler in order to initialize its state to initial values.
Actual execution of a program begins with handling of the Start event, in the
mandatory Main component.