[Firebug-cvs] firebug/project/java/src/org/firebug DBLogger.java,1.23,1.24 ListenFB.java,1.13,1.14 S
Brought to you by:
doolin
From: <che...@us...> - 2003-11-22 02:15:59
|
Update of /cvsroot/firebug/firebug/project/java/src/org/firebug In directory sc8-pr-cvs1:/tmp/cvs-serv3046/src/org/firebug Modified Files: DBLogger.java ListenFB.java SensorMsg.java Log Message: back up Index: DBLogger.java =================================================================== RCS file: /cvsroot/firebug/firebug/project/java/src/org/firebug/DBLogger.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** DBLogger.java 19 Nov 2003 00:53:59 -0000 1.23 --- DBLogger.java 22 Nov 2003 02:15:56 -0000 1.24 *************** *** 59,65 **** // Given a packet, we need to get a TOS // message. ! SensorMsg msg = new SensorMsg(packet,5,32); ! Connection conn = dbh.getConnection(); --- 59,66 ---- // Given a packet, we need to get a TOS // message. + System.out.println("dblogger.print\n"); + SensorMsg msg = new SensorMsg(packet,5,19); ! Connection conn = dbh.getConnection(); *************** *** 89,94 **** int NSEWind = msg.get_NSEWind(); float temp = msg.get_temp(); ! float rel_hum = msg.get_rel_hum(); ! float baro_pres = msg.get_baro_pres(); if (get_packet_type(packet) != 1){ --- 90,95 ---- int NSEWind = msg.get_NSEWind(); float temp = msg.get_temp(); ! //float rel_hum = msg.get_rel_hum(); ! //float baro_pres = msg.get_baro_pres(); if (get_packet_type(packet) != 1){ *************** *** 134,139 **** + "Long_dec_min=" + Long_dec_min + "," + "NSEWind=" + NSEWind + "," ! + "rel_hum=" + rel_hum + ", " ! + "baro_pres=" + baro_pres + ", " + "temp=" + temp + " WHERE mote_id=" + mote_id; --- 135,140 ---- + "Long_dec_min=" + Long_dec_min + "," + "NSEWind=" + NSEWind + "," ! //+ "rel_hum=" + rel_hum + ", " ! // + "baro_pres=" + baro_pres + ", " + "temp=" + temp + " WHERE mote_id=" + mote_id; *************** *** 142,147 **** + "NULL," //time + ", " + temp + ", " ! + rel_hum + ", " ! + baro_pres + ", " + cnt + ", " + hours + ", " --- 143,148 ---- + "NULL," //time + ", " + temp + ", " ! //+ rel_hum + ", " ! // + baro_pres + ", " + cnt + ", " + hours + ", " Index: ListenFB.java =================================================================== RCS file: /cvsroot/firebug/firebug/project/java/src/org/firebug/ListenFB.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ListenFB.java 19 Nov 2003 00:53:59 -0000 1.13 --- ListenFB.java 22 Nov 2003 02:15:56 -0000 1.14 *************** *** 30,34 **** --- 30,37 ---- import java.sql.*; + import net.tinyos.util.*; + import net.tinyos.packet.*; + import net.tinyos.message.*; public class ListenFB { *************** *** 38,43 **** // These three need to go into the PacketPrinter interface private static final int MAX_MSG_SIZE = 36; ! private static final int PORT_SPEED = 19200; ! //private static final int PORT_SPEED = 57600; private static final int LENGTH_OFFSET = 4; private int packetLength; --- 41,46 ---- // These three need to go into the PacketPrinter interface private static final int MAX_MSG_SIZE = 36; ! //private static final int PORT_SPEED = 19200; ! private static final int PORT_SPEED = 57600; private static final int LENGTH_OFFSET = 4; private int packetLength; *************** *** 75,80 **** public interface PacketPrinter { static final int MAX_MSG_SIZE = 36; ! static final int PORT_SPEED = 19200; ! //static final int PORT_SPEED = 57600; static final int LENGTH_OFFSET = 4; --- 78,83 ---- public interface PacketPrinter { static final int MAX_MSG_SIZE = 36; ! //static final int PORT_SPEED = 19200; ! static final int PORT_SPEED = 57600; static final int LENGTH_OFFSET = 4; *************** *** 158,165 **** //public void read(PacketPrinter printer) throws IOException { ! int i; ! int count = 0; ! byte[] packet = new byte[MAX_MSG_SIZE]; // Note that i is an integer, in.read() // is returning 4 bytes at a time. --- 161,192 ---- //public void read(PacketPrinter printer) throws IOException { ! //int i; ! //int count = 0; ! //byte[] packet = new byte[MAX_MSG_SIZE]; ! PacketSource reader = BuildSource.makePacketSource(); ! if (reader == null) { ! System.err.println("Invalid packet source (check your MOTECOM environment variable)"); ! System.exit(2); ! } ! ! try { ! reader.open(PrintStreamMessenger.err); ! for (;;) { ! byte[] packet = reader.readPacket(); ! Enumeration enum = printers.elements(); ! while (enum.hasMoreElements()) { ! PacketPrinter printer = (PacketPrinter)enum.nextElement(); ! printer.print(packet); ! } ! ! System.out.println(); ! } ! } ! catch (IOException e) { ! System.err.println("Error on " + reader.getName() + ": " + e); ! } ! + /* // Note that i is an integer, in.read() // is returning 4 bytes at a time. *************** *** 194,209 **** } } } private static void printUsage() { - //System.err.println("usage: java ListenFB [options] <port>"); System.err.println("usage: java ListenFB <database name> <port>"); - /* - System.err.println("options are:"); - System.err.println(" -h, --help: usage help"); - System.err.println(" -p: print available ports"); - System.err.println(" -e: display entire message"); - */ System.exit(-1); } --- 221,231 ---- } } + + */ } private static void printUsage() { System.err.println("usage: java ListenFB <database name> <port>"); System.exit(-1); } *************** *** 221,239 **** - /** None of the following is currently being used. */ - /* - for (int i = 0; i < args.length; i++) { - if (args[i].equals("-h") || args[i].equals("--help")) { - printUsage(); - } - if (args[i].equals("-p")) { - printAllPorts(); - } - if (args[i].equals("-e")) { - showEntireMessage = true; - } - } - */ - dbname = args[1]; --- 243,246 ---- *************** *** 258,263 **** String port = args[args.length - 1]; ListenFB reader = new ListenFB(port); - //RawPacket print = new RawPacket(); - //PrettyPacket print = new PrettyPacket(); SensorPacket print = new SensorPacket(); DBLogger dblogger = new DBLogger(dbname); --- 265,268 ---- *************** *** 267,274 **** try { ! reader.open(); ! reader.read(printers); } catch (Exception e) { ! e.printStackTrace(); } } --- 272,279 ---- try { ! //reader.open(); ! reader.read(printers); } catch (Exception e) { ! e.printStackTrace(); } } Index: SensorMsg.java =================================================================== RCS file: /cvsroot/firebug/firebug/project/java/src/org/firebug/SensorMsg.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SensorMsg.java 19 Nov 2003 00:53:59 -0000 1.6 --- SensorMsg.java 22 Nov 2003 02:15:56 -0000 1.7 *************** *** 10,19 **** /** The default size of this message type in bytes. */ ! public static final int DEFAULT_MESSAGE_SIZE = 26; /** The Active Message type associated with this message. */ public static final int AM_TYPE = 128; ! /** Create a new SensorMsg of size 26. */ public SensorMsg() { super(DEFAULT_MESSAGE_SIZE); --- 10,19 ---- /** The default size of this message type in bytes. */ ! public static final int DEFAULT_MESSAGE_SIZE = 18; /** The Active Message type associated with this message. */ public static final int AM_TYPE = 128; ! /** Create a new SensorMsg of size 18. */ public SensorMsg() { super(DEFAULT_MESSAGE_SIZE); *************** *** 120,129 **** s += " [temp="+Float.toString(get_temp())+"]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } - try { - s += " [rel_hum="+Float.toString(get_rel_hum())+"]\n"; - } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } - try { - s += " [baro_pres="+Float.toString(get_baro_pres())+"]\n"; - } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } return s; } --- 120,123 ---- *************** *** 821,950 **** */ public static int sizeBits_temp() { - return 32; - } - - ///////////////////////////////////////////////////////// - // Accessor methods for field: rel_hum - // Field type: float - // Offset (bits): 144 - // Size (bits): 32 - ///////////////////////////////////////////////////////// - - /** - * Return whether the field 'rel_hum' is signed (true). - */ - public static boolean isSigned_rel_hum() { - return true; - } - - /** - * Return whether the field 'rel_hum' is an array (false). - */ - public static boolean isArray_rel_hum() { - return false; - } - - /** - * Return the offset (in bytes) of the field 'rel_hum' - */ - public static int offset_rel_hum() { - return (144 / 8); - } - - /** - * Return the offset (in bits) of the field 'rel_hum' - */ - public static int offsetBits_rel_hum() { - return 144; - } - - /** - * Return the value (as a float) of the field 'rel_hum' - */ - public float get_rel_hum() { - return (float)getFloatElement(offsetBits_rel_hum(), 32); - } - - /** - * Set the value of the field 'rel_hum' - */ - public void set_rel_hum(float value) { - setFloatElement(offsetBits_rel_hum(), 32, value); - } - - /** - * Return the size, in bytes, of the field 'rel_hum' - */ - public static int size_rel_hum() { - return (32 / 8); - } - - /** - * Return the size, in bits, of the field 'rel_hum' - */ - public static int sizeBits_rel_hum() { - return 32; - } - - ///////////////////////////////////////////////////////// - // Accessor methods for field: baro_pres - // Field type: float - // Offset (bits): 176 - // Size (bits): 32 - ///////////////////////////////////////////////////////// - - /** - * Return whether the field 'baro_pres' is signed (true). - */ - public static boolean isSigned_baro_pres() { - return true; - } - - /** - * Return whether the field 'baro_pres' is an array (false). - */ - public static boolean isArray_baro_pres() { - return false; - } - - /** - * Return the offset (in bytes) of the field 'baro_pres' - */ - public static int offset_baro_pres() { - return (176 / 8); - } - - /** - * Return the offset (in bits) of the field 'baro_pres' - */ - public static int offsetBits_baro_pres() { - return 176; - } - - /** - * Return the value (as a float) of the field 'baro_pres' - */ - public float get_baro_pres() { - return (float)getFloatElement(offsetBits_baro_pres(), 32); - } - - /** - * Set the value of the field 'baro_pres' - */ - public void set_baro_pres(float value) { - setFloatElement(offsetBits_baro_pres(), 32, value); - } - - /** - * Return the size, in bytes, of the field 'baro_pres' - */ - public static int size_baro_pres() { - return (32 / 8); - } - - /** - * Return the size, in bits, of the field 'baro_pres' - */ - public static int sizeBits_baro_pres() { return 32; } --- 815,818 ---- |