[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Deluge/delugetools Pinger.java, 1.6, 1.7

Jonathan Hui jwhui at users.sourceforge.net
Mon Jun 13 23:06:46 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/Deluge/delugetools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5051

Modified Files:
	Pinger.java 
Log Message:

- Request 2 less packets per image when getting Ident info. The Ident
space on external flash that is reserved is greater than the actual
space used. Thus the 2 extra packets are not needed.

- Fixed a bug that detected Deluge/TOSBase node twice. Saves some time
when using a TOSBase node.

- Add suppression mechanisms to minimize message transfer and
clobbering of the base station. Message suppression occurs by only
transmitting and responding to requests from a specific node. If the
request is not satisfied after a few attempts, another ping attempt is
made.



Index: Pinger.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Deluge/delugetools/Pinger.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Pinger.java	17 May 2005 20:57:16 -0000	1.6
--- Pinger.java	14 Jun 2005 06:06:44 -0000	1.7
***************
*** 40,46 ****
    private static final short TOS_UART_ADDR = 0x007e;
    private static final int STRING_SIZE = 16;
  
    private static final int START_PKT = DelugeConsts.DELUGE_CRC_BLOCK_SIZE/DelugeConsts.DELUGE_PKT_PAYLOAD_SIZE;
!   private static final int END_PKT = DelugeConsts.DELUGE_IDENT_SIZE/DelugeConsts.DELUGE_PKT_PAYLOAD_SIZE;
  
    private MoteIF moteif;
--- 40,49 ----
    private static final short TOS_UART_ADDR = 0x007e;
    private static final int STRING_SIZE = 16;
+   private static final int MAX_ATTEMPTS = 3;
  
    private static final int START_PKT = DelugeConsts.DELUGE_CRC_BLOCK_SIZE/DelugeConsts.DELUGE_PKT_PAYLOAD_SIZE;
!   // TWO PACKETS WORTH OF DATA ARE RESERVED BUT UNUSED
!   // IF MORE IDENT DATA IS REQUIRED, REMOVE SUBTRACTION ON END POINT
!   private static final int END_PKT = DelugeConsts.DELUGE_IDENT_SIZE/DelugeConsts.DELUGE_PKT_PAYLOAD_SIZE - 2;
  
    private MoteIF moteif;
***************
*** 65,68 ****
--- 68,75 ----
    private boolean pingComplete = false;
    private boolean receivedExecutingIdent = false;
+   private boolean requesting = false;
+   private int dest = MoteIF.TOS_BCAST_ADDR;
+   private boolean skipNextAdv = false;
+   private int attempts = 0;
    private String identString = "";
  
***************
*** 116,119 ****
--- 123,130 ----
  	Thread.currentThread().sleep(500);
  
+ 	attempts++;
+ 	if (attempts > MAX_ATTEMPTS)
+ 	  dest = MoteIF.TOS_BCAST_ADDR;
+ 
  	if (advMsg.get_imgDesc_imgNum() >= numImages
  	    && numImages != -1)
***************
*** 122,126 ****
  	advMsg.set_sourceAddr(pcAddr);
  	advMsg = DelugeCrc.computeAdvCrc(advMsg);
! 	send(advMsg);
  	if (verbose) System.out.print(advMsg);
  
--- 133,141 ----
  	advMsg.set_sourceAddr(pcAddr);
  	advMsg = DelugeCrc.computeAdvCrc(advMsg);
! 	requesting = false;
! 	if (!skipNextAdv) send(advMsg);
! 
! 	skipNextAdv = false;
! 
  	if (verbose) System.out.print(advMsg);
  
***************
*** 160,164 ****
    private void send(Message m) {
      try {
!       moteif.send(MoteIF.TOS_BCAST_ADDR, m);
      } catch (Exception e) {
        e.printStackTrace();
--- 175,179 ----
    private void send(Message m) {
      try {
!       moteif.send(dest, m);
      } catch (Exception e) {
        e.printStackTrace();
***************
*** 171,176 ****
--- 186,193 ----
      pktsReceived = 0;
      curImage++;
+     advMsg.set_sourceAddr(pcAddr);
      advMsg.set_imgDesc_imgNum(curImage);
      advMsg = DelugeCrc.computeAdvCrc(advMsg);
+     skipNextAdv = true;
      send(advMsg);
      if (verbose) System.out.print(advMsg);
***************
*** 232,235 ****
--- 249,258 ----
        if (verbose) System.out.print(pingReply);
  
+       if (dest == MoteIF.TOS_BCAST_ADDR)
+ 	dest = pingReply.get_sourceAddr();
+ 
+       if (dest != pingReply.get_sourceAddr())
+ 	return;
+ 
        if (numImages == -1)
  	numImages = pingReply.get_numImages();



More information about the Tinyos-beta-commits mailing list