[Tinyos-help] Detecting one event in another event
ram kishore
rapoliit at gmail.com
Fri Aug 1 03:55:14 PDT 2008
Hi,
The problem is exactly like this:
""When the message is send,send.done() event is generated.I start waiting
for a packet to be received.If it doesn't come in 1ms,I will re-transmit
else I will transmit the next packet.""
*Coding part:*
In send.done ()
{
while ( timer <= 1000)
{
TOSH_uwait(1); //wait for 1microsecond
timer++;
if ( flag == 1) //flag is a conditional variable;If
packet is received,Receive.receive() event will set the flag to 1.
{
call Leds.yellowToggle();
break;
}
}
if ( timer == 1001)
post ResendTask();
return SUCCESS;
}
I will transmit the next packet in receive.receive event.
Conditional variable is not working in this regard.Any suggestion on
different paradigm ?
Regards,
Kishore
On Wed, Jul 30, 2008 at 11:54 PM, Eric Decker <cire831 at gmail.com> wrote:
>
>
> On Wed, Jul 30, 2008 at 10:55 AM, ram kishore <rapoliit at gmail.com> wrote:
>>
>> Hi all,
>>
>> When ever a packet is received, an event ReceiveMsg.receive(TOS_MsgPtr
>> Msg) is generated.Can I detect this in some other event for example in
>> send.senddone() event,so that I can perform alternative task.How to
>> detect it?
>
> First I'm not sure what problem you are trying to solve. The description
> you
> give above sounds complicated. If I understand correctly from the event
> handler for send.senddone you want to check to see if a message was
> received and do something else. Is that correct? If so it seems simpler
> to let the different handlers handler their one thing. Just an aside.
> events are signaled from another module and as such are pieces of static
> code. As such there isn't a way to detect an event in another event.
> That said your alternative sounds like it might work but it depends on
what
> kind of events, async or not, are being used. And as soon as you start
> mixing
> async stuff and wanting it to interact with a task level event things get
> complicated
> quickly.
> eric
>>
>> An alternative to this may be using conditional variables.I declare a
>> global variable "flag" as "false".Keep performing some task in
>> senddone() event.when a packet is received,receive event generated
>> will set the flag as "true", then I will stop doing task in senddone()
>> event.Will this work?
>>
>>
>> Best Regards,
>> Kishore
>> _______________________________________________
>> Tinyos-help mailing list
>> Tinyos-help at millennium.berkeley.edu
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
> --
> Eric B. Decker
> Senior (over 50 :-) Researcher
> Autonomous Systems Lab
> Jack Baskin School of Engineering
> UCSC
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080801/32597abd/attachment.htm
More information about the Tinyos-help
mailing list