I don't understand very well what you mean when you say that "within which the receiveMsg() command is called...", but I think I can perhaps help you a little bit.

When you want to receive something you just need to use the interface ReceiveMsg (GenericComm provides this interface, so just wire your component to it). Interface ReceiveMsg signals the event ReceiveMsg.receive() when a packet comes. It will give you a TOS_MsgPtr. As you have well guessed, if MsgPtr is a TOS_MsgPtr variable, MsgPtr->data contains the useful data. If you useful data is of type DataType, just do this:

DataType* pointerToUsefulData;
pointerToUsefulData = (DataType*) MsgPtr->data;

Now you can access all the fields in your data using variable pointerToUsefulData. For instance, if DataType has  field named tempValue, you just do this to access it:

where_you_want_to_save_the_received_data=pointerToUsefulData->tempValue;

Anyway, you have examples about this in the tinyos tutorial [1], and more documentation in the file ReceiveMsg.nc in tinyos-1.x/tos/interfaces.

[1]: http://www.tinyos.net/tinyos-1.x/doc/tutorial/index.html


primalfear 69 <[EMAIL PROTECTED]> escribió:
hello
 
    thanku very much for ur reply..........
 
    but i have another doubt..............what i am doing is receiving the packets from the radio using the function TOS_MsgPtr receive(TOS_MsgPtr received) within which the receiveMsg() command is called ......till here it is fine but my doubt is
 
 1. the received parameter variable in the func  holds what................does it holds the starting value of the packet or what ......
 
 2. if i want to view only the data coming from the radio other than the address and the length etc.........so can i view this data by writing as  
received->data[i]; or something else.............
 
3. in my code i called for HPLUART.put(received->data[i]) within a for loop.........this is giving only the first two values of the data which i want to view..........but i want all data,length of the data,crc etc......
 
    can u help me out with these...................
                   
                                                                  with regards,
 



LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to