On Fri, 2006-04-28 at 01:34 +0530, Aditya Bhave wrote:
> event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr msg)
> {
> /* extract the payload field, AnchorXY is my custom defined
> packet, i know for sure this event is triggered on receiving a packet
> of this type */
>
> struct AnchorXY *q = (AnchorXY*)(msg -> data);
>
> /* do some processing on this data.... call a local function
> process() */
> process(*q);
>
> /* Multi-hop this message */
> call SendMsg.send(TOS_BCAST_ADDR, sizeof(struct AnchorXY), msg);
> return msg;
> }
>
> The above code is sometimes working sometimes not. I suspect its
> because the send() command is non blocking therefore msg is returned
> to TinyOS before it is sent over the radio. Now maybe the buffer is
> getting overwritten with next received packet and that is why some
> packets are not getting sent. Is my reasoning right?
Yes.
You are telling TinyOS that it should send the buffer that you've
returned to it for reception. So if you receive a packet before you can
send, you'll overwrite what you were trying to send.
A simple way to test your hypothesis would have been to use two buffers,
one for sending and one for receiving.
Phil
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help