Upma Xmac 测试 04 XmacSenderP.nc SenderControl.startDone(error_t err)

一、XmacSenderP.nc  SenderControl.startDone(error_t err) 源码如下:

  

    event void SenderControl.startDone(error_t err)
    {
        uint16_t ms;
        message_t * msg;
        uint8_t len;
        
        atomic
        {
            msg = msg_;
            len = len_;
        }
        // Get the parameters
        
        if(err != SUCCESS)
        {
            call SendState.toIdle();
            signal Send.sendDone(msg, err);
            return;
        }
        // If we couldn't turn on the radio, give up
        ms = call LowPowerListening.getRemoteWakeupInterval(msg);    //得到远端节点唤醒间隔
        if(ms == 0)
            ms = call SystemLowPowerListening.getDefaultRemoteWakeupInterval();    //ms=0,代表远端节点并未设置唤醒间隔
        //printf("%d ms= %u\r\n",ms); 
        call PacketAcknowledgements.requestAck(msg);        //打开Ack应答
        // Turn on ACKing for the packet
        call PreambleSender.sendPreamble(msg, len, ms + 20, TRUE);    //在ms + 20发送第一个前导分组
        // Send the preamble for the sleep time, plus a 20 ms guard time
    }

    ms = call LowPowerListening.getRemoteWakeupInterval(msg); 的实现代码如下:      

   /opt/tinyos-2.1.2/wustl/upma/lib/macs/bmac/BmacLplPacketCC2420P.nc

   command uint16_t LowPowerListening.getRemoteWakeupInterval(message_t * msg) { //printf("BmacLplPacketCC2420P getFooter(message_t * msg)\r\n"); return (call CC2420PacketBody.getMetadata(msg))->rxInterval; }

  

posted @ 2017-11-21 23:12  XiaoBBai  阅读(267)  评论(0编辑  收藏  举报