On Fri, Jan 11, 2013 at 10:21 PM, Sean Dekker <[email protected]> wrote:

> Dear Eric,
>
> I tried to follow you. I ended up with the code below, yeti does not show
> any errors. So is this correct way to check for a radio message destinaton
> address?
>
>     event message_t * RadioReceive.receive(message_t *msg, void *payload,
> uint8_t len)
>     {
>         message_t* temp = (message_t*) msg;
>
>         //Top in my code I have:  uses interface AMPacket;
>         uint16_t destAddress = call AMPacket.destination(temp);
>
>         if(destAddress == 32564)
>         //Do stuff, else do nothing
>
>         return msg;
>     }
>
> Can you also please clearify this, DESTIONATION_ADDRESS is the mote that
> intended to receive the message, and SOURCE_ADDRESS is the node sending the
> message?
>
> I have 3 motes: The first one is running base station app and I send
> various serial packets and it broadcasts it. I have set the destination
> address in the serial packet that goes to the basestation, both motes will
> receive it and if the destination address is correct they will do theire
> job on the packet.
>
> Is this a correct approach? How about TOS_NODEID? Is it more recommended
> or its just another option.
>

TOS_NODEID is the defined address for this mote.   You would typically
assign a different nodeid to each different mote.


>
> Really appriciate your help.
>
> Regards,
> Sean.
>
>
>
>  ----- Original Message -----
>
> From: Eric Decker
>
> Sent: 01/12/13 05:00 AM
>
> To: Sean Dekker
>
> Subject: Re: [Tinyos-help] Checking for AM GROUP and AM TYPE
>
>
> 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
>
>
>
>
>
>


-- 
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