The documentation is clear that you need to do a buffer swap if you
want to continue using the received message pointer.  What one release
does to the other is irrelevant, so long as it follows the semantics
defined in the documentation.

-Joe

On 4/16/06, mikhail chainani <[EMAIL PROTECTED]> wrote:
>
>
>
> Thanks Joe
>
> Yes I have reffered to the lesson 4 of the tutorila nad I am aware that
> returning the msg pointer to the OS will cause unexpected behaviour.
>
> Actually what I wanted to know was that since this mechanism worked
> perfectly well in tinyos-1.x, is it that the send function was blocking in
> that release and is non blocking in the newer release?
>
> When I create a separate buffer as TOS_Msg buffer and assign buffer = *msg,
> and pass this &buffer to the send fuction, it works fine.
>
>
>
>  ________________________________
>
> From:  "Joe Polastre" <[EMAIL PROTECTED]>
> To:  "mikhail chainani" <[EMAIL PROTECTED]>
> CC:  [email protected]
> Subject:  Re: [Tinyos-help] Problems with sendding a packet within a receive
> event
> Date:  Sun, 16 Apr 2006 22:10:55 -0700
>
> >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
> > >
> > >
> > >
>
> ________________________________
>  Get turn-by-turn driving directions you can really use - Windows Live Local
> is here!

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

Reply via email to