Hi Orcun,

 

You call a Send() command without waiting until the previous send() command
returns a SendDone() event.

So while the radio stack is processing your message, you are trying to send
another message. This fails because radio is busy.

 

After each Send() command you need to wait until the SendDone event is
signaled, before posting the next sending task.

 

 

Cheers,

 

 

oussama

 

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of orcun
ertugrul
Sent: dinsdag 8 mei 2007 14:03
To: tinyos help
Subject: [Tinyos-help] consecutively two task

 

hi everyone;

i am trying to write a tinyos application for my final project. i have
problem about tasks. i call consecutively two tasks that sends data over rf,
in ReadyTimer.fired() function, but only the first task runs. The second
firstHelloTask does not run.

Thanks four your help...

   

task void sendHelloTask()
{
      if(((HelloMsg *)helloMsg.data)-> index < PATHSIZE)
      {
               ((HelloMsg *)helloMsg.data)->path[((HelloMsg
*)helloMsg.data)-> index] = TOS_LOCAL_ADDRESS;
               ((HelloMsg *)helloMsg.data)-> index++;
              call SendHelloMsg.send(parent, sizeof(HelloMsg), &helloMsg);  
     }
 }

 task void firstHelloTask()
   {
        atomic{
             ((HelloMsg *)helloMsg.data)-> index = 0;
        }
         post sendHelloTask(); 
   }
   
   task void sendCostTask()
 {
      ProjectMsg *costMsgPtr = (ProjectMsg *)sendCostMsg.data;
      atomic 
      {
           costMsgPtr->cost = cost;
           costMsgPtr->action = PARENT_REPLY;
           costMsgPtr->source = TOS_LOCAL_ADDRESS;
      }
       call Send.send(TOS_BCAST_ADDR, sizeof(ProjectMsg), &sendCostMsg);  
 }

   event result_t ReadyTimer.fired()
   {
        post sendCostTask();
        post firstHelloTask();
        call ADCTimer.start(TIMER_REPEAT,1000);
         return SUCCESS;
   }

 

  _____  

Yahoo! Mail is the world's favourite email. Don't settle for less, sign
<http://uk.rd.yahoo.com/evt=44106/*http:/uk.docs.yahoo.com/mail/winter07.htm
l>  up for your free account today.

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

Reply via email to