yep. But it isn't off the payload. take a look at:
tos/platforms/telosa/platform_message.h you'll see that a message_header_t is made up of the union of cc2420_header_t and serial_header_t. In tos/types/message.h all this various kruft is brought together into message_t. But to properly access the appropriate place in the header you have to use the accessor macros which also depend on you knowing what kind of packet you are looking at. Serial or Radio etc. Take a look at tos/lib/serial/SerialActiveMessageP.nc On Fri, Jan 11, 2013 at 8:44 AM, Sean Dekker <[email protected]> wrote: > Hi, > > Well know I did change source and destination addresses for different > nodes, now the question is how to access them? I mean for example is there > such thing like: > > event message_t * RadioReceive.receive(message_t *msg, void *payload, > uint8_t len) > { > if(payload->DESTINATION_ADDRESS == 32465) > //do stuff > return msg; > } > > > > > ----- Original Message ----- > > From: Eric Decker > > Sent: 01/11/13 07:03 AM > > To: Sean Dekker > > Subject: Re: [Tinyos-help] Checking for AM GROUP and AM TYPE > > > > On Thu, Jan 10, 2013 at 10:49 PM, Sean Dekker <[email protected]>wrote: > >> Hi all, >> >> I can successfuly receive radio packets on TelosB platform. However, all >> the nodes that I am working with do receive the packet from BaseStation >> mote. How can I check if a packet is intended to come into a specific mote? > > > The way this is supposed to work is via addressing. > > AM packets have 16 bit source and destination fields. It sounds like > they aren't being used properly and doing address discrimination. > > Rather than putting together a work around, figuring out why the address > discrimination doesn't work properly might be a reasonable approach. > > Just a thought. > > >> >> For example I have the follwoing code in header of my application: >> >> enum >> { >> //Active Message Type >> AM_TYPE = 8, >> //Active Message Group >> AM_GROUP = 22 >> }; >> >> And in my app I have this code to receive packets: >> >> event message_t * RadioReceive.receive(message_t *msg, void *payload, >> uint8_t len) >> { >> >> if(len == lenComMsg) >> { >> MyPacket_t* inc = (MyPacket_t*) payload; >> >> switch(inc->Command) >> { >> case 's': >> StartSci(); >> return msg; >> >> default: >> //Do nothing! >> break; >> } >> >> } >> } >> >> So my question is how can I check if the incoming packet has AM GROUP set >> to 22 and AM TYPE set to 8? >> >> This is the code from my configuration file: >> >> components ActiveMessageC; >> components new AMSenderC(AM_TYPE); >> components new AMReceiverC(AM_TYPE); >> >> App.RadioPacket -> AMSenderC; >> App.RadioSend -> AMSenderC; >> App.RadioControl -> ActiveMessageC; >> App.RadioReceive -> AMReceiverC; >> >> So shoud I change the AM_TYPE each time I am going to program a mote, or >> I can just check for it in receive event in my code? >> >> Regards, >> Sean. >> >> >> >> >> _______________________________________________ >> Tinyos-help mailing list >> [email protected] >> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > > > -- > Eric B. Decker > Senior (over 50 :-) Researcher > > > > > -- Eric B. Decker Senior (over 50 :-) Researcher
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
