Title: Message
Other queue issues aside, have you tried putting the call Send.send(..) in a task?
 

 

event result_t Send.sendDone(TOS_MsgPtr msg, result_t success)

  {

    if (pending)

      {

      pending = FALSE;

      signal SensorOutput.outputComplete(success);

      }

   

    if(stack_idx != 0)

    {

      pending = TRUE;

      ((SensorMsg *)data.data)->dest_addr = 0x0002;     

      post sendMsg();

      stack_idx = stack_idx - 1;

    }

   

    return SUCCESS;

  }

 

 

 

task void sendMsg() {

  if(!call Send.send(0x0002, sizeof(SensorMsg), &data)) {

    post sendMsg();

  }

}

 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gina Upperman
Sent: Friday, March 10, 2006 3:25 PM
To: tinyos-help@Millennium.Berkeley.EDU
Subject: [Tinyos-help] Sending messages at the same time using a queue inSendDone

We are trying to send messages at the same time.  To do this, we have built our own simple version of a queue.  When multiple messages are sent, one is transmitted and the others are added to the stack.  That is, the addresses of the nodes are added to an array of integers.  We tried using this code in the SendDone event and it doesn't work.

 

event result_t Send.sendDone(TOS_MsgPtr msg, result_t success)

  {

    if (pending)

      {

      pending = FALSE;

      signal SensorOutput.outputComplete(success);

      }

   

    if(stack_idx != 0)

    {

      pending = TRUE;

      ((SensorMsg *)data.data)->dest_addr = 0x0002;     

      call Send.send(0x0002, sizeof(SensorMsg), &data);

      stack_idx = stack_idx - 1;

    }

   

    return SUCCESS;

  }

 

 

We later tried instantiating a new TOS_Msg object so that there was no issue with overwriting the global variable.  The code appears below.  This also failed.

 

event result_t Send.sendDone(TOS_MsgPtr msg, result_t success)

  {

    TOS_Msg dataObject;

    if (pending)

      {

      pending = FALSE;

      signal SensorOutput.outputComplete(success);

      }

   

    if(stack_idx != 0)

    {

      pending = TRUE;

      ((SensorMsg *)dataObject.data)->dest_addr = 0x0002;     

      call Send.send(0x0002, sizeof(SensorMsg), &dataObject);

      stack_idx = stack_idx - 1;

    }

   

    return SUCCESS;

  }

 

Any suggestions / advice would be greatly appreciated.

 

Thanks!

Gina

 

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to