[Tinyos-help] Initialization of components

Alexandre Bergel Alexandre.Bergel at cs.tcd.ie
Fri Jul 7 04:09:52 PDT 2006


Hello,

I am wondering why component initialization has to be always  
specified by the user.

The following lines are duplicated in most of the applications that  
come with TinyOS.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
   command result_t StdControl.init() {
     return call Leds.init();
   }
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

An excerpt from StdControl.nc
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
On boot, the init() of all wired components must be called. init()
may be called multiple times, and in subcomponents before some of
their supercomponents (e.g. if they are the subcomponent of
multiple components).
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

It seems this can be easily inferred by the compiler.
Although there are some cases when other things has to be done in the  
initialization (i.e., in Surge with initialization of variables), it  
seems that most of the case the init method can be deduced from the  
sensors involved...

Regards,
Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





More information about the Tinyos-help mailing list