You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
(18) |
Apr
|
May
(1) |
Jun
(10) |
Jul
|
Aug
|
Sep
(8) |
Oct
(15) |
Nov
(6) |
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(1) |
Feb
|
Mar
(7) |
Apr
|
May
(1) |
Jun
|
Jul
(16) |
Aug
(7) |
Sep
(3) |
Oct
(4) |
Nov
(2) |
Dec
(4) |
| 2004 |
Jan
(5) |
Feb
(11) |
Mar
(7) |
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(1) |
Sep
(23) |
Oct
(1) |
Nov
|
Dec
(5) |
| 2005 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(1) |
May
(3) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Tim B. <tba...@us...> - 2008-08-11 14:37:37
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv16160 Modified Files: db_pgsql.c message.c message.h Log Message: APRS Spec states that Telemetry labels/units list may terminate after any field. Modified code to allow for this. Parse Telemetry labels/units with strtok; use pointers to tokens rather than duplicating with strncpy. Modify parsing of Telemetry coefficients. Trim trailing spaces from APRS message addressee so we do not place the spaces in the database. This permits us to query the database for messages and telemetry easier. Reworked parsing of Telemetry data to permit use of "MIC" sequence number as described in the APRS spec. Also dropped validating telemetry data packets against a minimum length since so many users out there don't follow the APRS spec. Index: db_pgsql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_pgsql.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** db_pgsql.c 11 Aug 2008 01:59:56 -0000 1.10 --- db_pgsql.c 11 Aug 2008 14:37:43 -0000 1.11 *************** *** 1030,1168 **** char *tmptok; ! char a_0[128]; ! char a_1[128]; ! char a_2[128]; ! char a_3[128]; ! char a_4[128]; ! char d_0[128]; ! char d_1[128]; ! char d_2[128]; ! char d_3[128]; ! char d_4[128]; ! char d_5[128]; ! char d_6[128]; ! char d_7[128]; ! if ( ! (get_insert_mask()&INSERT_TELEM) ) return; ! tmptok = strtok(p, ","); ! if (tmptok != NULL) ! strncpy(a_0, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(a_1, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(a_2, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(a_3, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(a_4, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(d_0, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(d_1, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(d_2, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(d_3, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(d_4, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(d_5, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(d_6, tmptok, 128); tmptok = strtok(NULL, ","); ! if (tmptok != NULL) ! strncpy(d_7, tmptok, 128); ! ! snprintf(sql_buf, 4096, ! "INSERT INTO %s%s ( " ! "source, " ! "a_0, " ! "a_1, " ! "a_2, " ! "a_3, " ! "a_4, " ! "d_0, " ! "d_1, " ! "d_2, " ! "d_3, " ! "d_4, " ! "d_5, " ! "d_6, " ! "d_7 " ! ") VALUES ( " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s' " ! ")", ! "aprs_", ! table, ! postgres_escape(source, strlen(source), &newlen), ! postgres_escape(a_0, strlen(a_0), &newlen), ! postgres_escape(a_1, strlen(a_1), &newlen), ! postgres_escape(a_2, strlen(a_2), &newlen), ! postgres_escape(a_3, strlen(a_3), &newlen), ! postgres_escape(a_4, strlen(a_4), &newlen), ! postgres_escape(d_0, strlen(d_0), &newlen), ! postgres_escape(d_1, strlen(d_1), &newlen), ! postgres_escape(d_2, strlen(d_2), &newlen), ! postgres_escape(d_3, strlen(d_3), &newlen), ! postgres_escape(d_4, strlen(d_4), &newlen), ! postgres_escape(d_5, strlen(d_5), &newlen), ! postgres_escape(d_6, strlen(d_6), &newlen), ! postgres_escape(d_7, strlen(d_7), &newlen) ! ); ! if (get_verbose() & VERBOSE_SQL) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! } else { ! PQclear(pg_res); ! } ! } --- 1030,1210 ---- char *tmptok; ! char *nul = ""; ! char *a_0 = nul; ! char *a_1 = nul; ! char *a_2 = nul; ! char *a_3 = nul; ! char *a_4 = nul; ! char *d_0 = nul; ! char *d_1 = nul; ! char *d_2 = nul; ! char *d_3 = nul; ! char *d_4 = nul; ! char *d_5 = nul; ! char *d_6 = nul; ! char *d_7 = nul; ! ! if ( ! (get_insert_mask()&INSERT_TELEM) ) ! return; ! ! // APRS Specification states that the parameter names/units comma ! // delimited list may terminate at any field. Therefore, here we ! // implement a "do while(FALSE)" loop that is guaranteed to execute ! // only once. At any time, if strtok returns a NULL indicating ! // that the list has terminated we break prematurely from the loop. ! do { ! // Swallow PARM. or UNIT. ! tmptok = strtok(p, "."); ! if (tmptok == NULL) { ! // Malformed string return; + } ! // Parse A0 ! tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! a_0 = tmptok; + // Parse A1 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! a_1 = tmptok; + // Parse A2 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! a_2 = tmptok; + // Parse A3 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! a_3 = tmptok; + // Parse A4 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! a_4 = tmptok; + // Parse D0 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! d_0 = tmptok; + // Parse D1 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! d_1 = tmptok; + // Parse D2 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! d_2 = tmptok; + // Parse D3 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! d_3 = tmptok; + // Parse D4 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! d_4 = tmptok; + // Parse D5 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! d_5 = tmptok; + // Parse D6 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! d_6 = tmptok; + // Parse D7 tmptok = strtok(NULL, ","); ! if (tmptok == NULL) ! break; ! d_7 = tmptok; ! } while(0); ! ! snprintf(sql_buf, 4096, ! "INSERT INTO %s%s ( " ! "source, " ! "a_0, " ! "a_1, " ! "a_2, " ! "a_3, " ! "a_4, " ! "d_0, " ! "d_1, " ! "d_2, " ! "d_3, " ! "d_4, " ! "d_5, " ! "d_6, " ! "d_7 " ! ") VALUES ( " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s' " ! ")", ! "aprs_", ! table, ! postgres_escape(source, strlen(source), &newlen), ! postgres_escape(a_0, strlen(a_0), &newlen), ! postgres_escape(a_1, strlen(a_1), &newlen), ! postgres_escape(a_2, strlen(a_2), &newlen), ! postgres_escape(a_3, strlen(a_3), &newlen), ! postgres_escape(a_4, strlen(a_4), &newlen), ! postgres_escape(d_0, strlen(d_0), &newlen), ! postgres_escape(d_1, strlen(d_1), &newlen), ! postgres_escape(d_2, strlen(d_2), &newlen), ! postgres_escape(d_3, strlen(d_3), &newlen), ! postgres_escape(d_4, strlen(d_4), &newlen), ! postgres_escape(d_5, strlen(d_5), &newlen), ! postgres_escape(d_6, strlen(d_6), &newlen), ! postgres_escape(d_7, strlen(d_7), &newlen) ! ); ! if (get_verbose() & VERBOSE_SQL) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! } else { ! PQclear(pg_res); ! } ! } // telemetry_labels_units() *************** *** 1177,1180 **** --- 1219,1223 ---- double c[5]; + // Initialize coefficients to 0*x^2 + 1*x + 0 for ( i=0 ; i<5 ; i++ ) { a[i]=0; *************** *** 1183,1209 **** } - if ( strlen(p) < 5 ) - return; ! p += 5; // swallow the EQNS. i=0; ! val = strtok(p,","); ! do { ! if ( 0 == val ) break; a[i] = atof(val); val = strtok(NULL,","); ! if ( 0 == val ) break; b[i] = atof(val); val = strtok(NULL,","); ! if ( 0 == val ) break; c[i] = atof(val); ! ! i++; ! val = strtok(NULL,","); ! } while ( i<5 ); if ( get_verbose() & VERBOSE_DEBUG ) { --- 1226,1257 ---- } ! // Swallow EQNS. ! val = strtok(p,"."); ! if ( NULL == val ) { ! // Malformed string ! return; ! } i=0; ! for( i=0; i<5; i++ ) { ! // Parse An ! val = strtok(NULL,","); ! if ( NULL == val ) break; a[i] = atof(val); + + // Parse Bn val = strtok(NULL,","); ! if ( NULL == val ) break; b[i] = atof(val); + + // Parse Cn val = strtok(NULL,","); ! if ( NULL == val ) break; c[i] = atof(val); ! }; if ( get_verbose() & VERBOSE_DEBUG ) { *************** *** 1249,1253 **** PQclear(pg_res); } ! } void object_insert (struct object *obj, unsigned long packet_id) { --- 1297,1301 ---- PQclear(pg_res); } ! } // telemetry_coefficients() void object_insert (struct object *obj, unsigned long packet_id) { Index: message.c =================================================================== RCS file: /cvsroot/aprsworld/parse/message.c,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** message.c 11 Aug 2008 02:50:41 -0000 1.96 --- message.c 11 Aug 2008 14:37:43 -0000 1.97 *************** *** 348,379 **** int i; ! /* drop out if string is too short */ ! if ( strlen(p) < 34 ) { if ( get_verbose() & VERBOSE_ERRORS ) { ! printf("Telemetry string is too short\n"); } return 1; } ! p += 2; /* strip of the T# */ ! p[3]='\0'; ! ! if ( ! isdigit(p[0]) ) { ! if ( get_verbose() & VERBOSE_ERRORS ) { ! printf("Telemetry sequence number is not a number!\n"); } ! ! telem->sequence=0; ! } else { ! telem->sequence = atoi(p); } - p += 4; ! /* Read the analog values */ ! for ( i=0 ; i<5 ; i++ ) { ! p[3]='\0'; ! telem->analog[i] = atoi(p); ! p += 4; } --- 348,410 ---- int i; + //----------------------------------------------------------------------------- + // I am commenting out this check for telemetery strings too short. It appears + // that there are a LOT of people out there transmitting telemetry packets + // that do not conform to the 3 digit analog value fields as specified in the + // APRS spec. Some packets contain empty analog values, others don't zero pad + // out three digits. + // Tim Baggett 11 Aug 2008 + //----------------------------------------------------------------------------- + // /* drop out if string is too short */ + // if ( strlen(p) < 34 ) { + // if ( get_verbose() & VERBOSE_ERRORS ) { + // printf("Telemetry string is too short (%d)\n", strlen(p)); + // } + // return 1; + // } + //----------------------------------------------------------------------------- ! p += 2; /* strip off the T# */ ! ! if ( isdigit(p[0]) && isdigit(p[1]) && isdigit(p[2]) && ','==p[3]) { ! // Three digit sequence number ! p[3]='\0'; ! telem->sequence = atoi(p); ! p +=4; ! } else if ( 0==strncmp(p,"MIC",3) ) { ! telem->sequence=-1; ! if( ','==p[3] ) { ! // "MIC" is followed by a comma ! p +=4; ! } else { ! // "MIC" is not followed by a comma ! p +=3; ! } ! } else { if ( get_verbose() & VERBOSE_ERRORS ) { ! printf("Telemetry sequence number is not valid!\n"); } return 1; } + ! /* Read the analog values */ ! p=strtok(p,","); ! for ( i=0; i<5; i++ ) { ! if ( NULL==p ) { ! if ( get_verbose() & VERBOSE_ERRORS ) { ! printf("Premature termination while parsing telemetry analog values\n"); ! } ! return 1; } ! telem->analog[i] = atoi(p); ! p=strtok(NULL,","); } ! if ( NULL==p ) { ! if ( get_verbose() & VERBOSE_ERRORS ) { ! printf("Premature termination while parsing telemetry looking for Digital Value field\n"); ! } ! return 1; } *************** *** 384,392 **** telem->digital += pow(2,7-i); } } - p += 8; if ( get_verbose() & VERBOSE_DEBUG ) { ! printf("telem source: %s\n",telem->source); printf("telem sequence: %d\n",telem->sequence); for ( i=0 ; i<5 ; i++ ) { --- 415,429 ---- telem->digital += pow(2,7-i); } + else if ( '0' != p[i] ) { + // Character was neither '0' or '1' - error + if ( get_verbose() & VERBOSE_ERRORS ) { + printf("Invalid character '%c' in Telemetry Digital Value field\n", p[i]); + } + return 1; + } } if ( get_verbose() & VERBOSE_DEBUG ) { ! printf("telem source: \"%s\"\n",telem->source); printf("telem sequence: %d\n",telem->sequence); for ( i=0 ; i<5 ; i++ ) { *************** *** 396,400 **** } return 0; ! } --- 433,437 ---- } return 0; ! } // parse_telemetry *************** *** 1782,1785 **** --- 1819,1834 ---- msg->addressee[i] = '\0'; // terminate string + // Remove trailing spaces used for padding in addressee + while( i>0 ) { + i--; + if ( ' '==msg->addressee[i] ) { + // trailing space + msg->addressee[i] = '\0'; + } else { + // No more trailing spaces + break; + } + } + p++; // swallow ':' for (i = 0; (i < 67) && (p < p_end) && (*p != '{'); p++, i++) { *************** *** 2147,2154 **** struct item itm; ! strcpy (packet.source, ""); ! strcpy (packet.destination, ""); ! strcpy (packet.information, ""); ! strcpy (packet.information, ""); if(!valid_packet(buffer)){ --- 2196,2211 ---- struct item itm; ! packet.source[0]='\0'; ! packet.destination[0]='\0'; ! packet.information[0]='\0'; ! packet.ip_source[0]='\0'; ! packet.digipeater[0][0]='\0'; ! packet.digipeater[1][0]='\0'; ! packet.digipeater[2][0]='\0'; ! packet.digipeater[3][0]='\0'; ! packet.digipeater[4][0]='\0'; ! packet.digipeater[5][0]='\0'; ! packet.digipeater[6][0]='\0'; ! packet.digipeater[7][0]='\0'; if(!valid_packet(buffer)){ Index: message.h =================================================================== RCS file: /cvsroot/aprsworld/parse/message.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** message.h 11 Aug 2008 02:50:41 -0000 1.12 --- message.h 11 Aug 2008 14:37:44 -0000 1.13 *************** *** 45,49 **** struct telemetry { char source[10]; // AX.25 Source address ! int sequence; // Sequence no int analog[5]; // analog channels int digital; --- 45,49 ---- struct telemetry { char source[10]; // AX.25 Source address ! int sequence; // Sequence no -1="MIC" sequence int analog[5]; // analog channels int digital; |
|
From: Tim B. <tba...@us...> - 2008-08-11 02:50:34
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv13618 Modified Files: message.c message.h metric.h Log Message: Adding NMEA GLL, VTG, and WPL sentence support. (Removed comment about WPT sentence as there appears to be no spec for WPT in NMEA and folks seem to believe that it is a typo in the APRS spec.) Modified the parsing of GGA and RMC sentences to support recent changes. Checksum is mandatory for only RMC sentences and is optional for the others which we support. Display the invalid packet itself when detected. Default time_of_fix to the current UTC time the packet was received. This is needed for storing of position geometries in 4D and also seems to follow the APRS 1.1 Spec changes described at http://aprs.org/aprs11/timestamps.txt . pos->magnetic_variance is now set to 360 when unknown (also fixed sign). pos->checksum is now -1 when unknown. pos->quality is now -1 when unknown, and added additional values. pos->sats is now -1 when unknown. pos->diff_station is now -1 when unknown. The FAA Mode field, when parsed from newer NMEA sentences, are currently mapped to the closest pos->quality values. Index: message.c =================================================================== RCS file: /cvsroot/aprsworld/parse/message.c,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** message.c 2 Jan 2008 04:22:32 -0000 1.95 --- message.c 11 Aug 2008 02:50:41 -0000 1.96 *************** *** 1,4 **** /* ! * vim:ts=3: APRS Parser with Database Support --- 1,4 ---- /* ! * vim:ts=3:sw=3: APRS Parser with Database Support *************** *** 73,77 **** INSERT_MESSAGE | INSERT_POSITION | ! /* INSERT_STATUS | */ INSERT_WEATHER | INSERT_LAST | --- 73,77 ---- INSERT_MESSAGE | INSERT_POSITION | ! INSERT_STATUS | INSERT_WEATHER | INSERT_LAST | *************** *** 747,751 **** strncpy (stat->comment, p, 256); // populate stat->comment with what is left ! pos->time_of_fix = 0; // let the raw table handle the time --- 747,751 ---- strncpy (stat->comment, p, 256); // populate stat->comment with what is left ! pos->time_of_fix=time(NULL); // Default to time received *************** *** 903,907 **** // BUG: Use packet time if available, or use system time ! } int parse_nmea (struct position *pos, char *p) { --- 903,907 ---- // BUG: Use packet time if available, or use system time ! } // parse_position() int parse_nmea (struct position *pos, char *p) { *************** *** 909,913 **** char elements[20][20]; // Store each element until we can put in structure int i, element, last, checksum; ! unsigned char local_checksum = nmea_0183_checksum (p); struct tm tomake; struct tm *curtime; --- 909,913 ---- char elements[20][20]; // Store each element until we can put in structure int i, element, last, checksum; ! unsigned char local_checksum; struct tm tomake; struct tm *curtime; *************** *** 917,920 **** --- 917,922 ---- curtime = gmtime (&aprstime); + // Calculate the checksum of our received sentence + local_checksum = nmea_0183_checksum (p); /* First parse to break into elements, then let the sentence parsers have fun */ *************** *** 949,959 **** return -1; } else if (strstr (elements[0], "RMC")) { ! // $GPRMC,222128.00,A,4211.1283,N,08805.4656,W,0.0,341.5,160301,,*24 if (get_verbose() & VERBOSE_DEBUG) printf ("GPRMC sentence\n"); ! strncpy (pos->sentence, elements[0], 6); ! // Time ! p = elements[1]; elements[19][0] = *p++; elements[19][1] = *p++; --- 951,1017 ---- return -1; } else if (strstr (elements[0], "RMC")) { ! //---------------------------------------------------------------------- ! // RMC - Recommended Minimum Navigation Information ! // 12 ! // 1 2 3 4 5 6 7 8 9 10 11| ! // | | | | | | | | | | | | ! // $--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a*hh<CR><LF> ! // ! // Field Number: ! // 1) UTC Time of fix (HHMMSS.SS) ! // 2) Status, V=Navigation receiver warning A=Valid ! // 3) Latitude ! // 4) N or S ! // 5) Longitude ! // 6) E or W ! // 7) Speed over ground, knots ! // 8) Track made good, degrees true ! // 9) UTC Date of fix (DDMMYY) ! // 10) Magnetic Variation, degrees ! // 11) E or W ! // 12) Checksum (Mandatory) ! // ! // 12 ! // 1 2 3 4 5 6 7 8 9 10 11| 13 ! // | | | | | | | | | | | | | ! // $--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a,m*hh<CR><LF> ! // ! // Field Number: ! // 1) UTC Time of fix (HHMMSS.SS) ! // 2) Status, V=Navigation receiver warning A=Valid ! // 3) Latitude ! // 4) N or S ! // 5) Longitude ! // 6) E or W ! // 7) Speed over ground, knots ! // 8) Track made good, degrees true ! // 9) UTC Date of fix (DDMMYY) ! // 10) Magnetic Variation, degrees ! // 11) E or W ! // 12) FAA mode indicator (NMEA 2.3 and later) ! // A - Autonomous ! // D - Differential ! // E - Estimated (Dead Reckoning) ! // M - Manual Input ! // S - Simulated ! // N - Data not valid ! // 13) Checksum (Mandatory) ! // ! // A status of V means the GPS has a valid fix that is below an internal ! // quality threshold, e.g. because the dilution of precision is too high ! // or an elevation mask test failed. ! //---------------------------------------------------------------------- ! // $GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70 ! // 1 2 3 4 5 6 7 8 9 10 11 12 ! // ! // $GPRMC,222002,A,3614.4133,N,11509.6897,W,0.0,355.3,070401,13.1,E,A*31 ! // 1 2 3 4 5 6 7 8 9 10 11 13 ! if (get_verbose() & VERBOSE_DEBUG) printf ("GPRMC sentence\n"); ! strncpy (pos->sentence, elements[0], POS_SEN_LEN); + // Parse Time + p = elements[1]; elements[19][0] = *p++; elements[19][1] = *p++; *************** *** 969,985 **** tomake.tm_sec = (atoi (elements[19])); pos->rx_warning = elements[2][0]; pos->latitude = dm2dd(atof (elements[3]) / 100); if (elements[4][0] == 'S') pos->latitude = (0 - pos->latitude); // make negative pos->longitude = dm2dd(atof (elements[5]) / 100); if (elements[6][0] == 'W') pos->longitude = (0 - pos->longitude); // make negative pos->speed_over_ground = NM_TO_KM(atof (elements[7])); pos->course_made_good = atof (elements[8]); ! // date p = elements[9]; elements[19][0] = *p++; --- 1027,1050 ---- tomake.tm_sec = (atoi (elements[19])); + // Parse Data Status pos->rx_warning = elements[2][0]; + // Parse Latitude pos->latitude = dm2dd(atof (elements[3]) / 100); if (elements[4][0] == 'S') pos->latitude = (0 - pos->latitude); // make negative + // Parse Longitude pos->longitude = dm2dd(atof (elements[5]) / 100); if (elements[6][0] == 'W') pos->longitude = (0 - pos->longitude); // make negative + // Parse Ground Speed in Knots (convert to KmPH) pos->speed_over_ground = NM_TO_KM(atof (elements[7])); + + // Parse track in degrees true pos->course_made_good = atof (elements[8]); ! ! // Parse UTC Date of fix p = elements[9]; elements[19][0] = *p++; *************** *** 1007,1049 **** printf ("%lu\n", aprstime); ! pos->magnetic_variance = atof (elements[10]); ! /* Spec says that checksum should be in 11 ... but KB7RSI-15 breaks ! * that and puts it in 12 ... and aprsdec still says okay... ??? ! * * $GPRMC,222002,A,3614.4133,N,11509.6897,W,0.0,355.3,070401,13.1,E,A*31 ! */ if (strcmp (elements[12], "")) { p = elements[12]; - p_end = strlen (elements[12]) + p; } else { p = elements[11]; - p_end = strlen (elements[11]) + p; } - for (; p < p_end && *p != '*'; p++) - ; - p++; // move to beginning of hex ! checksum = 0; ! sscanf (p, "%2x", &checksum); ! if (get_verbose() & VERBOSE_DEBUG) ! printf ("Scanned checksum: %02x Calculated: %02x\n", checksum,local_checksum); - if (checksum == local_checksum) { - pos->checksum = 1; if (get_verbose() & VERBOSE_DEBUG) ! printf ("good checksum\n"); ! } else { ! pos->checksum = 0; if (get_verbose() & VERBOSE_PARSE) ! printf ("bad checksum\n"); return -1; } } else if (strstr (elements[0], "GGA")) { /* $GPGGA,223623,3601.917,N,07952.321,W,1,03,2.1,291.7,M,-32.7,M,,*70 */ // 0 1 2 3 4 5 6 7 8 9 0 11 2 14 if (get_verbose() & VERBOSE_DEBUG) printf ("GPGGA sentence\n"); ! strncpy (pos->sentence, elements[0], 6); ! // time p = elements[1]; --- 1072,1200 ---- printf ("%lu\n", aprstime); ! // Parse Magnetic Variation from True ! if( '\0'!=elements[10][0] ) { ! pos->magnetic_variance = atof (elements[10]); ! if (elements[11][0] == 'W') ! pos->magnetic_variance = (0 - pos->magnetic_variance); // make negative ! } ! // For NMEA Vr2.3 and later, elements[12] contains FAA mode indicator ! // and the mandatory checksum. Prior NMEA versions did not contain the ! // FAA mode indicator and placed the checksum in elements[11] with the ! // magnetic variation direction. if (strcmp (elements[12], "")) { + // elements[12] is NOT empty, therefore we have the mode indicator and checksum + if( '*'!=elements[12][0] ) { + // field is not empty, extract mode indicator and convert to quality + switch(elements[12][0]){ + case 'A': // Autonomous + pos->quality = 1; + break; + case 'D': // Differential + pos->quality = 2; + break; + case 'E': // Estimated (Dead Reckoning) + pos->quality = 6; + break; + case 'M': // Manual Input + pos->quality = 7; + break; + case 'S': // Simulated + pos->quality = 8; + break; + case 'N': // Not Valid + pos->quality = 0; + break; + default: + break; + } + } p = elements[12]; } else { + // elements[12] is empty, therefore checksum must be in elements[11] p = elements[11]; } ! // Checksum is Mandatory! ! if( NULL!=(p=strchr(p,'*')) ) { ! // Found beginning of checksum ! sscanf (p, "*%2x", &checksum); if (get_verbose() & VERBOSE_DEBUG) ! printf ("Scanned checksum: %02x Calculated: %02x\n", checksum,local_checksum); ! ! if (checksum == local_checksum) { ! pos->checksum = 1; ! if (get_verbose() & VERBOSE_DEBUG) ! printf ("good checksum\n"); ! } else { ! pos->checksum = 0; ! if (get_verbose() & VERBOSE_PARSE) ! printf ("bad checksum\n"); ! return -1; ! } ! } // Checksum is present ! else { if (get_verbose() & VERBOSE_PARSE) ! printf ("mandatory checksum not found\n"); return -1; + } // Checksum is NOT present + + if (get_verbose() & VERBOSE_DEBUG) { + printf ("Date: %ld - %s\n", pos->time_of_fix, asctime(gmtime(&pos->time_of_fix))); + printf ("Status: %c\n", pos->rx_warning); + printf ("Latitude: %f\n", pos->latitude); + printf ("Longitude: %f\n", pos->longitude); + printf ("Ground Speed: %6.1f KMH %6.1f KTS\n", pos->speed_over_ground, KM_TO_NM(pos->speed_over_ground)); + printf ("Ground Track (True): %5.1f\n", pos->course_made_good); + printf ("Magnetic Variation: %5.1f\n", pos->magnetic_variance); + printf ("Quality: %d\n", pos->quality); } } else if (strstr (elements[0], "GGA")) { + //---------------------------------------------------------------------- + // GGA - Global Positioning System Fix Data + // Time, Position and fix related data for a GPS receiver. + // + // 1 2 3 4 5 6 7 8 9 10 | 12 13 14 15 + // | | | | | | | | | | | | | | | + // $--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF> + // + // Field Number: + // 1) Universal Time Coordinated (UTC) + // 2) Latitude + // 3) N or S (North or South) + // 4) Longitude + // 5) E or W (East or West) + // 6) GPS Quality Indicator, + // 0 - fix not available, + // 1 - GPS fix (SPS) + // 2 - Differential GPS fix (SPS) + // (values above 2 are 2.3 features) + // 3 = GPS fix (PPS) + // 4 = Real Time Kinematic + // 5 = Float RTK + // 6 = Estimated (dead reckoning) + // 7 = Manual input mode + // 8 = Simulation mode + // 7) Number of satellites in view, 00 - 12 + // 8) Horizontal Dilution of precision (meters) + // 9) Antenna Altitude above/below mean-sea-level (geoid) (in meters) + // 10) Units of antenna altitude, meters + // 11) Geoidal separation, the difference between the WGS-84 earth + // ellipsoid and mean-sea-level (geoid), "-" means mean-sea-level + // below ellipsoid + // 12) Units of geoidal separation, meters + // 13) Age of differential GPS data, time in seconds since last SC104 + // type 1 or 9 update, null field when DGPS is not used + // 14) Differential reference station ID, 0000-1023 + // 15) Checksum (Optional) + //---------------------------------------------------------------------- /* $GPGGA,223623,3601.917,N,07952.321,W,1,03,2.1,291.7,M,-32.7,M,,*70 */ // 0 1 2 3 4 5 6 7 8 9 0 11 2 14 if (get_verbose() & VERBOSE_DEBUG) printf ("GPGGA sentence\n"); ! strncpy (pos->sentence, elements[0], POS_SEN_LEN); ! ! // Parse Time p = elements[1]; *************** *** 1060,1108 **** elements[19][2] = '\0'; tomake.tm_sec = (atoi (elements[19])); ! tomake.tm_mday = curtime->tm_mday; tomake.tm_mon = curtime->tm_mon; tomake.tm_year = curtime->tm_year; ! pos->time_of_fix = aprstime = mktime (&tomake); pos->latitude = dm2dd(atof (elements[2]) / 100); if (elements[3][0] == 'S') pos->latitude = (0 - pos->latitude); // make negative pos->longitude = dm2dd(atof (elements[4]) / 100); if (elements[5][0] == 'W') pos->longitude = (0 - pos->longitude); // make negative pos->quality = atoi (elements[6]); pos->sats = atoi (elements[7]); pos->hor_dilution = atof (elements[8]); pos->altitude = atof (elements[9]); // BUG: parse units - is it ever anything besides meters??? pos->geoidal_separation = atof (elements[11]); ! // BUG: parse units - ditto pos->diff_last_update = atof (elements[13]); ! p = elements[14]; ! if ('*' == *p) { ! // Just read checksum ! sscanf (p, "%*c%2x", &checksum); ! } else { ! // Diffrential station ID and checksum ! sscanf (p, "%4d%*c%2x", &pos->diff_station, &checksum); ! } ! if (checksum == local_checksum) { ! pos->checksum = 1; ! if (get_verbose() & VERBOSE_DEBUG) ! printf ("good checksum\n"); ! } else { ! pos->checksum = 0; ! if (get_verbose() & VERBOSE_PARSE) ! printf ("bad checksum\n"); ! return -1; ! } ! if (get_verbose() & VERBOSE_DEBUG) { ! printf ("Date: %ld\n", pos->time_of_fix); printf ("Latitude: %f\n", pos->latitude); printf ("Longitude: %f\n", pos->longitude); --- 1211,1273 ---- elements[19][2] = '\0'; tomake.tm_sec = (atoi (elements[19])); ! tomake.tm_mday = curtime->tm_mday; tomake.tm_mon = curtime->tm_mon; tomake.tm_year = curtime->tm_year; ! pos->time_of_fix = aprstime = mktime (&tomake); + // Parse Latitude pos->latitude = dm2dd(atof (elements[2]) / 100); if (elements[3][0] == 'S') pos->latitude = (0 - pos->latitude); // make negative + // Parse Longitude pos->longitude = dm2dd(atof (elements[4]) / 100); if (elements[5][0] == 'W') pos->longitude = (0 - pos->longitude); // make negative + // Parse fix quality pos->quality = atoi (elements[6]); + + // Parse Number of Satellites used in fix pos->sats = atoi (elements[7]); + + // Parse HDOP (in meters) pos->hor_dilution = atof (elements[8]); + + // Parse Altitude pos->altitude = atof (elements[9]); // BUG: parse units - is it ever anything besides meters??? + + // Parse difference between WGS-84 ellipsoid and MSL pos->geoidal_separation = atof (elements[11]); ! // BUG: parse units - ditto ! ! // Parse time in seconds since last differential update pos->diff_last_update = atof (elements[13]); ! // Parse Differential Station ID - only if contains a digit ! p = &elements[14][0]; ! if( isdigit(p[0] && isdigit(p[1]) && isdigit(p[2]) && isdigit(p[3]) ) ) ! sscanf (p, "%4d", &pos->diff_station); ! ! // Checksum is optional - only validate if it is present ! if( NULL!=(p=strchr(&elements[14][0],'*')) ) { ! sscanf (p, "*%2x", &checksum); ! if (checksum == local_checksum) { ! pos->checksum = 1; ! if (get_verbose() & VERBOSE_DEBUG) ! printf ("good checksum\n"); ! } else { ! pos->checksum = 0; ! if (get_verbose() & VERBOSE_PARSE) ! printf ("bad checksum\n"); ! return -1; ! } ! } // Checksum is present ! if (get_verbose() & VERBOSE_DEBUG) { ! printf ("Date: %ld - %s\n", pos->time_of_fix, asctime(gmtime(&pos->time_of_fix))); printf ("Latitude: %f\n", pos->latitude); printf ("Longitude: %f\n", pos->longitude); *************** *** 1110,1132 **** printf ("Satellites in use: %d\n", pos->sats); printf ("Horizontal Dilution: %f\n", pos->hor_dilution); ! printf ("Altitude: %f\n", pos->altitude); ! printf ("Geoidal Separation: %f\n", pos->geoidal_separation); ! printf ("Last DGPS update: %f\n", pos->diff_last_update); } } else if (strstr (elements[0], "GLL")) { if (get_verbose() & VERBOSE_PARSE) ! fprintf (stdout, "NOT IMPLEMENTED: NMEA GLL\n"); ! return -1; } else if (strstr (elements[0], "VTG")) { if (get_verbose() & VERBOSE_PARSE) ! fprintf (stdout, "NOT IMPLEMENTED: NMEA VTG\n"); ! return -1; ! } else if (strstr (elements[0], "WPT")) { if (get_verbose() & VERBOSE_PARSE) ! fprintf (stdout, "NOT IMPLEMENTED: NMEA WPT\n"); ! return -1; } return 0; // successful, otherwise we would have already returned ! } --- 1275,1638 ---- printf ("Satellites in use: %d\n", pos->sats); printf ("Horizontal Dilution: %f\n", pos->hor_dilution); ! printf ("Altitude AMSL: %8.2f M\n", pos->altitude); ! printf ("Geoidal Separation WGS84 to MSL: %9.3f M\n", pos->geoidal_separation); ! printf ("Last DGPS update: %f seconds ago\n", pos->diff_last_update); ! printf ("DGPS station ID: %04i\n", pos->diff_station); } } else if (strstr (elements[0], "GLL")) { + //---------------------------------------------------------------------- + // GLL - Geographic Position - Latitude/Longitude + // + // 1 2 3 4 5 6 7 8 + // | | | | | | | | + // $--GLL,llll.ll,a,yyyyy.yy,a,hhmmss.ss,a,m,*hh<CR><LF> + // + // Field Number: + // 1) Latitude + // 2) N or S (North or South) + // 3) Longitude + // 4) E or W (East or West) + // 5) Universal Time Coordinated (UTC) + // 6) Status, V=Navigation receiver warning A=Valid + // 7) FAA mode indicator (NMEA 2.3 and later) + // A - Autonomous + // D - Differential + // E - Estimated (Dead Reckoning) + // M - Manual Input + // S - Simulated + // N - Data not valid + // 8) Checksum (Optional) + // + //---------------------------------------------------------------------- if (get_verbose() & VERBOSE_PARSE) ! printf ("GPGLL sentence\n"); ! strncpy (pos->sentence, elements[0], POS_SEN_LEN); ! ! // Parse Latitude ! pos->latitude = dm2dd(atof (elements[1]) / 100); ! if (elements[2][0] == 'S') ! pos->latitude = (0 - pos->latitude); // make negative ! ! // Parse Longitude ! pos->longitude = dm2dd(atof (elements[3]) / 100); ! if (elements[4][0] == 'W') ! pos->longitude = (0 - pos->longitude); // make negative ! ! // Parse Time ! p = elements[5]; ! ! elements[19][0] = *p++; ! elements[19][1] = *p++; ! elements[19][2] = '\0'; ! tomake.tm_hour = (atoi (elements[19])); ! elements[19][0] = *p++; ! elements[19][1] = *p++; ! elements[19][2] = '\0'; ! tomake.tm_min = (atoi (elements[19])); ! elements[19][0] = *p++; ! elements[19][1] = *p++; ! elements[19][2] = '\0'; ! tomake.tm_sec = (atoi (elements[19])); ! ! tomake.tm_mday = curtime->tm_mday; ! tomake.tm_mon = curtime->tm_mon; ! tomake.tm_year = curtime->tm_year; ! ! pos->time_of_fix = aprstime = mktime (&tomake); ! ! // Parse Position Status ! pos->rx_warning = elements[6][0]; ! ! // For NMEA Vr2.3 and later, elements[7] contains FAA mode indicator ! // and the optional checksum. Prior NMEA versions did not contain the ! // FAA mode indicator and placed the optional checksum in elements[6] with the ! // status ! if (strcmp (elements[7], "")) { ! // elements[7] is NOT empty, therefore we have the mode indicator and checksum ! if( '*'!=elements[7][0] ) { ! // field is not empty, extract mode indicator and convert to quality ! switch(elements[7][0]){ ! case 'A': // Autonomous ! pos->quality = 1; ! break; ! case 'D': // Differential ! pos->quality = 2; ! break; ! case 'E': // Estimated (Dead Reckoning) ! pos->quality = 6; ! break; ! case 'M': // Manual Input ! pos->quality = 7; ! break; ! case 'S': // Simulated ! pos->quality = 8; ! break; ! case 'N': // Not Valid ! pos->quality = 0; ! break; ! default: ! break; ! } ! } ! p = elements[7]; ! } else { ! // elements[7] is empty, therefore checksum may be in elements[6] ! p = elements[6]; ! } ! // Checksum is optional - only validate if it is present ! if( NULL!=(p=strchr(p,'*')) ) { ! sscanf (p, "*%2x", &checksum); ! if (checksum == local_checksum) { ! pos->checksum = 1; ! if (get_verbose() & VERBOSE_DEBUG) ! printf ("good checksum\n"); ! } else { ! pos->checksum = 0; ! if (get_verbose() & VERBOSE_PARSE) ! printf ("bad checksum\n"); ! return -1; ! } ! } // Checksum is present ! ! if (get_verbose() & VERBOSE_DEBUG) { ! printf ("Date: %ld - %s\n", pos->time_of_fix, asctime(gmtime(&pos->time_of_fix))); ! printf ("Latitude: %f\n", pos->latitude); ! printf ("Longitude: %f\n", pos->longitude); ! printf ("Status: %c\n", pos->rx_warning); ! printf ("Quality: %d\n", pos->quality); ! } } else if (strstr (elements[0], "VTG")) { + //---------------------------------------------------------------------- + // VTG - Track made good and Ground speed + // + // 1 2 3 4 5 6 7 8 9 10 + // | | | | | | | | | | + // $--VTG,x.x,T,x.x,M,x.x,N,x.x,K,m*hh<CR><LF> + // + // Field Number: + // 1) Track Degrees (True) + // 2) T = True + // 3) Track Degrees (Magnetic) + // 4) M = Magnetic + // 5) Speed Knots + // 6) N = Knots + // 7) Speed Kilometers Per Hour + // 8) K = Kilometers Per Hour + // 9) FAA mode indicator (NMEA 2.3 and later) + // A - Autonomous + // D - Differential + // E - Estimated (Dead Reckoning) + // M - Manual Input + // S - Simulated + // N - Data not valid + // 10) Checksum (Optional) + // + // Note: in some older versions of NMEA 0183, the sentence looks like this: + // + // 1 2 3 4 5 + // | | | | | + // $--VTG,x.x,x,x.x,x.x*hh<CR><LF> + // + // Field Number: + // 1) True course over ground (degrees) 000 to 359 + // 2) Magnetic course over ground 000 to 359 + // 3) Speed over ground (knots) 00.0 to 99.9 + // 4) Speed over ground (kilometers) 00.0 to 99.9 + // 5) Checksum (Optional) + // + // The two forms can be distinguished by field 2, which will be + // the fixed text 'T' in the newer form. The new form appears + // to have been introduced with NMEA 3.01 in 2002. + // + // Some devices, such as those described in [GLOBALSAT], leave the + // magnetic-bearing fields 3 and 4 empty. + //---------------------------------------------------------------------- if (get_verbose() & VERBOSE_PARSE) ! printf ("GPVTG sentence\n"); ! strncpy (pos->sentence, elements[0], POS_SEN_LEN); ! ! // Parse track in degrees true ! pos->course_made_good = atof (elements[1]); ! ! // Examine field 2 to determine which type of VTG sentence we have ! if( 'T'==elements[2][0] ) { ! // -------------------------------------------------------------- ! // 1 2 3 4 5 6 7 8 9 10 ! // | | | | | | | | | | ! // $--VTG,x.x,T,x.x,M,x.x,N,x.x,K,m*hh<CR><LF> ! // ! // Field Number: ! // 1) Track Degrees (True) ! // 2) T = True ! // 3) Track Degrees (Magnetic) ! // 4) M = Magnetic ! // 5) Speed Knots ! // 6) N = Knots ! // 7) Speed Kilometers Per Hour ! // 8) K = Kilometers Per Hour ! // 9) FAA mode indicator (NMEA 2.3 and later) ! // A - Autonomous ! // D - Differential ! // E - Estimated (Dead Reckoning) ! // M - Manual Input ! // S - Simulated ! // N - Data not valid ! // 10) Checksum (Optional) ! // -------------------------------------------------------------- ! ! if( '\0'!=elements[7][0] ) { ! // Parse Ground Speed in KmPH ! pos->speed_over_ground = atof (elements[7]); ! } else if( '\0'!=elements[5][0] ) { ! // Parse Ground Speed in Knots (convert to KmPH) ! pos->speed_over_ground = NM_TO_KM(atof (elements[5])); ! } ! ! // For NMEA Vr2.3 and later, elements[9] contains FAA mode indicator ! // and the optional checksum. Prior NMEA versions did not contain the ! // FAA mode indicator and placed the optional checksum in elements[8] with the ! // status ! if (strcmp (elements[9], "")) { ! // elements[9] is NOT empty, therefore we have the mode indicator and checksum ! if( '*'!=elements[9][0] ) { ! // field is not empty, extract mode indicator and convert to quality ! switch(elements[9][0]){ ! case 'A': // Autonomous ! pos->quality = 1; ! break; ! case 'D': // Differential ! pos->quality = 2; ! break; ! case 'E': // Estimated (Dead Reckoning) ! pos->quality = 6; ! break; ! case 'M': // Manual Input ! pos->quality = 7; ! break; ! case 'S': // Simulated ! pos->quality = 8; ! break; ! case 'N': // Not Valid ! pos->quality = 0; ! break; ! default: ! break; ! } ! } ! p = elements[9]; ! } else { ! // elements[9] is empty, therefore checksum may be in elements[8] ! p = elements[8]; ! } ! // Leave with p pointing to element with possible checksum ! } // Newer VTG format ! else { ! // -------------------------------------------------------------- ! // 1 2 3 4 5 ! // | | | | | ! // $--VTG,x.x,x,x.x,x.x*hh<CR><LF> ! // ! // Field Number: ! // 1) True course over ground (degrees) 000 to 359 ! // 2) Magnetic course over ground 000 to 359 ! // 3) Speed over ground (knots) 00.0 to 99.9 ! // 4) Speed over ground (kilometers) 00.0 to 99.9 ! // 5) Checksum (Optional) ! // ! // -------------------------------------------------------------- ! ! if( '\0'!=elements[4][0] ) { ! // Parse Ground Speed in KmPH ! pos->speed_over_ground = atof (elements[4]); ! } else if( '\0'!=elements[3][0] ) { ! // Parse Ground Speed in Knots (convert to KmPH) ! pos->speed_over_ground = NM_TO_KM(atof (elements[3])); ! } ! ! // Leave with p pointing to element with possible checksum ! p = elements[4]; ! } // Older VTG format ! ! // Checksum is optional - only validate if it is present ! if( NULL!=(p=strchr(p,'*')) ) { ! sscanf (p, "*%2x", &checksum); ! if (checksum == local_checksum) { ! pos->checksum = 1; ! if (get_verbose() & VERBOSE_DEBUG) ! printf ("good checksum\n"); ! } else { ! pos->checksum = 0; ! if (get_verbose() & VERBOSE_PARSE) ! printf ("bad checksum\n"); ! return -1; ! } ! } // Checksum is present ! ! ! if (get_verbose() & VERBOSE_DEBUG) { ! printf ("Ground Speed: %6.1f KMH %6.1f KTS\n", pos->speed_over_ground, KM_TO_NM(pos->speed_over_ground)); ! printf ("Ground Track (True): %5.1f\n", pos->course_made_good); ! printf ("Quality: %d\n", pos->quality); ! } ! } else if (strstr (elements[0], "WPL")) { ! //---------------------------------------------------------------------- ! // WPL - Waypoint Location ! // ! // 1 2 3 4 5 6 ! // | | | | | | ! // $--WPL,llll.ll,a,yyyyy.yy,a,c--c*hh<CR><LF> ! // ! // Field Number: ! // 1) Latitude ! // 2) N or S (North or South) ! // 3) Longitude ! // 4) E or W (East or West) ! // 5) Waypoint name ! // 6) Checksum (Optional) ! //---------------------------------------------------------------------- if (get_verbose() & VERBOSE_PARSE) ! printf ("GPWPL sentence\n"); ! strncpy (pos->sentence, elements[0], POS_SEN_LEN); ! ! // Parse Latitude ! pos->latitude = dm2dd(atof (elements[1]) / 100); ! if (elements[2][0] == 'S') ! pos->latitude = (0 - pos->latitude); // make negative ! ! // Parse Longitude ! pos->longitude = dm2dd(atof (elements[3]) / 100); ! if (elements[4][0] == 'W') ! pos->longitude = (0 - pos->longitude); // make negative ! ! // Checksum is optional - only validate if it is present ! if( NULL!=(p=strchr(&elements[5][0],'*')) ) { ! sscanf (p, "*%2x", &checksum); ! if (checksum == local_checksum) { ! pos->checksum = 1; ! if (get_verbose() & VERBOSE_DEBUG) ! printf ("good checksum\n"); ! } else { ! pos->checksum = 0; ! if (get_verbose() & VERBOSE_PARSE) ! printf ("bad checksum\n"); ! return -1; ! } ! // Terminate elements[5] at '*' ! *p = '\0'; ! } // Checksum is present ! ! // Parse the Waypoint Name ! strncpy(pos->source,&elements[5][0],POS_SRC_LEN); ! pos->source[POS_SRC_LEN-1]='\0'; ! ! ! if (get_verbose() & VERBOSE_DEBUG) { ! printf ("Latitude: %f\n", pos->latitude); ! printf ("Longitude: %f\n", pos->longitude); ! printf ("Waypoint Name: %s\n", pos->source); ! } } return 0; // successful, otherwise we would have already returned ! } // parse_nmea() *************** *** 1648,1652 **** if(!valid_packet(buffer)){ if( get_verbose() & VERBOSE_PARSE ) ! printf("%sInvalid packet rejected!%s\n", RED_TEXT, DEFAULT_TEXT); return; } --- 2154,2158 ---- if(!valid_packet(buffer)){ if( get_verbose() & VERBOSE_PARSE ) ! printf("%sInvalid packet rejected!%s\n%s\n", RED_TEXT, DEFAULT_TEXT, buffer); return; } *************** *** 1727,1731 **** packet_count[MOBILE]++; break; ! case '=': /* APRS fixed statuin */ if (get_verbose() & VERBOSE_DEBUG) --- 2233,2237 ---- packet_count[MOBILE]++; break; ! case '=': /* APRS fixed station */ if (get_verbose() & VERBOSE_DEBUG) *************** *** 1950,1956 **** obj->pos.latitude=0; obj->pos.longitude=0; ! obj->pos.speed_over_ground=-1; ! obj->pos.course_made_good=-1; ! obj->pos.altitude=0; obj->stat.comment[0] = '\0'; --- 2456,2463 ---- obj->pos.latitude=0; obj->pos.longitude=0; ! obj->pos.speed_over_ground=-1; // Unknown ! obj->pos.course_made_good=-1; // Unknown ! obj->pos.altitude=0; // On WGS-84 Ellipsoid ! obj->pos.time_of_fix=time(NULL); // Default to time received obj->stat.comment[0] = '\0'; *************** *** 2383,2403 **** void init_position(struct position *pos, char *source) { strncpy(pos->source,source,10); ! pos->time_of_fix=0; pos->latitude=0; pos->longitude=0; ! pos->speed_over_ground=-1; ! pos->course_made_good=-1; ! pos->altitude=0; ! pos->checksum=0; ! pos->sentence[0]='\0'; ! pos->rx_warning=0; ! pos->magnetic_variance=0; ! pos->quality=0; ! pos->sats=0; pos->hor_dilution=0; ! pos->geoidal_separation=0; pos->diff_last_update=0; ! pos->diff_station=0; } --- 2890,2910 ---- void init_position(struct position *pos, char *source) { strncpy(pos->source,source,10); ! pos->time_of_fix=time(NULL); // Default to time received pos->latitude=0; pos->longitude=0; ! pos->speed_over_ground=-1; // Unknown ! pos->course_made_good=-1; // Unknown ! pos->altitude=0; // On WGS-84 Ellipsoid surface ! pos->checksum=-1; // Default to no checksum present ! pos->sentence[0]='\0'; // Empty ! pos->rx_warning=0; // Unknown ! pos->magnetic_variance=360; // Unknown ! pos->quality=-1; // Unknown ! pos->sats=-1; // Unknown pos->hor_dilution=0; ! pos->geoidal_separation=0; // On WGS-84 Ellipsoid surface pos->diff_last_update=0; ! pos->diff_station=-1; // No station ID given } *************** *** 2409,2415 **** itm->pos.latitude=0; itm->pos.longitude=0; ! itm->pos.speed_over_ground=-1; ! itm->pos.course_made_good=-1; ! itm->pos.altitude=0; itm->stat.comment[0] = '\0'; --- 2916,2923 ---- itm->pos.latitude=0; itm->pos.longitude=0; ! itm->pos.speed_over_ground=-1; // Unknown ! itm->pos.course_made_good=-1; // Unknown ! itm->pos.altitude=0; // On WGS-84 Ellipsoid surface ! itm->pos.time_of_fix=time(NULL); // Default to time received itm->stat.comment[0] = '\0'; Index: message.h =================================================================== RCS file: /cvsroot/aprsworld/parse/message.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** message.h 2 Jan 2008 04:22:32 -0000 1.11 --- message.h 11 Aug 2008 02:50:41 -0000 1.12 *************** *** 115,121 **** void init_status(struct status *stat, char *source); /* station position */ struct position { ! char source[10]; // AX.25 Source address time_t time_of_fix; // Time of Fix (seconds since Epoch) double latitude; // Latitude (North=postive,South=negative) --- 115,123 ---- void init_status(struct status *stat, char *source); + #define POS_SRC_LEN 10 + #define POS_SEN_LEN 7 /* station position */ struct position { ! char source[POS_SRC_LEN]; // AX.25 Source address time_t time_of_fix; // Time of Fix (seconds since Epoch) double latitude; // Latitude (North=postive,South=negative) *************** *** 126,144 **** // APRS stuff // Less useful stuff (specific to instrument) below: ! int checksum; // Checksum (Valid=1,Invalid=0) ! char sentence[6]; // Sentence type // BUG: Should be enumerated ! char rx_warning; // Navigation receiver warning ! float magnetic_variance; // Magnetic variance ! int quality; // 0 = fix not available // 1 = GPS SPS mode // 2 = diffrential GPS, SPS mode // 3 = GPS PPS mode ! int sats; // Satellites in use ! float hor_dilution; // Horizontal dillution of precision ! float geoidal_separation; // difference between teh WGS84 earth // ellipsoid and mean sea level float diff_last_update; // seconds since last DGPS update ! int diff_station; // diffrential station ID (0000-1023) }; --- 128,153 ---- // APRS stuff // Less useful stuff (specific to instrument) below: ! int checksum; // Checksum (Valid=1,Invalid=0, None=-1) ! char sentence[POS_SEN_LEN]; // Sentence type // BUG: Should be enumerated ! char rx_warning; // Navigation receiver warning, '\0' = Unknown ! float magnetic_variance; // Magnetic variance, 360 = Unknown ! int quality; // Fix Quality (Also used for FAA Mode) ! // -1 = Unknown ! // 0 = fix not available // 1 = GPS SPS mode // 2 = diffrential GPS, SPS mode // 3 = GPS PPS mode ! // 4 = Real Time Kinematic ! // 5 = Float RTK ! // 6 = Estimated (Dead Reckoning) ! // 7 = Manual input mode ! // 8 = Simulation mode ! int sats; // Satellites in use (-1=Unknown) ! float hor_dilution; // Horizontal dillution of precision in Meters ! float geoidal_separation; // difference between MSL Geoid and WGS-84 Ellipsoid in Meters // ellipsoid and mean sea level float diff_last_update; // seconds since last DGPS update ! int diff_station; // diffrential station ID (0000-1023), None=-1 }; Index: metric.h =================================================================== RCS file: /cvsroot/aprsworld/parse/metric.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** metric.h 30 May 2005 01:58:26 -0000 1.3 --- metric.h 11 Aug 2008 02:50:41 -0000 1.4 *************** *** 130,133 **** --- 130,134 ---- #define NM_TO_KM(x) (1.853 * (x)) + #define KM_TO_NM(x) ((x) / 1.853) #define FT_TO_M(x) IN_TO_M(FT_TO_IN((x))) #define M_TO_FT(x) (3.2808F * (x)) |
|
From: Tim B. <tba...@us...> - 2008-08-11 01:59:50
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv29223 Modified Files: db_pgsql.c postgres.sql Log Message: Set client encoding to UTF8 upon connecting to postgres database. (I create my databases with UTF8 encoding. Don't know if I should or not, but upon reading the Postgres docs a client encoding of UTF8 should work with any server database encoding format). Reformated SQL statements. POINT geometries are now 4 dimensions (X,Y,Z,M) : Long, Lat, Altitude, and Time of Fix. Gemetries are also now stored in WGS-84 SRID as specified in the APRS Specification ("The default GPS earth datum is World Geodetic System (WGS) 1984"). This change permits us to pull the geometries from the database and reproject on the fly. The previous "unspecified" SRID=-1 would not permit this. Index: db_pgsql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_pgsql.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** db_pgsql.c 2 Jan 2008 04:25:10 -0000 1.9 --- db_pgsql.c 11 Aug 2008 01:59:56 -0000 1.10 *************** *** 83,87 **** ! sprintf(sql_buf, "begin work"); pg_res = PQexec(pg_conn, sql_buf); --- 83,87 ---- ! sprintf(sql_buf, "BEGIN WORK"); [...1614 lines suppressed...] ! "symbol_table, " ! "symbol_code, " ! "comment, " ! "position " ! ") VALUES ( " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "'%s', " ! "GeomFromEWKT('SRID=4326;POINT(%f %f %f %u)') " ! ")", ! postgres_escape(itm->source, strlen(itm->source), &newlen), ! postgres_escape(itm->name, strlen(itm->name), &newlen), ! postgres_escape(&itm->stat.symbol_table, 1, &newlen), ! postgres_escape(&itm->stat.symbol_code, 1, &newlen), ! postgres_escape(itm->stat.comment, strlen(itm->stat.comment), &newlen), ! itm->pos.longitude, itm->pos.latitude, itm->pos.altitude, itm->pos.time_of_fix ); Index: postgres.sql =================================================================== RCS file: /cvsroot/aprsworld/parse/postgres.sql,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** postgres.sql 2 Jan 2008 03:30:28 -0000 1.3 --- postgres.sql 11 Aug 2008 01:59:56 -0000 1.4 *************** *** 2,6 **** -- -- PostgreSQL and PostGIS required ! -- Tested on PostgreSQL 8.2.5 with PostGIS 1.2.1 -- -- --- 2,6 ---- -- -- PostgreSQL and PostGIS required ! -- Tested on PostgreSQL 8.3 with PostGIS 1.3.3 -- -- *************** *** 60,64 **** PRIMARY KEY (source) ); ! SELECT AddGeometryColumn('', 'aprs_lastposition', 'position', -1, 'POINT', 2 ); CREATE INDEX aprs_lastposition_id_idx ON aprs_lastposition(packet_id); --- 60,64 ---- PRIMARY KEY (source) ); ! SELECT AddGeometryColumn('', 'aprs_lastposition', 'position', 4326, 'POINT', 4 ); CREATE INDEX aprs_lastposition_id_idx ON aprs_lastposition(packet_id); *************** *** 88,92 **** ); ! SELECT AddGeometryColumn('', 'aprs_position', 'position', -1, 'POINT', 2 ); --CREATE INDEX aprs_position_geom_idx ON aprs_position USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_position_ts_idx ON aprs_position (packet_date); --- 88,92 ---- ); ! SELECT AddGeometryColumn('', 'aprs_position', 'position', 4326, 'POINT', 4 ); --CREATE INDEX aprs_position_geom_idx ON aprs_position USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_position_ts_idx ON aprs_position (packet_date); *************** *** 127,131 **** ); ! SELECT AddGeometryColumn('', 'aprs_object', 'position', -1, 'POINT', 2 ); --CREATE INDEX aprs_object_geom_idx ON aprs_object USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_object_source_idx ON aprs_object (source); --- 127,131 ---- ); ! SELECT AddGeometryColumn('', 'aprs_object', 'position', 4326, 'POINT', 4 ); --CREATE INDEX aprs_object_geom_idx ON aprs_object USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_object_source_idx ON aprs_object (source); *************** *** 167,171 **** ); ! SELECT AddGeometryColumn('', 'aprs_lastobject', 'position', -1, 'POINT', 2 ); --CREATE INDEX aprs_lastobject_geom_idx ON aprs_lastobject USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_lastobject_source_idx ON aprs_lastobject (source); --- 167,171 ---- ); ! SELECT AddGeometryColumn('', 'aprs_lastobject', 'position', 4326, 'POINT', 4 ); --CREATE INDEX aprs_lastobject_geom_idx ON aprs_lastobject USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_lastobject_source_idx ON aprs_lastobject (source); *************** *** 524,528 **** ); ! SELECT AddGeometryColumn('', 'aprs_item', 'position', -1, 'POINT', 2 ); --CREATE INDEX aprs_item_geom_idx ON aprs_item USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_item_source_idx ON aprs_item (source); --- 524,528 ---- ); ! SELECT AddGeometryColumn('', 'aprs_item', 'position', 4326, 'POINT', 4 ); --CREATE INDEX aprs_item_geom_idx ON aprs_item USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_item_source_idx ON aprs_item (source); *************** *** 550,554 **** ); ! SELECT AddGeometryColumn('', 'aprs_lastitem', 'position', -1, 'POINT', 2 ); --CREATE INDEX aprs_lastitem_geom_idx ON aprs_lastitem USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_lastitem_source_idx ON aprs_lastitem (source); --- 550,554 ---- ); ! SELECT AddGeometryColumn('', 'aprs_lastitem', 'position', 4326, 'POINT', 4 ); --CREATE INDEX aprs_lastitem_geom_idx ON aprs_lastitem USING GIST (position GIST_GEOMETRY_OPS); CREATE INDEX aprs_lastitem_source_idx ON aprs_lastitem (source); |
|
From: Tim B. <tba...@us...> - 2008-01-02 04:25:07
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv25123 Modified Files: db_mysql.c db_pgsql.c Log Message: * Cleanup to use VERBOSE macro definitions for improved readability. * All SQL debug printing is now enabled only with new VERBOSE_SQL macro. This allows us to debug the packet parser separate from the database handlers. Index: db_mysql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_mysql.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** db_mysql.c 29 Jan 2007 21:44:24 -0000 1.6 --- db_mysql.c 2 Jan 2008 04:25:10 -0000 1.7 *************** *** 87,91 **** if ( NULL == mysql_real_connect (&mysql, host, username, password, database, (char *) NULL, 0, (char *) NULL)) { ! if (get_verbose() & 1) { fprintf (stderr, "Failed to connect to database: Error: %s\n", mysql_error (&mysql)); } --- 87,91 ---- if ( NULL == mysql_real_connect (&mysql, host, username, password, database, (char *) NULL, 0, (char *) NULL)) { ! if (get_verbose() & VERBOSE_ERRORS) { fprintf (stderr, "Failed to connect to database: Error: %s\n", mysql_error (&mysql)); } *************** *** 169,173 **** query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); if ( mysql_query (&mysql, sql_buf) ) --- 169,173 ---- query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); if ( mysql_query (&mysql, sql_buf) ) *************** *** 215,219 **** query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 215,219 ---- query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 272,276 **** query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 272,276 ---- query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 334,338 **** query(&sql_query,sql_buf,"REPLACE"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); if ( mysql_query (&mysql, sql_buf) ) --- 334,338 ---- query(&sql_query,sql_buf,"REPLACE"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); if ( mysql_query (&mysql, sql_buf) ) *************** *** 397,401 **** query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 397,401 ---- query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 462,466 **** query(&sql_query,sql_buf,"REPLACE"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 462,466 ---- query(&sql_query,sql_buf,"REPLACE"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 495,499 **** } else { // Let's not explode in case we missed something. retval = atoi(row[0]); ! if (get_verbose() & 4) printf ("Using qa_hosts id %s for %s\n", row[0], hostname); } --- 495,499 ---- } else { // Let's not explode in case we missed something. retval = atoi(row[0]); ! if (get_verbose() & VERBOSE_DEBUG) printf ("Using qa_hosts id %s for %s\n", row[0], hostname); } *************** *** 534,538 **** result = mysql_use_result (&mysql); while ( row = mysql_fetch_row (result) ) { ! if ( get_verbose() & 2 ) printf("%s has triggered: %s\n",callsign,row[1]); --- 534,538 ---- result = mysql_use_result (&mysql); while ( row = mysql_fetch_row (result) ) { ! if ( get_verbose() & VERBOSE_SQL ) printf("%s has triggered: %s\n",callsign,row[1]); *************** *** 543,547 **** if ( pid == 0 ) { struct passwd *pwd; ! if ( get_verbose() & 2 ) printf("\tattempting to run %s as %s in %s (pid=%d)\n",row[1],row[2],row[0],(int) getpid()); --- 543,547 ---- if ( pid == 0 ) { struct passwd *pwd; ! if ( get_verbose() & VERBOSE_SQL ) printf("\tattempting to run %s as %s in %s (pid=%d)\n",row[1],row[2],row[0],(int) getpid()); *************** *** 624,628 **** } while ( i<5 ); ! if ( get_verbose() & 4 ) { printf("Telemetry coefficients:\n"); for ( i=0 ; i<5 ; i++ ) { --- 624,628 ---- } while ( i<5 ); ! if ( get_verbose() & VERBOSE_DEBUG ) { printf("Telemetry coefficients:\n"); for ( i=0 ; i<5 ; i++ ) { *************** *** 639,643 **** a[4],b[4],c[4]); ! if ( get_verbose() & 4 ) printf("SQL: %sql_buf\n", sql_buf); --- 639,643 ---- a[4],b[4],c[4]); ! if ( get_verbose() & VERBOSE_SQL ) printf("SQL: %sql_buf\n", sql_buf); *************** *** 707,711 **** query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 707,711 ---- query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 717,721 **** query(&sql_query,sql_buf,"REPLACE"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 717,721 ---- query(&sql_query,sql_buf,"REPLACE"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 764,768 **** query(&sql_query,sql_buf,"REPLACE"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 764,768 ---- query(&sql_query,sql_buf,"REPLACE"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 812,816 **** query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 812,816 ---- query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 864,868 **** query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 864,868 ---- query(&sql_query,sql_buf,"INSERT"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 927,931 **** sql_insert_value(&sql_query, sql_buf); ! if ( get_verbose() & 1 ) printf("%sql_buf\n",table); --- 927,931 ---- sql_insert_value(&sql_query, sql_buf); ! if ( get_verbose() & VERBOSE_SQL ) printf("%sql_buf\n",table); *************** *** 949,953 **** query(&sql_query, sql_buf, "INSERT"); ! if (get_verbose() & 2) printf ("%s;\n", sql_buf); --- 949,953 ---- query(&sql_query, sql_buf, "INSERT"); ! if (get_verbose() & VERBOSE_SQL) printf ("%s;\n", sql_buf); *************** *** 964,968 **** if ( obj->kill ) { ! if ( get_verbose() & 2 ) { printf("---> Killing object %s\n",obj->name); --- 964,968 ---- if ( obj->kill ) { ! if ( get_verbose() & VERBOSE_SQL ) { printf("---> Killing object %s\n",obj->name); Index: db_pgsql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_pgsql.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** db_pgsql.c 2 Jan 2008 03:32:46 -0000 1.8 --- db_pgsql.c 2 Jan 2008 04:25:10 -0000 1.9 *************** *** 79,83 **** int db_begin_txn() { ! if (get_verbose() & 2) printf("SQL: begin\n"); --- 79,83 ---- int db_begin_txn() { ! if (get_verbose() & VERBOSE_SQL) printf("SQL: begin\n"); *************** *** 100,104 **** int db_commit_txn() { ! if (get_verbose() & 2) printf("SQL: commit\n"); --- 100,104 ---- int db_commit_txn() { ! if (get_verbose() & VERBOSE_SQL) printf("SQL: commit\n"); *************** *** 118,122 **** int db_rollback_txn() { ! if (get_verbose() & 2) printf("SQL: rollback\n"); --- 118,122 ---- int db_rollback_txn() { ! if (get_verbose() & VERBOSE_SQL) printf("SQL: rollback\n"); *************** *** 162,166 **** sprintf(conninfo, "dbname=%s user=%s password=%s host=%s", database, username, password, host); ! if( get_verbose() & 4 ){ printf("%s\n",conninfo); } --- 162,166 ---- sprintf(conninfo, "dbname=%s user=%s password=%s host=%s", database, username, password, host); ! if( get_verbose() & VERBOSE_DEBUG ){ printf("%s\n",conninfo); } *************** *** 239,243 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 239,243 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 256,260 **** snprintf(sql_buf, 4096, "SELECT nextval('aprs_raw_seq')"); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 256,260 ---- snprintf(sql_buf, 4096, "SELECT nextval('aprs_raw_seq')"); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 301,305 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 301,305 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 355,359 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 355,359 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 416,420 **** ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 416,420 ---- ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 470,474 **** pos->latitude); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 470,474 ---- pos->latitude); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 527,531 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 527,531 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 578,582 **** pos->latitude); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 578,582 ---- pos->latitude); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 655,659 **** ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 655,659 ---- ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 730,734 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 730,734 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 781,785 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 781,785 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 839,843 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 839,843 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 878,882 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 878,882 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 918,922 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 918,922 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 964,968 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 964,968 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 1016,1020 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 1016,1020 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 1161,1165 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 1161,1165 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 1215,1219 **** } while ( i<5 ); ! if ( get_verbose() & 4 ) { printf("Telemetry coefficients:\n"); for ( i=0 ; i<5 ; i++ ) { --- 1215,1219 ---- } while ( i<5 ); ! if ( get_verbose() & VERBOSE_DEBUG ) { printf("Telemetry coefficients:\n"); for ( i=0 ; i<5 ; i++ ) { *************** *** 1266,1270 **** a[4],b[4],c[4]); ! if (get_verbose() & 2) printf("SQL: %sql_buf\n", sql_buf); --- 1266,1270 ---- a[4],b[4],c[4]); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %sql_buf\n", sql_buf); *************** *** 1351,1355 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 1351,1355 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 1368,1372 **** snprintf(sql_buf, 4096, "delete from aprs_lastobject where source = '%s' and name = '%s'", postgres_escape(obj->source, strlen(obj->source), &newlen), postgres_escape(obj->name, strlen(obj->name), &newlen)); ! if (get_verbose() & 2) { printf("---> Killing object %s\n", obj->name); printf("SQL: %s\n", sql_buf); --- 1368,1372 ---- snprintf(sql_buf, 4096, "delete from aprs_lastobject where source = '%s' and name = '%s'", postgres_escape(obj->source, strlen(obj->source), &newlen), postgres_escape(obj->name, strlen(obj->name), &newlen)); ! if (get_verbose() & VERBOSE_SQL) { printf("---> Killing object %s\n", obj->name); printf("SQL: %s\n", sql_buf); *************** *** 1437,1441 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 1437,1441 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 1520,1524 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 1520,1524 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 1567,1571 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 1567,1571 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 1618,1622 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 1618,1622 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); *************** *** 1659,1663 **** ); ! if (get_verbose() & 2) printf("SQL: %s\n", sql_buf); --- 1659,1663 ---- ); ! if (get_verbose() & VERBOSE_SQL) printf("SQL: %s\n", sql_buf); |
|
From: Tim B. <tba...@us...> - 2008-01-02 04:22:30
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv23984 Modified Files: message.c message.h README Log Message: * Add VERBOSE mask macro definitions in message.h * Verbose level defaults to "NORM" for normal logging. Pretty quiet. * General cleanup to use macros for readability. Index: message.c =================================================================== RCS file: /cvsroot/aprsworld/parse/message.c,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** message.c 29 Jan 2007 21:44:24 -0000 1.94 --- message.c 2 Jan 2008 04:22:32 -0000 1.95 *************** *** 1,6 **** /* APRS Parser with Database Support ! Copyright (C) 2007 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify --- 1,7 ---- /* + * vim:ts=3: [...1039 lines suppressed...] --- 2490,2494 ---- } ! if (get_verbose() & VERBOSE_DEBUG) printf ("Parse item status started with: %s\n", p); *************** *** 2495,2499 **** strcpy(itm->stat.comment, p); ! if (get_verbose() & 4) { printf (" source: '%s'\n", itm->source); printf (" name: '%s'\n", itm->name); --- 2500,2504 ---- strcpy(itm->stat.comment, p); ! if (get_verbose() & VERBOSE_DEBUG) { printf (" source: '%s'\n", itm->source); printf (" name: '%s'\n", itm->name); Index: message.h =================================================================== RCS file: /cvsroot/aprsworld/parse/message.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** message.h 29 Jan 2007 21:44:24 -0000 1.10 --- message.h 2 Jan 2008 04:22:32 -0000 1.11 *************** *** 1,2 **** --- 1,3 ---- + // vim:ts=3: #ifndef _MESSAGE_H *************** *** 35,38 **** --- 36,44 ---- #define INSERT_TELEM 256 + #define VERBOSE_ERRORS 1 /* system errors */ + #define VERBOSE_PARSE 2 /* packet parse problems */ + #define VERBOSE_DEBUG 4 /* debugging information */ + #define VERBOSE_NORM 8 /* Normal logging */ + #define VERBOSE_SQL 16 /* SQL statements */ Index: README =================================================================== RCS file: /cvsroot/aprsworld/parse/README,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** README 29 Jan 2007 21:50:05 -0000 1.7 --- README 2 Jan 2008 04:22:32 -0000 1.8 *************** *** 53,56 **** --- 53,57 ---- -v Verbosity level. 0 is pretty quite and 255 is pretty verbose. + See message.h for bitmask definitions. Default is NORM. -i *************** *** 58,67 **** tremendous amounts of disk space. ! -t packets to insert mask. See mysql.h for bitmask defines. -o source callsign Only process packets from specified station. ! -l Do not to last* tables, makes running consume less resources, but curent status/position data must be selected by ordering those specific tables. --- 59,69 ---- tremendous amounts of disk space. ! -t packets to insert mask. See message.h for bitmask definitions. ! Defaults is to everything except STATUS. -o source callsign Only process packets from specified station. ! -l Do not to last* tables, makes running consume less resources, but current status/position data must be selected by ordering those specific tables. *************** *** 78,81 **** --- 80,84 ---- James Jefferson Jarvis KB0THN <kb...@ap...> David Norris KG9AE <da...@we...> + Tim Baggett AA5DF <tba...@us...> X-Astir Dev Team <www.xastir.org> |
|
From: Tim B. <tba...@us...> - 2008-01-02 03:32:48
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv5294 Modified Files: db_pgsql.c Log Message: * Use new PGstringEscapeConn() rather than depreciated PGstringEscape() * Use insert masks to control what gets inserted into the tables * Can now disable storing raw packets into aprs_raw, while still inserting/updating in other tables * Added user_insert() and last_user_insert() functions to support APRS user defined protocol packets. Now links with message.o again :-) * Tested with Postgres 8.2.5 and Postgis 1.2.1 on Ubuntu 7.10 (Gutsy Gibbon) Index: db_pgsql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_pgsql.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** db_pgsql.c 31 Aug 2005 04:54:59 -0000 1.7 --- db_pgsql.c 2 Jan 2008 03:32:46 -0000 1.8 *************** *** 1,6 **** ! /* ! APRS Parser with Database Support ! Copyright (C) 2004 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify --- 1,5 ---- ! /* vim:ts=4: APRS Parser with Database Support ! Copyright (C) 2008 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify *************** *** 145,149 **** } ! *newlen = PQescapeString(pg_escape_buf[pg_escape_buf_index], str, length); if (*newlen > PG_ESCAPE_BUF_STRING_SIZE) { --- 144,148 ---- } ! *newlen = PQescapeStringConn(pg_conn, pg_escape_buf[pg_escape_buf_index], str, length, NULL); if (*newlen > PG_ESCAPE_BUF_STRING_SIZE) { *************** *** 194,198 **** */ ! if ( get_insert_information() ) { snprintf(sql_buf, 4096, "\ INSERT INTO aprs_raw (\ --- 193,199 ---- */ ! if ( ( get_insert_information()) && ! ( get_insert_mask() & INSERT_RAW ) ) { ! // Insert raw data snprintf(sql_buf, 4096, "\ INSERT INTO aprs_raw (\ *************** *** 236,297 **** postgres_escape(raw->information, strlen(raw->information), &newlen), qa_hostid ! ); ! } else { ! snprintf(sql_buf, 4096, "\ ! INSERT INTO aprs_raw (\ ! source, \ ! destination,\ ! digipeater_0,\ ! digipeater_1,\ ! digipeater_2,\ ! digipeater_3,\ ! digipeater_4,\ ! digipeater_5,\ ! digipeater_6,\ ! digipeater_7,\ ! information,\ ! hostid\ ! ) VALUES (\ ! '%s', \ ! '%s',\ ! '%s',\ ! '%s',\ ! '%s',\ ! '%s',\ ! '%s',\ ! '%s',\ ! '%s',\ ! '%s',\ ! '%s',\ ! %d\ ! )", ! postgres_escape(raw->source, strlen(raw->source), &newlen), ! postgres_escape(raw->destination, strlen(raw->destination), &newlen), ! postgres_escape(raw->digipeater[0], strlen(raw->digipeater[0]), &newlen), ! postgres_escape(raw->digipeater[1], strlen(raw->digipeater[1]), &newlen), ! postgres_escape(raw->digipeater[2], strlen(raw->digipeater[2]), &newlen), ! postgres_escape(raw->digipeater[3], strlen(raw->digipeater[3]), &newlen), ! postgres_escape(raw->digipeater[4], strlen(raw->digipeater[4]), &newlen), ! postgres_escape(raw->digipeater[5], strlen(raw->digipeater[5]), &newlen), ! postgres_escape(raw->digipeater[6], strlen(raw->digipeater[6]), &newlen), ! postgres_escape(raw->digipeater[7], strlen(raw->digipeater[7]), &newlen), ! "", ! qa_hostid ! ); ! } ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { PQclear(pg_res); - log_postgres_error(); - return -1; } - PQclear(pg_res); return packet_id; --- 237,273 ---- postgres_escape(raw->information, strlen(raw->information), &newlen), qa_hostid ! ); ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! return -1; ! } ! PQclear(pg_res); ! } else { ! // do not insert raw data ! // We must increment the aprs_raw_seq number so we can insert to other tables ! snprintf(sql_buf, 4096, "SELECT nextval('aprs_raw_seq')"); ! ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! ! pg_res = PQexec(pg_conn, sql_buf); ! if (PQresultStatus(pg_res) != PGRES_TUPLES_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! return -1; ! } ! PQclear(pg_res); } return packet_id; *************** *** 303,306 **** --- 279,285 ---- int newlen; + if ( ! (get_insert_mask()&INSERT_MESSAGE) ) + return; + snprintf(sql_buf, 4096, "\ INSERT INTO aprs_messages (\ *************** *** 339,342 **** --- 318,324 ---- int newlen; + if ( ! (get_insert_mask()&INSERT_STATUS) ) + return; + snprintf(sql_buf, 4096, "\ INSERT INTO aprs_status (\ *************** *** 392,396 **** int newlen; ! if (get_do_last_tables() == 1) { snprintf(sql_buf, 4096, "delete from aprs_laststatus where source = '%s'", postgres_escape(stat->source, strlen(stat->source), &newlen)); --- 374,379 ---- int newlen; ! if ( ( get_do_last_tables() == 1 ) && ! ( get_insert_mask() & INSERT_LAST ) ) { snprintf(sql_buf, 4096, "delete from aprs_laststatus where source = '%s'", postgres_escape(stat->source, strlen(stat->source), &newlen)); *************** *** 453,456 **** --- 436,442 ---- size_t newlen; + if ( ! (get_insert_mask() & INSERT_POSITION) ) + return; + /* We don't even want to bother inserting if the position looks to be obviously bogus. * This gets rid of unlocked GPSs, unconfigured APRS clients, and the like. *************** *** 481,486 **** pos->speed_over_ground, pos->altitude, ! pos->latitude, ! pos->longitude); if (get_verbose() & 2) --- 467,472 ---- pos->speed_over_ground, pos->altitude, ! pos->longitude, ! pos->latitude); if (get_verbose() & 2) *************** *** 503,506 **** --- 489,495 ---- int newlen, count; + if ( ! (get_insert_mask() & INSERT_LAST) ) + return; + /* We don't even want to bother inserting if the position looks to be obviously bogus. * This gets rid of unlocked GPSs, unconfigured APRS clients, and the like. *************** *** 695,698 **** --- 684,690 ---- int newlen, count; + if ( ! (get_insert_mask() & INSERT_WEATHER) ) + return; + snprintf(sql_buf, 4096, "\ INSERT INTO aprs_weather (\ *************** *** 754,758 **** */ ! if (get_do_last_tables() == 1) { snprintf(sql_buf, 4096, "\ --- 746,751 ---- */ ! if ( ( get_do_last_tables() == 1 ) && ! ( get_insert_mask() & INSERT_LAST ) ) { snprintf(sql_buf, 4096, "\ *************** *** 859,1027 **** } } ! snprintf(sql_buf, 4096, "\ ! INSERT INTO aprs_weather (\ ! source,\ ! wind_direction,\ ! wind_speed,\ ! wind_gust,\ ! wind_sustained,\ ! temperature,\ ! rain_hour,\ ! rain_calendar_day,\ ! rain_24hour_day,\ ! humidity,\ ! barometer,\ ! luminosity\ ! ) VALUES (\ ! '%s',\ ! %d,\ ! %d,\ ! %d,\ ! %d,\ ! %d,\ ! %f,\ ! %f,\ ! %f,\ ! %d,\ ! %f,\ ! %d\ ! )", ! postgres_escape(wx->source, strlen(wx->source), &newlen), ! wx->wind_direction, ! wx->wind_speed, ! wx->wind_gust, ! wx->wind_sustained, ! wx->temperature, ! wx->rain_hour, ! wx->rain_calendar_day, ! wx->rain_24hour_day, ! wx->humidity, ! wx->barometer, ! wx->luminosity ! ); ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! } else { ! PQclear(pg_res); ! } ! /* ! * Update aprs_lastweather too ! */ - if (get_do_last_tables() == 1) { ! snprintf(sql_buf, 4096, "\ ! UPDATE aprs_lastweather SET\ ! packet_date = now(),\ ! wind_direction = %d,\ ! wind_speed = %d,\ ! wind_gust = %d,\ ! wind_sustained = %d,\ ! temperature = %d,\ ! rain_hour = %f,\ ! rain_calendar_day = %f,\ ! rain_24hour_day = %f,\ ! humidity = %d,\ ! barometer = %f,\ ! luminosity = %d\ ! WHERE\ ! source = '%s'\ ! ", ! wx->wind_direction, ! wx->wind_speed, ! wx->wind_gust, ! wx->wind_sustained, ! wx->temperature, ! wx->rain_hour, ! wx->rain_calendar_day, ! wx->rain_24hour_day, ! wx->humidity, ! wx->barometer, ! wx->luminosity, ! postgres_escape(wx->source, strlen(wx->source), &newlen) ! ); ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! } else { ! count = atoi(PQcmdTuples(pg_res)); ! PQclear(pg_res); ! } ! // If the update affected zero rows, insert the new record. ! if (count == 0) { ! snprintf(sql_buf, 4096, "\ ! INSERT INTO aprs_lastweather (\ ! source,\ ! wind_direction,\ ! wind_speed,\ ! wind_gust,\ ! wind_sustained,\ ! temperature,\ ! rain_hour,\ ! rain_calendar_day,\ ! rain_24hour_day,\ ! humidity,\ ! barometer,\ ! luminosity\ ! ) VALUES (\ ! '%s',\ ! %d,\ ! %d,\ ! %d,\ ! %d,\ ! %d,\ ! %f,\ ! %f,\ ! %f,\ ! %d,\ ! %f,\ ! %d\ ! )", ! postgres_escape(wx->source, strlen(wx->source), &newlen), ! wx->wind_direction, ! wx->wind_speed, ! wx->wind_gust, ! wx->wind_sustained, ! wx->temperature, ! wx->rain_hour, ! wx->rain_calendar_day, ! wx->rain_24hour_day, ! wx->humidity, ! wx->barometer, ! wx->luminosity ! ); ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! } else { ! PQclear(pg_res); ! } ! } ! } } --- 852,978 ---- } } + } ! void last_user_insert (char *source, char *information, unsigned long packet_id) { ! int i; ! struct sql_insert sql_query; ! int newlen, count; ! if ( ( get_do_last_tables() == 1 ) && ! ( get_insert_mask() & INSERT_LAST ) ) { ! /* Update existing lastuserdefined row */ ! snprintf(sql_buf,4096,"\ ! UPDATE aprs_lastuserdefined SET\ ! packet_date = now(), \ ! user_id = '%s',\ ! packet_type = '%s',\ ! information = '%s'\ ! WHERE \ ! source = '%s' \ ! ", ! postgres_escape(&information[1],1,&newlen), ! postgres_escape(&information[2],1,&newlen), ! postgres_escape(information,strlen(information),&newlen), ! postgres_escape(source,strlen(source),&newlen) ! ); ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! } else { ! count = atoi(PQcmdTuples(pg_res)); ! PQclear(pg_res); ! } ! /* ! * If the update affected zero rows, then there was no previous position report to update, ! * and so we need to add the row. ! */ ! if (count == 0) { ! snprintf(sql_buf,4096,"\ ! INSERT INTO aprs_lastuserdefined (\ ! source, \ ! packet_date, \ ! user_id, \ ! packet_type, \ ! information \ ! ) VALUES ( \ ! '%s', \ ! now(), \ ! '%s',\ ! '%s',\ ! '%s'\ ! )", ! postgres_escape(source,strlen(source),&newlen), ! postgres_escape(&information[1],1,&newlen), ! postgres_escape(&information[2],1,&newlen), ! postgres_escape(information,strlen(information),&newlen) ! ); ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! pg_res = PQexec(pg_conn, sql_buf); ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! } else { ! PQclear(pg_res); ! } ! } ! } ! } ! void user_insert (char *source, char *information, unsigned long packet_id) { ! int i; ! struct sql_insert sql_query; ! int newlen; ! if ( ! (get_insert_mask()&INSERT_USER) ) ! return; ! last_user_insert(source,information,packet_id); ! ! snprintf(sql_buf,4096,"\ ! INSERT INTO aprs_userdefined (\ ! source, \ ! packet_date, \ ! user_id, \ ! packet_type, \ ! information \ ! ) VALUES ( \ ! '%s', \ ! now(), \ ! '%s',\ ! '%s',\ ! '%s'\ ! )", ! ! postgres_escape(source,strlen(source),&newlen), ! postgres_escape(&information[1],1,&newlen), ! postgres_escape(&information[2],1,&newlen), ! postgres_escape(information,strlen(information),&newlen) ! ); ! ! if (get_verbose() & 2) ! printf("SQL: %s\n", sql_buf); ! ! pg_res = PQexec(pg_conn, sql_buf); ! ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { ! PQclear(pg_res); ! log_postgres_error(); ! } else { ! PQclear(pg_res); ! } } *************** *** 1031,1034 **** --- 982,988 ---- int newlen; + if ( ! (get_insert_mask()&INSERT_TELEM) ) + return; + snprintf(sql_buf, 4096, "\ INSERT INTO aprs_telemetry (\ *************** *** 1098,1101 **** --- 1052,1058 ---- char d_7[128]; + if ( ! (get_insert_mask()&INSERT_TELEM) ) + return; + tmptok = strtok(p, ","); if (tmptok != NULL) *************** *** 1410,1413 **** --- 1367,1376 ---- snprintf(sql_buf, 4096, "delete from aprs_lastobject where source = '%s' and name = '%s'", postgres_escape(obj->source, strlen(obj->source), &newlen), postgres_escape(obj->name, strlen(obj->name), &newlen)); + + if (get_verbose() & 2) { + printf("---> Killing object %s\n", obj->name); + printf("SQL: %s\n", sql_buf); + } + pg_res = PQexec(pg_conn, sql_buf); *************** *** 1608,1612 **** pg_res = PQexec(pg_conn, sql_buf); ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { PQclear(pg_res); --- 1571,1575 ---- pg_res = PQexec(pg_conn, sql_buf); ! if (PQresultStatus(pg_res) != PGRES_COMMAND_OK) { PQclear(pg_res); |
|
From: Tim B. <tba...@us...> - 2008-01-02 03:30:26
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv4803 Modified Files: postgres.sql Log Message: * Updating postgres database schema to add tables for user defined protocol. * Tested with Postgres 8.2.5 and Postgis 1.2.1 on Ubuntu 7.10 (Gutsy Gibbon) Index: postgres.sql =================================================================== RCS file: /cvsroot/aprsworld/parse/postgres.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** postgres.sql 2 Mar 2004 06:15:29 -0000 1.2 --- postgres.sql 2 Jan 2008 03:30:28 -0000 1.3 *************** *** 1,5 **** -- AprsWorld PostgreSQL/PostGIS schema -- ! -- PostgreSQL 7.4 and PostGIS 0.8 required -- -- --- 1,6 ---- -- AprsWorld PostgreSQL/PostGIS schema -- ! -- PostgreSQL and PostGIS required ! -- Tested on PostgreSQL 8.2.5 with PostGIS 1.2.1 -- -- *************** *** 14,17 **** --- 15,19 ---- -- LOCK aprs_lastweather IN ACCESS EXCLUSIVE MODE; -- LOCK aprs_lastitem IN ACCESS EXCLUSIVE MODE; + -- LOCK aprs_lastuserdefined IN ACCESS EXCLUSIVE MODE; -- CLUSTER aprs_lastposition; -- CLUSTER aprs_lastobject; *************** *** 19,22 **** --- 21,25 ---- -- CLUSTER aprs_lastweather; -- CLUSTER aprs_lastitem; + -- CLUSTER aprs_lastuserdefined; -- COMMIT; -- *************** *** 27,34 **** --- 30,39 ---- -- delete from aprs_lastobject where packet_date < now() - '1 day'::interval; -- delete from aprs_lastposition where packet_date < now() - '1 day'::interval; + -- delete from aprs_lastuserdefined where packet_date < now() - '1 day'::interval; -- delete from aprs_lastweather where packet_date < now() - '1 day'::interval; -- vacuum aprs_lastitem; -- vacuum aprs_lastobject; -- vacuum aprs_lastposition; + -- vacuum aprs_lastuserdefined; -- vacuum aprs_lastweather; -- analyze; *************** *** 553,556 **** --- 558,593 ---- + -- + -- aprs_userdefined + -- + + DROP TABLE aprs_userdefined; + CREATE TABLE aprs_userdefined ( + packet_id BIGINT NOT NULL default currval('aprs_raw_seq'), + source varchar(20) NOT NULL, + packet_date timestamp NOT null default now(), + user_id char(1) NOT NULL, + packet_type char(1) NOT NULL, + information varchar(256) NOT NULL, + PRIMARY KEY (packet_id) + ); + + + -- + -- aprs_lastuserdefined + -- + + DROP TABLE aprs_lastuserdefined; + CREATE TABLE aprs_lastuserdefined ( + packet_id BIGINT NOT NULL default currval('aprs_raw_seq'), + source varchar(20) NOT NULL, + packet_date timestamp NOT null default now(), + user_id char(1) NOT NULL, + packet_type char(1) NOT NULL, + information varchar(256) NOT NULL, + PRIMARY KEY (source) + ); + + CREATE OR REPLACE FUNCTION aprs_distance(geometry, geometry) RETURNS FLOAT AS ' DECLARE |
|
From: Tim B. <tba...@us...> - 2008-01-02 03:26:05
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv2572 Modified Files: db_flatfile.c Log Message: * Add dummy functions user_insert() and last_user_insert() so it will build with latest message.c. * Now testing insert mask to control adding position and weather data to the files. ! Not tested for functionality - just verified that it compiles error free Index: db_flatfile.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_flatfile.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** db_flatfile.c 31 Aug 2005 05:04:13 -0000 1.3 --- db_flatfile.c 2 Jan 2008 03:26:02 -0000 1.4 *************** *** 1,6 **** ! /* APRS Parser with Database Support ! Copyright (C) 2004 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify --- 1,6 ---- ! /* vim:ts=4: APRS Parser with Database Support ! Copyright (C) 2008 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify *************** *** 94,97 **** --- 94,100 ---- time_t now; + if ( ! (get_insert_mask() & INSERT_POSITION) ) + return; + /* our current time */ now = time(NULL); *************** *** 165,168 **** --- 168,174 ---- time_t now; + if ( ! (get_insert_mask() & INSERT_WEATHER) ) + return; + /* our current time */ now = time(NULL); *************** *** 203,206 **** --- 209,215 ---- + void user_insert (char *source, char *information, unsigned long packet_id) { + } + void telemetry_insert (struct telemetry *telem, unsigned long packet_id) { } |
|
From: James J. <jje...@us...> - 2007-01-29 21:50:12
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22483 Modified Files: README Removed Files: NEWS server.list server_rotate.c watch_size.php Log Message: No longer needed. README updated to add the login information. Index: README =================================================================== RCS file: /cvsroot/aprsworld/parse/README,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** README 23 Sep 2004 15:52:15 -0000 1.6 --- README 29 Jan 2007 21:50:05 -0000 1.7 *************** *** 1,5 **** message James Jefferson Jarvis KB0THN ! 23 September 2004 Parses APRS packets from STDIN or Internet server and stores results in --- 1,5 ---- message James Jefferson Jarvis KB0THN ! 29 January 2007 Parses APRS packets from STDIN or Internet server and stores results in *************** *** 36,69 **** Options: - -a - How many seconds message should allow between receiving Internet data - before giving up and trying to reconnect to the Internet server. -b databaseName Database name to use, default to aprs -h host Database host name, defaults to localhost -u username Database username, defaults to root -p password Database password -d Message becomes a daemon ! -v verbose Level ! Verbose level. 0 is pretty quite and 255 is pretty verbose. -i Do not insert information into raw packet table. Doing this will save tremendous amounts of disk space. ! -j filtering level mask ! Filter out obvious junk that should not have gotten in the APRS stream. Set ! to 255 for best filtering. ! -t packets to insert mask ! Needs to be documented. ! -s serverlist file ! text file with servers and port numbers to connect to. Will automatically ! rotate through the list. -o source callsign Only process packets from specified station. -l Do not to last* tables, makes running consume less resources, but curent status/position data must be selected by ordering those specific tables. -c num When using PostgreSQL database, how many packets to process before issuing COMMIT. Default is 1. Larger values may decrease disk activity. --- 36,75 ---- Options: -b databaseName Database name to use, default to aprs + -h host Database host name, defaults to localhost + -u username Database username, defaults to root + -p password Database password + -d Message becomes a daemon ! ! -v ! Verbosity level. 0 is pretty quite and 255 is pretty verbose. ! -i Do not insert information into raw packet table. Doing this will save tremendous amounts of disk space. ! ! -t packets to insert mask. See mysql.h for bitmask defines. ! -o source callsign Only process packets from specified station. + -l Do not to last* tables, makes running consume less resources, but curent status/position data must be selected by ordering those specific tables. + + -U + username to use send to APRS server when connecting + + -P + passcode to send to APRS server when connecting + -c num When using PostgreSQL database, how many packets to process before issuing COMMIT. Default is 1. Larger values may decrease disk activity. --- NEWS DELETED --- --- server.list DELETED --- --- server_rotate.c DELETED --- --- watch_size.php DELETED --- |
|
From: James J. <jje...@us...> - 2007-01-29 21:49:42
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22080 Modified Files: aprs.sql Log Message: Updated to contain the slightly modified database schema. Seems to work with mysql-5 here. Index: aprs.sql =================================================================== RCS file: /cvsroot/aprsworld/parse/aprs.sql,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** aprs.sql 13 Aug 2003 19:23:06 -0000 1.7 --- aprs.sql 29 Jan 2007 21:49:36 -0000 1.8 *************** *** 1,323 **** ! -- MySQL dump 9.07 -- -- Host: localhost Database: aprs ! --------------------------------------------------------- ! -- Server version 4.0.11a-gamma -- ! -- Table structure for table 'lastposition' -- ! CREATE TABLE lastposition ( ! packet_id int(11) unsigned NOT NULL default '0', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! source varchar(9) NOT NULL default '', ! latitude double(8,6) NOT NULL default '0.000000', ! longitude double(8,6) NOT NULL default '0.000000', ! course smallint(5) unsigned default NULL, ! speed smallint(5) unsigned default NULL, ! altitude mediumint(9) default NULL, ! status tinytext, ! symbol_table char(1) default NULL, ! symbol_code char(1) default NULL, ! PRIMARY KEY (source), ! KEY source (source), ! KEY latitude (latitude), ! KEY longitude (longitude) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'laststatus' -- ! CREATE TABLE laststatus ( ! packet_id int(11) unsigned NOT NULL default '0', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! source varchar(9) NOT NULL default '', ! comment tinytext, ! power tinyint(4) default NULL, ! height smallint(5) unsigned default NULL, ! gain tinyint(4) default NULL, ! directivity tinyint(4) default NULL, ! rate tinyint(4) default NULL, ! symbol_table char(1) default NULL, ! symbol_code char(1) default NULL, ! PRIMARY KEY (source), ! KEY source (source), ! KEY rate (rate) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'lastweather' -- ! CREATE TABLE lastweather ( ! packet_id int(11) unsigned NOT NULL default '0', ! source char(9) NOT NULL default '', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! wind_direction smallint(3) unsigned default NULL, ! wind_speed tinyint(4) unsigned default NULL, ! wind_gust tinyint(4) unsigned default NULL, ! wind_sustained tinyint(4) unsigned default NULL, ! temperature tinyint(4) default NULL, ! rain_hour float default NULL, ! rain_calendar_day float default NULL, ! rain_24hour_day float default NULL, ! humidity tinyint(4) unsigned default NULL, ! barometer double(4,2) unsigned default NULL, ! luminosity smallint(5) unsigned default NULL, ! PRIMARY KEY (source) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'messages' -- ! CREATE TABLE messages ( ! packet_id int(10) unsigned NOT NULL default '0', ! source varchar(9) NOT NULL default '', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! addressee varchar(10) default NULL, ! text varchar(73) default NULL, ! id varchar(10) default NULL, ! KEY source (source), ! KEY addressee (addressee) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'msg2email_snoop_users' -- ! CREATE TABLE msg2email_snoop_users ( ! source varchar(10) NOT NULL default '', ! recipient text NOT NULL, ! form varchar(32) NOT NULL default 'simple.frm' ! ) TYPE=MyISAM; -- ! -- Table structure for table 'msg2email_users' -- ! CREATE TABLE msg2email_users ( ! source varchar(9) NOT NULL default '', ! email text NOT NULL, ! real_name varchar(32) NOT NULL default '', ! to_email text NOT NULL, ! PRIMARY KEY (source), ! UNIQUE KEY source (source) ! ) TYPE=MyISAM COMMENT='Callsign to e-mail address mapping'; -- ! -- Table structure for table 'position' -- ! CREATE TABLE position ( ! packet_id int(10) unsigned NOT NULL default '0', ! source char(9) NOT NULL default '', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! time_of_fix int(10) unsigned default NULL, ! latitude double(8,6) default NULL, ! longitude double(8,6) default NULL, ! course smallint(5) unsigned default NULL, ! speed smallint(3) unsigned default NULL, ! altitude mediumint(5) default NULL, ! UNIQUE KEY packet_id (packet_id), ! KEY source (source), ! KEY packet_date (packet_date) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'qa_hosts' -- ! CREATE TABLE qa_hosts ( ! id smallint(5) unsigned NOT NULL auto_increment, ! host varchar(255) NOT NULL default '', ! active tinyint(1) unsigned NOT NULL default '0', ! PRIMARY KEY (id), ! UNIQUE KEY id (id), ! KEY id_2 (id,host) ! ) TYPE=MyISAM COMMENT='Quality assurance hosts table'; -- ! -- Table structure for table 'raw' -- ! CREATE TABLE raw ( ! packet_id int(10) unsigned NOT NULL auto_increment, ! packet_time int(10) unsigned NOT NULL default '0', ! ip_source varchar(255) default NULL, ! source varchar(9) NOT NULL default '', ! destination varchar(9) NOT NULL default '', ! digipeater_0 varchar(9) default NULL, ! digipeater_1 varchar(9) default NULL, ! digipeater_2 varchar(9) default NULL, ! digipeater_3 varchar(9) default NULL, ! digipeater_4 varchar(9) default NULL, ! digipeater_5 varchar(9) default NULL, ! digipeater_6 varchar(9) default NULL, ! digipeater_7 varchar(9) default NULL, ! information tinytext, ! hostid tinyint(3) unsigned NOT NULL default '0', ! PRIMARY KEY (packet_id), ! UNIQUE KEY packet_id_2 (packet_id), ! KEY packet_time (packet_time) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'status' -- ! CREATE TABLE status ( ! packet_id int(10) unsigned NOT NULL default '0', ! source varchar(9) NOT NULL default '', ! comment tinytext, ! power tinyint(4) default NULL, ! height smallint(5) unsigned default NULL, ! gain tinyint(4) default NULL, ! directivity tinyint(4) default NULL, ! rate tinyint(4) default NULL, ! symbol_table char(1) default NULL, ! symbol_code char(1) default NULL, ! PRIMARY KEY (packet_id) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'telemetry' -- ! CREATE TABLE telemetry ( ! packet_id int(11) NOT NULL default '0', ! source char(10) NOT NULL default '', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! sequence int(3) NOT NULL default '0', ! analog_0 tinyint(3) unsigned NOT NULL default '0', ! analog_1 tinyint(3) unsigned NOT NULL default '0', ! analog_2 tinyint(3) unsigned NOT NULL default '0', ! analog_3 tinyint(3) unsigned NOT NULL default '0', ! analog_4 tinyint(3) unsigned NOT NULL default '0', ! digital tinyint(3) unsigned NOT NULL default '0', ! PRIMARY KEY (packet_id), ! KEY source (source) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'telemetry_coefficients' -- ! CREATE TABLE telemetry_coefficients ( ! source char(10) NOT NULL default '', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! a_0 double default NULL, ! b_0 double default NULL, ! c_0 double default NULL, ! a_1 double default NULL, ! b_1 double default NULL, ! c_1 double default NULL, ! a_2 double default NULL, ! b_2 double default NULL, ! c_2 double default NULL, ! a_3 double default NULL, ! b_3 double default NULL, ! c_3 double default NULL, ! a_4 double default NULL, ! b_4 double default NULL, ! c_4 double default NULL, ! KEY source (source,packet_date) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'telemetry_labels' -- ! CREATE TABLE telemetry_labels ( ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! source varchar(10) NOT NULL default '', ! a_0 tinytext NOT NULL, ! a_1 tinytext NOT NULL, ! a_2 tinytext NOT NULL, ! a_3 tinytext NOT NULL, ! a_4 tinytext NOT NULL, ! d_0 tinytext NOT NULL, ! d_1 tinytext NOT NULL, ! d_2 tinytext NOT NULL, ! d_3 tinytext NOT NULL, ! d_4 tinytext NOT NULL, ! d_5 tinytext NOT NULL, ! d_6 tinytext NOT NULL, ! d_7 tinytext NOT NULL, ! KEY source (source), ! KEY packet_date (packet_date) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'telemetry_units' -- ! CREATE TABLE telemetry_units ( ! source varchar(10) NOT NULL default '', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! a_0 tinytext NOT NULL, ! a_1 tinytext NOT NULL, ! a_2 tinytext NOT NULL, ! a_3 tinytext NOT NULL, ! a_4 tinytext NOT NULL, ! d_0 tinytext NOT NULL, ! d_1 tinytext NOT NULL, ! d_2 tinytext NOT NULL, ! d_3 tinytext NOT NULL, ! d_4 tinytext NOT NULL, ! d_5 tinytext NOT NULL, ! d_6 tinytext NOT NULL, ! d_7 tinytext NOT NULL, ! KEY source (source), ! KEY packet_date (packet_date) ! ) TYPE=MyISAM; -- ! -- Table structure for table 'watch_programs' -- ! CREATE TABLE watch_programs ( ! program tinyint(4) unsigned NOT NULL default '0', ! user varchar(20) default NULL, ! directory text, ! command text NOT NULL, ! PRIMARY KEY (program), ! UNIQUE KEY program (program) ! ) TYPE=MyISAM COMMENT='Listing of programs that can be triggered '; -- ! -- Table structure for table 'watch_users' -- ! CREATE TABLE watch_users ( ! source char(9) NOT NULL default '', ! program tinyint(4) unsigned NOT NULL default '0', ! KEY source (source) ! ) TYPE=MyISAM COMMENT='Callsigns that trigger external programs'; -- ! -- Table structure for table 'weather' -- ! CREATE TABLE weather ( ! packet_id int(11) unsigned NOT NULL default '0', ! source char(9) NOT NULL default '', ! packet_date datetime NOT NULL default '0000-00-00 00:00:00', ! wind_direction smallint(3) unsigned default NULL, ! wind_speed tinyint(4) unsigned default NULL, ! wind_gust tinyint(4) unsigned default NULL, ! wind_sustained tinyint(4) unsigned default NULL, ! temperature tinyint(4) default NULL, ! rain_hour float default NULL, ! rain_calendar_day float default NULL, ! rain_24hour_day float default NULL, ! humidity tinyint(4) unsigned default NULL, ! barometer double(4,2) unsigned default NULL, ! luminosity smallint(5) unsigned default NULL, ! PRIMARY KEY (packet_id), ! KEY source (source), ! KEY packet_date (packet_date) ! ) TYPE=MyISAM; --- 1,391 ---- ! -- MySQL dump 10.10 -- -- Host: localhost Database: aprs ! -- ------------------------------------------------------ ! -- Server version 5.0.22-Debian_0ubuntu6.06.2-log ! ! /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; ! /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; ! /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; ! /*!40101 SET NAMES utf8 */; ! /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; ! /*!40103 SET TIME_ZONE='+00:00' */; ! /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; ! /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; ! /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; ! /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- ! -- Table structure for table `lastposition` -- ! DROP TABLE IF EXISTS `lastposition`; ! CREATE TABLE `lastposition` ( ! `packet_id` int(11) unsigned NOT NULL default '0', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `source` varchar(9) NOT NULL default '', ! `latitude` double NOT NULL, ! `longitude` double NOT NULL, ! `course` smallint(5) unsigned default NULL, ! `speed` smallint(5) unsigned default NULL, ! `altitude` mediumint(9) default NULL, ! `status` tinytext, ! `symbol_table` char(1) default NULL, ! `symbol_code` char(1) default NULL, ! PRIMARY KEY (`source`), ! KEY `source` (`source`), ! KEY `latitude` (`latitude`), ! KEY `longitude` (`longitude`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `laststatus` -- ! DROP TABLE IF EXISTS `laststatus`; ! CREATE TABLE `laststatus` ( ! `packet_id` int(11) unsigned NOT NULL default '0', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `source` varchar(9) NOT NULL default '', ! `comment` tinytext, ! `power` tinyint(4) default NULL, ! `height` smallint(5) unsigned default NULL, ! `gain` tinyint(4) default NULL, ! `directivity` tinyint(4) default NULL, ! `rate` tinyint(4) default NULL, ! `symbol_table` char(1) default NULL, ! `symbol_code` char(1) default NULL, ! PRIMARY KEY (`source`), ! KEY `source` (`source`), ! KEY `rate` (`rate`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `lastuserdefined` -- ! DROP TABLE IF EXISTS `lastuserdefined`; ! CREATE TABLE `lastuserdefined` ( ! `packet_id` int(11) NOT NULL default '0', ! `source` varchar(10) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `user_id` char(1) NOT NULL default '', ! `packet_type` char(1) NOT NULL default '', ! `information` tinytext NOT NULL, ! PRIMARY KEY (`source`), ! KEY `source` (`source`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `lastweather` -- ! DROP TABLE IF EXISTS `lastweather`; ! CREATE TABLE `lastweather` ( ! `packet_id` int(11) unsigned NOT NULL default '0', ! `source` char(9) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `wind_direction` smallint(3) unsigned default NULL, ! `wind_speed` tinyint(4) unsigned default NULL, ! `wind_gust` tinyint(4) unsigned default NULL, ! `wind_sustained` tinyint(4) unsigned default NULL, ! `temperature` tinyint(4) default NULL, ! `rain_hour` float default NULL, ! `rain_calendar_day` float default NULL, ! `rain_24hour_day` float default NULL, ! `humidity` tinyint(4) unsigned default NULL, ! `barometer` double(4,2) unsigned default NULL, ! `luminosity` smallint(5) unsigned default NULL, ! PRIMARY KEY (`source`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `messages` -- ! DROP TABLE IF EXISTS `messages`; ! CREATE TABLE `messages` ( ! `packet_id` int(10) unsigned NOT NULL default '0', ! `source` varchar(9) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `addressee` varchar(10) default NULL, ! `text` varchar(73) default NULL, ! `id` varchar(10) default NULL, ! KEY `source` (`source`), ! KEY `addressee` (`addressee`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `msg2email_snoop_users` -- ! DROP TABLE IF EXISTS `msg2email_snoop_users`; ! CREATE TABLE `msg2email_snoop_users` ( ! `source` varchar(10) NOT NULL default '', ! `recipient` text NOT NULL, ! `form` varchar(32) NOT NULL default 'simple.frm' ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `msg2email_users` -- ! DROP TABLE IF EXISTS `msg2email_users`; ! CREATE TABLE `msg2email_users` ( ! `source` varchar(9) NOT NULL default '', ! `email` text NOT NULL, ! `real_name` varchar(32) NOT NULL default '', ! `to_email` text NOT NULL, ! PRIMARY KEY (`source`), ! UNIQUE KEY `source` (`source`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Callsign to e-mail address mapping'; -- ! -- Table structure for table `position` -- ! DROP TABLE IF EXISTS `position`; ! CREATE TABLE `position` ( ! `packet_id` int(10) unsigned NOT NULL default '0', ! `source` char(9) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `time_of_fix` int(10) unsigned default NULL, ! `latitude` double default NULL, ! `longitude` double default NULL, ! `course` smallint(5) unsigned default NULL, ! `speed` smallint(3) unsigned default NULL, ! `altitude` mediumint(5) default NULL, ! UNIQUE KEY `packet_id` (`packet_id`), ! KEY `source` (`source`), ! KEY `packet_date` (`packet_date`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `qa_hosts` -- ! DROP TABLE IF EXISTS `qa_hosts`; ! CREATE TABLE `qa_hosts` ( ! `id` smallint(5) unsigned NOT NULL auto_increment, ! `host` varchar(255) NOT NULL default '', ! `active` tinyint(1) unsigned NOT NULL default '0', ! PRIMARY KEY (`id`), ! UNIQUE KEY `id` (`id`), ! KEY `id_2` (`id`,`host`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Quality assurance hosts table'; -- ! -- Table structure for table `raw` -- ! DROP TABLE IF EXISTS `raw`; ! CREATE TABLE `raw` ( ! `packet_id` int(10) unsigned NOT NULL auto_increment, ! `packet_time` int(10) unsigned NOT NULL default '0', ! `ip_source` varchar(255) default NULL, ! `source` varchar(9) NOT NULL default '', ! `destination` varchar(9) NOT NULL default '', ! `digipeater_0` varchar(9) default NULL, ! `digipeater_1` varchar(9) default NULL, ! `digipeater_2` varchar(9) default NULL, ! `digipeater_3` varchar(9) default NULL, ! `digipeater_4` varchar(9) default NULL, ! `digipeater_5` varchar(9) default NULL, ! `digipeater_6` varchar(9) default NULL, ! `digipeater_7` varchar(9) default NULL, ! `information` tinytext, ! `hostid` tinyint(3) unsigned NOT NULL default '0', ! PRIMARY KEY (`packet_id`), ! UNIQUE KEY `packet_id_2` (`packet_id`), ! KEY `packet_time` (`packet_time`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `status` -- ! DROP TABLE IF EXISTS `status`; ! CREATE TABLE `status` ( ! `packet_id` int(10) unsigned NOT NULL default '0', ! `source` varchar(9) NOT NULL default '', ! `comment` tinytext, ! `power` tinyint(4) default NULL, ! `height` smallint(5) unsigned default NULL, ! `gain` tinyint(4) default NULL, ! `directivity` tinyint(4) default NULL, ! `rate` tinyint(4) default NULL, ! `symbol_table` char(1) default NULL, ! `symbol_code` char(1) default NULL, ! PRIMARY KEY (`packet_id`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `telemetry` -- ! DROP TABLE IF EXISTS `telemetry`; ! CREATE TABLE `telemetry` ( ! `packet_id` int(11) NOT NULL default '0', ! `source` char(10) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `sequence` int(3) NOT NULL default '0', ! `analog_0` tinyint(3) unsigned NOT NULL default '0', ! `analog_1` tinyint(3) unsigned NOT NULL default '0', ! `analog_2` tinyint(3) unsigned NOT NULL default '0', ! `analog_3` tinyint(3) unsigned NOT NULL default '0', ! `analog_4` tinyint(3) unsigned NOT NULL default '0', ! `digital` tinyint(3) unsigned NOT NULL default '0', ! PRIMARY KEY (`packet_id`), ! KEY `source` (`source`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `telemetry_coefficients` -- ! DROP TABLE IF EXISTS `telemetry_coefficients`; ! CREATE TABLE `telemetry_coefficients` ( ! `source` char(10) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `a_0` double default NULL, ! `b_0` double default NULL, ! `c_0` double default NULL, ! `a_1` double default NULL, ! `b_1` double default NULL, ! `c_1` double default NULL, ! `a_2` double default NULL, ! `b_2` double default NULL, ! `c_2` double default NULL, ! `a_3` double default NULL, ! `b_3` double default NULL, ! `c_3` double default NULL, ! `a_4` double default NULL, ! `b_4` double default NULL, ! `c_4` double default NULL, ! KEY `source` (`source`,`packet_date`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `telemetry_labels` -- ! DROP TABLE IF EXISTS `telemetry_labels`; ! CREATE TABLE `telemetry_labels` ( ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `source` varchar(10) NOT NULL default '', ! `a_0` tinytext NOT NULL, ! `a_1` tinytext NOT NULL, ! `a_2` tinytext NOT NULL, ! `a_3` tinytext NOT NULL, ! `a_4` tinytext NOT NULL, ! `d_0` tinytext NOT NULL, ! `d_1` tinytext NOT NULL, ! `d_2` tinytext NOT NULL, ! `d_3` tinytext NOT NULL, ! `d_4` tinytext NOT NULL, ! `d_5` tinytext NOT NULL, ! `d_6` tinytext NOT NULL, ! `d_7` tinytext NOT NULL, ! KEY `source` (`source`), ! KEY `packet_date` (`packet_date`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `telemetry_units` -- ! DROP TABLE IF EXISTS `telemetry_units`; ! CREATE TABLE `telemetry_units` ( ! `source` varchar(10) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `a_0` tinytext NOT NULL, ! `a_1` tinytext NOT NULL, ! `a_2` tinytext NOT NULL, ! `a_3` tinytext NOT NULL, ! `a_4` tinytext NOT NULL, ! `d_0` tinytext NOT NULL, ! `d_1` tinytext NOT NULL, ! `d_2` tinytext NOT NULL, ! `d_3` tinytext NOT NULL, ! `d_4` tinytext NOT NULL, ! `d_5` tinytext NOT NULL, ! `d_6` tinytext NOT NULL, ! `d_7` tinytext NOT NULL, ! KEY `source` (`source`), ! KEY `packet_date` (`packet_date`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `userdefined` -- ! DROP TABLE IF EXISTS `userdefined`; ! CREATE TABLE `userdefined` ( ! `packet_id` int(11) NOT NULL default '0', ! `source` varchar(10) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `user_id` char(1) NOT NULL default '', ! `packet_type` char(1) NOT NULL default '', ! `information` tinytext NOT NULL, ! PRIMARY KEY (`packet_id`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- ! -- Table structure for table `watch_programs` -- ! DROP TABLE IF EXISTS `watch_programs`; ! CREATE TABLE `watch_programs` ( ! `program` tinyint(4) unsigned NOT NULL default '0', ! `user` varchar(20) default NULL, ! `directory` text, ! `command` text NOT NULL, ! PRIMARY KEY (`program`), ! UNIQUE KEY `program` (`program`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Listing of programs that can be triggered '; ! ! -- ! -- Table structure for table `watch_users` ! -- ! ! DROP TABLE IF EXISTS `watch_users`; ! CREATE TABLE `watch_users` ( ! `source` char(9) NOT NULL default '', ! `program` tinyint(4) unsigned NOT NULL default '0', ! KEY `source` (`source`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Callsigns that trigger external programs'; ! ! -- ! -- Table structure for table `weather` ! -- ! ! DROP TABLE IF EXISTS `weather`; ! CREATE TABLE `weather` ( ! `packet_id` int(11) unsigned NOT NULL default '0', ! `source` char(9) NOT NULL default '', ! `packet_date` datetime NOT NULL default '0000-00-00 00:00:00', ! `wind_direction` smallint(3) unsigned default NULL, ! `wind_speed` tinyint(4) unsigned default NULL, ! `wind_gust` tinyint(4) unsigned default NULL, ! `wind_sustained` tinyint(4) unsigned default NULL, ! `temperature` tinyint(4) default NULL, ! `rain_hour` float default NULL, ! `rain_calendar_day` float default NULL, ! `rain_24hour_day` float default NULL, ! `humidity` tinyint(4) unsigned default NULL, ! `barometer` double(4,2) unsigned default NULL, ! `luminosity` smallint(5) unsigned default NULL, ! PRIMARY KEY (`packet_id`), ! KEY `source` (`source`), ! KEY `packet_date` (`packet_date`) ! ) ENGINE=MyISAM DEFAULT CHARSET=latin1; ! /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; ! ! /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; ! /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; ! /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; ! /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; ! /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; ! /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; ! /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; |
|
From: James J. <jje...@us...> - 2007-01-29 21:44:30
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv20127 Modified Files: db_mysql.c message.c message.h Log Message: Removed server rotation Added server login Some general cleanup in db_mysql Added insert_mask to all db_mysql.c insertion functions. Should be done for pg_sql and flatfile. Index: db_mysql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_mysql.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** db_mysql.c 31 Aug 2005 04:54:59 -0000 1.5 --- db_mysql.c 29 Jan 2007 21:44:24 -0000 1.6 *************** *** 1,6 **** /* - APRS Parser with Database Support ! Copyright (C) 2004 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify --- 1,5 ---- /* APRS Parser with Database Support ! Copyright (C) 2007 James Jefferson Jarvis <kb...@ap...> [...1178 lines suppressed...] ! ! printf("DELETE FROM lastposition WHERE source='%s'\n",obj->name); ! printf("DELETE FROM laststatus WHERE source='%s'\n",obj->name); ! printf("DELETE FROM lastweather WHERE source='%s'\n",obj->name); ! } return; *************** *** 865,869 **** /* mark when the housekeeper should expire it */ ! printf("REPLACE INTO object_expires (source,packet_id,posted) VALUES ('%s',%lu,now())\n",obj->name,packet_id); } --- 984,988 ---- /* mark when the housekeeper should expire it */ ! // printf("REPLACE INTO object_expires (source,packet_id,posted) VALUES ('%s',%lu,now())\n",obj->name,packet_id); } Index: message.c =================================================================== RCS file: /cvsroot/aprsworld/parse/message.c,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** message.c 30 May 2005 01:58:26 -0000 1.93 --- message.c 29 Jan 2007 21:44:24 -0000 1.94 *************** *** 2,6 **** APRS Parser with Database Support ! Copyright (C) 2005 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify --- 2,6 ---- APRS Parser with Database Support ! Copyright (C) 2007 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify *************** *** 69,81 **** /* variables */ ! unsigned int junk_mask = 255; // How much junk filtering we want to do ! unsigned int insert_mask = 255; // which packets to insert ! /* & 1 raw ! * & 2 message ! * & 4 position ! * & 8 status ! * & 16 weather ! * & 32 lastposit ! */ unsigned int verbose; // debugging level --- 69,74 ---- /* variables */ ! unsigned int insert_mask = 0xfff7; /* insert everything besides status */ ! /* insert masks are defined in message.h */ unsigned int verbose; // debugging level *************** *** 102,110 **** /* function prototypes */ double atof (); - void load_server_list(char *filename); - void add_server(char *host, int port); - void create_server_list(void); - void destroy_server_list(void); - void next_server(char *host, int *port); int make_connection (char *host, char *username, char *password, char *database); --- 95,98 ---- *************** *** 124,127 **** --- 112,116 ---- int parse_telemetry (struct telemetry *telem, char *p); void telemetry_insert (struct telemetry *telem, unsigned long packet_id); + void user_insert(char *source, char *information, unsigned long packet_id); int parse_wx (struct weather *wx, char *p); int parse_compressed_object(struct object *obj, char *p); *************** *** 145,153 **** int parse_message (struct message *msg, char *p); void parse_mic_e (struct position *pos, struct status *stat, char *p, char *d, unsigned long packet_id); ! void onalarm(); ! void inet_feed(int alarm_time); void stdin_feed(void); int main (int argc, char *argv[]); ! void inet_connect(); int valid_packet(char *buffer); void watch_trigger(char *callsign, unsigned long packet_id); --- 134,141 ---- int parse_message (struct message *msg, char *p); void parse_mic_e (struct position *pos, struct status *stat, char *p, char *d, unsigned long packet_id); ! void inet_feed(char *hostname, int port, char *username, char *password); void stdin_feed(void); int main (int argc, char *argv[]); ! int inet_connect(char *hostname, int port, char *username, char *password); int valid_packet(char *buffer); void watch_trigger(char *callsign, unsigned long packet_id); *************** *** 162,178 **** int extract_weather_item(char *data, char type, int datalen, char *temp); - /* for server rotation */ - Inet_server *data_servers; - #define INITIAL_SERVER_SET_COUNT 4 - int num_data_servers=0; - int num_data_servers_allocated=INITIAL_SERVER_SET_COUNT; - /* Yarg, these should be done in a cleaner way. */ unsigned int get_insert_information(void){ ! return insert_information; } unsigned int get_verbose(void){ ! return verbose; } int get_do_last_tables(void){ /* why isn't this unsigned? */ --- 150,164 ---- int extract_weather_item(char *data, char type, int datalen, char *temp); /* Yarg, these should be done in a cleaner way. */ unsigned int get_insert_information(void){ ! return insert_information; } unsigned int get_verbose(void){ ! return verbose; } + unsigned int get_insert_mask(void) { + return insert_mask; + } + int get_do_last_tables(void){ /* why isn't this unsigned? */ *************** *** 181,248 **** - void load_server_list(char *filename) { - FILE *fp; - char buffer[256]; - int i=num_data_servers; - - - printf("# LOADING DATA SOURCE LIST FROM %s\n",filename); - fp = fopen(filename,"r"); - - while ( fgets(buffer,256,fp) ) { - // printf("# '%s'\n",buffer); - - if ( i >= num_data_servers_allocated ) { - num_data_servers_allocated += INITIAL_SERVER_SET_COUNT; // how much to add - data_servers = realloc(data_servers,num_data_servers_allocated*sizeof(Inet_server)); - } - - sscanf(buffer,"%s %d",&data_servers[i].hostname, &data_servers[i].port); - printf("# %s:%d ADDED TO DATA SOURCE LIST\n",data_servers[i].hostname,data_servers[i].port); - i++; - } - - fclose(fp); - - num_data_servers = i; - } - - void add_server(char *host, int port) { - - if ( num_data_servers+1 >= num_data_servers_allocated ) { - num_data_servers_allocated ++ ; // how much to add - data_servers = realloc(data_servers,num_data_servers_allocated*sizeof(Inet_server)); - } - - strncpy(data_servers[num_data_servers].hostname,host,256); - data_servers[num_data_servers].port = port; - - num_data_servers++; - } - - void create_server_list(void) { - data_servers = calloc(num_data_servers_allocated,sizeof(Inet_server)); - } - - void destroy_server_list(void) { - num_data_servers_allocated=num_data_servers=0; - free(data_servers); - } - - - void next_server(char *host, int *port) { - static int current=0; - - - printf("# NEXT SERVER (%d)",current); - - strcpy(host,data_servers[current].hostname); - *port = data_servers[current].port; - - current = (current + 1) % num_data_servers; - - printf(" IS %s:%d\n",host,*port); - } - /* Take degree.minute and return degree.decimal */ double dm2dd(double dm) { --- 167,170 ---- *************** *** 1414,1506 **** ! void onalarm() { ! // if ( get_verbose() & 1 ) ! printf("We have not recieved inet traffic recently ... reconnecting.\n"); ! inet_connect(); ! } ! ! void inet_connect() { struct hostent *he; ! static int connected=0; ! static char host[256]; ! static int port; ! int connect_count=0; ! ! if ( connect_count >= num_data_servers ) { ! connect_count = 0; } ! connect_count++; ! while(!connected){ ! /* get next server in rotation */ ! next_server(host,&port); ! printf("# given %s:%d\n",host,port); ! ! close(sockfd); ! ! if ( get_verbose() & 4) ! printf("Connecting to: %s(%d)\n",host,port); ! ! if ( (he = gethostbyname (host) ) == NULL ) { ! // perror ("gethostbyname"); /* DNS lookups always "Success"fully fail. */ ! herror("DNS lookup failed"); ! if ( get_verbose() & 4) ! printf("Sleeping 10 seconds.\n"); ! sleep(10); ! continue; ! } ! ! if ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) == -1) { ! perror ("socket"); ! if ( get_verbose() & 4) ! printf("Sleeping 10 seconds.\n"); ! sleep(10); ! continue; ! } ! ! their_addr.sin_family = AF_INET; // host byte order ! their_addr.sin_port = htons (port); // short, network byte order ! memcpy(( caddr_t )&(their_addr.sin_addr), he->h_addr, he->h_length); ! memset(&(their_addr.sin_zero), 0, 8); // zero the rest of the struct ! ! if (connect(sockfd, (struct sockaddr *) &their_addr,sizeof (struct sockaddr)) == -1) { ! perror ("Error connecting"); ! if ( get_verbose() & 4) ! printf("Sleeping 10 seconds.\n"); ! sleep(10); ! continue; ! } ! /* Set the host id for raw packets */ ! qa_hostid = set_qa_hostid( host ); ! connected=1; ! } /* while not connected */ } ! void inet_feed(int alarm_time) { char buffer[BUFFSIZE], *p; int numbytes; int count = 0; time_t marker; ! /* begin SQL transaction */ ! db_begin_txn(); ! time(&marker); for(;;) { ! ! inet_connect(); ! ! /* ! * We have alarm_time seconds to get back here, or the inet ! * connection gets restarted. ! */ ! alarm(alarm_time); while ((numbytes = recv (sockfd, buffer, BUFFSIZE, 0)) > 0) { buffer[numbytes] = '\0'; - alarm(0); // Don't alarm processing. - process(strtok(buffer,"\r\n")); while ( p = strtok(NULL,"\r\n") ) { --- 1336,1423 ---- ! int inet_connect(char *host, int port, char *username, char *password) { struct hostent *he; ! char loginBuff[256]; ! int nSentBytes, nReadBytes; ! ! if ( get_verbose() & 4) ! printf("Connecting to: %s(%d)\n",host,port); ! ! if ( (he = gethostbyname (host) ) == NULL ) { ! herror("DNS lookup failed"); ! ! return 1; } ! ! if ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) == -1) { ! perror ("socket"); ! return 2; ! } ! ! their_addr.sin_family = AF_INET; // host byte order ! their_addr.sin_port = htons (port); // short, network byte order ! memcpy(( caddr_t )&(their_addr.sin_addr), he->h_addr, he->h_length); ! memset(&(their_addr.sin_zero), 0, 8); // zero the rest of the struct ! ! ! if (connect(sockfd, (struct sockaddr *) &their_addr,sizeof (struct sockaddr)) == -1) { ! perror ("Error connecting"); ! ! return 3; ! } ! ! /* connected */ ! ! /* send our login string if we have it */ ! if ( strlen(username) > 0 && strlen(password) > 0 ) { ! sprintf(loginBuff,"user %s pass %s\n",username,password); ! if ( 2 & get_verbose() ) ! printf("Sending login: %s",loginBuff); ! ! nReadBytes = strlen(loginBuff); ! nSentBytes=0; ! ! while (nSentBytes < nReadBytes) { ! int nTemp = send(sockfd, loginBuff + nSentBytes, nReadBytes - nSentBytes, 0); ! ! if (nTemp > 0) { ! nSentBytes += nTemp; ! } else { ! fprintf(stderr,"Connection unexpectedly dropped while sending login.\n"); ! /* unexpectedly dropped connection while sending login */ ! return 4; ! } ! } ! } ! ! /* Set the host id for raw packets */ ! qa_hostid = set_qa_hostid( host ); ! ! return 0; } ! void inet_feed(char *hostname, int port, char *username, char *password) { char buffer[BUFFSIZE], *p; int numbytes; int count = 0; time_t marker; + int r; ! /* begin SQL transaction */ ! db_begin_txn(); ! time(&marker); for(;;) { ! r=inet_connect(hostname, port, username, password); ! if ( r ) { ! /* error connecting */ ! return; ! } while ((numbytes = recv (sockfd, buffer, BUFFSIZE, 0)) > 0) { buffer[numbytes] = '\0'; process(strtok(buffer,"\r\n")); while ( p = strtok(NULL,"\r\n") ) { *************** *** 1510,1514 **** ++count; ! /* commit SQL transaction if needed */ if (count % packets_per_commit == 0) { --- 1427,1431 ---- ++count; ! /* commit SQL transaction if needed */ if (count % packets_per_commit == 0) { *************** *** 1523,1528 **** } - alarm(alarm_time); - } --- 1440,1443 ---- *************** *** 1545,1567 **** int main (int argc, char *argv[]) { ! char db_database[256], db_host[256], db_user[256], db_pass[256]; int n, daemon = 0; char server_list[256]; - int alarm_time=60; /* how long to set alarm for */ - int rotate=0; - - signal(SIGALRM,(void (*)) onalarm); /* call onalarm() when we get an alarm */ - /* Default database values */ ! strcpy (db_database, "aprs"); ! strcpy (db_host, "localhost"); ! strcpy (db_user, "root"); ! strcpy (db_pass, "roadtoad"); ! strcpy (server_list, "server.list"); ! while ((n = getopt (argc, argv, "a:b:c:dgh:ij:lo:p:s:t:u:v:")) != -1) { switch (n) { /* only process packets with this source callsign */ case 'o': --- 1460,1488 ---- int main (int argc, char *argv[]) { ! char db_database[256], db_host[256], db_user[256], db_pass[256]; /* database information */ ! char aUsername[16], aPassword[16]; /* APRS host username and password */ int n, daemon = 0; char server_list[256]; /* Default database values */ ! strcpy(db_database, "aprs"); ! strcpy(db_host, "localhost"); ! strcpy(db_user, "root"); ! strcpy(db_pass, "roadtoad"); ! strcpy(aUsername, "NOCALL"); ! strcpy(aPassword,"12960"); ! while ((n = getopt (argc, argv, "o:it:lb:h:u:p:dv:c:U:P:")) != -1) { switch (n) { + case 'U': + strncpy(aUsername,optarg,16); + aUsername[15]='\0'; + break; + case 'P': + strncpy(aPassword,optarg,16); + aPassword[15]='\0'; + break; + /* only process packets with this source callsign */ case 'o': *************** *** 1577,1586 **** insert_information=0; break; - /* Junk filtering. Clean up some really obvious junk that shouldn't have gotten to us. */ - case 'j': - junk_mask = atoi(optarg); - if ( get_verbose() & 1 ) - fprintf(stderr, "JUNK MASK=%d\n", junk_mask); - break; /* Insert masks is a bit-masked integer that controls what packets are inserted into * the database --- 1498,1501 ---- *************** *** 1589,1605 **** insert_mask = atoi(optarg); if (get_verbose() & 1) ! fprintf (stderr, "INSERT MASK=%d\n", insert_mask); ! break; ! /* Alarm_time is the time before we give up on our internet connection and attempt ! * to reconnect ! */ ! case 'a': ! alarm_time = atoi(optarg); ! break; ! ! /* server rotation */ ! case 's': ! strncpy(server_list,optarg,256); ! rotate=1; break; --- 1504,1508 ---- insert_mask = atoi(optarg); if (get_verbose() & 1) ! fprintf (stderr, "INSERT MASK=0x%2X\n", insert_mask); break; *************** *** 1649,1676 **** } ! if (make_connection(db_host, db_user, db_pass, db_database)) { ! fprintf (stderr, "%sCould not connect to database%s\n",RED_TEXT, DEFAULT_TEXT); ! exit (1); ! } ! ! /* allocate memory for server list */ ! create_server_list(); ! ! if ( rotate ) { ! load_server_list(server_list); ! printf("# %d DATA SERVERS LOADED\n",num_data_servers); ! } ! ! /* If we have two additional arguments that we haven't parsed, then we are to connect ! * to an internet server ! */ ! if ( !rotate &&( optind + 2 == argc ) ) { ! add_server(argv[optind],atoi(argv[optind+1])); // host, port } - /* GNU GPL suggests that we display this. */ if (get_verbose() & 4) { ! printf("APRS Parser with Database Support, Copyright (C) 2004 James Jefferson Jarvis\n"); printf("This software comes with ABSOLUTELY NO WARRANTY\n"); printf("This is free software, and you are welcome to redistribute it "); --- 1552,1563 ---- } ! if (make_connection(db_host, db_user, db_pass, db_database)) { ! fprintf (stderr, "%sCould not connect to database%s\n",RED_TEXT, DEFAULT_TEXT); ! exit (1); } /* GNU GPL suggests that we display this. */ if (get_verbose() & 4) { ! printf("APRS Parser with Database Support, Copyright (C) 2007 James Jefferson Jarvis\n"); printf("This software comes with ABSOLUTELY NO WARRANTY\n"); printf("This is free software, and you are welcome to redistribute it "); *************** *** 1680,1700 **** fprintf (stderr, "%sParser started%s\n", GREEN_TEXT, DEFAULT_TEXT); - /* If we are not connected to the internet then we are using stdin for input */ - if ( 0 == num_data_servers ) { - /* Set the host id for raw packets */ - qa_hostid = set_qa_hostid( "stdin" ); ! stdin_feed(); } else { ! inet_feed(alarm_time); } ! /* Close database link so we are not hogging resources when we are done */ ! close_connection(); ! destroy_server_list(); if (get_verbose() & 1) fprintf (stderr, "%sProgram terminated normally.%s\n", GREEN_TEXT, DEFAULT_TEXT); } --- 1567,1590 ---- fprintf (stderr, "%sParser started%s\n", GREEN_TEXT, DEFAULT_TEXT); ! /* start processing input from internet server (if two additional arguments) or stdin */ ! if ( optind + 2 == argc ) { ! inet_feed(argv[optind],atoi(argv[optind+1]),aUsername,aPassword); } else { ! /* otherwise we are getting input from stdin */ ! qa_hostid = set_qa_hostid( "stdin" ); ! stdin_feed(); } ! ! /* done parsing */ ! /* Close database link so we are not hogging resources when we are done */ ! close_connection(); if (get_verbose() & 1) fprintf (stderr, "%sProgram terminated normally.%s\n", GREEN_TEXT, DEFAULT_TEXT); + + exit(0); } *************** *** 1809,1818 **** if ( 0 == parse_message (&msg, packet.information) ) { /* Junk filter for USERLIST and javaMSG */ - if ( junk_mask && - (!strncmp(msg.addressee,"USERLIST",7) || !strncmp(msg.addressee,"javaMSG",7)) ) { - if ( get_verbose() & 4 ) - printf("got USERLIST or javaMSG, we are not inserting it\n"); - break; - } message_insert (&msg, packet_id); } --- 1699,1702 ---- *************** *** 1954,1962 **** /* Not implemented */ ! case '}': /* User defined format, Bob B WB4APR is currently keeping the list */ if (get_verbose() & 4) printf("User defined %s\n", packet.source); packet_count[USER]++; break; --- 1838,1848 ---- /* Not implemented */ ! case '{': /* User defined format, Bob B WB4APR is currently keeping the list */ if (get_verbose() & 4) printf("User defined %s\n", packet.source); + user_insert(packet.source,packet.information,packet_id); + packet_count[USER]++; break; *************** *** 1998,2002 **** } ! if ( insert_mask & 64 ) { if ( get_verbose() & 4 ) printf("Checking to see if \"%s\" is in watch_users\n",packet.source); --- 1884,1888 ---- } ! if ( insert_mask & INSERT_WATCH ) { if ( get_verbose() & 4 ) printf("Checking to see if \"%s\" is in watch_users\n",packet.source); *************** *** 2018,2022 **** /* Last position table stores the only the most recent position information for each * distinct callsign. */ ! if ( insert_mask & 32 && pos.latitude != 0 && pos.longitude != 0 ) { if ( get_verbose() & 4) printf("Inserting last position\n"); --- 1904,1908 ---- /* Last position table stores the only the most recent position information for each * distinct callsign. */ ! if ( pos.latitude != 0 && pos.longitude != 0 ) { if ( get_verbose() & 4) printf("Inserting last position\n"); Index: message.h =================================================================== RCS file: /cvsroot/aprsworld/parse/message.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** message.h 2 Sep 2004 04:08:46 -0000 1.9 --- message.h 29 Jan 2007 21:44:24 -0000 1.10 *************** *** 25,28 **** --- 25,39 ---- #define DEFAULT_TEXT "\033[0m" + #define INSERT_RAW 1 + #define INSERT_MESSAGE 2 + #define INSERT_POSITION 4 + #define INSERT_STATUS 8 + #define INSERT_WEATHER 16 + #define INSERT_LAST 32 /* all last tables {laststatus, lastweather, lastposition, lastuserdefined } */ + #define INSERT_WATCH 64 + #define INSERT_USER 128 + #define INSERT_TELEM 256 + + struct telemetry { |
|
From: David N. <au...@us...> - 2005-08-31 05:04:21
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14991 Modified Files: db_flatfile.c Log Message: Segfault when opening non-accessible files. Added error handling to fopen in db_flatfile.c Index: db_flatfile.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_flatfile.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** db_flatfile.c 30 May 2005 02:06:23 -0000 1.2 --- db_flatfile.c 31 Aug 2005 05:04:13 -0000 1.3 *************** *** 104,108 **** fp=fopen(filename,"a"); ! sprintf(line,"%u\t%2.6lf\t%2.6lf\t%d\t%d\t%d\n", (unsigned int) now, pos->latitude, --- 104,112 ---- fp=fopen(filename,"a"); ! if( !fp ){ ! printf("%s: %s\n", filename, strerror(errno)); ! exit(1); ! } ! sprintf(line,"%externiu\t%2.6lf\t%2.6lf\t%d\t%d\t%d\n", (unsigned int) now, pos->latitude, *************** *** 171,174 **** --- 175,182 ---- fp=fopen(filename,"a"); + if( !fp ){ + printf("%s: %s\n", filename, strerror(errno)); + exit(1); + } sprintf(line,"%u\t%d\t%d\t%d\t%d\t%d\t%f\t%f\t%f\t%d\t%f\t%d\t%d\t%d\t%d\t%d\n", (unsigned int) now, |
|
From: David N. <au...@us...> - 2005-08-31 04:55:07
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12871 Modified Files: db_mysql.c db_pgsql.c Log Message: Removed extern references. Index: db_mysql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_mysql.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** db_mysql.c 30 Jul 2005 20:25:02 -0000 1.4 --- db_mysql.c 31 Aug 2005 04:54:59 -0000 1.5 *************** *** 103,107 **** unsigned long packet_insert (struct raw_packet *raw) { ! extern struct sql_insert sql_query; unsigned long packet_id = 1; int newlen; --- 103,107 ---- unsigned long packet_insert (struct raw_packet *raw) { ! struct sql_insert sql_query; unsigned long packet_id = 1; int newlen; *************** *** 178,182 **** void message_insert (struct message *msg, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen; --- 178,182 ---- void message_insert (struct message *msg, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen; *************** *** 219,223 **** void status_insert (struct status *stat, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen; --- 219,223 ---- void status_insert (struct status *stat, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen; *************** *** 274,278 **** void laststatus_insert (struct status *stat, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen; --- 274,278 ---- void laststatus_insert (struct status *stat, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen; *************** *** 333,337 **** void position_insert (struct position *pos, unsigned long packet_id) { ! extern struct sql_insert sql_query; char *quotebuf[1024]; size_t newlen; --- 333,337 ---- void position_insert (struct position *pos, unsigned long packet_id) { ! struct sql_insert sql_query; char *quotebuf[1024]; size_t newlen; *************** *** 394,398 **** void lastposition_insert (struct position *pos, struct status *stat, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen, count; --- 394,398 ---- void lastposition_insert (struct position *pos, struct status *stat, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen, count; *************** *** 633,637 **** void weather_insert (struct weather *wx, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen, count; --- 633,637 ---- void weather_insert (struct weather *wx, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen, count; *************** *** 710,714 **** void telemetry_insert (struct telemetry *telem, unsigned long packet_id) { int i; ! extern struct sql_insert sql_query; int newlen; --- 710,714 ---- void telemetry_insert (struct telemetry *telem, unsigned long packet_id) { int i; ! struct sql_insert sql_query; int newlen; *************** *** 761,765 **** int i; char *val; ! extern struct sql_insert sql_query; int newlen; char *tmptok; --- 761,765 ---- int i; char *val; ! struct sql_insert sql_query; int newlen; char *tmptok; Index: db_pgsql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_pgsql.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** db_pgsql.c 30 Jul 2005 20:37:28 -0000 1.6 --- db_pgsql.c 31 Aug 2005 04:54:59 -0000 1.7 *************** *** 186,190 **** unsigned long packet_insert (struct raw_packet *raw) { ! extern struct sql_insert sql_query; unsigned long packet_id = 1; int newlen; --- 186,190 ---- unsigned long packet_insert (struct raw_packet *raw) { ! struct sql_insert sql_query; unsigned long packet_id = 1; int newlen; *************** *** 300,304 **** void message_insert (struct message *msg, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen; --- 300,304 ---- void message_insert (struct message *msg, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen; *************** *** 336,340 **** void status_insert (struct status *stat, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen; --- 336,340 ---- void status_insert (struct status *stat, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen; *************** *** 389,393 **** void laststatus_insert (struct status *stat, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen; --- 389,393 ---- void laststatus_insert (struct status *stat, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen; *************** *** 449,453 **** void position_insert (struct position *pos, unsigned long packet_id) { ! extern struct sql_insert sql_query; char *quotebuf[1024]; size_t newlen; --- 449,453 ---- void position_insert (struct position *pos, unsigned long packet_id) { ! struct sql_insert sql_query; char *quotebuf[1024]; size_t newlen; *************** *** 500,504 **** void lastposition_insert (struct position *pos, struct status *stat, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen, count; --- 500,504 ---- void lastposition_insert (struct position *pos, struct status *stat, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen, count; *************** *** 692,696 **** void weather_insert (struct weather *wx, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen, count; --- 692,696 ---- void weather_insert (struct weather *wx, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen, count; *************** *** 1028,1032 **** void telemetry_insert (struct telemetry *telem, unsigned long packet_id) { int i; ! extern struct sql_insert sql_query; int newlen; --- 1028,1032 ---- void telemetry_insert (struct telemetry *telem, unsigned long packet_id) { int i; ! struct sql_insert sql_query; int newlen; *************** *** 1079,1083 **** int i; char *val; ! extern struct sql_insert sql_query; int newlen; char *tmptok; --- 1079,1083 ---- int i; char *val; ! struct sql_insert sql_query; int newlen; char *tmptok; *************** *** 1323,1327 **** void object_insert (struct object *obj, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen, count; --- 1323,1327 ---- void object_insert (struct object *obj, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen, count; *************** *** 1575,1579 **** void item_insert(struct item *itm, unsigned long packet_id) { ! extern struct sql_insert sql_query; int newlen, count; --- 1575,1579 ---- void item_insert(struct item *itm, unsigned long packet_id) { ! struct sql_insert sql_query; int newlen, count; |
|
From: David N. <au...@us...> - 2005-07-30 20:37:37
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6241 Modified Files: db_pgsql.c Log Message: Fixed bug where all POINT inserts were flipped around. PostgreSQL POINT(x,y) corresponds to POINT(longitude, latitude) in the PostGIS spatial extensions. Index: db_pgsql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_pgsql.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** db_pgsql.c 30 Jul 2005 20:25:02 -0000 1.5 --- db_pgsql.c 30 Jul 2005 20:37:28 -0000 1.6 *************** *** 533,538 **** postgres_escape(&stat->symbol_table, 1, &newlen), postgres_escape(&stat->symbol_code, 1, &newlen), - pos->latitude, pos->longitude, postgres_escape(pos->source, strlen(pos->source), &newlen) ); --- 533,538 ---- postgres_escape(&stat->symbol_table, 1, &newlen), postgres_escape(&stat->symbol_code, 1, &newlen), pos->longitude, + pos->latitude, postgres_escape(pos->source, strlen(pos->source), &newlen) ); *************** *** 586,591 **** postgres_escape(&stat->symbol_table, 1, &newlen), postgres_escape(&stat->symbol_code, 1, &newlen), ! pos->latitude, ! pos->longitude); if (get_verbose() & 2) --- 586,591 ---- postgres_escape(&stat->symbol_table, 1, &newlen), postgres_escape(&stat->symbol_code, 1, &newlen), ! pos->longitude, ! pos->latitude); if (get_verbose() & 2) *************** *** 1390,1395 **** obj->pos.speed_over_ground, obj->pos.altitude, ! obj->pos.latitude, ! obj->pos.longitude ); --- 1390,1395 ---- obj->pos.speed_over_ground, obj->pos.altitude, ! obj->pos.longitude, ! obj->pos.latitude ); *************** *** 1468,1473 **** obj->pos.speed_over_ground, obj->pos.altitude, - obj->pos.latitude, obj->pos.longitude, postgres_escape(obj->source, strlen(obj->source), &newlen), postgres_escape(obj->name, strlen(obj->name), &newlen) --- 1468,1473 ---- obj->pos.speed_over_ground, obj->pos.altitude, obj->pos.longitude, + obj->pos.latitude, postgres_escape(obj->source, strlen(obj->source), &newlen), postgres_escape(obj->name, strlen(obj->name), &newlen) *************** *** 1553,1558 **** obj->pos.speed_over_ground, obj->pos.altitude, ! obj->pos.latitude, ! obj->pos.longitude ); --- 1553,1558 ---- obj->pos.speed_over_ground, obj->pos.altitude, ! obj->pos.longitude, ! obj->pos.latitude ); *************** *** 1600,1605 **** postgres_escape(&itm->stat.symbol_code, 1, &newlen), postgres_escape(itm->stat.comment, strlen(itm->stat.comment), &newlen), ! itm->pos.latitude, ! itm->pos.longitude ); --- 1600,1605 ---- postgres_escape(&itm->stat.symbol_code, 1, &newlen), postgres_escape(itm->stat.comment, strlen(itm->stat.comment), &newlen), ! itm->pos.longitude, ! itm->pos.latitude ); *************** *** 1649,1654 **** postgres_escape(&itm->stat.symbol_code, 1, &newlen), postgres_escape(itm->stat.comment, strlen(itm->stat.comment), &newlen), - itm->pos.latitude, itm->pos.longitude, postgres_escape(itm->source, strlen(itm->source), &newlen), postgres_escape(itm->name, strlen(itm->name), &newlen) --- 1649,1654 ---- postgres_escape(&itm->stat.symbol_code, 1, &newlen), postgres_escape(itm->stat.comment, strlen(itm->stat.comment), &newlen), itm->pos.longitude, + itm->pos.latitude, postgres_escape(itm->source, strlen(itm->source), &newlen), postgres_escape(itm->name, strlen(itm->name), &newlen) *************** *** 1692,1697 **** postgres_escape(&itm->stat.symbol_code, 1, &newlen), postgres_escape(itm->stat.comment, strlen(itm->stat.comment), &newlen), ! itm->pos.latitude, ! itm->pos.longitude ); --- 1692,1697 ---- postgres_escape(&itm->stat.symbol_code, 1, &newlen), postgres_escape(itm->stat.comment, strlen(itm->stat.comment), &newlen), ! itm->pos.longitude, ! itm->pos.latitude ); |
|
From: David N. <au...@us...> - 2005-07-30 20:25:12
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4472 Modified Files: db_mysql.c db_pgsql.c sqlinsert.c Added Files: sqlinsert.h Log Message: Defined sql_insert structure in sqlinsert.h header and include it in sql modules. --- NEW FILE: sqlinsert.h --- /* APRS Parser with Database Support Copyright (C) 2004 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* I think this motto was in mind when APRS was designed: * "Never make anything simple and efficient when a way can be found to make it * complex and wonderful" -- Found in the fortune */ /* BUG This structure probably shouldn't be statically defined ... problems will result if we want * more than 20 elements! */ struct sql_insert { int index; int val_index; char table_name[256]; char column_name[20][256]; char column_value[20][256]; char column_null_value[20][256]; }; Index: db_mysql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_mysql.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** db_mysql.c 23 Sep 2004 15:52:15 -0000 1.3 --- db_mysql.c 30 Jul 2005 20:25:02 -0000 1.4 *************** *** 65,68 **** --- 65,69 ---- #include "db_mysql.h" #include "message.h" + #include "sqlinsert.h" int log_mysql_error() { Index: db_pgsql.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_pgsql.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** db_pgsql.c 5 Sep 2004 09:35:46 -0000 1.4 --- db_pgsql.c 30 Jul 2005 20:25:02 -0000 1.5 *************** *** 65,69 **** #include "db_pgsql.h" #include "message.h" ! int log_postgres_error() { --- 65,69 ---- #include "db_pgsql.h" #include "message.h" ! #include "sqlinsert.h" int log_postgres_error() { Index: sqlinsert.c =================================================================== RCS file: /cvsroot/aprsworld/parse/sqlinsert.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sqlinsert.c 6 Oct 2002 01:49:31 -0000 1.5 --- sqlinsert.c 30 Jul 2005 20:25:02 -0000 1.6 *************** *** 1,2 **** --- 1,27 ---- + /* + + APRS Parser with Database Support + Copyright (C) 2004 James Jefferson Jarvis <kb...@ap...> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + /* I think this motto was in mind when APRS was designed: + * "Never make anything simple and efficient when a way can be found to make it + * complex and wonderful" -- Found in the fortune + */ + #include <stdio.h> #include <string.h> *************** *** 7,26 **** #endif ! ! /* BUG This structure probably shouldn't be statically defined ... problems will result if we want ! * more than 20 elements! */ ! ! ! ! struct sql_insert { ! int index; ! int val_index; ! char table_name[256]; ! char column_name[20][256]; ! char column_value[20][256]; ! char column_null_value[20][256]; ! }; ! ! struct sql_insert sql_query; void query(struct sql_insert *q, char *s, char *action) --- 32,36 ---- #endif ! #include "sqlinsert.h" void query(struct sql_insert *q, char *s, char *action) *************** *** 169,173 **** int i; char s[4096]; ! sql_insert_table(&sql_query,"messages"); --- 179,184 ---- int i; char s[4096]; ! ! struct sql_insert sql_query; sql_insert_table(&sql_query,"messages"); *************** *** 191,193 **** } #endif - --- 202,203 ---- |
|
From: James J. <jje...@us...> - 2005-05-30 02:06:32
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4482 Modified Files: db_flatfile.c Log Message: Very rudimentary flatfile support for weather and position Index: db_flatfile.c =================================================================== RCS file: /cvsroot/aprsworld/parse/db_flatfile.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** db_flatfile.c 24 Sep 2004 02:33:34 -0000 1.1 --- db_flatfile.c 30 May 2005 02:06:23 -0000 1.2 *************** *** 0 **** --- 1,208 ---- + /* + + APRS Parser with Database Support + Copyright (C) 2004 James Jefferson Jarvis <kb...@ap...> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #include <stdio.h> + #ifdef HAVE_STRING_H + #include <string.h> + #endif + #include <time.h> + #ifdef HAVE_STDLIB_H + #include <stdlib.h> + #endif + #ifdef HAVE_UNISTD_H + #include <unistd.h> + #endif + #include <signal.h> + #include <errno.h> + + + #include <math.h> + #include <pwd.h> + #include "db_flatfile.h" + #include "message.h" + + + /* dummy database transactions */ + int db_begin_txn(void){ + return 0; + } + int db_commit_txn(void){ + return 0; + } + int db_rollback_txn(void){ + return 0; + } + + int make_connection (char *host, char *username, char *password, char *database) { + return 0; + } + + void close_connection(void) { + } + + + unsigned long packet_insert (struct raw_packet *raw) { + } + + + void message_insert (struct message *msg, unsigned long packet_id) { + } + + void status_insert (struct status *stat, unsigned long packet_id) { + } + + + + void laststatus_insert (struct status *stat, unsigned long packet_id) { + } + + + /* file format: + packet_date | %d + latitude | %2.6lf + longitude | %2.6lf + course | %d + speed | %d + altitude | %d + */ + + void position_insert (struct position *pos, unsigned long packet_id) { + FILE *fp; + char filename[128]; + char line[1024]; + time_t now; + + /* our current time */ + now = time(NULL); + + if ( 0 == strcmp(pos->source,"") ) + return; + + sprintf(filename,"data/position/%s",pos->source); + // printf("POS: %s\n",filename); + + fp=fopen(filename,"a"); + sprintf(line,"%u\t%2.6lf\t%2.6lf\t%d\t%d\t%d\n", + (unsigned int) now, + pos->latitude, + pos->longitude, + (int) pos->course_made_good, + (int) pos->speed_over_ground, + (int) pos->altitude + ); + fputs(line,fp); + fclose(fp); + + } + + + void lastposition_insert (struct position *pos, struct status *stat, unsigned long packet_id) { + } + + /* + * Returns: + * hostid on success + * 0 on failure + * + */ + int set_qa_hostid( char *hostname ) { + return 1; + } + + + + + void watch_trigger(char *callsign, unsigned long packet_id) { + } + + void telemetry_coefficients(char *p, char *source) { + } + + + /* + packet_date + wind_direction + wind_speed + wind_gust + wind_sustained + temperature + rain_hour + rain_calendar_day + rain_24hour_day + humidity + barometer + luminosity + */ + void weather_insert (struct weather *wx, unsigned long packet_id) { + FILE *fp; + char filename[128]; + char line[1024]; + time_t now; + + /* our current time */ + now = time(NULL); + + if ( 0 == strcmp(wx->source,"") ) + return; + + sprintf(filename,"data/weather/%s",wx->source); + // printf("WX: %s\n",filename); + + fp=fopen(filename,"a"); + sprintf(line,"%u\t%d\t%d\t%d\t%d\t%d\t%f\t%f\t%f\t%d\t%f\t%d\t%d\t%d\t%d\t%d\n", + (unsigned int) now, + wx->wind_direction, + wx->wind_speed, + wx->wind_gust, + wx->wind_sustained, + wx->temperature, + wx->rain_hour, + wx->rain_calendar_day, + wx->rain_24hour_day, + wx->humidity, + wx->barometer, + wx->luminosity, + wx->rain_count, + wx->snowfall_24hour_day, + wx->fuel_temp, + wx->fuel_moisture + ); + fputs(line,fp); + fclose(fp); + + } + + + void telemetry_insert (struct telemetry *telem, unsigned long packet_id) { + } + + void telemetry_labels_units(char *p, char *source, char *table) { + } + + void item_insert(struct item *itm, unsigned long packet_id) { + } + + + void object_insert (struct object *obj, unsigned long packet_id) { + } |
|
From: James J. <jje...@us...> - 2005-05-30 02:02:04
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2332 Modified Files: aclocal.m4 Makefile.in configure Log Message: Silly autoconf Index: aclocal.m4 =================================================================== RCS file: /cvsroot/aprsworld/parse/aclocal.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** aclocal.m4 5 Sep 2004 09:50:00 -0000 1.4 --- aclocal.m4 30 May 2005 02:01:48 -0000 1.5 *************** *** 1,825 **** ! # generated automatically by aclocal 1.8.3 -*- Autoconf -*- ! ! # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 ! # Free Software Foundation, Inc. ! # This file is free software; the Free Software Foundation ! # gives unlimited permission to copy and/or distribute it, ! # with or without modifications, as long as this notice is preserved. ! ! # This program is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY, to the extent permitted by law; without [...1920 lines suppressed...] ! [AC_PREREQ([2.12]) ! AC_CONFIG_HEADER([$1]) ! dnl When config.status generates a header, we must update the stamp-h file. ! dnl This file resides in the same directory as the config header ! dnl that is generated. We must strip everything past the first ":", ! dnl and everything past the last "/". ! AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl ! ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, ! <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, ! <<am_indx=1 ! for am_file in <<$1>>; do ! case " <<$>>CONFIG_HEADERS " in ! *" <<$>>am_file "*<<)>> ! echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ! ;; ! esac ! am_indx=`expr "<<$>>am_indx" + 1` ! done<<>>dnl>>) ! changequote([,]))]) Index: Makefile.in =================================================================== RCS file: /cvsroot/aprsworld/parse/Makefile.in,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Makefile.in 24 Sep 2004 02:33:33 -0000 1.12 --- Makefile.in 30 May 2005 02:01:48 -0000 1.13 *************** *** 1,7 **** ! # Makefile.in generated by automake 1.8.3 from Makefile.am. ! # @configure_input@ ! # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ! # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, --- 1,5 ---- ! # Makefile.in generated automatically by automake 1.4-p6 from Makefile.am ! # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, *************** *** 13,34 **** # PARTICULAR PURPOSE. - @SET_MAKE@ - # Makefile.in for APRSWorld Parser, David L Norris # $Id$ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ! am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ ! install_sh_DATA = $(install_sh) -c -m 644 ! install_sh_PROGRAM = $(install_sh) -c ! install_sh_SCRIPT = $(install_sh) -c ! INSTALL_HEADER = $(INSTALL_DATA) ! transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : --- 11,51 ---- # PARTICULAR PURPOSE. # Makefile.in for APRSWorld Parser, David L Norris # $Id$ + + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ + sbindir = @sbindir@ + libexecdir = @libexecdir@ + datadir = @datadir@ + sysconfdir = @sysconfdir@ + sharedstatedir = @sharedstatedir@ + localstatedir = @localstatedir@ + infodir = @infodir@ + mandir = @mandir@ + includedir = @includedir@ + oldincludedir = /usr/include + + DESTDIR = + pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = . ! ! ACLOCAL = @ACLOCAL@ ! AUTOCONF = @AUTOCONF@ ! AUTOMAKE = @AUTOMAKE@ ! AUTOHEADER = @AUTOHEADER@ ! INSTALL = @INSTALL@ ! INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) ! INSTALL_DATA = @INSTALL_DATA@ ! INSTALL_SCRIPT = @INSTALL_SCRIPT@ ! transform = @program_transform_name@ ! NORMAL_INSTALL = : PRE_INSTALL = : *************** *** 37,294 **** PRE_UNINSTALL = : POST_UNINSTALL = : ! subdir = . ! DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ ! $(srcdir)/Makefile.in $(srcdir)/config.h.in \ ! $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ ! depcomp install-sh missing mkinstalldirs ! ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ! am__aclocal_m4_deps = $(top_srcdir)/configure.ac ! am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ! $(ACLOCAL_M4) ! am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ ! configure.lineno configure.status.lineno ! mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ! CONFIG_HEADER = config.h ! CONFIG_CLEAN_FILES = ! SOURCES = ! DIST_SOURCES = ! DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ! distdir = $(PACKAGE)-$(VERSION) ! top_distdir = $(distdir) ! am__remove_distdir = \ ! { test ! -d $(distdir) \ ! || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ ! && rm -fr $(distdir); }; } ! DIST_ARCHIVES = $(distdir).tar.gz ! GZIP_ENV = --best ! distuninstallcheck_listfiles = find . -type f -print ! distcleancheck_listfiles = find . -type f -print ! ACLOCAL = @ACLOCAL@ ! AMDEP_FALSE = @AMDEP_FALSE@ ! AMDEP_TRUE = @AMDEP_TRUE@ ! AMTAR = @AMTAR@ ! AUTOCONF = @AUTOCONF@ ! AUTOHEADER = @AUTOHEADER@ ! AUTOMAKE = @AUTOMAKE@ ! AWK = @AWK@ ! ! # C compiler ! CC = @CC@ ! CCDEPMODE = @CCDEPMODE@ ! ! # Flags for C compiler ! CFLAGS = -DVERSION=\"$(VERSION)\" -I. $(cflags) ! CPP = @CPP@ ! CPPFLAGS = @CPPFLAGS@ ! CYGPATH_W = @CYGPATH_W@ ! DEFS = @DEFS@ ! DEPDIR = @DEPDIR@ ! ECHO_C = @ECHO_C@ ! ECHO_N = @ECHO_N@ ! ECHO_T = @ECHO_T@ ! EGREP = @EGREP@ ! EXEEXT = @EXEEXT@ FLATFILE_CFLAGS = @FLATFILE_CFLAGS@ ! FLATFILE_LIBS = @FLATFILE_LIBS@ ! FLATFILE_OBJS = @FLATFILE_OBJS@ ! INSTALL_DATA = @INSTALL_DATA@ ! INSTALL_PROGRAM = @INSTALL_PROGRAM@ ! INSTALL_SCRIPT = @INSTALL_SCRIPT@ ! INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ ! LDFLAGS = $(ldflags) ! LIBOBJS = @LIBOBJS@ ! LIBS = @LIBS@ ! LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ - MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ - MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ - MYSQL_LIBS = @MYSQL_LIBS@ - MYSQL_OBJS = @MYSQL_OBJS@ MYSQL_REQUIRED_VERSION = @MYSQL_REQUIRED_VERSION@ NET_LIBS = @NET_LIBS@ - OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ - PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ - PACKAGE_NAME = @PACKAGE_NAME@ - PACKAGE_STRING = @PACKAGE_STRING@ - PACKAGE_TARNAME = @PACKAGE_TARNAME@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ PGSQL_CFLAGS = @PGSQL_CFLAGS@ PGSQL_CONFIG = @PGSQL_CONFIG@ - PGSQL_LIBS = @PGSQL_LIBS@ - PGSQL_OBJS = @PGSQL_OBJS@ PGSQL_REQUIRED_VERSION = @PGSQL_REQUIRED_VERSION@ ! SET_MAKE = @SET_MAKE@ ! SHELL = /bin/sh ! STRIP = @STRIP@ VERSION = @VERSION@ ! ac_ct_CC = @ac_ct_CC@ ! ac_ct_STRIP = @ac_ct_STRIP@ ! am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ ! am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ ! am__include = @am__include@ ! am__leading_dot = @am__leading_dot@ ! am__quote = @am__quote@ bindir = $(prefix)/bin - build_alias = @build_alias@ - datadir = @datadir@ exec_prefix = @exec_prefix@ - host_alias = @host_alias@ - includedir = @includedir@ - infodir = @infodir@ - install_sh = @install_sh@ libdir = @libdir@ - libexecdir = @libexecdir@ - localstatedir = @localstatedir@ - mandir = @mandir@ - mkdir_p = @mkdir_p@ - oldincludedir = @oldincludedir@ - prefix = @prefix@ - program_transform_name = @program_transform_name@ - sbindir = @sbindir@ - sharedstatedir = @sharedstatedir@ - sysconfdir = @sysconfdir@ - target_alias = @target_alias@ - NAME = @PACKAGE@ cflags = @CFLAGS@ @MYSQL_CFLAGS@ @PGSQL_CFLAGS@ @FLATFILE_CFLAGS@ ldflags = @LDFLAGS@ # Object Files to Compile. ! OBJS = daemon.o message.o mic_e.o navi-tra.o ultimeter.o UNCOMP_OBJS = uncompress.o # This is incorrect but will do until Makefile.am is rewritten. ! EXTRA_DIST = db_mysql.c db_pgsql.h metric.h mic_e.h \ ! server_rotate.c ultimeter.h daemon.c db_mysql.h message.c \ ! mic_e.c mic_e_parser.c sqlinsert.c uncompress.c \ ! daemon.h db_pgsql.c message.h mice.c navi-tra.c ultimeter.c SUFFIXES = .o .c ! all: config.h ! $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: ! .SUFFIXES: .o .c ! am--refresh: ! @: ! $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ! @for dep in $?; do \ ! case '$(am__configure_deps)' in \ ! *$$dep*) \ ! echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ ! cd $(srcdir) && $(AUTOMAKE) --gnu \ ! && exit 0; \ ! exit 1;; \ ! esac; \ ! done; \ ! echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ ! cd $(top_srcdir) && \ ! $(AUTOMAKE) --gnu Makefile ! .PRECIOUS: Makefile ! Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ! @case '$?' in \ ! *config.status*) \ ! echo ' $(SHELL) ./config.status'; \ ! $(SHELL) ./config.status;; \ ! *) \ ! echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ ! cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ ! esac; ! $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ! $(SHELL) ./config.status --recheck ! $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) - $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) ! config.h: stamp-h1 @if test ! -f $@; then \ ! rm -f stamp-h1; \ ! $(MAKE) stamp-h1; \ else :; fi ! ! stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status ! @rm -f stamp-h1 ! cd $(top_builddir) && $(SHELL) ./config.status config.h ! $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) ! rm -f stamp-h1 ! touch $@ ! ! distclean-hdr: ! -rm -f config.h stamp-h1 ! uninstall-info-am: ! tags: TAGS ! TAGS: ! ! ctags: CTAGS ! CTAGS: ! ! distdir: $(DISTFILES) ! $(am__remove_distdir) ! mkdir $(distdir) ! @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ ! topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ ! list='$(DISTFILES)'; for file in $$list; do \ ! case $$file in \ ! $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ ! $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ ! esac; \ ! if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ ! dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ ! if test "$$dir" != "$$file" && test "$$dir" != "."; then \ ! dir="/$$dir"; \ ! $(mkdir_p) "$(distdir)$$dir"; \ ! else \ ! dir=''; \ ! fi; \ ! if test -d $$d/$$file; then \ ! if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ ! cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ ! fi; \ ! cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ ! else \ ! test -f $(distdir)/$$file \ ! || cp -p $$d/$$file $(distdir)/$$file \ ! || exit 1; \ ! fi; \ ! done ! -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ ! || chmod -R a+r $(distdir) ! dist-gzip: distdir ! $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ! $(am__remove_distdir) ! dist-bzip2: distdir ! $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 ! $(am__remove_distdir) ! dist-tarZ: distdir ! $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z ! $(am__remove_distdir) ! dist-shar: distdir ! shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz ! $(am__remove_distdir) - dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) ! dist dist-all: distdir ! $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ! $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then --- 54,177 ---- PRE_UNINSTALL = : POST_UNINSTALL = : ! host_alias = @host_alias@ ! host_triplet = @host@ FLATFILE_CFLAGS = @FLATFILE_CFLAGS@ ! HAVE_LIB = @HAVE_LIB@ ! LIB = @LIB@ ! LTLIB = @LTLIB@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MYSQL_CFLAGS = @MYSQL_CFLAGS@ MYSQL_CONFIG = @MYSQL_CONFIG@ MYSQL_REQUIRED_VERSION = @MYSQL_REQUIRED_VERSION@ NET_LIBS = @NET_LIBS@ PACKAGE = @PACKAGE@ PGSQL_CFLAGS = @PGSQL_CFLAGS@ PGSQL_CONFIG = @PGSQL_CONFIG@ PGSQL_REQUIRED_VERSION = @PGSQL_REQUIRED_VERSION@ ! ! NAME = @PACKAGE@ VERSION = @VERSION@ ! ! # C compiler ! CC = @CC@ ! ! SHELL = /bin/sh ! prefix = @prefix@ bindir = $(prefix)/bin exec_prefix = @exec_prefix@ libdir = @libdir@ cflags = @CFLAGS@ @MYSQL_CFLAGS@ @PGSQL_CFLAGS@ @FLATFILE_CFLAGS@ ldflags = @LDFLAGS@ + LIBS = @LIBS@ + MYSQL_LIBS = @MYSQL_LIBS@ + PGSQL_LIBS = @PGSQL_LIBS@ + FLATFILE_LIBS = @FLATFILE_LIBS@ + + # Flags for C compiler + CFLAGS = -DVERSION=\"$(VERSION)\" -I. $(cflags) + LDFLAGS = $(ldflags) + # Object Files to Compile. ! OBJS = daemon.o message.o mic_e.o navi-tra.o ultimeter.o metric.o ! MYSQL_OBJS = @MYSQL_OBJS@ ! PGSQL_OBJS = @PGSQL_OBJS@ ! FLATFILE_OBJS = @FLATFILE_OBJS@ UNCOMP_OBJS = uncompress.o # This is incorrect but will do until Makefile.am is rewritten. ! EXTRA_DIST = db_mysql.c db_pgsql.h metric.h metric.c mic_e.h server_rotate.c ultimeter.h daemon.c db_mysql.h message.c mic_e.c mic_e_parser.c sqlinsert.c uncompress.c daemon.h db_pgsql.c message.h mice.c navi-tra.c ultimeter.c ! SUFFIXES = .o .c ! ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ! mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ! CONFIG_HEADER = config.h ! CONFIG_CLEAN_FILES = ! COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ! CCLD = $(CC) ! LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ ! DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ ! Makefile.am Makefile.in NEWS aclocal.m4 config.guess config.h.in \ ! config.sub configure configure.ac install-sh missing mkinstalldirs ! + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + + TAR = tar + GZIP_ENV = --best + all: all-redirect .SUFFIXES: ! .SUFFIXES: .c .o ! $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) ! cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile ! Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ! cd $(top_builddir) \ ! && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status ! $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.ac ! cd $(srcdir) && $(ACLOCAL) ! ! config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ! $(SHELL) ./config.status --recheck ! $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) ! config.h: stamp-h @if test ! -f $@; then \ ! rm -f stamp-h; \ ! $(MAKE) stamp-h; \ else :; fi ! stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status ! cd $(top_builddir) \ ! && CONFIG_FILES= CONFIG_HEADERS=config.h \ ! $(SHELL) ./config.status ! @echo timestamp > stamp-h 2> /dev/null ! $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in ! @if test ! -f $@; then \ ! rm -f $(srcdir)/stamp-h.in; \ ! $(MAKE) $(srcdir)/stamp-h.in; \ ! else :; fi ! $(srcdir)/stamp-h.in: $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) ! @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null ! mostlyclean-hdr: ! clean-hdr: ! distclean-hdr: ! -rm -f config.h ! maintainer-clean-hdr: ! tags: TAGS ! TAGS: ! distdir = $(PACKAGE)-$(VERSION) ! top_distdir = $(distdir) # This target untars the dist file and tries a VPATH configuration. Then *************** *** 296,320 **** # tarfile. distcheck: dist ! case '$(DIST_ARCHIVES)' in \ ! *.tar.gz*) \ ! GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ ! *.tar.bz2*) \ ! bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ ! *.tar.Z*) \ ! uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ ! *.shar.gz*) \ ! GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\ ! *.zip*) \ ! unzip $(distdir).zip ;;\ ! esac ! chmod -R a-w $(distdir); chmod a+w $(distdir) ! mkdir $(distdir)/_build ! mkdir $(distdir)/_inst ! chmod a-w $(distdir) ! dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ ! && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ ! && cd $(distdir)/_build \ ! && ../configure --srcdir=.. --prefix="$$dc_install_base" \ ! $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ --- 179,189 ---- # tarfile. distcheck: dist ! -rm -rf $(distdir) ! GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz ! mkdir $(distdir)/=build ! mkdir $(distdir)/=inst ! dc_install_base=`cd $(distdir)/=inst && pwd`; \ ! cd $(distdir)/=build \ ! && ../configure --srcdir=.. --prefix=$$dc_install_base \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ *************** *** 322,380 **** && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ ! && $(MAKE) $(AM_MAKEFLAGS) uninstall \ ! && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ ! distuninstallcheck \ ! && chmod -R a-w "$$dc_install_base" \ ! && ({ \ ! (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ ! && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ ! && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ ! && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ ! distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ ! } || { rm -rf "$$dc_destdir"; exit 1; }) \ ! && rm -rf "$$dc_destdir" \ ! && $(MAKE) $(AM_MAKEFLAGS) dist \ ! && rm -rf $(DIST_ARCHIVES) \ ! && $(MAKE) $(AM_MAKEFLAGS) distcleancheck ! $(am__remove_distdir) ! @(echo "$(distdir) archives ready for distribution: "; \ ! list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ ! sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' ! distuninstallcheck: ! @cd $(distuninstallcheck_dir) \ ! && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ ! || { echo "ERROR: files left after uninstall:" ; \ ! if test -n "$(DESTDIR)"; then \ ! echo " (check DESTDIR support)"; \ ! fi ; \ ! $(distuninstallcheck_listfiles) ; \ ! exit 1; } >&2 ! distcleancheck: distclean ! @if test '$(srcdir)' = . ; then \ ! echo "ERROR: distcleancheck can only run from a VPATH build" ; \ ! exit 1 ; \ ! fi ! @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ ! || { echo "ERROR: files left in build directory after distclean:" ; \ ! $(distcleancheck_listfiles) ; \ ! exit 1; } >&2 check-am: all-am check: check-am ! all-am: Makefile config.h ! installdirs: ! install: install-am install-exec: install-exec-am install-data: install-data-am - uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am ! ! installcheck: installcheck-am install-strip: ! $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ ! install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ ! `test -z '$(STRIP)' || \ ! echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: --- 191,257 ---- && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ ! && $(MAKE) $(AM_MAKEFLAGS) dist ! -rm -rf $(distdir) ! @banner="$(distdir).tar.gz is ready for distribution"; \ ! dashes=`echo "$$banner" | sed s/./=/g`; \ ! echo "$$dashes"; \ ! echo "$$banner"; \ ! echo "$$dashes" ! dist: distdir ! -chmod -R a+r $(distdir) ! GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) ! -rm -rf $(distdir) ! dist-all: distdir ! -chmod -R a+r $(distdir) ! GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) ! -rm -rf $(distdir) ! distdir: $(DISTFILES) ! -rm -rf $(distdir) ! mkdir $(distdir) ! -chmod 777 $(distdir) ! here=`cd $(top_builddir) && pwd`; \ ! top_distdir=`cd $(distdir) && pwd`; \ ! distdir=`cd $(distdir) && pwd`; \ ! cd $(top_srcdir) \ ! && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile ! @for file in $(DISTFILES); do \ ! d=$(srcdir); \ ! if test -d $$d/$$file; then \ ! cp -pr $$d/$$file $(distdir)/$$file; \ ! else \ ! test -f $(distdir)/$$file \ ! || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ! || cp -p $$d/$$file $(distdir)/$$file || :; \ ! fi; \ ! done ! info-am: ! info: info-am ! dvi-am: ! dvi: dvi-am check-am: all-am check: check-am ! installcheck-am: ! installcheck: installcheck-am ! all-recursive-am: config.h ! $(MAKE) $(AM_MAKEFLAGS) all-recursive ! ! install-exec-am: install-exec: install-exec-am + + install-data-am: install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am ! install: install-am ! uninstall-am: ! uninstall: uninstall-am ! all-am: Makefile config.h ! all-redirect: all-am install-strip: ! $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install ! installdirs: ! ! mostlyclean-generic: *************** *** 382,447 **** distclean-generic: ! -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: ! @echo "This command is intended for maintainers to use" ! @echo "it deletes files that may require special tools to rebuild." ! clean-am: clean-generic mostlyclean-am ! ! distclean: distclean-am ! -rm -f $(am__CONFIG_DISTCLEAN_FILES) ! -rm -f Makefile ! distclean-am: clean-am distclean-generic distclean-hdr ! ! dvi: dvi-am ! ! dvi-am: ! ! html: html-am ! ! info: info-am ! ! info-am: ! ! install-data-am: ! ! install-exec-am: ! ! install-info: install-info-am ! ! install-man: ! ! installcheck-am: ! ! maintainer-clean: maintainer-clean-am ! -rm -f $(am__CONFIG_DISTCLEAN_FILES) ! -rm -rf $(top_srcdir)/autom4te.cache ! -rm -f Makefile ! maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am ! mostlyclean-am: mostlyclean-generic ! pdf: pdf-am ! pdf-am: ! ps: ps-am ! ps-am: ! uninstall-am: uninstall-info-am ! .PHONY: all all-am am--refresh check check-am clean clean-generic dist \ ! dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip \ ! distcheck distclean distclean-generic distclean-hdr \ ! distcleancheck distdir distuninstallcheck dvi dvi-am html \ ! html-am info info-am install install-am install-data \ ! install-data-am install-exec install-exec-am install-info \ ! install-info-am install-man install-strip installcheck \ ! installcheck-am installdirs maintainer-clean \ ! maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ ! pdf-am ps ps-am uninstall uninstall-am uninstall-info-am --- 259,294 ---- distclean-generic: ! -rm -f Makefile $(CONFIG_CLEAN_FILES) ! -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: ! mostlyclean-am: mostlyclean-hdr mostlyclean-generic mostlyclean: mostlyclean-am ! clean-am: clean-hdr clean-generic mostlyclean-am ! clean: clean-am ! distclean-am: distclean-hdr distclean-generic clean-am ! distclean: distclean-am ! -rm -f config.status ! maintainer-clean-am: maintainer-clean-hdr maintainer-clean-generic \ ! distclean-am ! @echo "This command is intended for maintainers to use;" ! @echo "it deletes files that may require special tools to rebuild." ! maintainer-clean: maintainer-clean-am ! -rm -f config.status ! .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ ! tags distdir info-am info dvi-am dvi check check-am installcheck-am \ ! installcheck all-recursive-am install-exec-am install-exec \ ! install-data-am install-data install-am install uninstall-am uninstall \ ! all-redirect all-am all installdirs mostlyclean-generic \ ! distclean-generic clean-generic maintainer-clean-generic clean \ ! mostlyclean distclean maintainer-clean *************** *** 465,468 **** --- 312,316 ---- realclean: rm -f $(OBJS) $(MYSQL_OBJS) $(PGSQL_OBJS) $(FLATFILE_OBJS) $(UNCOMP_OBJS) message uncompress sqlinsert Makefile config.h + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. Index: configure =================================================================== RCS file: /cvsroot/aprsworld/parse/configure,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** configure 24 Sep 2004 02:33:34 -0000 1.10 --- configure 30 May 2005 02:01:48 -0000 1.11 *************** *** 312,316 **** #endif" ! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP MYSQL_CONFIG PGSQL_CONFIG LIBOBJS NET_LIBS MATH_LIBS PGSQL_REQUIRED_VERSION MYSQL_REQUIRED_VERSION MYSQL_LIBS MYSQL_CFLAGS MYSQL_OBJS PGSQL_LIBS PGSQL_CFLAGS PGSQL_OBJS FLATFILE_LIBS FLATFILE_CFLAGS FLATFILE_OBJS LTLIBOBJS' ac_subst_files='' --- 312,316 ---- #endif" ! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MYSQL_CONFIG PGSQL_CONFIG LIBOBJS NET_LIBS MATH_LIBS PGSQL_REQUIRED_VERSION MYSQL_REQUIRED_VERSION MYSQL_LIBS MYSQL_CFLAGS MYSQL_OBJS PGSQL_LIBS PGSQL_CFLAGS PGSQL_OBJS FLATFILE_LIBS FLATFILE_CFLAGS FLATFILE_OBJS LTLIBOBJS' ac_subst_files='' [...1273 lines suppressed...] ! s/.*/./; q'` ! done ! test ! -n "$as_dirs" || mkdir $as_dirs ! fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 ! echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} ! { (exit 1); exit 1; }; }; } ! ! # echo "creating $dirpart/$file" ! echo '# dummy' > "$dirpart/$file" ! done ! done ! ;; esac done --- 7405,7409 ---- echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in ! default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; esac done |
|
From: James J. <jje...@us...> - 2005-05-30 01:58:46
|
Update of /cvsroot/aprsworld/parse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv410 Modified Files: message.c Makefile.am metric.h Added Files: metric.c Log Message: Wrote a new fahrenheit to celsius conversion function that rounds to the nearest integer. --- NEW FILE: metric.c --- /* convert degrees f to degrees c and round in appropriate manner */ int F_TO_C(int f) { double d; d = (f-32.0)*(5.0/9.0); if ( d > 0 ) return (int) (d+0.5); return (int) (d-0.5); } Index: message.c =================================================================== RCS file: /cvsroot/aprsworld/parse/message.c,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** message.c 23 Sep 2004 15:52:15 -0000 1.92 --- message.c 30 May 2005 01:58:26 -0000 1.93 *************** *** 2,6 **** APRS Parser with Database Support ! Copyright (C) 2004 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify --- 2,6 ---- APRS Parser with Database Support ! Copyright (C) 2005 James Jefferson Jarvis <kb...@ap...> This program is free software; you can redistribute it and/or modify *************** *** 168,172 **** int num_data_servers_allocated=INITIAL_SERVER_SET_COUNT; - /* Yarg, these should be done in a cleaner way. */ unsigned int get_insert_information(void){ --- 168,171 ---- *************** *** 1736,1739 **** --- 1735,1739 ---- */ void process (char *buffer) { + static int tick=0; unsigned long packet_id; struct raw_packet packet; *************** *** 2024,2027 **** --- 2024,2036 ---- } + /* tick marks */ + tick++; + if ( 0 == (tick % 100) ) { + putchar('.'); + fflush(stdout); + tick=0; + } + + /* Seperator bar */ if (get_verbose() & 2) *************** *** 2349,2353 **** // raw rain counter if (extract_weather_item(p,'#',3, buffer) == 1) { ! obj->wx.rain_counter = atoi(buffer); p += 4; } --- 2358,2362 ---- // raw rain counter if (extract_weather_item(p,'#',3, buffer) == 1) { ! obj->wx.rain_count = atoi(buffer); p += 4; } *************** *** 2446,2449 **** --- 2455,2462 ---- wx->luminosity=-1; wx->rain_count=0; + + wx->snowfall_24hour_day=0; + wx->fuel_temp=-100; + wx->fuel_moisture=0; } Index: Makefile.am =================================================================== RCS file: /cvsroot/aprsworld/parse/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.am 24 Sep 2004 02:33:33 -0000 1.7 --- Makefile.am 30 May 2005 01:58:26 -0000 1.8 *************** *** 26,30 **** # Object Files to Compile. ! OBJS = daemon.o message.o mic_e.o navi-tra.o ultimeter.o MYSQL_OBJS = @MYSQL_OBJS@ PGSQL_OBJS = @PGSQL_OBJS@ --- 26,30 ---- # Object Files to Compile. ! OBJS = daemon.o message.o mic_e.o navi-tra.o ultimeter.o metric.o MYSQL_OBJS = @MYSQL_OBJS@ PGSQL_OBJS = @PGSQL_OBJS@ *************** *** 33,37 **** # This is incorrect but will do until Makefile.am is rewritten. ! EXTRA_DIST=db_mysql.c db_pgsql.h metric.h mic_e.h \ server_rotate.c ultimeter.h daemon.c db_mysql.h message.c \ mic_e.c mic_e_parser.c sqlinsert.c uncompress.c \ --- 33,37 ---- # This is incorrect but will do until Makefile.am is rewritten. ! EXTRA_DIST=db_mysql.c db_pgsql.h metric.h metric.c mic_e.h \ server_rotate.c ultimeter.h daemon.c db_mysql.h message.c \ mic_e.c mic_e_parser.c sqlinsert.c uncompress.c \ Index: metric.h =================================================================== RCS file: /cvsroot/aprsworld/parse/metric.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** metric.h 29 Jun 2002 00:19:10 -0000 1.2 --- metric.h 30 May 2005 01:58:26 -0000 1.3 *************** *** 129,135 **** /* KB0THN's additions */ - #define C_TO_F(x) ( (x) * 1.8 + 32.0 ) - #define F_TO_C(x) ( ((x) - 32.0 ) * (5.0/9.0) ) - #define NM_TO_KM(x) (1.853 * (x)) #define FT_TO_M(x) IN_TO_M(FT_TO_IN((x))) --- 129,132 ---- |
|
From: James J. <jje...@us...> - 2005-04-17 17:00:25
|
Update of /cvsroot/aprsworld/web/datamart In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1849 Modified Files: station-list.php Log Message: Changed the way some of the emergency stuff is handled. Index: station-list.php =================================================================== RCS file: /cvsroot/aprsworld/web/datamart/station-list.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** station-list.php 13 Feb 2005 01:04:51 -0000 1.11 --- station-list.php 17 Apr 2005 17:00:16 -0000 1.12 *************** *** 27,31 **** //$call = strtoupper($call); ! $headline = $title = sprintf("Search results for %s",implode(" or ",$calls)); $subtitle=""; $hr=1; --- 27,34 ---- //$call = strtoupper($call); ! if ( $emergency_only ) ! $headline=$title="EMERGENCY STATIONS in last 48 hours"; ! else ! $headline = $title = sprintf("Search results for %s",implode(" or ",$calls)); $subtitle=""; $hr=1; *************** *** 90,94 **** if ( TRUE == $emergency_only ) { ! $query = sprintf("SELECT lastposition.packet_id, lastposition.packet_date, lastposition.source, lastposition.latitude, lastposition.longitude, lastposition.course, lastposition.speed, lastposition.altitude, lastposition.status, lastposition.symbol_table, lastposition.symbol_code, lastweather.packet_date AS lastweather_packet_date, lastweather.wind_direction, lastweather.wind_speed, lastweather.wind_gust, lastweather.wind_sustained, lastweather.temperature, lastweather.rain_hour, lastweather.rain_calendar_day, lastweather.rain_24hour_day, lastweather.humidity, lastweather.barometer, lastweather.luminosity, laststatus.comment AS laststatus_comment, laststatus.power, laststatus.height, laststatus.gain, laststatus.directivity, laststatus.rate, sec_to_time(unix_timestamp()-unix_timestamp(lastposition.packet_date)) AS packet_age FROM lastposition LEFT JOIN laststatus ON laststatus.source=lastposition.source LEFT JOIN lastweather ON lastweather.source=lastposition.source WHERE lastposition.status LIKE 'EMERGENCY%%' OR laststatus.comment LIKE 'EMERGENCY%%' ORDER BY '%s' %s",$sort,$order); $maps=TRUE; } else if ( $symbol_code!="" && $symbol_table!="" ) { --- 93,97 ---- if ( TRUE == $emergency_only ) { ! $query = sprintf("SELECT lastposition.packet_id, lastposition.packet_date, lastposition.source, lastposition.latitude, lastposition.longitude, lastposition.course, lastposition.speed, lastposition.altitude, lastposition.status, lastposition.symbol_table, lastposition.symbol_code, lastweather.packet_date AS lastweather_packet_date, lastweather.wind_direction, lastweather.wind_speed, lastweather.wind_gust, lastweather.wind_sustained, lastweather.temperature, lastweather.rain_hour, lastweather.rain_calendar_day, lastweather.rain_24hour_day, lastweather.humidity, lastweather.barometer, lastweather.luminosity, laststatus.comment AS laststatus_comment, laststatus.power, laststatus.height, laststatus.gain, laststatus.directivity, laststatus.rate, sec_to_time(unix_timestamp()-unix_timestamp(lastposition.packet_date)) AS packet_age FROM lastposition LEFT JOIN laststatus ON laststatus.source=lastposition.source LEFT JOIN lastweather ON lastweather.source=lastposition.source WHERE lastposition.status LIKE 'EMERGENCY%%' AND (unix_timestamp()-unix_timestamp(lastposition.packet_date)) < 172800 ORDER BY '%s' %s",$sort,$order); $maps=TRUE; } else if ( $symbol_code!="" && $symbol_table!="" ) { *************** *** 279,283 **** <P> <H3>Icon Colors</H3> ! The color behind the station icon represents the stations status. A moving station will have a yellow background, a static station will have a white background, and an old station will have a grey background. If the icon has a black background then you are likely using a Microsoft browser product that <A HREF="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294714">does not understand transparent PNG</A> files. Perhaps you could try a broswer like <A HREF="http://www.mozilla.org">Mozilla</A>. <? --- 282,286 ---- <P> <H3>Icon Colors</H3> ! The color behind the station icon represents the stations status. An emergency station will have a red background, a moving station will have a yellow background, a static station will have a white background, and an old station will have a grey background. If the icon has a black background then you are likely using a Microsoft browser product that <A HREF="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294714">does not understand transparent PNG</A> files. Perhaps you could try a broswer like <A HREF="http://www.mozilla.org">Mozilla</A>. <? |
|
From: James J. <jje...@us...> - 2005-03-23 19:53:42
|
Update of /cvsroot/aprsworld/web/datamart In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6433 Modified Files: geoFunctions.php track-search.php Log Message: You can now make a date or time html form with specifying a timestamp. Now track-search date search defaults to now()-$start_hours. Index: geoFunctions.php =================================================================== RCS file: /cvsroot/aprsworld/web/datamart/geoFunctions.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** geoFunctions.php 13 Feb 2005 01:04:52 -0000 1.12 --- geoFunctions.php 23 Mar 2005 19:53:18 -0000 1.13 *************** *** 330,339 **** } ! function dateSelect($prefix,$useSelected=1) { $months = array("January","February","March","April","May","June","July","August","September","October","November","December"); printf("<SELECT NAME=\"%s_year\" SIZE=1>\n",$prefix); for ( $i=date("Y")+1 ; $i>=2002 ; $i-- ) { ! if ( $useSelected && $i == date("Y") ) $selected=" SELECTED"; else --- 330,342 ---- } ! function dateSelect($prefix,$useSelected=1,$timestamp=-1) { ! if ( -1 == $timestamp ) { ! $timestamp=time(); ! } $months = array("January","February","March","April","May","June","July","August","September","October","November","December"); printf("<SELECT NAME=\"%s_year\" SIZE=1>\n",$prefix); for ( $i=date("Y")+1 ; $i>=2002 ; $i-- ) { ! if ( $useSelected && $i == date("Y",$timestamp) ) $selected=" SELECTED"; else *************** *** 346,350 **** printf("<SELECT NAME=\"%s_month\" SIZE=1>\n",$prefix); for ( $i=0 ; $i<12 ; $i++ ) { ! if ( $useSelected && $i == date("m")-1 ) $selected=" SELECTED"; else --- 349,353 ---- printf("<SELECT NAME=\"%s_month\" SIZE=1>\n",$prefix); for ( $i=0 ; $i<12 ; $i++ ) { ! if ( $useSelected && $i == date("m",$timestamp)-1 ) $selected=" SELECTED"; else *************** *** 357,361 **** printf("<SELECT NAME=\"%s_day\" SIZE=1>\n",$prefix); for ( $i=1 ; $i<=31 ; $i++ ) { ! if ( $useSelected && $i == date("d") ) $selected=" SELECTED"; else --- 360,364 ---- printf("<SELECT NAME=\"%s_day\" SIZE=1>\n",$prefix); for ( $i=1 ; $i<=31 ; $i++ ) { ! if ( $useSelected && $i == date("d",$timestamp) ) $selected=" SELECTED"; else *************** *** 368,376 **** } ! function timeSelect($prefix,$useSelected=1) { printf("<SELECT NAME=\"%s_hour\" SIZE=1>\n",$prefix); for ( $i=0 ; $i<=23 ; $i++ ) { ! if ( $useSelected && $i == date("H") ) $selected=" SELECTED"; else --- 371,382 ---- } ! function timeSelect($prefix,$useSelected=1,$timestamp=-1) { ! if ( -1 == $timestamp ) { ! $timestamp=time(); ! } printf("<SELECT NAME=\"%s_hour\" SIZE=1>\n",$prefix); for ( $i=0 ; $i<=23 ; $i++ ) { ! if ( $useSelected && $i == date("H",$timestamp) ) $selected=" SELECTED"; else *************** *** 383,387 **** printf("<SELECT NAME=\"%s_minute\" SIZE=1>\n",$prefix); for ( $i=0 ; $i<=59 ; $i++ ) { ! if ( $useSelected && $i == date("i") ) $selected=" SELECTED"; else --- 389,393 ---- printf("<SELECT NAME=\"%s_minute\" SIZE=1>\n",$prefix); for ( $i=0 ; $i<=59 ; $i++ ) { ! if ( $useSelected && $i == date("i",$timestamp) ) $selected=" SELECTED"; else Index: track-search.php =================================================================== RCS file: /cvsroot/aprsworld/web/datamart/track-search.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** track-search.php 13 Feb 2005 00:56:36 -0000 1.5 --- track-search.php 23 Mar 2005 19:53:29 -0000 1.6 *************** *** 80,93 **** <TR> <TD> ! <? echo dateSelect("start",1); ?><BR> </TD> <TD> ! <? echo timeSelect("start",1); ?><BR> </TD> <TD> ! <? echo dateSelect("end",0); ?><BR> </TD> <TD> ! <? echo timeSelect("end",0); ?><BR> </TD> </TR> --- 80,93 ---- <TR> <TD> ! <? echo dateSelect("start",1,time()-3600*$start_hours); ?> </TD> <TD> ! <? echo timeSelect("start",1,time()-3600*$start_hours); ?> </TD> <TD> ! <? echo dateSelect("end",0); ?> </TD> <TD> ! <? echo timeSelect("end",0); ?> </TD> </TR> |
|
From: James J. <jje...@us...> - 2005-02-13 01:05:09
|
Update of /cvsroot/aprsworld/web/datamart In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26429 Modified Files: station-list.php geoFunctions.php Log Message: Added link to igate hops for a station. Changed the label for google maps. Index: station-list.php =================================================================== RCS file: /cvsroot/aprsworld/web/datamart/station-list.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** station-list.php 15 Jan 2005 22:54:23 -0000 1.10 --- station-list.php 13 Feb 2005 01:04:51 -0000 1.11 *************** *** 213,217 **** ?> <TR> ! <TD COLSPAN=8> <TABLE WIDTH="100%" BORDER=0> --- 213,217 ---- ?> <TR> ! <TD COLSPAN=9> <TABLE WIDTH="100%" BORDER=0> *************** *** 242,245 **** --- 242,248 ---- <A HREF="<? echo getQrzLink($data[$i]["source"]); ?>">QRZ Lookup</A> </TD> + <TD> + <A HREF="<? echo getHopsUrl($data[$i]["source"]); ?>">Show hops to IGATE for area</A> + </TD> </TR> </TABLE> Index: geoFunctions.php =================================================================== RCS file: /cvsroot/aprsworld/web/datamart/geoFunctions.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** geoFunctions.php 16 Sep 2004 02:34:57 -0000 1.11 --- geoFunctions.php 13 Feb 2005 01:04:52 -0000 1.12 *************** *** 60,64 **** function datamartCloseStations($lat, $lon, $name="",$bbox_size=1 ) { ! return sprintf("http://%s/map/near.php?lat=%.5f&lon=%.5f&name=%s&bbox_size=%d&maps=yes",GEO_HOST,$lat,$lon,urlencode($name),$bbox_size); // return sprintf("http://%s/datamart/stations-near.php?lat=%.5f&lon=%.5f&name=%s&bbox_size=%d",DATAMART_HOST,$lat,$lon,urlencode($name),$bbox_size); } --- 60,64 ---- function datamartCloseStations($lat, $lon, $name="",$bbox_size=1 ) { ! return sprintf("http://%s/map/near.phtml?lat=%.5f&lon=%.5f&name=%s&bbox_size=%d&maps=yes",MAPSERVER_HOST,$lat,$lon,urlencode($name),$bbox_size); // return sprintf("http://%s/datamart/stations-near.php?lat=%.5f&lon=%.5f&name=%s&bbox_size=%d",DATAMART_HOST,$lat,$lon,urlencode($name),$bbox_size); } *************** *** 74,78 **** function mapserverRadarImgUrl($lat, $lon, $name, $icon="", $scale="") { ! return sprintf("http://geo.aprsworld.net/map/map.phtml?lat=%f&lon=%f&label=%s&icon=%s&scale=%s&radar=1&width=600&height=350",$lat,$lon,urlencode($name),urlencode($icon),$scale); } --- 74,78 ---- function mapserverRadarImgUrl($lat, $lon, $name, $icon="", $scale="") { ! return sprintf("http://maps.aprsworld.net/map/map.phtml?lat=%f&lon=%f&label=%s&icon=%s&scale=%s&radar=1&width=600&height=350",$lat,$lon,urlencode($name),urlencode($icon),$scale); } *************** *** 526,530 **** function mapserverGeoImgUrl($lat, $lon, $name, $icon="", $scale="") { ! return sprintf("http://geo.aprsworld.net/map/map.phtml?lat=%f&lon=%f&label=%s&icon=%s&scale=%s",$lat,$lon,urlencode($name),urlencode($icon),$scale); } --- 526,530 ---- function mapserverGeoImgUrl($lat, $lon, $name, $icon="", $scale="") { ! return sprintf("http://maps.aprsworld.net/map/map.phtml?lat=%f&lon=%f&label=%s&icon=%s&scale=%s",$lat,$lon,urlencode($name),urlencode($icon),$scale); } *************** *** 551,553 **** --- 551,586 ---- } + function getOutsideMapList($lat,$lon,$label) { + $s=array(); + $s[]="Google Maps|http://maps.google.com/maps?q=##LABEL##&ll=##LAT##%2C##LON##&spn=0.006714%2C0.014455"; + $s[]="ACME Mapper USA Satellite Image|http://www.acme.com/mapper/?lat=##LAT##&long=##LON##&theme=Image"; + $s[]="ACME Mapper USA Topo Map|http://www.acme.com/mapper/?lat=##LAT##&long=##LON##&theme=Topo"; + $s[]="MSN Europe|http://www.mapblast.com/map.aspx?L=EUR&C=##LAT##%2c##LON##&A=7.16667&P=|##LAT##%2c##LON##|1|##LABEL##|L1|"; + $s[]="MSN USA|http://www.mapblast.com/map.aspx?L=USA0409&C=##LAT##%2c##LON##&A=7.16667&P=|##LAT##%2c##LON##|1|##LABEL##|L1|"; + $s[]="MSN World Wide|http://www.mapblast.com/map.aspx?L=WLD0409&C=##LAT##%2c##LON##&A=7.16667&P=|##LAT##%2c##LON##|1|##LABEL##|L1|"; + ?> + <FORM METHOD=POST ACTION="http://aprsworld.net/jump.php"> + <SELECT NAME="location" SIZE=1> + <? + for ( $i=0 ; $i<count($s) ; $i++ ) { + $parts=explode("|",$s[$i]); + $l=substr($s[$i],strlen($parts[0])+1); + $l = str_replace("##LAT##",$lat,$l); + $l = str_replace("##LON##",$lon,$l); + $l = str_replace("##LABEL##",urlencode($label),$l); + + printf("\t\t\t<OPTION VALUE=\"%s\">%s</OPTION>\n",htmlspecialchars($l),$parts[0]); + } + ?> + </SELECT> + <INPUT TYPE=SUBMIT VALUE="View Map"> + </FORM> + <? + } + + function getHopsUrl($term) { + return sprintf("http://%s/datamart/igate-hops/hops-switch.php?name=%s",DATAMART_HOST,urlencode($term)); + } + + ?> |
|
From: James J. <jje...@us...> - 2005-02-13 00:56:48
|
Update of /cvsroot/aprsworld/web/datamart In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23132 Modified Files: track-search.php Log Message: Added option to display raw packets. Index: track-search.php =================================================================== RCS file: /cvsroot/aprsworld/web/datamart/track-search.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** track-search.php 26 Dec 2004 18:03:32 -0000 1.4 --- track-search.php 13 Feb 2005 00:56:36 -0000 1.5 *************** *** 42,45 **** --- 42,46 ---- <TH>Show table?</TH> <TH>Hide bad packets?</TH> + <TH>Show raw packets?</TH> </TR> <TR> *************** *** 55,58 **** --- 56,63 ---- <INPUT TYPE=RADIO NAME="skipBogusCheck" VALUE="1">No<BR> </TD> + <TD> + <INPUT TYPE=RADIO NAME="showRawPackets" VALUE="0" CHECKED>No<BR> + <INPUT TYPE=RADIO NAME="showRawPackets" VALUE="1">Yes<BR> + </TD> </TR> </TABLE> *************** *** 118,121 **** --- 123,127 ---- <TH>Show table?</TH> <TH>Hide bad packets?</TH> + <TH>Show raw packets?</TH> </TR> <TR> *************** *** 131,134 **** --- 137,144 ---- <INPUT TYPE=RADIO NAME="skipBogusCheck" VALUE="1">No<BR> </TD> + <TD> + <INPUT TYPE=RADIO NAME="showRawPackets" VALUE="0" CHECKED>No<BR> + <INPUT TYPE=RADIO NAME="showRawPackets" VALUE="1">Yes<BR> + </TD> </TR> </TABLE> |
|
From: James J. <jje...@us...> - 2005-02-13 00:56:17
|
Update of /cvsroot/aprsworld/map In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22843 Modified Files: track.phtml timesearch.php datesearch.php Log Message: Added the ability to retrieve raw packets with the track. Also added the bounding box display around the track map. Index: track.phtml =================================================================== RCS file: /cvsroot/aprsworld/map/track.phtml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** track.phtml 26 Dec 2004 18:19:27 -0000 1.1.1.1 --- track.phtml 13 Feb 2005 00:56:06 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- $call = strtoupper($_REQUEST["call"]); // station to track $skipBogusCheck = $_REQUEST["skipBogusCheck"]; + $showRawPackets = $_REQUEST["showRawPackets"]; $skipTable = $_REQUEST["skipTable"]; $debug = $_REQUEST["debug"]; *************** *** 73,77 **** --- 74,99 ---- + function rawPacket($record) { + $d[0]=$record["digipeater_0"]; + $d[1]=$record["digipeater_1"]; + $d[2]=$record["digipeater_2"]; + $d[3]=$record["digipeater_3"]; + $d[4]=$record["digipeater_4"]; + $d[5]=$record["digipeater_5"]; + $d[6]=$record["digipeater_6"]; + $d[7]=$record["digipeater_7"]; + + $r = sprintf("%s>%s",$record["source"],$record["destination"]); + + $i=0; + while ( "" != $d[$i] ) { + $r .= sprintf(",%s",$d[$i]); + $i++; + } + + $r .= sprintf(":%s",$record["information"]); + return $r; + } function addBadPacket($record,$humanError="Unknown Error") { *************** *** 165,168 **** --- 187,194 ---- /* sum our odometer */ $odometer=$row["odometer"] = $row["dp"] + $odometer; + + if ( $showRawPackets ) { + $row["raw_packet"] = rawPacket($row); + } } *************** *** 190,205 **** $fileBasePath="/var/www/html/tmp/track/" . $fileBaseName; ! $dFields = array( ! array("packet_id","N",10,0), ! array("date","C",19), ! array("latitude","C",8), ! array("longitude","C",9), ! // array("latitude","N",3,4), // these don't work for some reason... ! // array("longitude","N",4,4), ! array("course","N",3,0), ! array("speed","N",4,0), ! array("altitude","N",5,0), ! array("odometer","N",8,2) ! ); /* first delete the DBF file if it already exists */ --- 216,247 ---- $fileBasePath="/var/www/html/tmp/track/" . $fileBaseName; ! if ( $showRawPackets ) { ! $dFields = array( ! array("packet_id","N",10,0), ! array("date","C",19), ! array("latitude","C",8), ! array("longitude","C",9), ! // array("latitude","N",3,4), // these don't work for some reason... ! // array("longitude","N",4,4), ! array("course","N",3,0), ! array("speed","N",4,0), ! array("altitude","N",5,0), ! array("odometer","N",8,2), ! array("raw_packet","C",255) ! ); ! } else { ! $dFields = array( ! array("packet_id","N",10,0), ! array("date","C",19), ! array("latitude","C",8), ! array("longitude","C",9), ! // array("latitude","N",3,4), // these don't work for some reason... ! // array("longitude","N",4,4), ! array("course","N",3,0), ! array("speed","N",4,0), ! array("altitude","N",5,0), ! array("odometer","N",8,2) ! ); ! } /* first delete the DBF file if it already exists */ *************** *** 237,240 **** --- 279,284 ---- $dRecord[6]=$p[$i]["altitude"]; $dRecord[7]=$p[$i]["odometer"]; + if ( $showRawPackets ) + $dRecord[8]=$p[$i]["raw_packet"]; /* add DBF info */ *************** *** 255,259 **** <A HREF="<? printf("http://%s/datamart/track-search.php?call=%s",DATAMART_HOST,$call); ?>">New Track Search</A> <P> ! <IMG SRC="<? echo getTrackImageUrl($call,$p[$i-1]["latitude"],$p[$i-1]["longitude"],$fileBaseName,$minx,$maxx,$miny,$maxy,TRUE,640,480); ?>" WIDTH=640 HEIGHT=480 ALT="Track Map"> <P> </DIV> --- 299,312 ---- <A HREF="<? printf("http://%s/datamart/track-search.php?call=%s",DATAMART_HOST,$call); ?>">New Track Search</A> <P> ! <TABLE> ! <TR><TD></TD><TH><? printf("%.4lf",$maxy); ?></TH><TD></TD></TR> ! <TR> ! <TH STYLE="vertical-align: middle;"><? printf("%.4lf",$minx); ?></TH> ! <TD><IMG SRC="<? echo getTrackImageUrl($call,$p[$i-1]["latitude"],$p[$i-1]["longitude"],$fileBaseName,$minx,$maxx,$miny,$maxy,TRUE,640,480); ?>" WIDTH=640 HEIGHT=480 ALT="Track Map"></TD> ! <TH STYLE="vertical-align: middle;"><? printf("%.4lf",$maxx); ?></TH> ! </TR> ! ! <TR><TD></TD><TH><? printf("%.4lf",$miny); ?></TH><TD></TD></TR> ! </TABLE> <P> </DIV> *************** *** 275,278 **** --- 328,332 ---- <TH>Odometer<BR><? echo getUnitByName("distance",$metric); ?></TH> <TH>π</TH> + <? if ( $showRawPackets ) { ?><TH>Raw Packet</TH><? } ?> <? if ( $debug ) { ?><TH>Debug</TH><? } ?> </TR> *************** *** 286,289 **** --- 340,345 ---- } + $cSpan=6; + printf("\t<TR%s>",$badRowHTML); printf("<TD><A HREF=\"%s\" onMouseover=\"window.status='aprsworld packet_id: %d'; return true\">%s</A></TD>",rawTncUrl($p[$i]["packet_id"]),$p[$i]["packet_id"],$p[$i]["packet_date"]); *************** *** 291,294 **** --- 347,351 ---- printf("<TD>%d</TD>",cvrt($p[$i]["speed"],"kmmi",$metric)); printf("<TD>%d</TD>",$p[$i]["course"]); + if ( 0 != $p[$i]["altitude"] ) { printf("<TD>%d</TD>",cvrt($p[$i]["altitude"],"mefe",$metric)); *************** *** 296,304 **** --- 353,370 ---- printf("<TD></TD>"); } + printf("<TD>%.1lf</TD>",cvrt($p[$i]["odometer"],"mikm",! $metric)); + printf("<TD><A HREF=\"%s\">Geocode</A></TD>",getGeocodeLink($p[$i]["latitude"],$p[$i]["longitude"],$p[$i]["packet_id"])); + + if ( $showRawPackets ) { + printf("<TD>%s</TD>\n",htmlspecialchars($p[$i]["raw_packet"])); + $cSpan++; + } + if ( $debug ) { printf("<TD>%.3lf mi / %d sec</TD>\n",$p[$i]["dp"],$p[$i]["dt"]); + $cSpan++; } printf("</TR>\n"); *************** *** 310,314 **** <B><? echo count($p); ?> records.</B> </TD> ! <TD COLSPAN=6> <? if ( $badPacketCount > 0 ) { --- 376,380 ---- <B><? echo count($p); ?> records.</B> </TD> ! <TD COLSPAN=<? echo $cSpan; ?>> <? if ( $badPacketCount > 0 ) { *************** *** 329,332 **** --- 395,399 ---- <H3>Bounds</H3> The bounding box for this track is <B><? echo printf("%.4lf %.4lf %.4lf %.4lf",$minx,$maxx,$miny,$maxy); ?></B> (minx, maxx, miny, maxy). + <? if ( ! $skipTable ) { Index: timesearch.php =================================================================== RCS file: /cvsroot/aprsworld/map/timesearch.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** timesearch.php 26 Dec 2004 18:19:27 -0000 1.1.1.1 --- timesearch.php 13 Feb 2005 00:56:06 -0000 1.2 *************** *** 12,16 **** } ! $sql=sprintf("SELECT *,unix_timestamp(packet_date) AS packet_time FROM position WHERE source='%s' AND packet_date >= date_sub(now(),INTERVAL %d MINUTE) AND packet_date <= date_sub(now(),INTERVAL %d MINUTE) ORDER BY packet_time",$call,$smin,$emin); if ( $debug ) { --- 12,20 ---- } ! if ( $showRawPackets ) { ! $sql=sprintf("SELECT position.*,unix_timestamp(packet_date) AS packet_time,raw.* FROM position LEFT JOIN raw ON raw.packet_id=position.packet_id WHERE position.source='%s' AND packet_date >= date_sub(now(),INTERVAL %d MINUTE) AND packet_date <= date_sub(now(),INTERVAL %d MINUTE) ORDER BY packet_time",$call,$smin,$emin); ! } else { ! $sql=sprintf("SELECT *,unix_timestamp(packet_date) AS packet_time FROM position WHERE source='%s' AND packet_date >= date_sub(now(),INTERVAL %d MINUTE) AND packet_date <= date_sub(now(),INTERVAL %d MINUTE) ORDER BY packet_time",$call,$smin,$emin); ! } if ( $debug ) { Index: datesearch.php =================================================================== RCS file: /cvsroot/aprsworld/map/datesearch.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** datesearch.php 26 Dec 2004 18:19:27 -0000 1.1.1.1 --- datesearch.php 13 Feb 2005 00:56:06 -0000 1.2 *************** *** 1,5 **** <? ! $sql=sprintf("SELECT *,unix_timestamp(packet_date) AS packet_time FROM position WHERE source='%s' ",$call); /* valid date can't be less than 10 characters long */ --- 1,9 ---- <? ! if ( $showRawPackets ) { ! $sql=sprintf("SELECT position.*,unix_timestamp(packet_date) AS packet_time, raw.* FROM position LEFT JOIN raw ON raw.packet_id=position.packet_id WHERE position.source='%s' ",$call); ! } else { ! $sql=sprintf("SELECT position.*,unix_timestamp(packet_date) AS packet_time FROM position WHERE source='%s' ",$call); ! } /* valid date can't be less than 10 characters long */ |
|
From: James J. <jje...@us...> - 2005-01-15 22:55:25
|
Update of /cvsroot/aprsworld/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8383 Modified Files: world_head.php Log Message: Maps default to on unless $maps=0 or $maps=no or $maps=No or $maps=NO or $maps=nO Index: world_head.php =================================================================== RCS file: /cvsroot/aprsworld/web/world_head.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** world_head.php 11 Jul 2004 20:55:03 -0000 1.3 --- world_head.php 15 Jan 2005 22:55:15 -0000 1.4 *************** *** 1,3 **** --- 1,8 ---- <?PHP + if ( $_REQUEST["maps"] == "0" || strtolower($_REQUEST["maps"]) == "no" ) { + $maps=$_REQUEST["maps"]=0; + } else { + $maps=$_REQUEST["maps"]=1; + } require_once($_SERVER["DOCUMENT_ROOT"] . "/world_config.php"); *************** *** 58,65 **** ?> <LINK REL="StyleSheet" HREF="/world_style.css" TYPE="text/css"> ! <TITLE>APRS World: <? if ($title != "") echo strip_tags($title); else echo "Unknown"?></TITLE> <? printf("%s\n",$head_message); ?> </HEAD> ! <BODY BGCOLOR="#ffffff"> <? if ( $q != "1" ) { // shh --- 63,70 ---- ?> <LINK REL="StyleSheet" HREF="/world_style.css" TYPE="text/css"> ! <TITLE>aprsworld: <? if ($title != "") echo strip_tags($title); else echo "Unknown"?></TITLE> <? printf("%s\n",$head_message); ?> </HEAD> ! <BODY BGCOLOR="#ffffff" <? echo $body_message; ?>> <? if ( $q != "1" ) { // shh |
|
From: James J. <jje...@us...> - 2005-01-15 22:54:34
|
Update of /cvsroot/aprsworld/web/datamart In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8195 Modified Files: weather-list.php station-list.php Log Message: Added ability to search for multiple stations separated by | character. example: http://db.aprsworld.net/datamart/weather-list.php?call=kb0thn-2%7Ckb0vyo-12%7Ck0ny-2&q=1&maps=0 Index: weather-list.php =================================================================== RCS file: /cvsroot/aprsworld/web/datamart/weather-list.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** weather-list.php 16 Sep 2004 02:34:57 -0000 1.8 --- weather-list.php 15 Jan 2005 22:54:23 -0000 1.9 *************** *** 8,12 **** $max_age = $_REQUEST["max_age"]; ! $call = strtoupper($call); /* set sane initial values */ --- 8,23 ---- $max_age = $_REQUEST["max_age"]; ! /* check for multiple calls separated with | symbol */ ! $calls=explode("|",strtoupper($_REQUEST["call"])); ! if ( 1 == count($calls) ) { ! $call=$calls[0]; ! } else { ! $call = sprintf("%s' OR lastweather.source LIKE ",$calls[0]); ! for ( $i=1 ; $i<count($calls)-1 ; $i++ ) { ! $call .= sprintf("'%s' OR lastweather.source LIKE ",$calls[$i]); ! } ! $call .= sprintf("'%s",$calls[$i]); ! } ! /* set sane initial values */ *************** *** 21,25 **** ! $headline=$title="Weather search for " . strtoupper($call); $refreshable=1; $refresh_period_min=60; require $_SERVER["DOCUMENT_ROOT"] . "/world_head.php"; --- 32,36 ---- ! $headline = $title = sprintf("Weather results for %s",implode(" or ",$calls)); $refreshable=1; $refresh_period_min=60; require $_SERVER["DOCUMENT_ROOT"] . "/world_head.php"; Index: station-list.php =================================================================== RCS file: /cvsroot/aprsworld/web/datamart/station-list.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** station-list.php 16 Sep 2004 02:34:57 -0000 1.9 --- station-list.php 15 Jan 2005 22:54:23 -0000 1.10 *************** *** 3,7 **** define("MAX_STATIONS",100); ! $call = $_REQUEST["call"]; $emergency_only = $_REQUEST["emergency_only"]; $order = $_REQUEST["order"]; --- 3,18 ---- define("MAX_STATIONS",100); ! /* check for multiple calls separated with | symbol */ ! $calls=explode("|",strtoupper($_REQUEST["call"])); ! if ( 1 == count($calls) ) { ! $call=$calls[0]; ! } else { ! $call = sprintf("%s' OR lastposition.source LIKE ",$calls[0]); ! for ( $i=1 ; $i<count($calls)-1 ; $i++ ) { ! $call .= sprintf("'%s' OR lastposition.source LIKE ",$calls[$i]); ! } ! $call .= sprintf("'%s",$calls[$i]); ! } ! $emergency_only = $_REQUEST["emergency_only"]; $order = $_REQUEST["order"]; *************** *** 15,20 **** ! $call = strtoupper($call); ! $headline = $title = sprintf("Search results for %s",$call); $subtitle=""; $hr=1; --- 26,31 ---- ! //$call = strtoupper($call); ! $headline = $title = sprintf("Search results for %s",implode(" or ",$calls)); $subtitle=""; $hr=1; *************** *** 62,66 **** $db = open_mysql("aprs"); - ss_timing_start(); if ( $sort == "" ) --- 73,76 ---- *************** *** 94,98 **** --- 104,110 ---- printf("MySQL = %s<BR>\n",$query); + ss_timing_start(); $q1 = mysql_query($query,$db); + ss_timing_stop(); $i=0; *************** *** 201,216 **** ?> <TR> ! <TD COLSPAN=9> ! <TABLE WIDTH="100%"> <TR CLASS="highlighttwo"> <TD ALIGN="right">Geospatial:</TD> ! <TD> ! <A HREF="<? printf("http://www.acme.com/mapper/?lat=%lf&long=%lf&theme=Image",$data[$i]["latitude"],$data[$i]["longitude"]); ?>">Satellite Photo</A> ! </TD> ! <TD> ! <A HREF="<? echo mapserverImgUrl($data[$i]["latitude"],$data[$i]["longitude"],$data[$i]["source"],$data[$i]["icon"],"regional"); ?>">Regional Map</A> ! </TD> ! <TD> ! <A HREF="<? echo mapserverImgUrl($data[$i]["latitude"],$data[$i]["longitude"],$data[$i]["source"],$data[$i]["icon"],"street"); ?>">Steet Map</A> </TD> <TD> --- 213,223 ---- ?> <TR> ! <TD COLSPAN=8> ! <TABLE WIDTH="100%" BORDER=0> ! <TR CLASS="highlighttwo"> <TD ALIGN="right">Geospatial:</TD> ! <TD COLSPAN=2> ! <? echo getOutsideMapList($data[$i]["latitude"],$data[$i]["longitude"],$data[$i]["source"]); ?> </TD> <TD> *************** *** 237,244 **** </TR> </TABLE> </TR> <? } - ss_timing_stop(); ?> <TR> --- 244,251 ---- </TR> </TABLE> + </TD> </TR> <? } ?> <TR> |