[Firebug-cvs] fireboard/beta/fireworks/apps/MultihopLinkEstimator MultihopLinkEstimator.h,1.3,1.4 Mu
Brought to you by:
doolin
From: Karthik D. <da...@us...> - 2005-08-10 03:05:37
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/MultihopLinkEstimator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20808 Modified Files: MultihopLinkEstimator.h MultihopLinkEstimatorM.nc Log Message: Reduce seq no to 16-bit Index: MultihopLinkEstimatorM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/MultihopLinkEstimator/MultihopLinkEstimatorM.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MultihopLinkEstimatorM.nc 8 Aug 2005 19:51:52 -0000 1.3 --- MultihopLinkEstimatorM.nc 9 Aug 2005 00:07:53 -0000 1.4 *************** *** 72,76 **** TOS_Msg gMsgBuffer; norace uint16_t gSensorData; // protected by gfSendBusy flag ! uint32_t seqno; bool initTimer; bool gfSendBusy; --- 72,76 ---- TOS_Msg gMsgBuffer; norace uint16_t gSensorData; // protected by gfSendBusy flag ! uint16_t seqno; bool initTimer; bool gfSendBusy; *************** *** 85,90 **** bool leSendBusy; bool pSendBusy; ! uint32_t pseqno; ! uint32_t leseqno; /*********************************************************************** --- 85,96 ---- bool leSendBusy; bool pSendBusy; ! uint16_t pseqno; ! uint16_t leseqno; ! ! uint16_t lesource; ! uint16_t lerssi; ! uint16_t lelqi; ! uint16_t sourceseqno; ! /*********************************************************************** *************** *** 112,115 **** --- 118,126 ---- leseqno = 0; pseqno = 0; + + lesource = 0; + lerssi = 0; + lelqi = 0; + sourceseqno = 0; } *************** *** 132,149 **** task void sendPing() { ! PingMsg *pingMsg; uint16_t len; ! if((pingMsg = call Send.getBuffer(&pMsg, &len)) != NULL) { ! /* Build the ping packet */ ! pingMsg->seqno = ++pseqno; ! pingMsg->source = TOS_LOCAL_ADDRESS; #ifdef LE_LEDS ! call Leds.redOn(); #endif ! pSendBusy = TRUE; ! if(call SendPing.send(TOS_BCAST_ADDR, sizeof(PingMsg), &pMsg) != SUCCESS) { ! pSendBusy = FALSE; ! } } } --- 143,158 ---- task void sendPing() { ! PingMsg *pingMsg = (PingMsg *) &(pMsg.data); uint16_t len; ! /* Build the ping packet */ ! pingMsg->seqno = ++pseqno; ! pingMsg->source = TOS_LOCAL_ADDRESS; #ifdef LE_LEDS ! call Leds.redOn(); #endif ! pSendBusy = TRUE; ! if(call SendPing.send(TOS_BCAST_ADDR, sizeof(PingMsg), &pMsg) != SUCCESS) { ! pSendBusy = FALSE; } } *************** *** 151,159 **** task void sendLinkEstimate() { uint16_t len; ! if(call Send.getBuffer(&leMsg, &len) != NULL) { #ifdef LE_LEDS call Leds.yellowOn(); #endif leSendBusy = TRUE; if((call SendLinkEstimate.send(&leMsg, sizeof(LinkEstimatorMsg))) != SUCCESS) { --- 160,175 ---- task void sendLinkEstimate() { uint16_t len; + LinkEstimatorMsg *linkMsg; ! if((linkMsg = (LinkEstimatorMsg *) call Send.getBuffer(&leMsg, &len)) != NULL) { #ifdef LE_LEDS call Leds.yellowOn(); #endif + linkMsg->source = lesource; + linkMsg->dest = TOS_LOCAL_ADDRESS; + linkMsg->RSSI = lerssi; + linkMsg->LQI = lelqi; + linkMsg->source_seqno = sourceseqno; + leSendBusy = TRUE; if((call SendLinkEstimate.send(&leMsg, sizeof(LinkEstimatorMsg))) != SUCCESS) { *************** *** 214,218 **** rtimer = (call Random.rand() & 0x1fff) + 0x2710; ! call Timer.start(TIMER_ONE_SHOT, rtimer); post sendPing(); --- 230,234 ---- rtimer = (call Random.rand() & 0x1fff) + 0x2710; ! call LinkTimer.start(TIMER_ONE_SHOT, rtimer); post sendPing(); *************** *** 238,245 **** PingMsg *pingMsg = (PingMsg *) &(m->data); - #ifdef LE_LEDS - call Leds.greenToggle(); - #endif - /* Build the LinkEstimatorMsg */ atomic { --- 254,257 ---- *************** *** 247,255 **** le->seqno = ++leseqno; ! le->source = pingMsg->source; ! le->dest = TOS_LOCAL_ADDRESS; ! le->RSSI = m->strength; ! le->LQI = m->lqi; ! le->source_seqno = pingMsg->seqno; post sendLinkEstimate(); } --- 259,266 ---- le->seqno = ++leseqno; ! lesource = pingMsg->source; ! lerssi = m->strength; ! lelqi = m->lqi; ! sourceseqno = pingMsg->seqno; post sendLinkEstimate(); } Index: MultihopLinkEstimator.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/MultihopLinkEstimator/MultihopLinkEstimator.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MultihopLinkEstimator.h 8 Aug 2005 19:51:51 -0000 1.3 --- MultihopLinkEstimator.h 9 Aug 2005 00:07:53 -0000 1.4 *************** *** 48,61 **** typedef struct LinkEstimatorMsg { ! uint32_t seqno; uint16_t source; uint16_t dest; uint16_t RSSI; uint16_t LQI; ! uint32_t source_seqno; } LinkEstimatorMsg; typedef struct PingMsg { ! uint32_t seqno; uint16_t source; } PingMsg; --- 48,61 ---- typedef struct LinkEstimatorMsg { ! uint16_t seqno; uint16_t source; uint16_t dest; uint16_t RSSI; uint16_t LQI; ! uint16_t source_seqno; } LinkEstimatorMsg; typedef struct PingMsg { ! uint16_t seqno; uint16_t source; } PingMsg; *************** *** 65,69 **** uint16_t reading; uint16_t parentaddr; ! uint32_t seq_no; } SurgeMsg; --- 65,69 ---- uint16_t reading; uint16_t parentaddr; ! uint16_t seq_no; } SurgeMsg; |