Component SerialDispatcherC is a configuration module and has a provides and
uses section.  This allows folks who wire to SerialDispatcher to connect to
anything specified in the provides or uses sections.

The configuration SerialDispatcherC by specifing Leds in the uses section
says one must wire this to another module that provides this module.  It
allows one to wire to the Leds implementation of ones own choice.  And
requires you to provide the wiring before the compiler will be happy.

The implementation section says Leds = SerialDispatcherP.  What that means
is the implementation of SerialDispatcherP is exporting the Leds interface
and it is exported to the configuration export of Leds.    Namely that
SerialDispatcherC.Leds is exactly SerialDispatcherP.Leds.   Note that
SerialDispatcherP uses Leds.

Now in some other configuration where you are actually using
SerialDispatcherC we would see something like:

module blahC {}
implementation {
    components SerialDispatcherC;
    components blahP as App;
    components LedsC;

    App.Receive -> SerialDispatcherC.Receive[0];
    SerialDispatcherC.Leds -> LedsC;
}

Now when SerialDispatcherP calls Leds to twinkle the lights it has been
connected to LedsC (typically tos/system/LedsC which wires into
Platform_LedsC).

hopefully this clears things up.

eric


On Sun, May 9, 2010 at 8:52 AM, Xiaohui Liu <[email protected]> wrote:

> Hi,
>
> Component SerialDispatcherC ($TOSDIR/lib/serial) *USEs* interface Leds,
> but in its implementation I find "Leds = SerialDispatcherP;". Can anyone
> explain what's going on here? Isn't that left side of delegation must be an
> interface this component is providing?
>
> --
> -Xiaohui Liu
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to