[Firebug-cvs] fireboard/beta/fireworks/tools/java/net/sf/firebug/DataCollection DataCollect.java,1.1
Brought to you by:
doolin
From: Karthik D. <da...@us...> - 2005-08-29 00:25:37
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug/DataCollection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17154 Modified Files: DataCollect.java Makefile Log Message: Functional java modules Index: DataCollect.java =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug/DataCollection/DataCollect.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DataCollect.java 28 Aug 2005 20:01:43 -0000 1.1 --- DataCollect.java 29 Aug 2005 00:25:27 -0000 1.2 *************** *** 73,76 **** --- 73,79 ---- //=== PRIVATE VARIABLES ================================================ + static final int SENSORREADING = 0; + static final int CALIBRATION = 1; + String strAddr; int nPort; *************** *** 156,159 **** --- 159,164 ---- public DataCollect() { + dlist = new LinkedList(); + clist = new LinkedList(); this.dataCollectStub = null; try { *************** *** 166,179 **** System.exit(1); } - - try { - this.calibrateStub = new MoteIF(); - calibrateStub.registerListener(new CalibrationMsg(), this); - - calibrateStub.start(); - } catch (Exception e) { - e.printStackTrace(); //To change body of catch statement use Options | File Templates. - System.exit(1); - } } --- 171,174 ---- *************** *** 201,231 **** public void messageReceived(int to, Message m) { int index=0; ! if (m.amType() == DataCollectionMsg.AM_TYPE) { ! DataCollectionMsg msg = new DataCollectionMsg(m,0); if(get_data(msg.get_seq_no(), (long)msg.get_src()) == 0) { /* Not a duplicate */ if((index = get_calibration(msg.get_seq_no(), (long)msg.get_src())) == 0) { /* No calibration data received yet. So, add to the list */ dlist.add(msg); } else { dlist.add(msg); printData(index, get_data(msg.get_seq_no(), (long)msg.get_src())); } } } ! else if(m.amType() == CalibrationMsg.AM_TYPE) { ! CalibrationMsg cMsg = new CalibrationMsg(m,0); if(get_calibration(cMsg.get_seq_no(), (long)cMsg.get_src()) == 0) { /* Not a duplicate */ if((index = get_data(cMsg.get_seq_no(), (long)cMsg.get_src())) == 0) { /* No calibration data received yet. So, add to the list */ clist.add(cMsg); } else { clist.add(cMsg); printData(get_calibration(cMsg.get_seq_no(), (long)cMsg.get_src()), index); } --- 196,243 ---- public void messageReceived(int to, Message m) { + System.out.println("Message Received with AM Type " + m.amType()); + if(m.amType() == DataCollectionMsg.AM_TYPE) { + MultihopMsg msg = new MultihopMsg(m.dataGet()); + this.packetReceived(msg); + } + } + + public void packetReceived(MultihopMsg m) { int index=0; ! DataCollectionMsg msg = new DataCollectionMsg(m.dataGet(),m.offset_data(0)); ! System.out.println("Type is " + msg.get_type()); ! if(msg.get_type() == SENSORREADING) { ! System.out.println("Sensor reading"); if(get_data(msg.get_seq_no(), (long)msg.get_src()) == 0) { + System.out.println("not duplicate with seq no " + msg.get_seq_no()); /* Not a duplicate */ if((index = get_calibration(msg.get_seq_no(), (long)msg.get_src())) == 0) { /* No calibration data received yet. So, add to the list */ + System.out.println("Added to list"); dlist.add(msg); } else { dlist.add(msg); + System.out.println("Sending to print"); printData(index, get_data(msg.get_seq_no(), (long)msg.get_src())); } } } ! else if(msg.get_type() == CALIBRATION) { ! System.out.println("Calibration"); ! CalibrationMsg cMsg = new CalibrationMsg(m.dataGet(),m.offset_data(0)); if(get_calibration(cMsg.get_seq_no(), (long)cMsg.get_src()) == 0) { /* Not a duplicate */ + System.out.println("not duplicate with seq no " + msg.get_seq_no()); if((index = get_data(cMsg.get_seq_no(), (long)cMsg.get_src())) == 0) { /* No calibration data received yet. So, add to the list */ + System.out.println("Added to list"); clist.add(cMsg); } else { clist.add(cMsg); + System.out.println("Send to print"); printData(get_calibration(cMsg.get_seq_no(), (long)cMsg.get_src()), index); } *************** *** 235,238 **** --- 247,251 ---- void printData(int cindex, int dindex) { + System.out.println("In print data"); DataCollectionMsg dMsg = (DataCollectionMsg) dlist.get(dindex); CalibrationMsg cMsg = (CalibrationMsg) clist.get(cindex); Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug/DataCollection/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 28 Aug 2005 20:01:43 -0000 1.1 --- Makefile 29 Aug 2005 00:25:27 -0000 1.2 *************** *** 5,9 **** # List of message classes to build ! MSGS = DataCollectionMsg.java CalibrationMsg.java INITIAL_TARGETS = $(MSGS) OTHER_CLEAN = cleanmig --- 5,9 ---- # List of message classes to build ! MSGS = DataCollectionMsg.java CalibrationMsg.java MultihopMsg.java INITIAL_TARGETS = $(MSGS) OTHER_CLEAN = cleanmig *************** *** 11,14 **** --- 11,15 ---- ROOT = $(TOS)/../contrib/moteiv/tools/java include $(ROOT)/Makefile.include + DataCollectionMsg.java: $(MIG) -java-classname=$(PACKAGE).DataCollectionMsg $(APP)/DataCollection.h DataCollectionMsg >$@ *************** *** 17,20 **** --- 18,24 ---- $(MIG) -java-classname=$(PACKAGE).CalibrationMsg $(APP)/Calibration.h CalibrationMsg >$@ + MultihopMsg.java: + $(MIG) -java-classname=$(PACKAGE).MultihopMsg $(TOS)/lib/MultihopLQI/Multihop.h MultihopMsg >$@ + cleanmig: rm -f $(MSGS) |