I personally think the LedsC component isn't complete, and should be updated
to include the StdControl interface while remaining compatible with current
applications.
All components should be wired directly to Main.StdControl somehow in
configurations, unless there is some compelling reason not to do so.
Architecturally, it is much easier to build large applications without
having to worry if some component's init was called inside the module of
some random component.. which is why LedsC needs to change.
As long as init gets called on every component that is used at least once,
you should be ok. In the case of LedsC, you'll need to call init() inside
at least one module that would use LedsC. If you call init twice, that's
fine, but that init code gets executed twice. But if you call it at least
once, it will initialize the LedsC for every component that uses it.
If you have components A and B that both have an StdControl interface, do
not turn your architecture into speghetti by wiring StdControl to A and then
controlling the StdControl of B from A's module. Instead, directly in your
configuration(s), wire up your StdControl to each component. If you have
sub-configurations, pass the StdControl on down through each configuration
until it reaches the correct module. After your StdControl is wired through
the configurations to each module that needs it, you can wire up your
components to each other.
configuration MyApp {
}
implementation {
components Main, A, B, LedsC;
// Wire up StdControl directly to everything that needs to initialize and
start:
Main.StdControl -> LedsC; // LedsC needs to be edited to support this
Main.StdControl -> A;
Main.StdControl -> B;
// Then wire up your components' interfaces:
A.Leds -> LedsC;
A.MyInterface -> B;
B.Leds -> LedsC;
}
-david
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Arijit
Ghosh
Sent: Sunday, March 19, 2006 4:07 PM
To: [email protected]
Subject: [Tinyos-help] StdControl.init()
Hello,
I need some help in understanding the
StdControl.init() function. My confusion is if init()
of subcomponents should be called explicitly or are
there some implicit assumptions. If for example. my
top level configuration is A and lets say A is wired
to B (defined by me) and a Leds. Within init() of A,
should I:
1) Call init() of both B and Leds?
2) Call init() of only B?
3) Call init() of only Leds?
I was going through the example SenseLightToLog
application, and in it I saw that init() of hardware
components were called explicitly. Any quick help will
be much appreciated.
Thanks in advance,
Rij
"Do the best you can, with what you have, where you are." -- Roosevelt
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help