[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla
AgillaProperties.java, 1.7, 1.8 Injector.java, 1.4,
1.5 LocationManager.java, 1.12, 1.13 Address.java, 1.4,
1.5 AgentInjector.java, 1.13, 1.14 Makefile, 1.6,
1.7 SNInterface.java, 1.8, 1.9 SwingAgentInjectorGUI.java, 1.9, 1.10
borndigerati
borndigerati at users.sourceforge.net
Wed Apr 5 03:28:35 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15660/edu/wustl/mobilab/agilla
Modified Files:
AgillaProperties.java Injector.java LocationManager.java
Address.java AgentInjector.java Makefile SNInterface.java
SwingAgentInjectorGUI.java
Log Message:
Changes to support clustering!
Index: AgillaProperties.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/AgillaProperties.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** AgillaProperties.java 19 Dec 2005 23:06:25 -0000 1.7
--- AgillaProperties.java 5 Apr 2006 10:28:21 -0000 1.8
***************
*** 50,56 ****
private static final String DEFAULT_RUN_TEST = "false";
private static final String DEFAULT_NUM_COL = "20";
! private static String initDir, defaultAgent;
private static int numCol;
! private static boolean runTest;
private AgillaProperties() {
--- 50,58 ----
private static final String DEFAULT_RUN_TEST = "false";
private static final String DEFAULT_NUM_COL = "20";
! private static final String DEFAULT_ENABLE_CLUSTERING = "false";
! private static final String DEFAULT_NETWORK_NAME = "Unk";
! private static String initDir, defaultAgent, nwName;
private static int numCol;
! private static boolean runTest, enableClustering;
private AgillaProperties() {
***************
*** 60,63 ****
--- 62,67 ----
runTest = Boolean.valueOf(DEFAULT_RUN_TEST).booleanValue();
numCol = Integer.valueOf(DEFAULT_NUM_COL).intValue();
+ enableClustering = Boolean.valueOf(DEFAULT_ENABLE_CLUSTERING).booleanValue();
+ nwName = DEFAULT_NETWORK_NAME;
try {
load(new FileInputStream("agilla.properties"));
***************
*** 75,78 ****
--- 79,84 ----
runTest = Boolean.valueOf(getProperty("runTest", DEFAULT_RUN_TEST)).booleanValue();
numCol = Integer.valueOf(getProperty("numCol", DEFAULT_NUM_COL)).intValue();
+ enableClustering = Boolean.valueOf(getProperty("enableClustering", DEFAULT_ENABLE_CLUSTERING)).booleanValue();
+ nwName = getProperty("nwName", DEFAULT_NETWORK_NAME);
} catch(Exception e) {
e.printStackTrace();
***************
*** 88,91 ****
--- 94,105 ----
}
+ public static boolean enableClustering() {
+ return enableClustering;
+ }
+
+ public static String networkName(){
+ return nwName;
+ }
+
public String getInitDir() {
return initDir;
Index: Injector.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/Injector.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Injector.java 21 Mar 2006 04:31:35 -0000 1.4
--- Injector.java 5 Apr 2006 10:28:21 -0000 1.5
***************
*** 96,105 ****
public void reset(int address) {
! if (address == TOS_BCAST_ADDRESS)
! locMgr.resetAll();
! else
! locMgr.resetNode(address);
sendMsg(new AgillaResetMsgJ(TOS_UART_ADDRESS, address));
}
public void registerListener(MessageJ msg, MessageListenerJ listener) {
--- 96,106 ----
public void reset(int address) {
!
sendMsg(new AgillaResetMsgJ(TOS_UART_ADDRESS, address));
}
+
+ public LocationManager getLocMgr(){
+ return locMgr;
+ }
public void registerListener(MessageJ msg, MessageListenerJ listener) {
Index: LocationManager.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/LocationManager.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** LocationManager.java 29 Mar 2006 02:27:22 -0000 1.12
--- LocationManager.java 5 Apr 2006 10:28:21 -0000 1.13
***************
*** 45,53 ****
public class LocationManager {
! final static int QUERY_CHECK_INTERVAL = 5; // seconds
! final static int QUERY_TIMEOUT = 5; // seconds
! final static int CH_UPDATE_INTERVAL = 10; // seconds
! final static int BS_UPDATE_INTERVAL = 20; // seconds
! final static int AGENT_INFO_TIMEOUT = 120; // seconds
public enum PktType { UNKNOWN, RTPKT, CMPKT, CHPKT, BBPKT, APKT, ADPKT, AUPKT, QPKT, QRPKT }
--- 45,61 ----
[...2137 lines suppressed...]
***************
*** 1101,1104 ****
--- 2320,2324 ----
max_agent_speed = aspeed;
directory = new Directory();
+ queryList = new QueryList();
locMsgHandler = new LocMsgHandler(sni);
queryNumAgentsMsgHandler = new QueryNumAgentsMsgHandler(sni);
***************
*** 1106,1109 ****
--- 2326,2334 ----
queryNearestAgentMsgHandler = new QueryNearestAgentMsgHandler(sni);
queryAllAgentsMsgHandler = new QueryAllAgentsMsgHandler(sni);
+ queryReplyAgentLocMsgHandler = new QueryReplyAgentLocMsgHandler(sni);
+ queryReplyNearestAgentMsgHandler = new QueryReplyNearestAgentMsgHandler(sni);
+ queryReplyAllAgentsMsgHandler = new QueryReplyAllAgentsMsgHandler(sni);
+ networkName = new AgillaString(edu.wustl.mobilab.agilla.AgillaProperties.networkName());
+ clusterDebugMsgHandler = new ClusterDebugMsgHandler(sni);
}
Index: Address.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/Address.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Address.java 26 Mar 2006 07:53:11 -0000 1.4
--- Address.java 5 Apr 2006 10:28:21 -0000 1.5
***************
*** 9,16 ****
{
private int addr;
! private short hopsToGW;
private int lqi;
! public Address(int addr, short hopsToGW) {
this.addr = addr;
this.hopsToGW = hopsToGW;
--- 9,16 ----
{
private int addr;
! private int hopsToGW;
private int lqi;
! public Address(int addr, int hopsToGW) {
this.addr = addr;
this.hopsToGW = hopsToGW;
***************
*** 18,22 ****
}
! public Address(int addr, short hopsToGW, int lqi) {
this.addr = addr;
this.hopsToGW = hopsToGW;
--- 18,22 ----
}
! public Address(int addr, int hopsToGW, int lqi) {
this.addr = addr;
this.hopsToGW = hopsToGW;
***************
*** 28,32 ****
}
! public short hopsToGW() {
return hopsToGW;
}
--- 28,32 ----
}
! public int hopsToGW() {
return hopsToGW;
}
Index: AgentInjector.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/AgentInjector.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** AgentInjector.java 28 Mar 2006 03:25:51 -0000 1.13
--- AgentInjector.java 5 Apr 2006 10:28:21 -0000 1.14
***************
*** 110,113 ****
--- 110,125 ----
/**
+ * Creates an AgentInjector that serves as a basic interface to the sensor network.
+ * It does not display a GUI and assumes that the number of columns is 5.
+ *
+ * @param source The MoteIF source, e.g., COM4:mica2 or sf at localhost:9001
+ * @param debug Whether to be in debug mode
+ * @throws Exception
+ */
+ public AgentInjector(String source, boolean debug) throws Exception {
+ this(source, true, 5, false, debug);
+ }
+
+ /**
* Creates an AgentInjector.
*
***************
*** 118,121 ****
--- 130,134 ----
* @param createGUI Whether to create a GUI
* @param debug Whether to be in debug mode
+ * @throws Exception
*/
public AgentInjector(String source, boolean connect, int col,
***************
*** 151,157 ****
public void connect() throws Exception {
if (moteIF == null) {
! if (source.equals("tossim-serial") || source.equals("serialforwarder"))
//moteIF = new MoteIF(PrintStreamMessenger.err);
! moteIF = new MoteIF(BuildSource.makePhoenix("sf at localhost:9001", PrintStreamMessenger.err));
else {
psource = BuildSource.makePhoenix(
--- 164,171 ----
public void connect() throws Exception {
if (moteIF == null) {
! if (source.startsWith("sf"))
//moteIF = new MoteIF(PrintStreamMessenger.err);
! //moteIF = new MoteIF(BuildSource.makePhoenix("sf at localhost:9001", PrintStreamMessenger.err));
! moteIF = new MoteIF(BuildSource.makePhoenix(source, PrintStreamMessenger.err));
else {
psource = BuildSource.makePhoenix(
***************
*** 345,348 ****
--- 359,366 ----
e.printStackTrace();
}
+ if (addr == TOS_BCAST_ADDRESS)
+ injector.getLocMgr().resetAll();
+ else
+ injector.getLocMgr().resetNode(addr);
// setBS();
changeGridSize(AgillaLocation.NUM_COLUMNS);
***************
*** 395,404 ****
* Queries the neighbor list of an agent.
*
* @return A vector containing the addresses within the mote's neighbor list.
! * The addresses are stored as Address objects.
*/
! public Vector queryNbrList(int addr) {
! short fromPC = 1;
! AgillaGetNbrMsgJ msg = new AgillaGetNbrMsgJ(fromPC, TOS_UART_ADDRESS, addr);
nbrMsgs = new Vector();
injector.sendMsg(msg);
--- 413,423 ----
* Queries the neighbor list of an agent.
*
+ * @param directQuery 1 if the QueryNeighborList program is used to query
+ * the neighbor list.
* @return A vector containing the addresses within the mote's neighbor list.
! * The addresses are stored as Address objects.
*/
! public Vector queryNbrList(int addr, short directQuery) {
! AgillaGetNbrMsgJ msg = new AgillaGetNbrMsgJ(directQuery, TOS_UART_ADDRESS, addr);
nbrMsgs = new Vector();
injector.sendMsg(msg);
***************
*** 481,489 ****
// nbrMsgs.add(nbrMsg.getNbr(i));
// }
! nbrMsgs.addAll(nbrMsg.getNbrs());
//nbrTimer.kill();
! synchronized(nbrLock) {
! nbrLock.notify();
! }
}
}
--- 500,509 ----
// nbrMsgs.add(nbrMsg.getNbr(i));
// }
! if (nbrMsgs != null)
! nbrMsgs.addAll(nbrMsg.getNbrs());
//nbrTimer.kill();
! //synchronized(nbrLock) {
! //nbrLock.notify();
! //}
}
}
Index: Makefile
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/Makefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Makefile 28 Mar 2006 01:58:53 -0000 1.6
--- Makefile 5 Apr 2006 10:28:21 -0000 1.7
***************
*** 37,42 ****
AgillaQueryReplyAgentLocMsg.java \
AgillaQueryReplyNearestAgentMsg.java \
! AgillaQueryReplyAllAgentsMsg.java \
! AgillaClusterMsg.java
INITIAL_TARGETS = $(MSGS)
--- 37,43 ----
AgillaQueryReplyAgentLocMsg.java \
AgillaQueryReplyNearestAgentMsg.java \
! AgillaQueryReplyAllAgentsMsg.java \
! AgillaClusterMsg.java \
! AgillaClusterDebugMsg.java
INITIAL_TARGETS = $(MSGS)
***************
*** 155,158 ****
--- 156,162 ----
$(MIG) -java-classname=$(PACKAGE).messages.AgillaClusterMsg $(AGILLA)/types/Clustering.h AgillaClusterMsg -o messages/$@
+ AgillaClusterDebugMsg.java:
+ $(MIG) -java-classname=$(PACKAGE).messages.AgillaClusterDebugMsg $(AGILLA)/types/Clustering.h AgillaClusterDebugMsg -o messages/$@
+
mig: $(MSGS)
Index: SNInterface.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/SNInterface.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SNInterface.java 28 Mar 2006 01:58:53 -0000 1.8
--- SNInterface.java 5 Apr 2006 10:28:21 -0000 1.9
***************
*** 101,104 ****
--- 101,108 ----
moteIF.registerListener(new AgillaQueryAllAgentsMsg(), this);
moteIF.registerListener(new AgillaClusterMsg(), this);
+ moteIF.registerListener(new AgillaQueryReplyAgentLocMsg(), this);
+ moteIF.registerListener(new AgillaQueryReplyNearestAgentMsg(), this);
+ moteIF.registerListener(new AgillaQueryReplyAllAgentsMsg(), this);
+ moteIF.registerListener(new AgillaClusterDebugMsg(), this);
}
***************
*** 139,142 ****
--- 143,150 ----
moteIF.deregisterListener(new AgillaQueryAllAgentsMsg(), this);
moteIF.deregisterListener(new AgillaClusterMsg(), this);
+ moteIF.deregisterListener(new AgillaQueryReplyAgentLocMsg(), this);
+ moteIF.deregisterListener(new AgillaQueryReplyNearestAgentMsg(), this);
+ moteIF.deregisterListener(new AgillaQueryReplyAllAgentsMsg(), this);
+ moteIF.deregisterListener(new AgillaClusterDebugMsg(), this);
moteIF = null;
}
***************
*** 322,325 ****
--- 330,345 ----
msgJ = new AgillaClusterMsgJ((AgillaClusterMsg)m);
break;
+ case AgillaQueryReplyAgentLocMsg.AM_TYPE:
+ msgJ = new AgillaQueryReplyAgentLocMsgJ((AgillaQueryReplyAgentLocMsg)m);
+ break;
+ case AgillaQueryReplyNearestAgentMsg.AM_TYPE:
+ msgJ = new AgillaQueryReplyNearestAgentMsgJ((AgillaQueryReplyNearestAgentMsg)m);
+ break;
+ case AgillaQueryReplyAllAgentsMsg.AM_TYPE:
+ msgJ = new AgillaQueryReplyAllAgentsMsgJ((AgillaQueryReplyAllAgentsMsg)m);
+ break;
+ case AgillaClusterDebugMsg.AM_TYPE:
+ msgJ = new AgillaClusterDebugMsgJ((AgillaClusterDebugMsg)m);
+ break;
default:
if (Debugger.debug)
Index: SwingAgentInjectorGUI.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/SwingAgentInjectorGUI.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** SwingAgentInjectorGUI.java 13 Feb 2006 08:40:40 -0000 1.9
--- SwingAgentInjectorGUI.java 5 Apr 2006 10:28:21 -0000 1.10
***************
*** 713,717 ****
String addrS = JOptionPane.showInputDialog("Address?");
if (addrS != null && !addrS.equals("")) {
! Vector nbrs = injector.queryNbrList(Integer.valueOf(addrS).intValue());
if (nbrs.size() != 0) {
//System.out.println("Node " + addrS + " replied with:");
--- 713,717 ----
String addrS = JOptionPane.showInputDialog("Address?");
if (addrS != null && !addrS.equals("")) {
! Vector nbrs = injector.queryNbrList(Integer.valueOf(addrS).intValue(), (short)0);
if (nbrs.size() != 0) {
//System.out.println("Node " + addrS + " replied with:");
More information about the Tinyos-contrib-commits
mailing list