[Tinyos-help] Component initialization

Philip Levis pal at cs.stanford.edu
Wed Feb 13 15:18:46 PST 2008

On Feb 13, 2008, at 3:04 PM, Flavio Pompermaier wrote:

> Hi to all,I have a quick question:
> suppose I have a component that when initialized starts a timer.
> The main program is however another one, which needs that component
> in order to work. How do I need to initialize the first component?
> Should I need to declare it as implementing Init, StdControl,
> SplitControl or something else? It is not a two-phase component, so
> using StdControl or SplitControl sounds to me like a waste, whereas
> using Init could be more reasonable..however do I need to call  
> Init.init
> from Boot.booted of the second component or from
> MainC.softwareInit?? Do you have some example about it to suggest me?

Init should only be called in the boot sequence. You should not have  
components calling Init on one another later than that, unless you  
want to re-initialize for some reason.

Your component should handle the booted event and start its timer there.


More information about the Tinyos-help mailing list