[Tinyos-help] BaseStationP.nc--I need your help

wkq5325 wkq5325 at 163.com
Sat Feb 7 19:27:01 PST 2009


Hi all,
I am sorry to trouble you,Can you  please explain the following  question to me?

The following code is from tinyos-2.x/apps/BaseStation/BaseStationP.nc
task void uartSendTask() {
    ........
    atomic
      if (uartIn == uartOut && !uartFull)
    {
      uartBusy = FALSE;
      return;
    }
    msg = uartQueue[uartOut];
    tmpLen = len = call RadioPacket.payloadLength(msg);  
    id = call RadioAMPacket.type(msg);
    addr = call RadioAMPacket.destination(msg);
    src = call RadioAMPacket.source(msg);
    call UartPacket.clear(msg);
    call UartAMPacket.setSource(msg, src); 

    if (call UartSend.send[id](addr, uartQueue[uartOut], len) == SUCCESS)
      call Leds.led1Toggle();
    else
      {
    failBlink();
    post uartSendTask();
      }
  }
/*Is it planning to acess radio message header,and deciding to  send radio message to serial?? If so, call UartSend.send it means to   send radio message to serial.Then why use call UartAMPacket.setSource(msg, src) ? What is its role? Why no use  call UartAMPacket.setDestination(msg, src) */

Thanks for  kind help!
Sincerely
wkq
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090208/c67cc2da/attachment.htm 


More information about the Tinyos-help mailing list