Once you return 'msg' in the Receive event handler, that pointer can not be used in any other function. Because you passed it into SendMsg.send(), the results are unpredictable because the receive path of the radio still owns the pointer.
You need to return a different message pointer at the end of the receive event handler. Of course, this is described in Lesson 4 of the TinyOS tutorial, of which I hope you have consulted prior to emailing this list: http://www.tinyos.net/tinyos-1.x/doc/tutorial/lesson4.html -Joe On 4/16/06, mikhail chainani <[EMAIL PROTECTED]> wrote: > > I am trying to forward a packet received by my mica2 mote - to implement > controlled flooding. In order to accomplish this I call the SendMsg.send() > fuction within the event ReceiveMsg.receive() and wired it appropriately > with the same handler id. I use the same TOS_MsgPtr that was passed as a > parameter in the receive event, in the send fuction as well. > > event result_t ReceiveMsg.receive(TOSMsgPtr msg) > { > ..... > if(SendMsg.send(TOS_UART_ADDR, length, msg)) //same 'msg' that is passed in > receive > ..... > return msg; > } > > I was using tinyos-1.x and ths worked fine. But whn I changed to > tinyos-1.1.x I encounter a problem. > > The problem is at the base station I use the TOS_UART_ADDR instead of the > TOS_BCAST_ADDR to forward the packet to the PC. When I use Listen to view > the packet at the PC I get to see only the header and the length of the data > payload is 00. > Could someone tell me what is the cause of this problem? > I suspect that the new tinyos implements send as a non blocking fuction > which is creating this problem. Can someone clarify this please? > > Also, is there a better way to implement this controlled flooding mechanism? > > Thanks > mikhail. > > ________________________________ > Play Trivia with MSN Messenger for a chance to win an XBOX™ 360 prize pack! > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
