[Tinyos-commits] CVS: tinyos-1.x/tools/java/net/tinyos/deluge Pinger.java, 1.4, 1.5

Jonathan Hui jwhui at users.sourceforge.net
Sat Aug 27 15:29:54 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tools/java/net/tinyos/deluge
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3207

Modified Files:
	Pinger.java 
Log Message:
- Ping a specific node ID.



Index: Pinger.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tools/java/net/tinyos/deluge/Pinger.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Pinger.java	23 Aug 2005 01:52:22 -0000	1.4
--- Pinger.java	27 Aug 2005 22:29:52 -0000	1.5
***************
*** 80,86 ****
    private boolean error = false;
  
!   public Pinger(MoteIF moteif, boolean verbose) {
      this.moteif = moteif;
      this.verbose = verbose;
      this.moteif.registerListener(new DelugeAdvMsg(), this);
      this.moteif.registerListener(new DelugeDataMsg(), this);
--- 80,90 ----
    private boolean error = false;
  
!   private int unicast = MoteIF.TOS_BCAST_ADDR;
! 
!   public Pinger(MoteIF moteif, boolean verbose, int dest) {
      this.moteif = moteif;
      this.verbose = verbose;
+     this.dest = dest;
+     this.unicast = dest;
      this.moteif.registerListener(new DelugeAdvMsg(), this);
      this.moteif.registerListener(new DelugeDataMsg(), this);
***************
*** 96,100 ****
      advMsg.set_imgDesc_vNum(DelugeConsts.DELUGE_INVALID_VNUM);
  
!     System.out.println("Pinging node ...");
  
      // get executing image
--- 100,107 ----
      advMsg.set_imgDesc_vNum(DelugeConsts.DELUGE_INVALID_VNUM);
  
!     if ( dest == MoteIF.TOS_BCAST_ADDR )
!       System.out.println("Pinging node ...");
!     else
!       System.out.println("Pinging node " + dest + " ...");
  
      // get executing image
***************
*** 127,131 ****
        try {
  	attempts++;
! 	if (attempts > MAX_ATTEMPTS)
  	  dest = MoteIF.TOS_BCAST_ADDR;
  
--- 134,138 ----
        try {
  	attempts++;
! 	if ( attempts > MAX_ATTEMPTS )
  	  dest = MoteIF.TOS_BCAST_ADDR;
  
***************
*** 183,191 ****
  
    private void send(Message m) {
      try {
!       moteif.send(dest, m);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  
--- 190,203 ----
  
    private void send(Message m) {
+     
+     int addr;
+ 
      try {
!       addr = ( unicast != MoteIF.TOS_BCAST_ADDR ) ? unicast : dest;
!       moteif.send(addr, m);
      } catch (Exception e) {
        e.printStackTrace();
      }
+ 
    }
  



More information about the Tinyos-commits mailing list