[Tinyos-help] using two Receives in an application

Urs Hunkeler urs.hunkeler at epfl.ch
Fri Nov 12 02:48:31 PST 2010


Hi,

Your application uses twice the Receive interface. To be able to 
distinguish the two interfaces, you have give them a name in the 
application, like this:

uses interface Receive as SerialReceive;

In the configuration you can then wire it explicitly like this:

App.SerialReceive -> AMSerial.Receive[AM_TEST_SERIAL_MSG];

Giving explicit names to the interfaces can also make your program more 
readable.

Cheers,
Urs

On 11/12/2010 10:42 AM, Venkat wrote:
> Hi all,,
>
> I am a newbie to tinyos.. I am trying to build an application that uses
> 2 Receive interfaces. i.e ,, the first Receive is to receive packets
> from the AMReceiverC to receive packets via the Radio, and another
> Receive is to receive packets from the Serial port from an application
> running on the PC. I am using the right components and wiring,, But when
> i compile this, i get a a warning as "redefinition or Receive." Is there
> a way to do this ? Should i implement both receives in a single
> Receive.recive() event? A snapshot of my code is as below.
>
> *Configuration . *
>
> components ActiveMessageC;
> components new AMSenderC(AM_BLINKTORADIO);
> components new AMReceiverC(AM_BLINKTORADIO);
>
> components SerialActiveMessageC as AMSerial;
> App.AMControl -> ActiveMessageC;
> App.AMSend -> AMSenderC;
> App.Receive -> AMReceiverC;
>
> App.Receive -> AMSerial.Receive[AM_TEST_SERIAL_MSG];
> App.SerialControl -> AMSerial;
>
>
> *Application*
> implementation {
>
> uses interface Receive; // fro Radio receive
> uses interface SplitControl as AMControl;
> uses interface Receive; // for serial recive.
> uses interface SplitControl as SerialControl;
> }
> followed by even implementation ..
>
> Could someone kindly give me some suggestions?
>
>
> Thank you ,
> Venkat.
>
>
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



More information about the Tinyos-help mailing list