hi, in the below code it uses interface RouteControl to send the data... i am really sorry for asking this many times but, i still do not get how to find out which routing algorithm it uses, if i am not mistaken in looking for the correct source according to below link
http://webs.cs.berkeley.edu/tos/tinyos-1.x/doc/multihop/multihop_routing.html it says that it uses "The implementation uses a shortest-path-first algorithm with a single destination node (the root) and active two-way link estimation." Is this what the below code uses as its routing algorithm? thanks! //C:\cygwin\opt\moteiv\apps\Delta\DeltaM.nc DeltaM.nc #include "Delta.h" #include "circularQueue.h" module DeltaM { provides { interface StdControl; } uses { interface Send as SendDeltaMsg; interface Intercept as SnoopDeltaMsg; interface RouteControl; interface RouteStatistics; interface ADC; interface Timer; interface Timer as TimerBlink; interface Leds; } } implementation { /************************* VARIABLES *******************************/ uint16_t m_adc; uint32_t m_seqno; TOS_Msg msg[DELTA_QUEUE_SIZE]; CircularQueue_t queue; /************************* HELPER FUNCTIONS ************************/ task void sendData() { uint16_t _length; int i; uint16_t neighbors[MHOP_PARENT_SIZE]; uint16_t quality[MHOP_PARENT_SIZE]; if (cqueue_pushBack( &queue ) == SUCCESS) { DeltaMsg* dmsg = (DeltaMsg*)call SendDeltaMsg.getBuffer(&msg[queue.back], &_length); atomic dmsg->reading = m_adc; dmsg->parent = call RouteControl.getParent(); call RouteStatistics.getNeighbors(neighbors, MHOP_PARENT_SIZE); call RouteStatistics.getNeighborQuality(quality, MHOP_PARENT_SIZE); for (i = 0; i < MHOP_PARENT_SIZE; i++) { dmsg->neighbors[i] = neighbors[i]; dmsg->quality[i] = quality[i]; } dmsg->neighborsize = MHOP_PARENT_SIZE; dmsg->retransmissions = call RouteStatistics.getRetransmissions(); dmsg->seqno = m_seqno; if (call SendDeltaMsg.send( &msg[queue.back], sizeof(DeltaMsg) ) == SUCCESS) { call Leds.redOn(); } else { // remove from queue cqueue_popBack( &queue ); } } // always increase seqno. gives a better idea of how many packets // really have been dropped m_seqno++; } void blinkBlue() { call Leds.yellowOn(); call TimerBlink.start(TIMER_ONE_SHOT, 20); } /************************* STD CONTROL *****************************/ command result_t StdControl.init() { cqueue_init( &queue, DELTA_QUEUE_SIZE ); return SUCCESS; } command result_t StdControl.start() { call Timer.start( TIMER_REPEAT, DELTA_TIME ); return SUCCESS; } command result_t StdControl.stop() { return SUCCESS; } /************************* TIMER ***********************************/ event result_t Timer.fired() { call ADC.getData(); return SUCCESS; } event result_t TimerBlink.fired() { call Leds.yellowOff(); return SUCCESS; } /************************* ADC *************************************/ async event result_t ADC.dataReady(uint16_t data) { m_adc = data; post sendData(); return SUCCESS; } /************************* SEND ************************************/ event result_t SendDeltaMsg.sendDone(TOS_MsgPtr _msg, result_t _success) { cqueue_popFront( &queue ); if (cqueue_isEmpty( &queue )) { call Leds.redOff(); } return SUCCESS; } /************************* SEND ************************************/ event result_t SnoopDeltaMsg.intercept(TOS_MsgPtr _msg, void* payload, uint16_t payloadLen) { blinkBlue(); return SUCCESS; } } _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help