[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla AgentInjector.java, 1.22.2.2, 1.22.2.3 AgillaProperties.java, 1.11.2.1, 1.11.2.2 PromiscuousListener.java, 1.5.2.1, 1.5.2.2

Chien-Liang Fok chien-liang at users.sourceforge.net
Mon Nov 20 16:34:04 PST 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13431

Modified Files:
      Tag: GroupComm
	AgentInjector.java AgillaProperties.java 
	PromiscuousListener.java 
Log Message:
supports proxy

Index: AgentInjector.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/AgentInjector.java,v
retrieving revision 1.22.2.2
retrieving revision 1.22.2.3
diff -C2 -d -r1.22.2.2 -r1.22.2.3
*** AgentInjector.java	15 Nov 2006 09:39:45 -0000	1.22.2.2
--- AgentInjector.java	21 Nov 2006 00:34:01 -0000	1.22.2.3
***************
*** 1,713 ****
! // $Id$
! 
! /* Agilla - A middleware for wireless sensor networks.
!  * Copyright (C) 2004, Washington University in Saint Louis
!  * By Chien-Liang Fok.
!  *
!  * Washington University states that Agilla is free software;
!  * you can redistribute it and/or modify it under the terms of
!  * the current version of the GNU Lesser General Public License
!  * as published by the Free Software Foundation.
[...1397 lines suppressed...]
! 		public void run () {
! 			while(true) {
! 				AgillaSetBSMsgJ bsMsg = new AgillaSetBSMsgJ(vID); // notify mote it is a base station
! //				System.out.println("Sending "  + bsMsg);
! 				injector.sendMsg(bsMsg);
! 				try {
! 					Thread.sleep(3000);
! 				} catch(Exception e) {
! 					e.printStackTrace();
! 				}
! 			}
! 		}
! 	}
! 	
! 	private void log(String msg) {
! 		Debugger.dbg("AgentInjector", msg);
! 	}
! 	
! }
! 

Index: AgillaProperties.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/AgillaProperties.java,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -C2 -d -r1.11.2.1 -r1.11.2.2
*** AgillaProperties.java	15 Nov 2006 04:30:39 -0000	1.11.2.1
--- AgillaProperties.java	21 Nov 2006 00:34:01 -0000	1.11.2.2
***************
*** 59,65 ****
  	private static final String DEFAULT_BASESTATION_OFFSET_X = "0"; // used to enable global co-ordinates across sensor networks
  	private static final String DEFAULT_BASESTATION_OFFSET_Y = "0"; // used to enable global co-ordinates across sensor networks
  	
  	private static String initDir, defaultAgent, nwName;
! 	private static int numCol, numNodes, basestationOffsetX, basestationOffsetY, initAgentID, initNodeID;
  	private static boolean runTest, enableClustering, enableLocationUpdateMsgs;
  	
--- 59,66 ----
  	private static final String DEFAULT_BASESTATION_OFFSET_X = "0"; // used to enable global co-ordinates across sensor networks
  	private static final String DEFAULT_BASESTATION_OFFSET_Y = "0"; // used to enable global co-ordinates across sensor networks
+ 	private static final String DEFAULT_VIRTUAL_ID = "0"; // used to enable global co-ordinates across sensor networks
  	
  	private static String initDir, defaultAgent, nwName;
! 	private static int numCol, numNodes, basestationOffsetX, basestationOffsetY, initAgentID, initNodeID, virtualID;
  	private static boolean runTest, enableClustering, enableLocationUpdateMsgs;
  	
***************
*** 70,73 ****
--- 71,75 ----
  		runTest = Boolean.valueOf(DEFAULT_RUN_TEST).booleanValue();
  		numCol = Integer.valueOf(DEFAULT_NUM_COL).intValue();
+ 		virtualID = Integer.valueOf(DEFAULT_VIRTUAL_ID).intValue();
  		initAgentID = Integer.valueOf(DEFAULT_INIT_AGENT_ID).intValue();
  		initNodeID = Integer.valueOf(DEFAULT_INIT_NODE_ID).intValue();
***************
*** 94,97 ****
--- 96,100 ----
  			numCol = Integer.valueOf(getProperty("numCol", DEFAULT_NUM_COL)).intValue();
  			initAgentID = Integer.valueOf(getProperty("initAgentID", DEFAULT_INIT_AGENT_ID)).intValue();
+ 			virtualID = Integer.valueOf(getProperty("virtualID", DEFAULT_VIRTUAL_ID)).intValue();
  			initNodeID = Integer.valueOf(getProperty("initNodeID", DEFAULT_INIT_AGENT_ID)).intValue();
  			numNodes = Integer.valueOf(getProperty("numNodes", DEFAULT_NUM_NODES)).intValue();
***************
*** 134,137 ****
--- 137,143 ----
  	}
  	
+ 	public static int virtualID() {
+ 		return virtualID;
+ 	}
  	/**
  	 * Sets the network name.

Index: PromiscuousListener.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/PromiscuousListener.java,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -C2 -d -r1.5.2.1 -r1.5.2.2
*** PromiscuousListener.java	15 Nov 2006 09:39:45 -0000	1.5.2.1
--- PromiscuousListener.java	21 Nov 2006 00:34:01 -0000	1.5.2.2
***************
*** 1,149 ****
! // $Id$
! 
! /* Agilla - A middleware for wireless sensor networks.
!  * Copyright (C) 2004, Washington University in Saint Louis
!  * By Chien-Liang Fok.
!  *
!  * Washington University states that Agilla is free software;
!  * you can redistribute it and/or modify it under the terms of
!  * the current version of the GNU Lesser General Public License
!  * as published by the Free Software Foundation.
!  *
!  * Agilla is distributed in the hope that it will be useful, but
!  * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
!  * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
!  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
!  *
!  * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
!  * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
!  * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
!  * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
!  * PROPRIETARY RIGHTS.  THERE ARE NO WARRANTIES THAT SOFTWARE IS
!  * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
!  * OR OTHER HARMFUL CODE.
!  *
!  * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
!  * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
!  * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
!  * indemnify, defend, and hold harmless WU, its employees, officers and
!  * agents from any and all claims, costs, or liabilities, including
!  * attorneys fees and court costs at both the trial and appellate levels
!  * for any loss, damage, or injury caused by your actions or actions of
!  * your officers, servants, agents or third parties acting on behalf or
!  * under authorization from you, as a result of using Agilla.
!  *
!  * See the GNU Lesser General Public License for more details, which can
!  * be found here: http://www.gnu.org/copyleft/lesser.html
!  */
! /*									tab:4
!  * "Copyright (c) 2000-2003 The Regents of the University  of California.
!  * All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  *
!  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
!  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
!  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
!  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  *
!  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
!  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
!  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
!  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
!  *
!  * Copyright (c) 2002-2003 Intel Corporation
!  * All rights reserved.
!  *
!  * This file is distributed under the terms in the attached INTEL-LICENSE
!  * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
!  * 94704.  Attention:  Intel License Inquiry.
!  */
! /* Authors: Chien-Liang Fok <liang at cse.wustl.edu>
!  * Date:        May 2 2005
!  * Desc:        Main class for promiscuous message listener
!  *
!  */
! package edu.wustl.mobilab.agilla;
! import net.tinyos.message.*;
! import net.tinyos.packet.*;
! import net.tinyos.util.*;
! 
! /**
!  * Listens for Agilla messages sent over the wireless network and 
!  * prints them to the screen.
!  * 
!  * @author Chien-Liang Fok <liang at cse.wustl.edu>
!  */
! public class PromiscuousListener implements AgillaConstants {
! 	private MoteIF moteIF = null;
! 	private PhoenixSource psource;
! 	private SNInterface sni;
! 	
! 	public PromiscuousListener(String source, boolean debug, boolean printBeacons) throws Exception {
! 		Debugger.debug = debug;
! 		Debugger.printAllMsgs = true;
! 		Debugger.printBeacons = printBeacons;
! 		
! 		try {
! 			if (source.startsWith("sf"))
! 				moteIF = new MoteIF(BuildSource.makePhoenix(source, PrintStreamMessenger.err));
! 			else {
! 				psource = BuildSource.makePhoenix(
! 					BuildSource.makeArgsSerial(source),
! 					net.tinyos.util.PrintStreamMessenger.err);
! 				moteIF = new MoteIF(psource);
! 			}
! 		} catch (Exception e) {
! 			e.printStackTrace();
! 			System.exit(1);
! 		}
! 		
! 		
! 		sni = new SNInterface(true);
! 		sni.setMoteIF(moteIF);		
! 	}
! 	
! 	public static void main(String[] args) {
! 		try {
! 			String source = "COM1:mica2"; //"sf at localhost:9001";
! 			boolean debug = false;
! 			boolean printBeacons = false;
! 			int index = 0;
! 			
! 			while (index < args.length) {
! 				String arg = args[index];
! 				if (arg.equals("-h") || arg.equals("--help")) {
! 					usage();
! 					System.exit(0);
! 				} else if (arg.equals("-comm")) {
! 					index++;
! 					source = args[index];
! 				} else if (arg.equals("-d"))
! 					debug = true;
! 				else if (arg.equals("-b"))
! 					printBeacons = true;
! 				else {
! 					usage();
! 					System.exit(1);
! 				}
! 				index++;
! 			}
! 			new PromiscuousListener(source, debug, printBeacons);
! 		} catch (Exception e) {
! 			e.printStackTrace();
! 		}
! 	}
! 	private static void usage() {
! 		System.err.println("usage: PromiscuousListener[-h | -comm <source> | -b | -d]");
! 		System.err.println("\t-h prints this help message");
! 		System.err.println("\t-comm <source> where <source> is COMx:[platform] or sf at localhost:[port]");
! 		System.err.println("\t-d for debug mode");
! 		System.err.println("\t-b for printing beacons");
! 		System.err.println("\nExample usage:\njava edu.wustl.mobilab.agilla.PromiscuousListener -comm COM51:tmote 2>&1 | tee text.txt");
! 	}
! }
--- 1,149 ----
! // $Id$
! 
! /* Agilla - A middleware for wireless sensor networks.
!  * Copyright (C) 2004, Washington University in Saint Louis
!  * By Chien-Liang Fok.
!  *
!  * Washington University states that Agilla is free software;
!  * you can redistribute it and/or modify it under the terms of
!  * the current version of the GNU Lesser General Public License
!  * as published by the Free Software Foundation.
!  *
!  * Agilla is distributed in the hope that it will be useful, but
!  * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
!  * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
!  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
!  *
!  * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
!  * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
!  * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
!  * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
!  * PROPRIETARY RIGHTS.  THERE ARE NO WARRANTIES THAT SOFTWARE IS
!  * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
!  * OR OTHER HARMFUL CODE.
!  *
!  * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
!  * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
!  * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
!  * indemnify, defend, and hold harmless WU, its employees, officers and
!  * agents from any and all claims, costs, or liabilities, including
!  * attorneys fees and court costs at both the trial and appellate levels
!  * for any loss, damage, or injury caused by your actions or actions of
!  * your officers, servants, agents or third parties acting on behalf or
!  * under authorization from you, as a result of using Agilla.
!  *
!  * See the GNU Lesser General Public License for more details, which can
!  * be found here: http://www.gnu.org/copyleft/lesser.html
!  */
! /*									tab:4
!  * "Copyright (c) 2000-2003 The Regents of the University  of California.
!  * All rights reserved.
!  *
!  * Permission to use, copy, modify, and distribute this software and its
!  * documentation for any purpose, without fee, and without written agreement is
!  * hereby granted, provided that the above copyright notice, the following
!  * two paragraphs and the author appear in all copies of this software.
!  *
!  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
!  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
!  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
!  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  *
!  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
!  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
!  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
!  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
!  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
!  *
!  * Copyright (c) 2002-2003 Intel Corporation
!  * All rights reserved.
!  *
!  * This file is distributed under the terms in the attached INTEL-LICENSE
!  * file. If you do not find these files, copies can be found by writing to
!  * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
!  * 94704.  Attention:  Intel License Inquiry.
!  */
! /* Authors: Chien-Liang Fok <liang at cse.wustl.edu>
!  * Date:        May 2 2005
!  * Desc:        Main class for promiscuous message listener
!  *
!  */
! package edu.wustl.mobilab.agilla;
! import net.tinyos.message.*;
! import net.tinyos.packet.*;
! import net.tinyos.util.*;
! 
! /**
!  * Listens for Agilla messages sent over the wireless network and 
!  * prints them to the screen.
!  * 
!  * @author Chien-Liang Fok <liang at cse.wustl.edu>
!  */
! public class PromiscuousListener implements AgillaConstants {
! 	private MoteIF moteIF = null;
! 	private PhoenixSource psource;
! 	private SNInterface sni;
! 	
! 	public PromiscuousListener(String source, boolean debug, boolean printBeacons) throws Exception {
! 		Debugger.debug = debug;
! 		Debugger.printAllMsgs = true;
! 		Debugger.printBeacons = printBeacons;
! 		
! 		try {
! 			if (source.startsWith("sf"))
! 				moteIF = new MoteIF(BuildSource.makePhoenix(source, PrintStreamMessenger.err));
! 			else {
! 				psource = BuildSource.makePhoenix(
! 					BuildSource.makeArgsSerial(source),
! 					net.tinyos.util.PrintStreamMessenger.err);
! 				moteIF = new MoteIF(psource);
! 			}
! 		} catch (Exception e) {
! 			e.printStackTrace();
! 			System.exit(1);
! 		}
! 		
! 		
! 		sni = new SNInterface(true);
! 		sni.setMoteIF(moteIF);		
! 	}
! 	
! 	public static void main(String[] args) {
! 		try {
! 			String source = "COM1:mica2"; //"sf at localhost:9001";
! 			boolean debug = false;
! 			boolean printBeacons = false;
! 			int index = 0, vid;
! 			
! 			while (index < args.length) {
! 				String arg = args[index];
! 				if (arg.equals("-h") || arg.equals("--help")) {
! 					usage();
! 					System.exit(0);
! 				} else if (arg.equals("-comm")) {
! 					index++;
! 					source = args[index];
! 				} else if (arg.equals("-d"))
! 					debug = true;
! 				else if (arg.equals("-b"))
! 					printBeacons = true;
! 				else {
! 					usage();
! 					System.exit(1);
! 				}
! 				index++;
! 			}
! 			new PromiscuousListener(source, debug, printBeacons);
! 		} catch (Exception e) {
! 			e.printStackTrace();
! 		}
! 	}
! 	private static void usage() {
! 		System.err.println("usage: PromiscuousListener[-h | -comm <source> | -b | -d]");
! 		System.err.println("\t-h prints this help message");
! 		System.err.println("\t-comm <source> where <source> is COMx:[platform] or sf at localhost:[port]");
! 		System.err.println("\t-d for debug mode");
! 		System.err.println("\t-b for printing beacons");
! 		System.err.println("\nExample usage:\njava edu.wustl.mobilab.agilla.PromiscuousListener -comm COM51:tmote 2>&1 | tee text.txt");
! 	}
! }



More information about the Tinyos-contrib-commits mailing list