You basically need to send messages in sequence, one from the
sendDone() of the other. I have in my config file:

  // Status replies to send
  RoboMsgM.RStatusMsg -> RComm.SendMsg[AM_ROBOSTATUSMSG];

In RoboMsgM.nc, a method that does the first, radio, send:

  call RStatusMsg.send( TosBaseId, sizeof(RoboStatusMsg), statmsgp );

and in the sendDone() I start the second, UART, send:

  call RStatusMsg.send( TOS_UART_ADDR, sizeof(RoboStatusMsg), statmsgp );

You need a state variable to keep track of where you are
so you don't get stuck in a resending loop.

A working example, along with all of my available code is in:
  http://www.etantdonnes.com/Motes/schipTOS.zip

MS


Xavi Colomer wrote:
> Hello,
> 
> I need to send to UART and Radio at a time, but only one of SendMsg 
> calls works... What is the problem? Parameterized interfaces solves the 
> problem? 
> *
> *
> *MyApp.nc*
> [...]
> MyAppM.SendMsg -> Comm.SendMsg[AM_XSXMSG]; //AM_XSXMSG=0
> MyAppM.UARTMsg -> Comm.SendMsg[AM_XSYMSG];//AM_XSYMSG=1
> [...]
> *MyAppM.nc*
> [...]
> uses {
>     interface Timer;
>     interface Leds;
>     interface ReceiveMsg;
>     interface SendMsg; 
>     interface SendMsg as UARTMsg;
> }
> [...]
> void task SendFlag()
>   {
>     atomic sending_packet = TRUE;
>     
> if (call SendMsg[AM_XSXMSG].send(port,sizeof(XDataMsg),&msg_buffer) != 
> SUCCESS)
>    sending_packet = FALSE;
> return;
>   }
>   void task SendData()
>   {
>   atomic sending_packet = TRUE;
> 
>   if (call UARTMsg.send(TOS_UART_ADDR,sizeof(YDataMsg),&msg_buffer2) != 
> SUCCESS)
>     sending_packet = FALSE;
>  return;
> }
> 
> Sorry for my bad english, and thanks in advance.
> 
> Xavi
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to