firebug-cvs Mailing List for FireBug: wireless wildfire monitoring (Page 9)
Brought to you by:
doolin
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(36) |
Jun
(45) |
Jul
(108) |
Aug
(31) |
Sep
(2) |
Oct
(4) |
Nov
(113) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(63) |
Feb
(37) |
Mar
(24) |
Apr
(6) |
May
(5) |
Jun
(5) |
Jul
(71) |
Aug
(42) |
Sep
(7) |
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(64) |
Jun
(71) |
Jul
(51) |
Aug
(89) |
Sep
(24) |
Oct
(1) |
Nov
(1) |
Dec
(2) |
2006 |
Jan
|
Feb
|
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
(21) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: David M. D. <do...@us...> - 2005-06-20 21:55:04
|
Update of /cvsroot/firebug/firebug/web/postgres In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30111/postgres Modified Files: db_create.php Log Message: Added link to point pinole pictures. Index: db_create.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/postgres/db_create.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** db_create.php 4 Jun 2005 08:35:57 -0000 1.4 --- db_create.php 20 Jun 2005 21:54:55 -0000 1.5 *************** *** 51,55 **** if (!$flag) { $dbh = connect_postgres($defaultdb); ! $statement = "CREATE DATABASE $dbname"; $create_stat = @pg_exec($dbh,$statement); if (!$create_stat) { --- 51,55 ---- if (!$flag) { $dbh = connect_postgres($defaultdb); ! $statement = "CREATE DATABASE $dbname template firebug"; $create_stat = @pg_exec($dbh,$statement); if (!$create_stat) { |
From: David M. D. <do...@us...> - 2005-06-20 21:45:57
|
Update of /cvsroot/firebug/firebug/web/images/pinole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25377 Added Files: stage3_1_small.jpg stage3_2_small.jpg stage3_3_small.jpg stage3_4_small.jpg stage3_5_small.jpg stage3_6_small.jpg Log Message: Added some Point Pinole burn pictures. --- NEW FILE: stage3_1_small.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: stage3_3_small.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: stage3_5_small.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: stage3_2_small.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: stage3_4_small.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: stage3_6_small.jpg --- (This appears to be a binary file; contents omitted.) |
From: David M. D. <do...@us...> - 2005-06-20 21:44:53
|
Update of /cvsroot/firebug/firebug/web/images/pinole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24829/pinole Log Message: Directory /cvsroot/firebug/firebug/web/images/pinole added to the repository |
From: David M. D. <do...@us...> - 2005-06-20 17:58:53
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25475 Modified Files: firebug.sql Log Message: Fixed table names for location_conditions view. Index: firebug.sql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/firebug.sql,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** firebug.sql 20 Jun 2005 17:50:53 -0000 1.4 --- firebug.sql 20 Jun 2005 17:58:43 -0000 1.5 *************** *** 3,6 **** --- 3,10 ---- -- specific functions. + -- TODO: Make sure the tables are owned by the firebug user. + -- May have to figure out how to switch users on the fly...? + + -- How to check whether table already exists? drop table xbow_weather; create table xbow_weather (result_time timestamp without time zone, *************** *** 51,54 **** --- 55,59 ---- + drop view location_conditions; create view location_conditions as select gga_l.nodeid, latitudedegree, latitudeminutes, longitudedegree, |
From: David M. D. <do...@us...> - 2005-06-20 17:51:12
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21056 Modified Files: firebug.sql Log Message: Fixed table names for location_conditions view. Index: firebug.sql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/firebug.sql,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** firebug.sql 19 Jun 2005 22:47:33 -0000 1.3 --- firebug.sql 20 Jun 2005 17:50:53 -0000 1.4 *************** *** 51,56 **** ! create view location_conditions as -- select * from task_query_log; ! select gga.nodeid, latitudedegree, latitudeminutes, longitudedegree, longitudeminute, temperature, humidity, pressure ! from gga, xbow_weather where gga.nodeid = xbow_weather.nodeid; \ No newline at end of file --- 51,56 ---- ! create view location_conditions as ! select gga_l.nodeid, latitudedegree, latitudeminutes, longitudedegree, longitudeminute, temperature, humidity, pressure ! from gga_l, xbow_weather_l where gga_l.nodeid = xbow_weather_l.nodeid; \ No newline at end of file |
From: David M. D. <do...@us...> - 2005-06-20 17:50:33
|
Update of /cvsroot/firebug/firebug/web/gmaps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20530 Modified Files: db_render_xml.php Log Message: php script now uses a view for getting locations and conditions in the same query. Index: db_render_xml.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/db_render_xml.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** db_render_xml.php 14 Jun 2005 20:24:57 -0000 1.10 --- db_render_xml.php 20 Jun 2005 17:50:16 -0000 1.11 *************** *** 72,76 **** */ $dbname = "rfs_demo_06_09_2005"; ! $tblname = "gga_l"; global $ids, $images, $icons, $global_id; --- 72,77 ---- */ $dbname = "rfs_demo_06_09_2005"; ! $tblname = "location_conditions"; //"gga_l"; ! global $ids, $images, $icons, $global_id; *************** *** 81,85 **** } ! $statement = "SELECT a.attname FROM pg_attribute a,pg_class c where c.relname ='$tblname' and a.attrelid = c.oid and a.attnum > 0"; $stat = @pg_exec($dbh,$statement); if(!stat) { --- 82,86 ---- } ! $statement = "SELECT a.attname FROM pg_attribute a,pg_class c where c.relname = '$tblname' and a.attrelid = c.oid and a.attnum > 0"; $stat = @pg_exec($dbh,$statement); if(!stat) { *************** *** 94,97 **** --- 95,99 ---- } + $statement = "SELECT * FROM $tblname"; $stat = @pg_exec($dbh,$statement); *************** *** 99,102 **** --- 101,105 ---- die("Cannot select from table\n"); } + /*** *************** *** 113,117 **** foreach ($row as $key => $value) { ! // print "$key"; //$value\n"; switch($labels[$key]) { case "latitudedegree": --- 116,120 ---- foreach ($row as $key => $value) { ! //print ("$labels[$key]: $value, "); switch($labels[$key]) { case "latitudedegree": *************** *** 127,130 **** --- 130,142 ---- $longmin=$value; break; + case "temperature": + $temp=$value; + break; + case "humidity": + $humidity=$value; + break; + case "pressure": + $pressure=$value; + break; case "nodeid": $nodeid=$value; *************** *** 144,175 **** $title = "Firebug sensor $nodeid"; ! ! $query = "SELECT temperature,humidity,pressure FROM xbow_weather_l where nodeid = $nodeid"; ! $result = @pg_query($dbh,$query); ! if(!result) { ! die("Cannot select from table\n"); ! } ! ! $wrow = pg_fetch_array($result, NULL, PGSQL_ASSOC) or perr("db_render_xml", "Cannot retrieve data"); ! $temp = $wrow["temperature"]; ! $humidity = $wrow["humidity"]; ! $pressure = $wrow["pressure"]; ! ! $address = "<line>Firebug sensor $nodeid</line><line>Temp: $temp C</line><line>Rel. Hum: $humidity%</line><line>Press: $pressure mBar</line>"; emit_gps_location($id,$lat,$long,$image,$icon,$title,$address); $global_id = $i; - - - - - } - pg_close($dbh); } - - print("<?xml version=\"1.0\"?>\n"); print("<page>\n"); --- 156,167 ---- $title = "Firebug sensor $nodeid"; ! $address = "<line>Firebug sensor $nodeid</line><line>Temp: $temp C, Rel. Hum: $humidity%, Press: $pressure mBar</line><line>Lat: $lat, Long: $long</line>"; emit_gps_location($id,$lat,$long,$image,$icon,$title,$address); $global_id = $i; } pg_close($dbh); } print("<?xml version=\"1.0\"?>\n"); print("<page>\n"); *************** *** 181,186 **** print("<overlay panelStyle=\"sidepanel.xsl\">\n\n\n"); - - // An ugly function, can be refactored later. print_from_database(); --- 173,176 ---- *************** *** 193,201 **** $image = "images/sitar.jpg"; - //print($icon); emit_gps_location($id,$lat,$long,$icon,$image,'Nick\'s office',$address); - //$address = '<line>Dave and Karthik</line>'; - print("</overlay>\n"); print("</page>\n"); --- 183,188 ---- |
From: Michael N. <mne...@us...> - 2005-06-20 03:06:13
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14092 Modified Files: TestMTS400M.nc Log Message: eliminate atomic warning related to variable 'pack' Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TestMTS400M.nc 19 Jun 2005 19:09:27 -0000 1.14 --- TestMTS400M.nc 20 Jun 2005 03:06:04 -0000 1.15 *************** *** 1,3 **** --- 1,5 ---- /* tab:4 + * + * * "Copyright (c) 2000-2002 The Regents of the University of California. * All rights reserved. *************** *** 275,284 **** if (sending_packet) return; ! atomic sending_packet = TRUE; ! pack->xSensorHeader.board_id = SENSOR_BOARD_ID; ! pack->xSensorHeader.packet_id = iNextPacketID; ! pack->xSensorHeader.node_id = TOS_LOCAL_ADDRESS; ! // pack->xSensorHeader.rsvd = 0; ! call Leds.yellowOn(); if (IsUART) { --- 277,287 ---- if (sending_packet) return; ! atomic { ! sending_packet = TRUE; ! pack->xSensorHeader.board_id = SENSOR_BOARD_ID; ! pack->xSensorHeader.packet_id = iNextPacketID; ! pack->xSensorHeader.node_id = TOS_LOCAL_ADDRESS; ! // pack->xSensorHeader.rsvd = 0; ! }; call Leds.yellowOn(); if (IsUART) { *************** *** 334,339 **** sending_packet = FALSE; WaitingForSend = FALSE; } - pack = (XDataMsg *)msg_ptr->data; // usart1 is also connected to external serial flash --- 337,342 ---- sending_packet = FALSE; WaitingForSend = FALSE; + pack = (XDataMsg *)msg_ptr->data; } // usart1 is also connected to external serial flash *************** *** 598,603 **** ****************************************************************************/ async event result_t ADCBATT.dataReady(uint16_t data) { ! pack->xData.data1.vref = data ; ! atomic state = BATT_DONE; return SUCCESS; } --- 601,608 ---- ****************************************************************************/ async event result_t ADCBATT.dataReady(uint16_t data) { ! atomic { ! pack->xData.data1.vref = data ; ! state = BATT_DONE; ! }; return SUCCESS; } *************** *** 617,627 **** ****************************************************************************/ async event result_t IntersemaPressure.dataReady(uint16_t data) { ! pack->xData.data1.pressure = data ; ! atomic atomic sensor_state = SENSOR_PRESSURE_GETTEMPDATA; return call IntersemaTemp.getData(); } async event result_t IntersemaTemp.dataReady(uint16_t data) { ! pack->xData.data1.intersematemp = data ; post stopPressureControl(); return SUCCESS; --- 622,634 ---- ****************************************************************************/ async event result_t IntersemaPressure.dataReady(uint16_t data) { ! atomic { ! pack->xData.data1.pressure = data ; ! sensor_state = SENSOR_PRESSURE_GETTEMPDATA; ! }; return call IntersemaTemp.getData(); } async event result_t IntersemaTemp.dataReady(uint16_t data) { ! atomic pack->xData.data1.intersematemp = data ; post stopPressureControl(); return SUCCESS; *************** *** 635,644 **** if (count == 4) { ! pack->xData.data1.cal_wrod1 = calibration[0]; ! pack->xData.data1.cal_wrod2 = calibration[1]; ! pack->xData.data1.cal_wrod3 = calibration[2]; ! pack->xData.data1.cal_wrod4 = calibration[3]; ! ! atomic sensor_state = SENSOR_PRESSURE_GETPRESSDATA; call IntersemaPressure.getData(); } --- 642,653 ---- if (count == 4) { ! atomic { ! pack->xData.data1.cal_wrod1 = calibration[0]; ! pack->xData.data1.cal_wrod2 = calibration[1]; ! pack->xData.data1.cal_wrod3 = calibration[2]; ! pack->xData.data1.cal_wrod4 = calibration[3]; ! ! sensor_state = SENSOR_PRESSURE_GETPRESSDATA; ! }; call IntersemaPressure.getData(); } *************** *** 674,678 **** *****************************************************************************/ async event result_t Temperature.dataReady(uint16_t data) { ! pack->xData.data1.temperature = data ; post stopTempHumControl(); return SUCCESS; --- 683,687 ---- *****************************************************************************/ async event result_t Temperature.dataReady(uint16_t data) { ! atomic pack->xData.data1.temperature = data ; post stopTempHumControl(); return SUCCESS; *************** *** 680,685 **** async event result_t Humidity.dataReady(uint16_t data) { ! pack->xData.data1.humidity = data ; ! atomic sensor_state = SENSOR_HUMIDITY_GETTEMPDATA; return call Temperature.getData(); } --- 689,696 ---- async event result_t Humidity.dataReady(uint16_t data) { ! atomic { ! pack->xData.data1.humidity = data ; ! sensor_state = SENSOR_HUMIDITY_GETTEMPDATA; ! }; return call Temperature.getData(); } *************** *** 723,728 **** *****************************************************************************/ async event result_t TaosCh1.dataReady(uint16_t data) { ! ! pack->xData.data1.taoch1 = data & 0x00ff; post stopTaosControl(); return SUCCESS; --- 734,738 ---- *****************************************************************************/ async event result_t TaosCh1.dataReady(uint16_t data) { ! atomic pack->xData.data1.taoch1 = data & 0x00ff; post stopTaosControl(); return SUCCESS; *************** *** 730,736 **** async event result_t TaosCh0.dataReady(uint16_t data) { ! ! pack->xData.data1.taoch0 = data & 0x00ff; ! atomic sensor_state = SENSOR_LIGHT_GETCH1DATA; return call TaosCh1.getData(); } --- 740,747 ---- async event result_t TaosCh0.dataReady(uint16_t data) { ! atomic { ! pack->xData.data1.taoch0 = data & 0x00ff; ! sensor_state = SENSOR_LIGHT_GETCH1DATA; ! }; return call TaosCh1.getData(); } *************** *** 766,772 **** *****************************************************************************/ async event result_t AccelY.dataReady(uint16_t data){ ! ! pack->xData.data1.accel_y = data & 0xff; ! pack->xSensorHeader.rsvd = data >> 8; post powerOffAccel(); return SUCCESS; --- 777,784 ---- *****************************************************************************/ async event result_t AccelY.dataReady(uint16_t data){ ! atomic { ! pack->xData.data1.accel_y = data & 0xff; ! pack->xSensorHeader.rsvd = data >> 8; ! }; post powerOffAccel(); return SUCCESS; *************** *** 776,781 **** /***************************************************/ async event result_t AccelX.dataReady(uint16_t data) { ! pack->xData.data1.accel_x = data; ! atomic sensor_state = SENSOR_ACCEL_GETYDATA; call AccelY.getData(); return SUCCESS; --- 788,795 ---- /***************************************************/ async event result_t AccelX.dataReady(uint16_t data) { ! atomic { ! pack->xData.data1.accel_x = data; ! sensor_state = SENSOR_ACCEL_GETYDATA; ! }; call AccelY.getData(); return SUCCESS; |
From: David M. D. <do...@us...> - 2005-06-19 23:04:45
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28002 Added Files: fireboard.h Log Message: Added header file for firebug specific code. --- NEW FILE: fireboard.h --- #ifndef FB_FIREBOARD_H #define FB_FIREBOARD_H #include <NMEA.h> #include "../xdb.h" #include "../xsensors.h" void fb_pg_log_gga_data (XbowSensorboardPacket *packet); /** * When the schema changes, or for whatever other * reason, the firebug tables may need to be recreated * from scratch. */ void fb_pg_recreate_tables (void); #endif /* FB_FIREBOARD_H */ |
From: David M. D. <do...@us...> - 2005-06-19 23:04:02
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27594/boards Modified Files: pg_test.c Log Message: Command line specified database now inherits from the firebug template, so all the tables are automatically created. Index: pg_test.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/pg_test.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pg_test.c 19 Jun 2005 22:28:33 -0000 1.8 --- pg_test.c 19 Jun 2005 23:03:54 -0000 1.9 *************** *** 53,56 **** --- 53,57 ---- if (xdb_table_exists((char*)table)) { + fprintf(stderr,"Table xbow_weather exists.\n"); return; } |
From: David M. D. <do...@us...> - 2005-06-19 23:04:01
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27594 Modified Files: xdb.c Log Message: Command line specified database now inherits from the firebug template, so all the tables are automatically created. Index: xdb.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** xdb.c 19 Jun 2005 22:28:33 -0000 1.6 --- xdb.c 19 Jun 2005 23:03:53 -0000 1.7 *************** *** 195,200 **** int errno; char command[256]; ! char * statement = "create database %s"; ! sprintf(command,statement,dbname); errno = xdb_execute(command); } --- 195,200 ---- int errno; char command[256]; ! char * statement = "create database %s template %s"; ! sprintf(command,statement,dbname,g_dbname); errno = xdb_execute(command); } |
From: David M. D. <do...@us...> - 2005-06-19 22:47:43
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18669 Modified Files: firebug.sql Log Message: Added a handy view joining two of the tables for emitting data to gmaps application. Index: firebug.sql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/firebug.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** firebug.sql 19 Jun 2005 22:26:32 -0000 1.2 --- firebug.sql 19 Jun 2005 22:47:33 -0000 1.3 *************** *** 49,50 **** --- 49,56 ---- DELETE FROM gga_l WHERE nodeid = NEW.nodeid; INSERT INTO gga_l VALUES (NEW.*); ); + + + create view location_conditions as -- select * from task_query_log; + select gga.nodeid, latitudedegree, latitudeminutes, longitudedegree, + longitudeminute, temperature, humidity, pressure + from gga, xbow_weather where gga.nodeid = xbow_weather.nodeid; \ No newline at end of file |
From: David M. D. <do...@us...> - 2005-06-19 22:29:22
|
Update of /cvsroot/firebug/firebug/doc/userman In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10217/userman Modified Files: userman.txt Log Message: Added some installation notes for postgres. Index: userman.txt =================================================================== RCS file: /cvsroot/firebug/firebug/doc/userman/userman.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** userman.txt 19 Jun 2005 15:59:29 -0000 1.1 --- userman.txt 19 Jun 2005 22:29:13 -0000 1.2 *************** *** 2,5 **** --- 2,9 ---- INSTALLATION + The Firebug system assumes the listener can + connect to a postgres database using a default + database "firebug." + 1. Run all the sql scripts to get the postgres database set up correctly. |
From: David M. D. <do...@us...> - 2005-06-19 22:28:43
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9568 Modified Files: Makefile xdb.c xdb.h xlisten.c Added Files: args.c args.h Log Message: Database connection can now specified from the command using the -l option. Index: xdb.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xdb.c 17 Jun 2005 23:23:36 -0000 1.5 --- xdb.c 19 Jun 2005 22:28:33 -0000 1.6 *************** *** 14,17 **** --- 14,21 ---- #include <libpq-fe.h> + /** These variables should be read in from a + * a local configuration file which is not + * archived in cvs. + */ static char *g_server = "localhost"; //!< Postgres server IP or hostname static char *g_port = "5432"; //!< Postgres server port *************** *** 24,51 **** void xdb_set_table(char *table) { g_table = table; } - void - xdb_set_dbname(char *dbname) { - - int errno; - char command[256]; - char * statement = "create database %s"; - sprintf(command,statement,dbname); - errno = xdb_execute(command); - - #if 0 - if (errno == 0) { - g_dbname = dbname; - } else { - exit(0); - } - #endif - - } - - PGconn *xdb_exit(PGconn *conn) - { PQfinish(conn); return NULL; --- 28,36 ---- void xdb_set_table(char *table) { g_table = table; } + PGconn * + xdb_exit(PGconn *conn) { PQfinish(conn); return NULL; *************** *** 83,92 **** * check to see that the backend connection was successfully made */ ! if (PQstatus(conn) == CONNECTION_BAD) ! { ! fprintf(stderr, "error: Connection to database '%s' failed.\n", ! g_dbname); ! fprintf(stderr, "%s", PQerrorMessage(conn)); ! conn = xdb_exit(conn); } --- 68,75 ---- * check to see that the backend connection was successfully made */ ! if (PQstatus(conn) == CONNECTION_BAD) { ! //fprintf(stderr, "error: Connection to database '%s' failed.\n", g_dbname); ! fprintf(stderr, "%s", PQerrorMessage(conn)); ! conn = xdb_exit(conn); } *************** *** 181,182 **** --- 164,202 ---- return xdb_execute(command); } + + + #define PG_DB_NOT_EXISTS "FATAL: database %s does not exist" + + + + void + xdb_set_dbname(char *dbname) { + + g_dbname = dbname; + } + + + int + xdb_db_exists(const char * dbname) { + + PGconn *conn; + conn = PQsetdbLogin(g_server, g_port, NULL, NULL, + dbname, g_user, g_passwd); + + if (PQstatus(conn) == CONNECTION_BAD) { + return 0; + } + return 1; + } + + void + xdb_createdb(char * dbname) { + + int errno; + char command[256]; + char * statement = "create database %s"; + sprintf(command,statement,dbname); + errno = xdb_execute(command); + } + + --- NEW FILE: args.c --- #include "xsensors.h" #include "args.h" /** Global var containing xlisten cvs Id tag. */ extern const char *g_version; /** FILE pointer for the input device. * TODO: Open this device in main instead of * here where it is set. */ extern int g_istream; // TODO: 1. Move the argument parsing code in here. // 2. Change to getopts parsing. /** * Extracts command line options and sets flags internally. * * @param argc Argument count * @param argv Argument vector * * @author Martin Turon * * @version 2004/3/10 mturon Intial version * @n 2004/3/12 mturon Added -b,-s,-q,-x * @n 2004/8/04 mturon Added -l [ver. 1.11] * @n 2004/8/22 mturon Added -i [ver. 1.13] * @n 2004/9/27 mturon Added -t [ver. 1.15] * @n 2004/9/29 mturon Added -f,-a [v 1.16] */ void parse_args(int argc, char **argv, s_params * g_params) { // This value is set if/when the bitflag is set. unsigned baudrate = 0; char *server, *port; g_params->flat = 0; /* default to no params set */ while (argc) { if ((argv[argc]) && (*argv[argc] == '-')) { switch(argv[argc][1]) { case '?': g_params->bits.display_help = 1; break; case 'q': g_params->bits.mode_quiet = 1; break; case 'p': g_params->bits.display_parsed = 1; break; case 'r': g_params->bits.display_raw = 1; break; case 'a': g_params->bits.display_ascii = 1; break; case 'c': g_params->bits.display_cooked = 1; break; case 'x': switch (argv[argc][2]) { case 'c': g_params->bits.export_cooked = 1; break; default: case 'r': g_params->bits.export_parsed = 1; break; } break; case 'f': switch (argv[argc][2]) { case '=': // specify arbitrary offset g_params->bits.mode_framing = atoi(argv[argc]+3)&3; break; case 'a': // automatic deframing g_params->bits.mode_framing = 0; break; case '0': case 'n': // assume no framing g_params->bits.mode_framing = 2; break; case '1': // force framing default: g_params->bits.mode_framing = 1; break; } break; case 'w': case 'h': { int offset = XPACKET_DATASTART_MULTIHOP; g_params->bits.mode_header = 1; switch (argv[argc][2]) { case '=': // specify arbitrary offset offset = atoi(argv[argc]+3); break; case '0': // direct uart (no wireless) case '1': // single hop offset offset = XPACKET_DATASTART_STANDARD; break; } xpacket_set_start(offset); break; } case 'l': g_params->bits.log_cooked = 1; if (argv[argc][2] == '=') { //xdb_set_table(argv[argc]+3); if (!xdb_db_exists(argv[argc]+3)) { xdb_createdb(argv[argc]+3); xdb_set_dbname(argv[argc]+3); } } break; case 'b': if (argv[argc][2] == '=') { baudrate = xserial_set_baud(argv[argc]+3); g_params->bits.display_baud = 1; } break; case 's': switch (argv[argc][2]) { case '=': xserial_set_device(argv[argc]+3); break; case 'f': g_params->bits.mode_sf = 1; g_params->bits.mode_socket = 1; if (argv[argc][3] == '=') { server = argv[argc]+4; port = strchr(server, ':'); if (port) { *port++ = '\0'; xsocket_set_port(port); } xsocket_set_server(server); } break; } break; case 't': g_params->bits.display_time = 1; break; case 'i': g_params->bits.mode_sf = 0; g_params->bits.mode_socket = 1; if (argv[argc][2] == '=') { server = argv[argc]+3; port = strchr(server, ':'); if (port) { *port++ = '\0'; xsocket_set_port(port); } xsocket_set_server(server); } break; case 'v': g_params->bits.mode_version = 1; break; case 'd': g_params->bits.mode_debug = 1; break; } } argc--; } if (!g_params->bits.mode_quiet) { // Summarize parameter settings printf("xlisten Ver:%s\n", g_version); if (g_params->bits.mode_version) xpacket_print_versions(); printf("Using params: "); if (g_params->bits.display_help) printf("[help] "); if (g_params->bits.display_baud) printf("[baud=0x%04x] ", baudrate); if (g_params->bits.display_raw) printf("[raw] "); if (g_params->bits.display_ascii) printf("[ascii] "); if (g_params->bits.display_parsed) printf("[parsed] "); if (g_params->bits.display_cooked) printf("[cooked] "); if (g_params->bits.export_parsed) printf("[export] "); if (g_params->bits.display_time) printf("[timed] "); if (g_params->bits.export_cooked) printf("[convert] "); if (g_params->bits.log_cooked) printf("[logging] "); if (g_params->bits.mode_framing==1)printf("[framed] "); if (g_params->bits.mode_framing==2)printf("[unframed] "); if (g_params->bits.mode_header) printf("[header=%i] ", xpacket_get_start()); if (g_params->bits.mode_socket) printf("[inet=%s:%u] ", xsocket_get_server(), xsocket_get_port()); if (g_params->bits.mode_debug) { printf("[debug - serial dump!] \n"); xserial_port_dump(); } printf("\n"); } if (g_params->bits.display_help) { printf( "\nUsage: xlisten <-?|r|p|c|x|l|d|v|q> <-l=table>" "\n <-s=device> <-b=baud> <-i=server:port>" "\n -? = display help [help]" "\n -r = raw display of tos packets [raw]" "\n -a = ascii display of tos packets [ascii]" "\n -p = parse packet into raw sensor readings [parsed]" "\n -c = convert data to engineering units [cooked]" "\n -l = log data to database or file [logged]" "\n -xr = export raw readings in csv spreadsheet format [export]" "\n -xc = export cooked in csv spreadsheet format [export]" "\n -d = debug serial port by dumping bytes [debug]" "\n -b = set the baudrate [baud=#|mica2|mica2dot]" "\n -s = set serial port device [device=com1]" "\n -i = use socket input [inet=host:port]" "\n -sf = use serial forwarder input [inet=host:port]" "\n -f = specify framing (0=auto|1=on|2=off)" "\n -h = specify header size [header=offset]" "\n -t = display time packet was received [timed]" "\n -q = quiet mode (suppress headers)" "\n -v = show version of all modules" "\n" ); exit(0); } /* Default to displaying packets as raw, parsed, and cooked. */ if (g_params->options.output == 0) { g_params->bits.display_raw = 1; g_params->bits.display_parsed = 1; g_params->bits.display_cooked = 1; } /** TODO: This should probably go back into main. * Once the code is tested out, delete the following. */ #if 0 /* Stream initialization */ // Set STDOUT and STDERR to be line buffered, so output is not delayed. setlinebuf(stdout); setlinebuf(stderr); if (g_params->bits.mode_socket) { g_istream = xsocket_port_open(); } else { g_istream = xserial_port_open(); } #endif } --- NEW FILE: args.h --- /** A structure to store parsed parameter flags. */ typedef union { unsigned flat; struct { // output display options unsigned display_raw : 1; //!< raw TOS packets unsigned display_parsed : 1; //!< pull out sensor readings unsigned display_cooked : 1; //!< convert to engineering units unsigned export_parsed : 1; //!< output comma delimited fields unsigned export_cooked : 1; //!< output comma delimited fields unsigned log_parsed : 1; //!< log output to database unsigned log_cooked : 1; //!< log output to database unsigned display_time : 1; //!< display timestamp of packet unsigned display_ascii : 1; //!< display packet as ASCII characters unsigned display_rsvd : 7; //!< pad first word for output options // modes of operation unsigned display_help : 1; unsigned display_baud : 1; //!< baud was set by user unsigned mode_debug : 1; //!< debug serial port unsigned mode_quiet : 1; //!< suppress headers unsigned mode_version : 1; //!< print versions of all modules unsigned mode_header : 1; //!< user using custom packet header unsigned mode_socket : 1; //!< connect to a serial socket unsigned mode_sf : 1; //!< connect to a serial forwarder unsigned mode_framing : 2; //!< auto=0, framed=1, unframed=2 } bits; struct { unsigned short output; //!< one output option required unsigned short mode; } options; } s_params; void parse_args (int argc, char **argv, s_params * g_params); Index: xdb.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** xdb.h 17 Jun 2005 22:09:49 -0000 1.4 --- xdb.h 19 Jun 2005 22:28:33 -0000 1.5 *************** *** 17,28 **** #include "timestamp/timestamp.h" - PGconn *xdb_connect (); - PGconn *xdb_exit (PGconn *conn); - int xdb_execute (char *command); ! char *xdb_get_table (); ! void xdb_set_table (char *table); void xdb_set_dbname (char *table); ! int xdb_table_exists (char *table); #endif /* __XDB_H__ */ --- 17,34 ---- #include "timestamp/timestamp.h" ! PGconn *xdb_connect (void); ! PGconn *xdb_exit (PGconn *conn); ! int xdb_execute (char *command); ! ! char *xdb_get_table (void); ! void xdb_set_table (char *table); void xdb_set_dbname (char *table); ! int xdb_table_exists (char *table); ! ! /** Requires an existing database for connecting. */ ! void xdb_createdb (char * dbname); ! ! int xdb_db_exists (const char * dbname); #endif /* __XDB_H__ */ Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 2 Jun 2005 00:00:24 -0000 1.7 --- Makefile 19 Jun 2005 22:28:33 -0000 1.8 *************** *** 10,14 **** # Main xlisten sources SRCS = xlisten.c xpacket.c xconvert.c xdb.c ! SRCS += xserial.c xsocket.c # Add Mote Sensor board support --- 10,14 ---- # Main xlisten sources SRCS = xlisten.c xpacket.c xconvert.c xdb.c ! SRCS += xserial.c xsocket.c args.c # Add Mote Sensor board support Index: xlisten.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xlisten.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xlisten.c 17 Jun 2005 23:23:41 -0000 1.5 --- xlisten.c 19 Jun 2005 22:28:33 -0000 1.6 *************** *** 12,60 **** #include "xsensors.h" ! static const char *g_version = "$Id$"; - /** A structure to store parsed parameter flags. */ - typedef union { - unsigned flat; - - struct { - // output display options - unsigned display_raw : 1; //!< raw TOS packets - unsigned display_parsed : 1; //!< pull out sensor readings - unsigned display_cooked : 1; //!< convert to engineering units - unsigned export_parsed : 1; //!< output comma delimited fields - unsigned export_cooked : 1; //!< output comma delimited fields - unsigned log_parsed : 1; //!< log output to database - unsigned log_cooked : 1; //!< log output to database - unsigned display_time : 1; //!< display timestamp of packet - unsigned display_ascii : 1; //!< display packet as ASCII characters - unsigned display_rsvd : 7; //!< pad first word for output options - - // modes of operation - unsigned display_help : 1; - unsigned display_baud : 1; //!< baud was set by user - unsigned mode_debug : 1; //!< debug serial port - unsigned mode_quiet : 1; //!< suppress headers - unsigned mode_version : 1; //!< print versions of all modules - unsigned mode_header : 1; //!< user using custom packet header - unsigned mode_socket : 1; //!< connect to a serial socket - unsigned mode_sf : 1; //!< connect to a serial forwarder - unsigned mode_framing : 2; //!< auto=0, framed=1, unframed=2 - } bits; - - struct { - unsigned short output; //!< one output option required - unsigned short mode; - } options; - } s_params; ! /** A variable to store parsed parameter flags. */ ! static s_params g_params; ! static int g_istream; //!< Handle of input stream /** ! * Extracts command line options and sets flags internally. * * @param argc Argument count --- 12,35 ---- #include "xsensors.h" + #include "args.h" ! /** It's OK to make this global. */ ! const char *g_version = "$Id$"; ! /** TODO: Set the name of the input stream in the argument ! * parsing code, but open it in main. ! */ ! int g_istream; //!< Handle of input stream ! ! ! int ! xmain_get_verbose(s_params * g_params) { ! return !g_params->bits.mode_quiet; ! } /** ! * The main entry point for the sensor listener console application. * * @param argc Argument count *************** *** 62,296 **** * * @author Martin Turon - * * @version 2004/3/10 mturon Intial version - * @n 2004/3/12 mturon Added -b,-s,-q,-x - * @n 2004/8/04 mturon Added -l [ver. 1.11] - * @n 2004/8/22 mturon Added -i [ver. 1.13] - * @n 2004/9/27 mturon Added -t [ver. 1.15] - * @n 2004/9/29 mturon Added -f,-a [v 1.16] */ ! void parse_args(int argc, char **argv) ! { ! // This value is set if/when the bitflag is set. ! unsigned baudrate = 0; ! char *server, *port; ! ! g_params.flat = 0; /* default to no params set */ ! ! ! ! while (argc) { ! if ((argv[argc]) && (*argv[argc] == '-')) { ! switch(argv[argc][1]) { ! case '?': ! g_params.bits.display_help = 1; ! break; ! ! case 'q': ! g_params.bits.mode_quiet = 1; ! break; ! ! case 'p': ! g_params.bits.display_parsed = 1; ! break; ! ! case 'r': ! g_params.bits.display_raw = 1; ! break; ! ! case 'a': ! g_params.bits.display_ascii = 1; ! break; ! ! case 'c': ! g_params.bits.display_cooked = 1; ! break; ! ! case 'x': ! switch (argv[argc][2]) { ! case 'c': g_params.bits.export_cooked = 1; break; ! default: ! case 'r': g_params.bits.export_parsed = 1; break; ! } ! break; ! ! case 'f': ! switch (argv[argc][2]) { ! case '=': // specify arbitrary offset ! g_params.bits.mode_framing = atoi(argv[argc]+3)&3; ! break; ! ! case 'a': // automatic deframing ! g_params.bits.mode_framing = 0; ! break; ! ! case '0': ! case 'n': // assume no framing ! g_params.bits.mode_framing = 2; ! break; ! ! case '1': // force framing ! default: ! g_params.bits.mode_framing = 1; ! break; ! } ! break; ! ! ! case 'w': ! case 'h': { ! int offset = XPACKET_DATASTART_MULTIHOP; ! g_params.bits.mode_header = 1; ! switch (argv[argc][2]) { ! case '=': // specify arbitrary offset ! offset = atoi(argv[argc]+3); ! break; ! case '0': // direct uart (no wireless) ! case '1': // single hop offset ! offset = XPACKET_DATASTART_STANDARD; ! break; ! } ! xpacket_set_start(offset); ! break; ! } ! ! case 'l': ! g_params.bits.log_cooked = 1; ! if (argv[argc][2] == '=') { ! //xdb_set_table(argv[argc]+3); ! printf("dbname=%s\n",argv[argc]+3); ! xdb_set_dbname(argv[argc]+3); ! //exit(0); ! } ! break; ! ! case 'b': ! if (argv[argc][2] == '=') { ! baudrate = xserial_set_baud(argv[argc]+3); ! g_params.bits.display_baud = 1; ! } ! break; ! ! case 's': ! switch (argv[argc][2]) { ! case '=': ! xserial_set_device(argv[argc]+3); ! break; ! ! case 'f': ! g_params.bits.mode_sf = 1; ! g_params.bits.mode_socket = 1; ! if (argv[argc][3] == '=') { ! server = argv[argc]+4; ! port = strchr(server, ':'); ! if (port) { ! *port++ = '\0'; ! xsocket_set_port(port); ! } ! xsocket_set_server(server); ! } ! break; ! } ! break; ! ! case 't': ! g_params.bits.display_time = 1; ! break; ! ! case 'i': ! g_params.bits.mode_sf = 0; ! g_params.bits.mode_socket = 1; ! if (argv[argc][2] == '=') { ! server = argv[argc]+3; ! port = strchr(server, ':'); ! if (port) { ! *port++ = '\0'; ! xsocket_set_port(port); ! } ! xsocket_set_server(server); ! } ! break; ! ! case 'v': ! g_params.bits.mode_version = 1; ! break; ! ! case 'd': ! g_params.bits.mode_debug = 1; ! break; ! } ! } ! argc--; ! } ! ! if (!g_params.bits.mode_quiet) { ! // Summarize parameter settings ! printf("xlisten Ver:%s\n", g_version); ! if (g_params.bits.mode_version) xpacket_print_versions(); ! printf("Using params: "); ! if (g_params.bits.display_help) printf("[help] "); ! if (g_params.bits.display_baud) printf("[baud=0x%04x] ", baudrate); ! if (g_params.bits.display_raw) printf("[raw] "); ! if (g_params.bits.display_ascii) printf("[ascii] "); ! if (g_params.bits.display_parsed) printf("[parsed] "); ! if (g_params.bits.display_cooked) printf("[cooked] "); ! if (g_params.bits.export_parsed) printf("[export] "); ! if (g_params.bits.display_time) printf("[timed] "); ! if (g_params.bits.export_cooked) printf("[convert] "); ! if (g_params.bits.log_cooked) printf("[logging] "); ! if (g_params.bits.mode_framing==1)printf("[framed] "); ! if (g_params.bits.mode_framing==2)printf("[unframed] "); ! if (g_params.bits.mode_header) printf("[header=%i] ", ! xpacket_get_start()); ! if (g_params.bits.mode_socket) printf("[inet=%s:%u] ", ! xsocket_get_server(), ! xsocket_get_port()); ! if (g_params.bits.mode_debug) { ! printf("[debug - serial dump!] \n"); ! xserial_port_dump(); ! } ! printf("\n"); ! } ! ! if (g_params.bits.display_help) { ! printf( ! "\nUsage: xlisten <-?|r|p|c|x|l|d|v|q> <-l=table>" ! "\n <-s=device> <-b=baud> <-i=server:port>" ! "\n -? = display help [help]" ! "\n -r = raw display of tos packets [raw]" ! "\n -a = ascii display of tos packets [ascii]" ! "\n -p = parse packet into raw sensor readings [parsed]" ! "\n -c = convert data to engineering units [cooked]" ! "\n -l = log data to database or file [logged]" ! "\n -xr = export raw readings in csv spreadsheet format [export]" ! "\n -xc = export cooked in csv spreadsheet format [export]" ! "\n -d = debug serial port by dumping bytes [debug]" ! "\n -b = set the baudrate [baud=#|mica2|mica2dot]" ! "\n -s = set serial port device [device=com1]" ! "\n -i = use socket input [inet=host:port]" ! "\n -sf = use serial forwarder input [inet=host:port]" ! "\n -f = specify framing (0=auto|1=on|2=off)" ! "\n -h = specify header size [header=offset]" ! "\n -t = display time packet was received [timed]" ! "\n -q = quiet mode (suppress headers)" ! "\n -v = show version of all modules" ! "\n" ! ); ! exit(0); ! } ! ! /* Default to displaying packets as raw, parsed, and cooked. */ ! if (g_params.options.output == 0) { ! g_params.bits.display_raw = 1; ! g_params.bits.display_parsed = 1; ! g_params.bits.display_cooked = 1; ! } ! /* Stream initialization */ // Set STDOUT and STDERR to be line buffered, so output is not delayed. setlinebuf(stdout); setlinebuf(stderr); - if (g_params.bits.mode_socket) { g_istream = xsocket_port_open(); --- 37,55 ---- * * @author Martin Turon * @version 2004/3/10 mturon Intial version */ ! int ! main(int argc, char **argv) { ! int length; ! unsigned char buffer[255]; ! /* A variable to store parsed parameter flags. */ ! s_params g_params; + parse_args(argc, argv, &g_params); + /* Stream initialization */ // Set STDOUT and STDERR to be line buffered, so output is not delayed. setlinebuf(stdout); setlinebuf(stderr); if (g_params.bits.mode_socket) { g_istream = xsocket_port_open(); *************** *** 298,322 **** g_istream = xserial_port_open(); } - } - - int xmain_get_verbose() { - return !g_params.bits.mode_quiet; - } ! /** ! * The main entry point for the sensor listener console application. ! * ! * @param argc Argument count ! * @param argv Argument vector ! * ! * @author Martin Turon ! * @version 2004/3/10 mturon Intial version ! */ ! int main(int argc, char **argv) ! { ! int length; ! unsigned char buffer[255]; ! ! parse_args(argc, argv); xpacket_initialize(); --- 57,64 ---- g_istream = xserial_port_open(); } ! /* Each different sensor board has different packet ! * layouts, which are initialized in the following. ! */ xpacket_initialize(); |
From: David M. D. <do...@us...> - 2005-06-19 22:28:43
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9568/boards Modified Files: fireboard.c pg_test.c Log Message: Database connection can now specified from the command using the -l option. Index: pg_test.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/pg_test.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pg_test.c 17 Jun 2005 23:23:41 -0000 1.7 --- pg_test.c 19 Jun 2005 22:28:33 -0000 1.8 *************** *** 5,14 **** */ - #include <NMEA.h> - - #include "../xdb.h" - #include "../xsensors.h" ! // TODO: Condense tables down to gga, weather, etc. --- 5,13 ---- */ ! /* Not sure how the functions for the fireboard ! * should be handled, but this is a start. ! */ ! #include "fireboard.h" *************** *** 23,36 **** "temperature float, " "pressure float)"; - #if 0 - "intersemacal1 integer, " - "intersemacal2 integer, " - "intersemacal3 integer, " - "intersemacal4 integer," - "prtemp integer, " - "press integer, " - "taosch0 integer, " - "taosch1 integer, " - #endif --- 22,25 ---- *************** *** 169,170 **** --- 158,161 ---- xdb_execute(pg_statement); } + + Index: fireboard.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/fireboard.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** fireboard.c 1 Jun 2005 23:34:20 -0000 1.12 --- fireboard.c 19 Jun 2005 22:28:33 -0000 1.13 *************** *** 18,23 **** #include <sensorboardApp.h> ! #include "../xdb.h" ! #include "../xsensors.h" --- 18,22 ---- #include <sensorboardApp.h> ! #include "fireboard.h" |
From: David M. D. <do...@us...> - 2005-06-19 22:26:43
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8749 Modified Files: firebug-db-setup.sh firebug.sql Log Message: Extended firebug postgres startup script. Index: firebug-db-setup.sh =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/firebug-db-setup.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** firebug-db-setup.sh 17 Jun 2005 23:11:29 -0000 1.1 --- firebug-db-setup.sh 19 Jun 2005 22:26:32 -0000 1.2 *************** *** 23,26 **** --- 23,28 ---- #fi + + #### FIXME: Upgrade to current pg. # Create database only if it wasn't created before #if [ ! -d /pgdata ]; then *************** *** 30,34 **** #fi ! ### pg_ctl is not on the debian box. #pg_ctl start -l /tmp/postgresql.log --- 32,36 ---- #fi ! #### FIXME: Upgrade to current pg. ### pg_ctl is not on the debian box. #pg_ctl start -l /tmp/postgresql.log *************** *** 38,111 **** #psql -c "create user tele password 'tiny' createdb createuser;" template1 ! #### assumes firebug owner is valid, password prompt is not working. ! createdb --username firebug --password firebug --owner firebug ! #psql --echo-queries task tele < task.sql - # Add MoteView client to db - #echo "Adding MoteView as client." - #psql -c "DELETE FROM task_client_info where name='MoteView';" task - #psql -c "INSERT INTO task_client_info (name, type, clientinfo) VALUES ('MoteView', 'CONFIGURATION', '');" task - #psql -c "INSERT INTO task_mote_info (mote_id, x_coord, y_coord, z_coord, calib, moteinfo, clientinfo_name) VALUES (0, 10, 10, 0, '', 'Gateway', 'MoteView');" task ! # Finalize db creation with xlisten tables ! #echo "Creating xlisten tables for XSensor." ! #psql -c "CREATE TABLE xtest_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, light integer);" task ! #psql -c "CREATE TABLE xtest_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, light integer);" task ! #psql -c "CREATE RULE xtest_results AS ON INSERT TO xtest_results DO ( DELETE FROM xtest_results_L WHERE nodeid = NEW.nodeid; INSERT INTO xtest_results_L VALUES ( NEW.* ); );" task ! #psql -c "CREATE INDEX xtest_time_idx ON xtest_results USING BTREE ( result_time ) ;" task ! #psql -c "DELETE FROM task_query_time_log where query_id=8;" task #psql -c "DELETE FROM task_query_log where query_id=8;" task #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (8, 8, 'SELECT nodeid,parent,light,voltage SAMPLE PERIOD 1000', 'sensor', 'xtest_results');" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (8, now());" task - # Add MEP401/MEP500 enviro Tables: #echo "Creating xlisten tables for MEP401 / MEP500." #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('inthum', 3, 1, 'Sensirion internal humidity reading') ;" task - #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('inttemp', 3, 1, 'Sensirion internal temperature reading') ;" task - #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('therm', 3, 1, 'Mica2dot thermistor reading') ;" task - - #psql -c "CREATE TABLE enviro_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, therm integer, humid integer, humtemp integer, inthum integer, inttemp integer, photo1 integer, photo2 integer, photo3 integer, photo4 integer, accel_x integer, accel_y integer, prtemp integer, press integer );" task - #psql -c "CREATE TABLE enviro_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, therm integer, humid integer, humtemp integer, inthum integer, inttemp integer, photo1 integer, photo2 integer, photo3 integer, photo4 integer, accel_x integer, accel_y integer, prtemp integer, press integer );" task - - #psql -c "CREATE RULE cache_enviro_results AS ON INSERT TO enviro_results DO ( DELETE FROM enviro_results_L WHERE nodeid = NEW.nodeid; INSERT INTO enviro_results_L VALUES ( NEW.* ); );" task - #psql -c "CREATE INDEX enviro_time_idx ON enviro_results USING BTREE ( result_time ) ;" task - - #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (10, 10, 'SELECT nodeid,parent,voltage,therm,humid,humtemp,inthum,inttemp,photo1,photo2,photo3,photo4,accel_x,accel_y,prtemp,press SAMPLE PERIOD 3000', 'sensor', 'enviro_results');" task - #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (10, now()) ;" task - - # Add MTS300/310 Tables: - #echo "Creating tables for MTS300/310." - #psql -c "CREATE TABLE mts310_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, temp integer, light integer, accel_x integer, accel_y integer, mag_x integer, mag_y integer );" task - #psql -c "CREATE TABLE mts310_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, temp integer, light integer, accel_x integer, accel_y integer, mag_x integer, mag_y integer );" task - #psql -c "CREATE RULE cache_mts310_results AS ON INSERT TO mts310_results DO ( DELETE FROM mts310_results_L WHERE nodeid = NEW.nodeid; INSERT INTO mts310_results_L VALUES ( NEW.* ); );" task - #psql -c "CREATE INDEX mts310_time_idx ON mts310_results USING BTREE ( result_time ) ;" task - #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (12, 12, 'SELECT nodeid,parent,voltage,temp,light,accel_x,accel_y,mag_x,mag_y SAMPLE PERIOD 3000', 'sensor', 'mts310_results');" task - #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (12, now()) ;" task - - - # Add MDA300 Plant App Tables: - #echo "Creating tables for MDA300." - #psql -c "CREATE TABLE mda300_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, humid integer, humtemp integer, echo10 integer, echo20 integer, soiltemp integer );" task - #psql -c "CREATE TABLE mda300_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, humid integer, humtemp integer, echo10 integer, echo20 integer, soiltemp integer );" task - #psql -c "CREATE RULE cache_mda300_results AS ON INSERT TO mda300_results DO ( DELETE FROM mda300_results_L WHERE nodeid = NEW.nodeid; INSERT INTO mda300_results_L VALUES ( NEW.* ); );" task - #psql -c "CREATE INDEX mda300_time_idx ON mda300_results USING BTREE ( result_time ) ;" task - #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (13, 13, 'SELECT nodeid,parent,voltage,humid,humtemp,echo10,echo20,soiltemp SAMPLE PERIOD 6000', 'sensor', 'mda300_results');" task - #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (13, now()) ;" task - - #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('echo10', 3, 1, 'Echo10 soil moisture probe') ;" task - #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('echo20', 3, 1, 'Echo20 soil moisture probe') ;" task - #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('soiltemp', 3, 1, 'Davis soil temperature probe') ;" task - - - # Finalize db creation with xlisten tables - #echo "Creating tables for Surge." - #psql -c "CREATE TABLE surge_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, light integer, temp integer, voltage integer, mag_x integer, mag_y integer, accel_x integer, accel_y integer);" task - #psql -c "CREATE TABLE surge_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, light integer, temp integer, voltage integer, mag_x integer, mag_y integer, accel_x integer, accel_y integer);" task - #psql -c "CREATE RULE cache_surge_results AS ON INSERT TO surge_results DO ( DELETE FROM surge_results_L WHERE nodeid = NEW.nodeid; INSERT INTO surge_results_L VALUES ( NEW.* ); );" task - #psql -c "CREATE INDEX surge_time_idx ON surge_results USING BTREE ( result_time ) ;" task - #psql -c "DELETE FROM task_query_time_log where query_id=7;" task - #psql -c "DELETE FROM task_query_log where query_id=7;" task - #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (7, 7, 'SELECT nodeid,parent,light,temp,voltage,mag_x,mag_y,accel_x,accel_y SAMPLE PERIOD 3000', 'sensor', 'surge_results');" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (7, now());" task --- 40,61 ---- #psql -c "create user tele password 'tiny' createdb createuser;" template1 ! #### assumes firebug owner is valid, password prompt assumes the ! #### user running the script has appropriate permissions to ! #### create databases. ! #### Change these to the psql -c "command here" form. ! createuser firebug --echo --adduser --createdb #--pwprompt ! createdb firebug --echo --username firebug --owner firebug ! psql --echo-queries --dbname firebug firebug < firebug.sql ! #### The following are just examples of how to set up ! #### the database initially. #psql -c "DELETE FROM task_query_log where query_id=8;" task #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (8, 8, 'SELECT nodeid,parent,light,voltage SAMPLE PERIOD 1000', 'sensor', 'xtest_results');" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (8, now());" task # Add MEP401/MEP500 enviro Tables: #echo "Creating xlisten tables for MEP401 / MEP500." #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('inthum', 3, 1, 'Sensirion internal humidity reading') ;" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (7, now());" task Index: firebug.sql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/firebug.sql,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** firebug.sql 17 Jun 2005 23:11:29 -0000 1.1 --- firebug.sql 19 Jun 2005 22:26:32 -0000 1.2 *************** *** 1,387 **** ! -- SQL for creating tables to initialize a GSK database. ! -- This script is platform specific. It uses some PostgreSQL specific ! -- data types (e.g., bytea). ! ! -- task_query_log is a complete log of all queries submitted to ! -- the sensor network ! drop table task_query_log cascade; ! create table task_query_log ( ! query_id int primary key, /* unique id for queries */ ! tinydb_qid smallint, /* TinyDB query id, 1-byte */ ! query_text text not null, /* query text in TinyDB SQL */ ! query_type varchar(20) not null, /* query type: sensor or health */ ! table_name varchar(100) not null unique /* name of table where the query results are logged */ ! ); ! ! -- task_query_time_log records the query start and stop times ! drop table task_query_time_log; ! create table task_query_time_log ( ! query_id int references task_query_log, /* query id */ ! start_time timestamp not null, /* query start time */ ! stop_time timestamp, /* query stop time */ ! primary key(query_id, start_time) ! ); ! ! -- task_command_log is a complete log of all commands submitted to ! -- the sensor network ! drop table task_command_log cascade; ! create table task_command_log ( ! command_id int primary key, /* unique command id */ ! submit_time timestamp, /* command submission time */ ! command_name varchar(100), /* command name, e.g., reset, sample_rate, ping, calibrate, etc. */ ! node_id int, /* target node id, -1 means all nodes */ ! query_id int, /* query id the command is targeting, -1 means all queries */ ! command_arg int /* single integer argument value, will generalize later */ ! ); ! ! -- task_command_acks records the acknowledgements from each node in reponse to ! -- a command issued from the server. ! drop table task_command_acks; ! create table task_command_acks ( ! command_id int references task_command_log, ! ack_time timestamp, /* timestamp when ack comes in */ ! node_id int, /* node id from which the ack is sent */ ! query_id int, /* query id if command is targeting a particular query */ ! epoch int, /* last epoch number for the query */ ! sample_rate int /* all acks include the current sample rate in seconds */ ! ); ! ! -- task_packet_log is a complete log of all raw packets received from ! -- the sensor network. ! -- There will also be a per-query table (specified by task_query_log.table_name) ! -- logging the query result tuples. ! drop table task_packet_log; ! create table task_packet_log ( ! query_id int references task_query_log, /* id of query that generated the packet */ ! epoch int, /* epoch number */ ! server_time timestamp, /* time received at server */ ! mote_time timestamp, /* logical time stamped by mote */ ! mote_id int, /* id of mote that generated the packet */ ! raw_packet bytea /* raw packet bytes */ ! ); ! ! -- task_health_log is a complete log of network health and statistics ! -- that can be collected from the sensor network. It includes all ! -- possible network health and statistics related attributes. Each ! -- health query will only collect a subset of these attributes. The ! -- attributes that are not included in the query will be filled with ! -- NULL values. ! drop table task_health_log; ! create table task_health_log ( ! query_id int references task_query_log, /* query id */ ! epoch int, /* epoch number */ ! server_time timestamp, /* time received at server */ ! mote_time timestamp, /* logical time stamped by mote */ ! mote_id int, /* mote id */ ! parent int, /* parent id in routing tree */ ! voltage int, /* battery voltage */ ! contention int /* radio contention */ ! /* The exact list of health&stat attributes is yet to be finalized. */ ! ); ! ! -- task_last_query_id implements a persistent counter for generating ! -- unique GSK query ids ! drop table task_next_query_id; ! create table task_next_query_id ( ! query_id int, /* next query id */ ! tinydb_qid smallint, /* next tinydb query id, 1 byte */ ! command_id int /* next command id */ ! ); ! -- query 0 is reserved for the calibration query ! insert into task_next_query_id values (1, 1, 0); ! ! -- task_current_results is a view into queryN_results table ! -- for the last query executed. ! -- initialized as task_query_log as a placeholder ! drop view task_current_results; ! create view task_current_results as select * from task_query_log; ! ! -- task_attributes contains information about all the attributes ! -- that can be queries from the sensor network ! drop table task_attributes; ! create table task_attributes ( ! name varchar(8), /* attribute name, limited to 8 characters */ ! typeid int, /* type of attribute */ ! power_cons int, /* per sample power consumption rate */ ! description varchar(1000) /* description of the attribute */ ! ); ! insert into task_attributes values ('nodeid', 3, 1, 'node id'); ! insert into task_attributes values ('light', 3, 1, 'light sensor reading'); ! insert into task_attributes values ('temp', 3, 1, 'temperature sensor reading'); ! insert into task_attributes values ('parent', 3, 1, 'parent node id in routing tree'); ! insert into task_attributes values ('accel_x', 3, 1, 'accelerometer reading in x axis'); ! insert into task_attributes values ('accel_y', 3, 1, 'accelerometer reading in y axis'); ! insert into task_attributes values ('mag_x', 3, 1, 'magnetometer reading in x axis'); ! insert into task_attributes values ('mag_y', 3, 1, 'magnetometer reading in y axis'); ! insert into task_attributes values ('noise', 3, 1, 'aggregated microphone readings'); ! insert into task_attributes values ('tones', 3, 1, 'aggregated number of tones detected'); ! insert into task_attributes values ('voltage', 3, 1, 'battery voltage level'); ! insert into task_attributes values ('rawtone', 3, 1, 'raw tone detector output: 1 detected 0 otherwise'); ! insert into task_attributes values ('rawmic', 3, 1, 'raw microphone reading'); ! insert into task_attributes values ('freeram', 3, 1, 'amount of RAM available in bytes'); ! insert into task_attributes values ('qlen', 1, 1, 'global send queue length'); ! insert into task_attributes values ('mhqlen', 1, 1, 'multi-hop forward queue length'); ! insert into task_attributes values ('depth', 1, 1, 'multi-hop depth'); ! insert into task_attributes values ('timelo', 4, 1, 'low 32-bit of mote logical time'); ! insert into task_attributes values ('timehi', 4, 1, 'high 32-bit of mote logical time'); ! insert into task_attributes values ('qual', 1, 1, 'quality of multi-hop parent'); ! insert into task_attributes values ('humid', 3, 1, 'Senirion Humidity sensor humidity reading'); ! insert into task_attributes values ('humtemp', 3, 1, 'Senirion Humidity sensor temperature reading'); ! insert into task_attributes values ('echo10', 3, 1, 'Echo10 soil moisture sensor temperature reading'); ! insert into task_attributes values ('taosbot', 3, 1, 'Bottom Taos Photo sensor reading'); ! insert into task_attributes values ('taostop', 3, 1, 'Top Taos Photo sensor reading'); ! insert into task_attributes values ('press', 3, 1, 'Intersema Pressure sensor pressure reading'); ! insert into task_attributes values ('prtemp', 3, 1, 'Intersema Pressure sensor temperature reading'); ! insert into task_attributes values ('prcalib', 9, 1, 'Intersema Pressure sensor calibration reading'); ! insert into task_attributes values ('hamatop', 3, 1, 'Top Hamamatsu light sensor reading'); ! insert into task_attributes values ('hamabot', 3, 1, 'Bottom Hamamatsu light sensor reading'); ! insert into task_attributes values ('thermo', 3, 1, 'Melexis sensor thermopile reading'); ! insert into task_attributes values ('thmtemp', 3, 1, 'Melexis sensor temperature reading'); ! -- insert into task_attributes values ('content', 3, 1, 'radio contention'); ! ! -- task_aggregates contains information about all aggregates that ! -- are supported by GSK ! drop table task_aggregates; ! create table task_aggregates ( ! name varchar(32), /* name of aggregate */ ! return_type int, /* return type of aggregate */ ! num_args int, /* number of arguments */ ! arg_type int, /* type of the non-constant argument */ ! description varchar(1000) /* description of the aggregate */ ! ); ! insert into task_aggregates values ('winavg', 3, 3, 3, 'temporal windowed average'); ! insert into task_aggregates values ('winsum', 3, 3, 3, 'temporal windowed sum'); ! insert into task_aggregates values ('winmin', 3, 3, 3, 'temporal windowed minimum'); ! insert into task_aggregates values ('winmax', 3, 3, 3, 'temporal windowed maximum'); ! insert into task_aggregates values ('wincnt', 3, 3, 3, 'temporal windowed count'); ! ! -- task_commands contains information about all sensor network ! -- commands supported by GSK ! drop table task_commands; ! create table task_commands ( ! name varchar(8), /* name of command */ ! return_type int, /* return type of the command */ ! num_args int, /* number of arguments */ ! arg_types int[], /* argument types */ ! description varchar(1000) /* brief description */ ! ); ! insert into task_commands values ('SetLedR', 9, 1, '{1}', 'SetLedR(0) turns off the red LED, SetLedR(1) turns on the red LED, SetLedR(2) toggles the red LED'); ! insert into task_commands values ('SetLedY', 9, 1, '{1}', 'SetLedY(0) turns off the yellow LED, SetLedY(1) turns on the yellow LED, SetLedY(2) toggles the yellow LED'); ! insert into task_commands values ('SetLedG', 9, 1, '{1}', 'SetLedG(0) turns off the green LED, SetLedG(1) turns on the green LED, SetLedG(2) toggles the green LED'); ! insert into task_commands values ('SetPot', 9, 1, '{1}', 'set potentiometer level'); ! insert into task_commands values ('Reset', 9, 0, '{}', 'reboot mote'); ! insert into task_commands values ('LogClr', 9, 0, '{}', 'clear tuple log in EEPROM'); ! -- insert into task_commands values ('SetSnd', 9, 1, '{2}', 'turn on sounder for n milliseconds'); ! ! -- task_client_info contains opaque information about task clients ! -- such as layouts. ! drop table task_client_info cascade; ! create table task_client_info ( ! name varchar(100) primary key, /* name of client info */ ! type varchar(100), /* java type of client info */ ! clientinfo bytea /* opaque client info object */ ! ); ! ! -- task_mote_info contains opaque per-mote client information relative to ! -- a particular client info. ! drop table task_mote_info; ! create table task_mote_info ( ! mote_id int, /* mote id */ ! x_coord double precision, /* x coordinate */ ! y_coord double precision, /* y coordinate */ ! z_coord double precision, /* z coordinate */ ! calib bytea, /* calibration coefficiences, raw bytes from motes */ ! moteinfo bytea, /* opaque mote info object */ ! clientinfo_name varchar(100) references task_client_info, /* client info name */ ! primary key (mote_id, clientinfo_name) ! ); ! ! create or replace function humidity(int /* raw humidity */) returns real ! as 'select (-4 + 0.0405 * $1 + -2.8e-6 * $1 * $1)::real as result;' ! language sql; ! ! create or replace function humid_temp(int /* raw temperature */) returns real ! as 'select (-38.4 + 0.0098 * $1)::real as result;' ! language sql; ! ! create or replace function humid_adj(int /* raw humidity */, int /* raw temperature */) returns real ! as 'select ((humid_temp($2) - 25) * (0.01 + 0.00008 * $1) + humidity($1))::real as result;' ! language sql; ! ! CREATE FUNCTION plpgsql_call_handler () RETURNS language_handler ! AS '$libdir/plpgsql', 'plpgsql_call_handler' ! LANGUAGE c; ! ! ! CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler; ! ! create or replace function photo(int /* channel 0 */, int /* channel 1 */) returns real ! as 'declare ! s0 int; ! cc0 int; ! s1 int; ! cc1 int; ! adccount0 int; ! adccount1 int; ! lux real := 0; ! begin ! s0 := $1 & 15; ! cc0 := (($1 & 127) >> 4) & 7; ! s1 := $2 & 15; ! cc1 := (($2 & 127) >> 4) & 7; ! -- check if we are railed ! if s0 = 15 and s1 = 15 and cc0 = 7 and cc1 = 7 ! then return null; ! end if; ! ! adccount0 := (16.5 * (2^cc0 - 1))::int + (s0 * 2^cc0)::int; ! adccount1 := (16.5 * (2^cc1 - 1))::int + (s1 * 2^cc1)::int; ! ! if adccount0 = 0 then return null; end if; ! if (adccount1 / adccount0) > 27 then return 0.0; end if; ! lux := adccount0 * 0.46 * exp(-3.13 * (adccount1 / adccount0)); ! return lux; ! end;' ! language 'plpgsql'; ! ! create or replace function thermopile(int /* raw thermopile */) returns real ! as 'select ((($1 >> 4) * (120 - (-20))) / (2^12 - 1) + (-20))::real as result;' ! language sql; ! ! create or replace function thermistor(int /* raw temperature */) returns real ! as 'select ((($1 >> 4) * (85 - (-20))) / (2^12 - 1) + (-20))::real as result;' ! language sql; ! ! create or replace function voltage(int /* raw voltage */) returns real ! as 'select (case when $1 = 0 then 0 else 0.58 * 1024 / $1 end)::real as result;' ! language sql; ! ! create or replace function hamamatsu_current(int /* raw hamamatsu */, int /* raw voltage */) returns real ! as 'select (($1 * voltage($2) / 1024.0) / 5.0)::real as result;' ! language sql; ! ! create or replace function hamamatsu(int /* raw hamamatsu */, int /* raw voltage */) returns real ! as 'select (hamamatsu_current($1, $2) * 1e6)::real as result;' ! language sql; ! ! create or replace function pressure_mbar(int /* raw pressure */, int /* raw temperature */, bytea /* calibration */) returns real ! as 'declare ! c1 int; c2 int; c3 int; c4 int; c5 int; c6 int; ! calib0 int; calib1 int; calib2 int; calib3 int; ! ut1 int; ! dt int; ! temp real; ! off real; ! sens real; ! x real; ! p real; ! begin ! -- parse calibration coefficiences out of byte array ! calib0 := get_byte($3, 0) & 255; ! calib0 := calib0 | (((get_byte($3, 1) & 255) << 8) & 65280); ! calib1 := get_byte($3, 2) & 255; ! calib1 := calib1 | (((get_byte($3, 3) & 255) << 8) & 65280); ! calib2 := get_byte($3, 4) & 255; ! calib2 := calib2 | (((get_byte($3, 5) & 255) << 8) & 65280); ! calib3 := get_byte($3, 6) & 255; ! calib3 := calib3 | (((get_byte($3, 7) & 255) << 8) & 65280); ! ! c1 := calib0 >> 1; ! c2 := calib2 & 63; ! c2 := c2 << 6; ! c2 := c2 | (calib3 & 63); ! c3 := calib3 >> 6; ! c4 := calib2 >> 6; ! c5 := calib0 << 10; ! c5 := c5 & 1024; ! c5 := c5 + (calib1 >> 6); ! c6 := calib1 & 63; ! ut1 := 8 * c5 + 20224; ! dt := $2 - ut1; ! temp := 200 + dt * (c6 + 50) / 1024; ! off := c2 * 4 + ((c4 - 512) * dt) / 4096; ! sens := c1 + (c3 * dt) / 1024 + 24576; ! x := (sens * ($1 - 7168)) / 16384 - off; ! p := x * 100 / 32 + 250 * 100; ! return p / 100; ! end;' ! language 'plpgsql'; ! create or replace function pressure_inHg(int /* raw pressure */, int /* raw temperature */, bytea /* calibration */) returns real ! as 'declare ! c1 int; c2 int; c3 int; c4 int; c5 int; c6 int; ! calib0 int; calib1 int; calib2 int; calib3 int; ! ut1 int; ! dt int; ! off real; ! sens real; ! x real; ! p real; ! begin ! -- parse calibration coefficiences out of byte array ! calib0 := get_byte($3, 0) & 255; ! calib0 := calib0 | (((get_byte($3, 1) & 255) << 8) & 65280); ! calib1 := get_byte($3, 2) & 255; ! calib1 := calib1 | (((get_byte($3, 3) & 255) << 8) & 65280); ! calib2 := get_byte($3, 4) & 255; ! calib2 := calib2 | (((get_byte($3, 5) & 255) << 8) & 65280); ! calib3 := get_byte($3, 6) & 255; ! calib3 := calib3 | (((get_byte($3, 7) & 255) << 8) & 65280); ! c1 := calib0 >> 1; ! c2 := calib2 & 63; ! c2 := c2 << 6; ! c2 := c2 | (calib3 & 63); ! c3 := calib3 >> 6; ! c4 := calib2 >> 6; ! c5 := calib0 << 10; ! c5 := c5 & 1024; ! c5 := c5 + (calib1 >> 6); ! c6 := calib1 & 63; ! ut1 := 8 * c5 + 20224; ! dt := $2 - ut1; ! off := c2 * 4 + ((c4 - 512) * dt) / 4096; ! sens := c1 + (c3 * dt) / 1024 + 24576; ! x := (sens * ($1 - 7168)) / 16384 - off; ! p := x * 100 / 32 + 250 * 100; ! return p / (100 * 33.864); ! end;' ! language 'plpgsql'; ! create or replace function pressure_temp(int /* raw temperature */, bytea /* calibration */) returns real ! as 'declare ! c1 int; c2 int; c3 int; c4 int; c5 int; c6 int; ! calib0 int; calib1 int; calib2 int; calib3 int; ! ut1 int; ! dt int; ! temp real; ! begin ! -- parse calibration coefficiences out of byte array ! calib0 := get_byte($2, 0) & 255; ! calib0 := calib0 | (((get_byte($2, 1) & 255) << 8) & 65280); ! calib1 := get_byte($2, 2) & 255; ! calib1 := calib1 | (((get_byte($2, 3) & 255) << 8) & 65280); ! calib2 := get_byte($2, 4) & 255; ! calib2 := calib2 | (((get_byte($2, 5) & 255) << 8) & 65280); ! calib3 := get_byte($2, 6) & 255; ! calib3 := calib3 | (((get_byte($2, 7) & 255) << 8) & 65280); - c1 := calib0 >> 1; - c2 := calib2 & 63; - c2 := c2 << 6; - c2 := c2 | (calib3 & 63); - c3 := calib3 >> 6; - c4 := calib2 >> 6; - c5 := calib0 << 10; - c5 := c5 & 1024; - c5 := c5 + (calib1 >> 6); - c6 := calib1 & 63; ! ut1 := 8 * c5 + 20224; ! dt := $1 - ut1; ! temp := 200 + dt * (c6 + 50) / 1024; ! return temp / 10; ! end;' ! language 'plpgsql'; --- 1,50 ---- ! -- SQL for creating tables to initialize a Firebug database. ! -- This script is platform specific, may use some postgres ! -- specific functions. ! drop table xbow_weather; ! create table xbow_weather (result_time timestamp without time zone, ! nodeid integer, ! voltage integer, ! humidity float, ! temperature float, ! pressure float); ! drop table xbow_weather_l; ! create table xbow_weather_l (result_time timestamp without time zone, ! nodeid integer, ! voltage integer, ! humidity float, ! temperature float, ! pressure float); ! CREATE RULE cache_xbow_weather AS ON INSERT TO xbow_weather DO ( ! DELETE FROM xbow_weather_l WHERE nodeid = NEW.nodeid; ! INSERT INTO xbow_weather_l VALUES (NEW.*); ); ! drop table gga; ! CREATE TABLE gga (nodeid integer, ! Hours integer, ! Minutes integer, ! seconds float, ! Latitudedegree integer, ! Latitudeminutes float, ! Longitudedegree integer, ! Longitudeminute float, ! NSEWind integer); ! drop table gga_l; ! CREATE TABLE gga_l (nodeid integer, ! Hours integer, ! Minutes integer, ! seconds float, ! Latitudedegree integer, ! Latitudeminutes float, ! Longitudedegree integer, ! Longitudeminute float, ! NSEWind integer); ! CREATE RULE cache_gga AS ON INSERT TO gga DO ( ! DELETE FROM gga_l WHERE nodeid = NEW.nodeid; ! INSERT INTO gga_l VALUES (NEW.*); ); |
From: David M. D. <do...@us...> - 2005-06-19 19:09:50
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7063/XSensorMTS400 Modified Files: Makefile TestMTS400.nc TestMTS400M.nc appFeatures.h Log Message: . Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TestMTS400M.nc 1 Jun 2005 23:56:01 -0000 1.13 --- TestMTS400M.nc 19 Jun 2005 19:09:27 -0000 1.14 *************** *** 1,5 **** /* tab:4 - * - * * "Copyright (c) 2000-2002 The Regents of the University of California. * All rights reserved. --- 1,3 ---- Index: TestMTS400.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400.nc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestMTS400.nc 27 May 2005 00:38:13 -0000 1.4 --- TestMTS400.nc 19 Jun 2005 19:09:27 -0000 1.5 *************** *** 85,88 **** --- 85,89 ---- NMEAC, LedsC, + DelugeC, Accel, TaosPhoto, *************** *** 96,99 **** --- 97,101 ---- Main.StdControl -> TestMTS400M; Main.StdControl -> TimerC; + Main.StdControl -> DelugeC; XEE_PARAMS_WIRING() Index: appFeatures.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/appFeatures.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** appFeatures.h 24 May 2005 21:53:17 -0000 1.4 --- appFeatures.h 19 Jun 2005 19:09:27 -0000 1.5 *************** *** 22,26 **** #endif ! //#define FEATURE_GPS_ONLY 1 #ifndef FEATURE_GPS_ONLY --- 22,26 ---- #endif ! //#define FEATURE_GPS_ONLY 0 #ifndef FEATURE_GPS_ONLY Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile 27 May 2005 00:38:13 -0000 1.8 --- Makefile 19 Jun 2005 19:09:26 -0000 1.9 *************** *** 1,14 **** COMPONENT=TestMTS400 SENSORBOARD=mts400 ! MSG_SIZE=120 XBOWROOT=$(TOSROOT)/contrib/xbow/tos CWD = $(shell pwd) FIREBOARDROOT=$(CWD)/../../.. ! PFLAGS= -I$(XBOWROOT)/interfaces -I$(XBOWROOT)/system \ ! -I$(XBOWROOT)/platform/$(PLATFORM) \ ! -I$(XBOWROOT)/AXStack/$(PLATFORM) \ ! -I$(XBOWROOT)/lib PFLAGS += -I$(FIREBOARDROOT)/beta/tos/sensorboards/$(SENSORBOARD) --- 1,17 ---- + include ../Makelocal + COMPONENT=TestMTS400 SENSORBOARD=mts400 ! #MSG_SIZE=120 XBOWROOT=$(TOSROOT)/contrib/xbow/tos CWD = $(shell pwd) FIREBOARDROOT=$(CWD)/../../.. ! PFLAGS = -I$(XBOWROOT)/interfaces ! PFLAGS += -I$(XBOWROOT)/system ! PFLAGS += -I$(XBOWROOT)/platform/$(PLATFORM) ! #PFLAGS += -I$(XBOWROOT)/AXStack/$(PLATFORM) ! #PFLAGS += -I$(XBOWROOT)/lib PFLAGS += -I$(FIREBOARDROOT)/beta/tos/sensorboards/$(SENSORBOARD) *************** *** 16,21 **** PFLAGS += -I$(FIREBOARDROOT)/interfaces ! include ../MakeXbowlocal ! include ${TOSROOT}/tools/make/Makerules --- 19,25 ---- PFLAGS += -I$(FIREBOARDROOT)/interfaces ! #include ../MakeXbowlocal ! #include ${TOSROOT}/tools/make/Makerules ! include ${TOSROOT}/apps/Makerules |
From: David M. D. <do...@us...> - 2005-06-19 19:09:36
|
Update of /cvsroot/firebug/fireboard/beta/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7063 Added Files: Makelocal Log Message: . --- NEW FILE: Makelocal --- DEFAULT_LOCAL_GROUP=0x7d CFLAGS += -DCC1K_DEFAULT_FREQ=CC1K_433_002_MHZ CFLAGS += -DRADIO_XMIT_POWER=0xFF |
From: David M. D. <do...@us...> - 2005-06-19 15:59:37
|
Update of /cvsroot/firebug/firebug/doc/userman In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9990 Added Files: userman.txt Log Message: Added file for user manual which also covers installation. --- NEW FILE: userman.txt --- INSTALLATION 1. Run all the sql scripts to get the postgres database set up correctly. |
From: David M. D. <do...@us...> - 2005-06-19 15:58:07
|
Update of /cvsroot/firebug/firebug/doc/userman In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9314/userman Log Message: Directory /cvsroot/firebug/firebug/doc/userman added to the repository |
From: David M. D. <do...@us...> - 2005-06-17 23:23:51
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30285/boards Modified Files: pg_test.c Log Message: Added db to command line. Index: pg_test.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/pg_test.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pg_test.c 7 Jun 2005 22:10:30 -0000 1.6 --- pg_test.c 17 Jun 2005 23:23:41 -0000 1.7 *************** *** 83,86 **** --- 83,87 ---- if (xdb_table_exists((char*)table)) { + fprintf(stderr,"Table gga exists.\n"); return; } |
From: David M. D. <do...@us...> - 2005-06-17 23:23:51
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30285 Modified Files: xdb.c xlisten.c Log Message: Added db to command line. Index: xdb.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** xdb.c 17 Jun 2005 22:09:49 -0000 1.4 --- xdb.c 17 Jun 2005 23:23:36 -0000 1.5 *************** *** 29,35 **** int errno; char command[256]; ! char * statement = "create database %s template firebug"; sprintf(command,statement,dbname); errno = xdb_execute(command); } --- 29,44 ---- int errno; char command[256]; ! char * statement = "create database %s"; sprintf(command,statement,dbname); errno = xdb_execute(command); + + #if 0 + if (errno == 0) { + g_dbname = dbname; + } else { + exit(0); + } + #endif + } *************** *** 106,111 **** { errno = PQresultStatus(res); ! if (errno > PGRES_COMMAND_OK) fprintf(stderr, "error: DATABASE command failed: %i\n", errno); PQclear(res); } --- 115,122 ---- { errno = PQresultStatus(res); ! if (errno > PGRES_COMMAND_OK) { fprintf(stderr, "error: DATABASE command failed: %i\n", errno); + fprintf(stderr,"%s",PQresultErrorMessage(res)); + } PQclear(res); } Index: xlisten.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xlisten.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** xlisten.c 17 Jun 2005 22:09:49 -0000 1.4 --- xlisten.c 17 Jun 2005 23:23:41 -0000 1.5 *************** *** 159,164 **** if (argv[argc][2] == '=') { //xdb_set_table(argv[argc]+3); - xdb_set_dbname(argv[argc]+3); printf("dbname=%s\n",argv[argc]+3); //exit(0); } --- 159,164 ---- if (argv[argc][2] == '=') { //xdb_set_table(argv[argc]+3); printf("dbname=%s\n",argv[argc]+3); + xdb_set_dbname(argv[argc]+3); //exit(0); } |
From: David M. D. <do...@us...> - 2005-06-17 23:11:39
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25656 Added Files: firebug-db-setup.sh firebug.sql Log Message: Start of psql scripts. --- NEW FILE: firebug-db-setup.sh --- #!/bin/bash # # FILE: createdb-task # AUTHOR: Martin Turon # DATE CREATED: July 12, 2004 # DESCRIPTION: PostgreSQL start script # # $Id: firebug-db-setup.sh,v 1.1 2005/06/17 23:11:29 doolin Exp $ # echo "Creating Postgres FireBug database." #setup-task-db.sh # --> Corrected script enclosed here ### IPC Daemon is obsolete ### TODO: Check whether postmaster is running. # start ipc-daemon #echo "Setting up PostgreSQL database for TASK. Only need to do this once." #if cygpath / > /dev/null 2>/dev/null; then # ipc-daemon & # export PGDATA=/pgdata #fi # Create database only if it wasn't created before #if [ ! -d /pgdata ]; then # initdb # sed -e 's/#tcpip_socket = false/tcpip_socket = true/' /pgdata/postgresql.conf > /tmp/postgresql.conf # mv /tmp/postgresql.conf /pgdata #fi ### pg_ctl is not on the debian box. #pg_ctl start -l /tmp/postgresql.log # wait for postmaster to start up #sleep 5 #psql -c "drop user tele;" template1 #psql -c "create user tele password 'tiny' createdb createuser;" template1 #### assumes firebug owner is valid, password prompt is not working. createdb --username firebug --password firebug --owner firebug #psql --echo-queries task tele < task.sql # Add MoteView client to db #echo "Adding MoteView as client." #psql -c "DELETE FROM task_client_info where name='MoteView';" task #psql -c "INSERT INTO task_client_info (name, type, clientinfo) VALUES ('MoteView', 'CONFIGURATION', '');" task #psql -c "INSERT INTO task_mote_info (mote_id, x_coord, y_coord, z_coord, calib, moteinfo, clientinfo_name) VALUES (0, 10, 10, 0, '', 'Gateway', 'MoteView');" task # Finalize db creation with xlisten tables #echo "Creating xlisten tables for XSensor." #psql -c "CREATE TABLE xtest_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, light integer);" task #psql -c "CREATE TABLE xtest_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, light integer);" task #psql -c "CREATE RULE xtest_results AS ON INSERT TO xtest_results DO ( DELETE FROM xtest_results_L WHERE nodeid = NEW.nodeid; INSERT INTO xtest_results_L VALUES ( NEW.* ); );" task #psql -c "CREATE INDEX xtest_time_idx ON xtest_results USING BTREE ( result_time ) ;" task #psql -c "DELETE FROM task_query_time_log where query_id=8;" task #psql -c "DELETE FROM task_query_log where query_id=8;" task #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (8, 8, 'SELECT nodeid,parent,light,voltage SAMPLE PERIOD 1000', 'sensor', 'xtest_results');" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (8, now());" task # Add MEP401/MEP500 enviro Tables: #echo "Creating xlisten tables for MEP401 / MEP500." #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('inthum', 3, 1, 'Sensirion internal humidity reading') ;" task #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('inttemp', 3, 1, 'Sensirion internal temperature reading') ;" task #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('therm', 3, 1, 'Mica2dot thermistor reading') ;" task #psql -c "CREATE TABLE enviro_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, therm integer, humid integer, humtemp integer, inthum integer, inttemp integer, photo1 integer, photo2 integer, photo3 integer, photo4 integer, accel_x integer, accel_y integer, prtemp integer, press integer );" task #psql -c "CREATE TABLE enviro_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, therm integer, humid integer, humtemp integer, inthum integer, inttemp integer, photo1 integer, photo2 integer, photo3 integer, photo4 integer, accel_x integer, accel_y integer, prtemp integer, press integer );" task #psql -c "CREATE RULE cache_enviro_results AS ON INSERT TO enviro_results DO ( DELETE FROM enviro_results_L WHERE nodeid = NEW.nodeid; INSERT INTO enviro_results_L VALUES ( NEW.* ); );" task #psql -c "CREATE INDEX enviro_time_idx ON enviro_results USING BTREE ( result_time ) ;" task #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (10, 10, 'SELECT nodeid,parent,voltage,therm,humid,humtemp,inthum,inttemp,photo1,photo2,photo3,photo4,accel_x,accel_y,prtemp,press SAMPLE PERIOD 3000', 'sensor', 'enviro_results');" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (10, now()) ;" task # Add MTS300/310 Tables: #echo "Creating tables for MTS300/310." #psql -c "CREATE TABLE mts310_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, temp integer, light integer, accel_x integer, accel_y integer, mag_x integer, mag_y integer );" task #psql -c "CREATE TABLE mts310_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, temp integer, light integer, accel_x integer, accel_y integer, mag_x integer, mag_y integer );" task #psql -c "CREATE RULE cache_mts310_results AS ON INSERT TO mts310_results DO ( DELETE FROM mts310_results_L WHERE nodeid = NEW.nodeid; INSERT INTO mts310_results_L VALUES ( NEW.* ); );" task #psql -c "CREATE INDEX mts310_time_idx ON mts310_results USING BTREE ( result_time ) ;" task #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (12, 12, 'SELECT nodeid,parent,voltage,temp,light,accel_x,accel_y,mag_x,mag_y SAMPLE PERIOD 3000', 'sensor', 'mts310_results');" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (12, now()) ;" task # Add MDA300 Plant App Tables: #echo "Creating tables for MDA300." #psql -c "CREATE TABLE mda300_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, humid integer, humtemp integer, echo10 integer, echo20 integer, soiltemp integer );" task #psql -c "CREATE TABLE mda300_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, voltage integer, humid integer, humtemp integer, echo10 integer, echo20 integer, soiltemp integer );" task #psql -c "CREATE RULE cache_mda300_results AS ON INSERT TO mda300_results DO ( DELETE FROM mda300_results_L WHERE nodeid = NEW.nodeid; INSERT INTO mda300_results_L VALUES ( NEW.* ); );" task #psql -c "CREATE INDEX mda300_time_idx ON mda300_results USING BTREE ( result_time ) ;" task #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (13, 13, 'SELECT nodeid,parent,voltage,humid,humtemp,echo10,echo20,soiltemp SAMPLE PERIOD 6000', 'sensor', 'mda300_results');" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (13, now()) ;" task #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('echo10', 3, 1, 'Echo10 soil moisture probe') ;" task #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('echo20', 3, 1, 'Echo20 soil moisture probe') ;" task #psql -c "INSERT INTO task_attributes (name, typeid, power_cons, description) VALUES ('soiltemp', 3, 1, 'Davis soil temperature probe') ;" task # Finalize db creation with xlisten tables #echo "Creating tables for Surge." #psql -c "CREATE TABLE surge_results ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, light integer, temp integer, voltage integer, mag_x integer, mag_y integer, accel_x integer, accel_y integer);" task #psql -c "CREATE TABLE surge_results_L ( result_time timestamp without time zone, epoch integer, nodeid integer, parent integer, light integer, temp integer, voltage integer, mag_x integer, mag_y integer, accel_x integer, accel_y integer);" task #psql -c "CREATE RULE cache_surge_results AS ON INSERT TO surge_results DO ( DELETE FROM surge_results_L WHERE nodeid = NEW.nodeid; INSERT INTO surge_results_L VALUES ( NEW.* ); );" task #psql -c "CREATE INDEX surge_time_idx ON surge_results USING BTREE ( result_time ) ;" task #psql -c "DELETE FROM task_query_time_log where query_id=7;" task #psql -c "DELETE FROM task_query_log where query_id=7;" task #psql -c "INSERT INTO task_query_log (query_id, tinydb_qid, query_text, query_type, table_name) VALUES (7, 7, 'SELECT nodeid,parent,light,temp,voltage,mag_x,mag_y,accel_x,accel_y SAMPLE PERIOD 3000', 'sensor', 'surge_results');" task #psql -c "INSERT INTO task_query_time_log (query_id, start_time) VALUES (7, now());" task --- NEW FILE: firebug.sql --- -- SQL for creating tables to initialize a GSK database. -- This script is platform specific. It uses some PostgreSQL specific -- data types (e.g., bytea). -- task_query_log is a complete log of all queries submitted to -- the sensor network drop table task_query_log cascade; create table task_query_log ( query_id int primary key, /* unique id for queries */ tinydb_qid smallint, /* TinyDB query id, 1-byte */ query_text text not null, /* query text in TinyDB SQL */ query_type varchar(20) not null, /* query type: sensor or health */ table_name varchar(100) not null unique /* name of table where the query results are logged */ ); -- task_query_time_log records the query start and stop times drop table task_query_time_log; create table task_query_time_log ( query_id int references task_query_log, /* query id */ start_time timestamp not null, /* query start time */ stop_time timestamp, /* query stop time */ primary key(query_id, start_time) ); -- task_command_log is a complete log of all commands submitted to -- the sensor network drop table task_command_log cascade; create table task_command_log ( command_id int primary key, /* unique command id */ submit_time timestamp, /* command submission time */ command_name varchar(100), /* command name, e.g., reset, sample_rate, ping, calibrate, etc. */ node_id int, /* target node id, -1 means all nodes */ query_id int, /* query id the command is targeting, -1 means all queries */ command_arg int /* single integer argument value, will generalize later */ ); -- task_command_acks records the acknowledgements from each node in reponse to -- a command issued from the server. drop table task_command_acks; create table task_command_acks ( command_id int references task_command_log, ack_time timestamp, /* timestamp when ack comes in */ node_id int, /* node id from which the ack is sent */ query_id int, /* query id if command is targeting a particular query */ epoch int, /* last epoch number for the query */ sample_rate int /* all acks include the current sample rate in seconds */ ); -- task_packet_log is a complete log of all raw packets received from -- the sensor network. -- There will also be a per-query table (specified by task_query_log.table_name) -- logging the query result tuples. drop table task_packet_log; create table task_packet_log ( query_id int references task_query_log, /* id of query that generated the packet */ epoch int, /* epoch number */ server_time timestamp, /* time received at server */ mote_time timestamp, /* logical time stamped by mote */ mote_id int, /* id of mote that generated the packet */ raw_packet bytea /* raw packet bytes */ ); -- task_health_log is a complete log of network health and statistics -- that can be collected from the sensor network. It includes all -- possible network health and statistics related attributes. Each -- health query will only collect a subset of these attributes. The -- attributes that are not included in the query will be filled with -- NULL values. drop table task_health_log; create table task_health_log ( query_id int references task_query_log, /* query id */ epoch int, /* epoch number */ server_time timestamp, /* time received at server */ mote_time timestamp, /* logical time stamped by mote */ mote_id int, /* mote id */ parent int, /* parent id in routing tree */ voltage int, /* battery voltage */ contention int /* radio contention */ /* The exact list of health&stat attributes is yet to be finalized. */ ); -- task_last_query_id implements a persistent counter for generating -- unique GSK query ids drop table task_next_query_id; create table task_next_query_id ( query_id int, /* next query id */ tinydb_qid smallint, /* next tinydb query id, 1 byte */ command_id int /* next command id */ ); -- query 0 is reserved for the calibration query insert into task_next_query_id values (1, 1, 0); -- task_current_results is a view into queryN_results table -- for the last query executed. -- initialized as task_query_log as a placeholder drop view task_current_results; create view task_current_results as select * from task_query_log; -- task_attributes contains information about all the attributes -- that can be queries from the sensor network drop table task_attributes; create table task_attributes ( name varchar(8), /* attribute name, limited to 8 characters */ typeid int, /* type of attribute */ power_cons int, /* per sample power consumption rate */ description varchar(1000) /* description of the attribute */ ); insert into task_attributes values ('nodeid', 3, 1, 'node id'); insert into task_attributes values ('light', 3, 1, 'light sensor reading'); insert into task_attributes values ('temp', 3, 1, 'temperature sensor reading'); insert into task_attributes values ('parent', 3, 1, 'parent node id in routing tree'); insert into task_attributes values ('accel_x', 3, 1, 'accelerometer reading in x axis'); insert into task_attributes values ('accel_y', 3, 1, 'accelerometer reading in y axis'); insert into task_attributes values ('mag_x', 3, 1, 'magnetometer reading in x axis'); insert into task_attributes values ('mag_y', 3, 1, 'magnetometer reading in y axis'); insert into task_attributes values ('noise', 3, 1, 'aggregated microphone readings'); insert into task_attributes values ('tones', 3, 1, 'aggregated number of tones detected'); insert into task_attributes values ('voltage', 3, 1, 'battery voltage level'); insert into task_attributes values ('rawtone', 3, 1, 'raw tone detector output: 1 detected 0 otherwise'); insert into task_attributes values ('rawmic', 3, 1, 'raw microphone reading'); insert into task_attributes values ('freeram', 3, 1, 'amount of RAM available in bytes'); insert into task_attributes values ('qlen', 1, 1, 'global send queue length'); insert into task_attributes values ('mhqlen', 1, 1, 'multi-hop forward queue length'); insert into task_attributes values ('depth', 1, 1, 'multi-hop depth'); insert into task_attributes values ('timelo', 4, 1, 'low 32-bit of mote logical time'); insert into task_attributes values ('timehi', 4, 1, 'high 32-bit of mote logical time'); insert into task_attributes values ('qual', 1, 1, 'quality of multi-hop parent'); insert into task_attributes values ('humid', 3, 1, 'Senirion Humidity sensor humidity reading'); insert into task_attributes values ('humtemp', 3, 1, 'Senirion Humidity sensor temperature reading'); insert into task_attributes values ('echo10', 3, 1, 'Echo10 soil moisture sensor temperature reading'); insert into task_attributes values ('taosbot', 3, 1, 'Bottom Taos Photo sensor reading'); insert into task_attributes values ('taostop', 3, 1, 'Top Taos Photo sensor reading'); insert into task_attributes values ('press', 3, 1, 'Intersema Pressure sensor pressure reading'); insert into task_attributes values ('prtemp', 3, 1, 'Intersema Pressure sensor temperature reading'); insert into task_attributes values ('prcalib', 9, 1, 'Intersema Pressure sensor calibration reading'); insert into task_attributes values ('hamatop', 3, 1, 'Top Hamamatsu light sensor reading'); insert into task_attributes values ('hamabot', 3, 1, 'Bottom Hamamatsu light sensor reading'); insert into task_attributes values ('thermo', 3, 1, 'Melexis sensor thermopile reading'); insert into task_attributes values ('thmtemp', 3, 1, 'Melexis sensor temperature reading'); -- insert into task_attributes values ('content', 3, 1, 'radio contention'); -- task_aggregates contains information about all aggregates that -- are supported by GSK drop table task_aggregates; create table task_aggregates ( name varchar(32), /* name of aggregate */ return_type int, /* return type of aggregate */ num_args int, /* number of arguments */ arg_type int, /* type of the non-constant argument */ description varchar(1000) /* description of the aggregate */ ); insert into task_aggregates values ('winavg', 3, 3, 3, 'temporal windowed average'); insert into task_aggregates values ('winsum', 3, 3, 3, 'temporal windowed sum'); insert into task_aggregates values ('winmin', 3, 3, 3, 'temporal windowed minimum'); insert into task_aggregates values ('winmax', 3, 3, 3, 'temporal windowed maximum'); insert into task_aggregates values ('wincnt', 3, 3, 3, 'temporal windowed count'); -- task_commands contains information about all sensor network -- commands supported by GSK drop table task_commands; create table task_commands ( name varchar(8), /* name of command */ return_type int, /* return type of the command */ num_args int, /* number of arguments */ arg_types int[], /* argument types */ description varchar(1000) /* brief description */ ); insert into task_commands values ('SetLedR', 9, 1, '{1}', 'SetLedR(0) turns off the red LED, SetLedR(1) turns on the red LED, SetLedR(2) toggles the red LED'); insert into task_commands values ('SetLedY', 9, 1, '{1}', 'SetLedY(0) turns off the yellow LED, SetLedY(1) turns on the yellow LED, SetLedY(2) toggles the yellow LED'); insert into task_commands values ('SetLedG', 9, 1, '{1}', 'SetLedG(0) turns off the green LED, SetLedG(1) turns on the green LED, SetLedG(2) toggles the green LED'); insert into task_commands values ('SetPot', 9, 1, '{1}', 'set potentiometer level'); insert into task_commands values ('Reset', 9, 0, '{}', 'reboot mote'); insert into task_commands values ('LogClr', 9, 0, '{}', 'clear tuple log in EEPROM'); -- insert into task_commands values ('SetSnd', 9, 1, '{2}', 'turn on sounder for n milliseconds'); -- task_client_info contains opaque information about task clients -- such as layouts. drop table task_client_info cascade; create table task_client_info ( name varchar(100) primary key, /* name of client info */ type varchar(100), /* java type of client info */ clientinfo bytea /* opaque client info object */ ); -- task_mote_info contains opaque per-mote client information relative to -- a particular client info. drop table task_mote_info; create table task_mote_info ( mote_id int, /* mote id */ x_coord double precision, /* x coordinate */ y_coord double precision, /* y coordinate */ z_coord double precision, /* z coordinate */ calib bytea, /* calibration coefficiences, raw bytes from motes */ moteinfo bytea, /* opaque mote info object */ clientinfo_name varchar(100) references task_client_info, /* client info name */ primary key (mote_id, clientinfo_name) ); create or replace function humidity(int /* raw humidity */) returns real as 'select (-4 + 0.0405 * $1 + -2.8e-6 * $1 * $1)::real as result;' language sql; create or replace function humid_temp(int /* raw temperature */) returns real as 'select (-38.4 + 0.0098 * $1)::real as result;' language sql; create or replace function humid_adj(int /* raw humidity */, int /* raw temperature */) returns real as 'select ((humid_temp($2) - 25) * (0.01 + 0.00008 * $1) + humidity($1))::real as result;' language sql; CREATE FUNCTION plpgsql_call_handler () RETURNS language_handler AS '$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c; CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler; create or replace function photo(int /* channel 0 */, int /* channel 1 */) returns real as 'declare s0 int; cc0 int; s1 int; cc1 int; adccount0 int; adccount1 int; lux real := 0; begin s0 := $1 & 15; cc0 := (($1 & 127) >> 4) & 7; s1 := $2 & 15; cc1 := (($2 & 127) >> 4) & 7; -- check if we are railed if s0 = 15 and s1 = 15 and cc0 = 7 and cc1 = 7 then return null; end if; adccount0 := (16.5 * (2^cc0 - 1))::int + (s0 * 2^cc0)::int; adccount1 := (16.5 * (2^cc1 - 1))::int + (s1 * 2^cc1)::int; if adccount0 = 0 then return null; end if; if (adccount1 / adccount0) > 27 then return 0.0; end if; lux := adccount0 * 0.46 * exp(-3.13 * (adccount1 / adccount0)); return lux; end;' language 'plpgsql'; create or replace function thermopile(int /* raw thermopile */) returns real as 'select ((($1 >> 4) * (120 - (-20))) / (2^12 - 1) + (-20))::real as result;' language sql; create or replace function thermistor(int /* raw temperature */) returns real as 'select ((($1 >> 4) * (85 - (-20))) / (2^12 - 1) + (-20))::real as result;' language sql; create or replace function voltage(int /* raw voltage */) returns real as 'select (case when $1 = 0 then 0 else 0.58 * 1024 / $1 end)::real as result;' language sql; create or replace function hamamatsu_current(int /* raw hamamatsu */, int /* raw voltage */) returns real as 'select (($1 * voltage($2) / 1024.0) / 5.0)::real as result;' language sql; create or replace function hamamatsu(int /* raw hamamatsu */, int /* raw voltage */) returns real as 'select (hamamatsu_current($1, $2) * 1e6)::real as result;' language sql; create or replace function pressure_mbar(int /* raw pressure */, int /* raw temperature */, bytea /* calibration */) returns real as 'declare c1 int; c2 int; c3 int; c4 int; c5 int; c6 int; calib0 int; calib1 int; calib2 int; calib3 int; ut1 int; dt int; temp real; off real; sens real; x real; p real; begin -- parse calibration coefficiences out of byte array calib0 := get_byte($3, 0) & 255; calib0 := calib0 | (((get_byte($3, 1) & 255) << 8) & 65280); calib1 := get_byte($3, 2) & 255; calib1 := calib1 | (((get_byte($3, 3) & 255) << 8) & 65280); calib2 := get_byte($3, 4) & 255; calib2 := calib2 | (((get_byte($3, 5) & 255) << 8) & 65280); calib3 := get_byte($3, 6) & 255; calib3 := calib3 | (((get_byte($3, 7) & 255) << 8) & 65280); c1 := calib0 >> 1; c2 := calib2 & 63; c2 := c2 << 6; c2 := c2 | (calib3 & 63); c3 := calib3 >> 6; c4 := calib2 >> 6; c5 := calib0 << 10; c5 := c5 & 1024; c5 := c5 + (calib1 >> 6); c6 := calib1 & 63; ut1 := 8 * c5 + 20224; dt := $2 - ut1; temp := 200 + dt * (c6 + 50) / 1024; off := c2 * 4 + ((c4 - 512) * dt) / 4096; sens := c1 + (c3 * dt) / 1024 + 24576; x := (sens * ($1 - 7168)) / 16384 - off; p := x * 100 / 32 + 250 * 100; return p / 100; end;' language 'plpgsql'; create or replace function pressure_inHg(int /* raw pressure */, int /* raw temperature */, bytea /* calibration */) returns real as 'declare c1 int; c2 int; c3 int; c4 int; c5 int; c6 int; calib0 int; calib1 int; calib2 int; calib3 int; ut1 int; dt int; off real; sens real; x real; p real; begin -- parse calibration coefficiences out of byte array calib0 := get_byte($3, 0) & 255; calib0 := calib0 | (((get_byte($3, 1) & 255) << 8) & 65280); calib1 := get_byte($3, 2) & 255; calib1 := calib1 | (((get_byte($3, 3) & 255) << 8) & 65280); calib2 := get_byte($3, 4) & 255; calib2 := calib2 | (((get_byte($3, 5) & 255) << 8) & 65280); calib3 := get_byte($3, 6) & 255; calib3 := calib3 | (((get_byte($3, 7) & 255) << 8) & 65280); c1 := calib0 >> 1; c2 := calib2 & 63; c2 := c2 << 6; c2 := c2 | (calib3 & 63); c3 := calib3 >> 6; c4 := calib2 >> 6; c5 := calib0 << 10; c5 := c5 & 1024; c5 := c5 + (calib1 >> 6); c6 := calib1 & 63; ut1 := 8 * c5 + 20224; dt := $2 - ut1; off := c2 * 4 + ((c4 - 512) * dt) / 4096; sens := c1 + (c3 * dt) / 1024 + 24576; x := (sens * ($1 - 7168)) / 16384 - off; p := x * 100 / 32 + 250 * 100; return p / (100 * 33.864); end;' language 'plpgsql'; create or replace function pressure_temp(int /* raw temperature */, bytea /* calibration */) returns real as 'declare c1 int; c2 int; c3 int; c4 int; c5 int; c6 int; calib0 int; calib1 int; calib2 int; calib3 int; ut1 int; dt int; temp real; begin -- parse calibration coefficiences out of byte array calib0 := get_byte($2, 0) & 255; calib0 := calib0 | (((get_byte($2, 1) & 255) << 8) & 65280); calib1 := get_byte($2, 2) & 255; calib1 := calib1 | (((get_byte($2, 3) & 255) << 8) & 65280); calib2 := get_byte($2, 4) & 255; calib2 := calib2 | (((get_byte($2, 5) & 255) << 8) & 65280); calib3 := get_byte($2, 6) & 255; calib3 := calib3 | (((get_byte($2, 7) & 255) << 8) & 65280); c1 := calib0 >> 1; c2 := calib2 & 63; c2 := c2 << 6; c2 := c2 | (calib3 & 63); c3 := calib3 >> 6; c4 := calib2 >> 6; c5 := calib0 << 10; c5 := c5 & 1024; c5 := c5 + (calib1 >> 6); c6 := calib1 & 63; ut1 := 8 * c5 + 20224; dt := $1 - ut1; temp := 200 + dt * (c6 + 50) / 1024; return temp / 10; end;' language 'plpgsql'; |
From: David M. D. <do...@us...> - 2005-06-17 22:09:58
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28709 Modified Files: xdb.c xdb.h xlisten.c Log Message: Added changing databases from the command line. Index: xdb.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** xdb.h 24 May 2005 21:50:42 -0000 1.3 --- xdb.h 17 Jun 2005 22:09:49 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- char *xdb_get_table (); void xdb_set_table (char *table); + void xdb_set_dbname (char *table); int xdb_table_exists (char *table); Index: xdb.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** xdb.c 24 May 2005 21:50:42 -0000 1.3 --- xdb.c 17 Jun 2005 22:09:49 -0000 1.4 *************** *** 16,22 **** static char *g_server = "localhost"; //!< Postgres server IP or hostname static char *g_port = "5432"; //!< Postgres server port ! static char *g_user = "tele"; //!< Postgres server user ! static char *g_passwd = "tiny"; //!< Postgres server password ! static char *g_dbname = "task"; //!< Postgres database to use static char *g_table = ""; //!< Postgres table to use --- 16,22 ---- static char *g_server = "localhost"; //!< Postgres server IP or hostname static char *g_port = "5432"; //!< Postgres server port ! static char *g_user = "firebug"; //!< Postgres server user ! static char *g_passwd = "soedlufr"; //!< Postgres server password ! static char *g_dbname = "firebug"; //!< Postgres database to use static char *g_table = ""; //!< Postgres table to use *************** *** 24,27 **** --- 24,40 ---- void xdb_set_table(char *table) { g_table = table; } + void + xdb_set_dbname(char *dbname) { + + int errno; + char command[256]; + char * statement = "create database %s template firebug"; + sprintf(command,statement,dbname); + errno = xdb_execute(command); + } + + + + PGconn *xdb_exit(PGconn *conn) { Index: xlisten.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xlisten.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** xlisten.c 24 May 2005 21:50:42 -0000 1.3 --- xlisten.c 17 Jun 2005 22:09:49 -0000 1.4 *************** *** 78,82 **** g_params.flat = 0; /* default to no params set */ ! xpacket_initialize(); while (argc) { --- 78,82 ---- g_params.flat = 0; /* default to no params set */ ! while (argc) { *************** *** 158,162 **** g_params.bits.log_cooked = 1; if (argv[argc][2] == '=') { ! xdb_set_table(argv[argc]+3); } break; --- 158,165 ---- g_params.bits.log_cooked = 1; if (argv[argc][2] == '=') { ! //xdb_set_table(argv[argc]+3); ! xdb_set_dbname(argv[argc]+3); ! printf("dbname=%s\n",argv[argc]+3); ! //exit(0); } break; *************** *** 316,319 **** --- 319,323 ---- parse_args(argc, argv); + xpacket_initialize(); while (1) { *************** *** 348,351 **** --- 352,357 ---- if (g_params.bits.display_cooked) xpacket_print_cooked(buffer); } + + } |
From: David M. D. <do...@us...> - 2005-06-17 20:29:36
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22486/bin Log Message: Directory /cvsroot/firebug/fireboard/beta/bin added to the repository |
From: David M. D. <do...@us...> - 2005-06-15 23:01:35
|
Update of /cvsroot/firebug/firebug/web/gmaps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28710 Modified Files: db_gmap.php Log Message: Fixed Google API change in map application. Index: db_gmap.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/db_gmap.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** db_gmap.php 14 Jun 2005 20:24:56 -0000 1.4 --- db_gmap.php 15 Jun 2005 23:01:26 -0000 1.5 *************** *** 19,23 **** document.getElementById("permalink"), document.getElementById("toggle"), ! document.getElementById("printheader")); myMapApp.loadMap(); /* Note: All XML & XSL files must be on same domain. --- 19,26 ---- document.getElementById("permalink"), document.getElementById("toggle"), ! document.getElementById("printheader"), ! [new _GoogleMapSpec(), ! new _KeyholeMapSpec()]); ! myMapApp.loadMap(); /* Note: All XML & XSL files must be on same domain. |