On Sunday 10 June 2007 14:20, Murtuza wrote:
> I am working on tinyos-2.x and i have a very simple question to ask. Though
> I read the TEPs etc I still cant figure out what AMType means. The
> tutorials too dont tell what it is. Can anyone tell me what it is?

Others have used the analogy that the AM type field is analogous to the port 
field in the TCP and UDP IP protocols.  Pretty good, I think.

> I want to write a code in which a receiving mote receives data from
> different other motes running different codes on them and sending out data
> packets which are not identical i.e different messages being sent.

You can assign different AM type values to different application-level 
messages.  I think this is what you are attempting below.

> How can I have multiple receive events at the receiver mote. I saw the
> BaseStation code and it implements a queue of receive events. But how can I
> distinguish between various received messages without looking at the
> payload or their IDs. Can I give a separate AMType to different messages
> coming out from different motes using AMPacket.setType(). I used this
> function to set the type to one of the motes but it did not work. It still
> sends packets with type 06. The motes which I use always send out messages
> with type 06. Why is it so?

You might want to use the AMSend and Receive interfaces.  I'm pretty sure 
there's a tutorial that covers this.  You'd have wiring similar to:

configuration MyComponentC {
  provides {
    interface AMSend as Msg1Send;
    interface Receive as Msg1Recv;
    interface AMSend as Msg2Send;
    interface Receive as Msg2Recv;
  }
}
implementation {
  enum {
    APP_MSG1 = 1,
    APP_MSG2 = 2
  };

  components new AMSenderC(APP_MSG1) as Send1;
  Msg1Send = Send1;

  components new AMSenderC(APP_MSG2) as Send2;
  Msg2Send = Send2;

  components new AMReceiver(APP_MSG1) as Recv1;
  Msg1Recv = Recv1;

  components new AMReceiver(APP_MSG2) as Recv2;
  Msg2Recv = Recv2;
}

A module could then use Msg1Send.send() to send a message with its type set to 
APP_MSG1, and Msg2Send.send() for type set to APP_MSG2.  Similarly, messages 
received with type set to APP_MSG1 would be received via the 
Msg1Recv.receive() event and APP_MSG2 messages received via 
Msg2Recv.receive().

All the best,
Steve
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to