diff options
-rw-r--r-- | display.c | 2 | ||||
-rw-r--r-- | drivers.c | 4 | ||||
-rw-r--r-- | evermore.c | 8 | ||||
-rw-r--r-- | garmin.c | 2 | ||||
-rw-r--r-- | gpsd.h | 17 | ||||
-rw-r--r-- | libgpsd_core.c | 12 | ||||
-rw-r--r-- | packet.c | 15 | ||||
-rw-r--r-- | packet_states.h | 3 |
8 files changed, 44 insertions, 19 deletions
@@ -119,7 +119,7 @@ void draw_graphics(struct gps_data_t *gpsdata) (double)gpsdata->elevation[i], &x, &y); if (gpsdata->ss[i] < 10) - set_color("DarkGray"); + set_color("Black"); else if (gpsdata->ss[i] < 30) set_color("Red"); else if (gpsdata->ss[i] < 35) @@ -37,7 +37,9 @@ ssize_t pass_rtcm(struct gps_device_t *session, char *buf, size_t rtcmbytes) gps_mask_t nmea_parse_input(struct gps_device_t *session) { - if (session->packet.type == SIRF_PACKET) { + if (session->packet.type == COMMENT_PACKET) { + return 0; + } else if (session->packet.type == SIRF_PACKET) { gpsd_report(LOG_WARN, "SiRF packet seen when NMEA expected.\n"); #ifdef SIRF_ENABLE (void)gpsd_switch_driver(session, "SiRF binary"); @@ -374,8 +374,9 @@ static gps_mask_t evermore_parse_input(struct gps_device_t *session) return 0; } -/* configure various EverMore settings to default */ +#ifdef ALLOW_RECONFIGURE static bool evermore_default(struct gps_device_t *session, int mode) +/* configure various EverMore settings to default */ { bool ok = true; /*@ +charint @*/ @@ -507,7 +508,6 @@ static bool evermore_default(struct gps_device_t *session, int mode) return ok; } -#ifdef ALLOW_RECONFIGURE #ifdef __UNUSED__ static bool evermore_set_mode(struct gps_device_t *session, speed_t speed, bool mode) @@ -603,6 +603,7 @@ static void evermore_mode(struct gps_device_t *session, int mode) } } +#ifdef ALLOW_RECONFIGURE static void evermore_configurator(struct gps_device_t *session, unsigned int seq) { if (seq == 0) { @@ -610,12 +611,11 @@ static void evermore_configurator(struct gps_device_t *session, unsigned int seq if (session->packet.type == NMEA_PACKET) { gpsd_report(LOG_WARN, "NMEA_PACKET packet\n"); } -#ifdef ALLOW_RECONFIGURE (void)evermore_default(session, 1); /* switch GPS to binary mode */ session->back_to_nmea = true; -#endif /* ALLOW_RECONFIGURE */ } } +#endif /* ALLOW_RECONFIGURE */ #ifdef __UNUSED__ static void evermore_probe(struct gps_device_t *session) @@ -961,6 +961,7 @@ gps_mask_t garmin_ser_parse(struct gps_device_t *session) } /*@ -charint @*/ +#ifdef ALLOW_RECONFIGURE static void settle(void) { struct timespec delay, rem; @@ -971,6 +972,7 @@ static void settle(void) nanosleep(&delay, &rem); /*@ +type +unrecog @*/ } +#endif /* ALLOW_RECONFIGURE */ static void garmin_switcher(struct gps_device_t *session, int mode) { @@ -45,14 +45,15 @@ struct gps_packet_t { /* packet-getter internals */ int type; #define BAD_PACKET -1 -#define NMEA_PACKET 0 -#define SIRF_PACKET 1 -#define ZODIAC_PACKET 2 -#define TSIP_PACKET 3 -#define EVERMORE_PACKET 4 -#define ITALK_PACKET 5 -#define RTCM_PACKET 6 -#define GARMIN_PACKET 7 +#define COMMENT_PACKET 0 +#define NMEA_PACKET 1 +#define SIRF_PACKET 2 +#define ZODIAC_PACKET 3 +#define TSIP_PACKET 4 +#define EVERMORE_PACKET 5 +#define ITALK_PACKET 6 +#define RTCM_PACKET 7 +#define GARMIN_PACKET 8 unsigned int state; size_t length; unsigned char inbuffer[MAX_PACKET_LENGTH*2+1]; diff --git a/libgpsd_core.c b/libgpsd_core.c index b591fa75..005408d3 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -232,7 +232,9 @@ int gpsd_activate(struct gps_device_t *session, bool reconfigurable) /*@ +mustfreeonly @*/ gpsd_report(LOG_PROG, "no probe matched...\n"); foundit: +#ifdef ALLOW_RECONFIGURE session->enable_reconfigure = reconfigurable; +#endif /* ALLOW_RECONFIGURE */ #endif /* NON_NMEA_ENABLE */ session->gpsdata.online = timestamp(); #ifdef SIRF_ENABLE @@ -619,6 +621,8 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) session->packet.type); if (session->packet.type != BAD_PACKET) { switch (session->packet.type) { + case COMMENT_PACKET: + break; #ifdef SIRF_ENABLE case SIRF_PACKET: (void)gpsd_switch_driver(session, "SiRF binary"); @@ -694,10 +698,10 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) session->gpsdata.d_recv_time = timestamp(); /* Get data from current packet into the fix structure */ - if (session->device_type != NULL && session->device_type->parse_packet!=NULL) - received = session->device_type->parse_packet(session); - else - received = 0; /* it was all done in the packet getter */ + received = 0; + if (session->packet.type != COMMENT_PACKET) + if (session->device_type != NULL && session->device_type->parse_packet!=NULL) + received = session->device_type->parse_packet(session); /* * Compute fix-quality data from the satellite positions. @@ -81,13 +81,16 @@ static void nextstate(struct gps_packet_t *lexer, switch(lexer->state) { case GROUND_STATE: + if (c == '#') { + lexer->state = COMMENT_BODY; + break; + } #ifdef NMEA_ENABLE if (c == '$') { lexer->state = NMEA_DOLLAR; break; } #endif /* NMEA_ENABLE */ - #ifdef TNT_ENABLE if (c == '@') { lexer->state = TNT_LEADER; @@ -144,6 +147,12 @@ static void nextstate(struct gps_packet_t *lexer, #endif /* RTCM104_ENABLE */ break; /*@ +casebreak @*/ + case COMMENT_BODY: + if (c == '\n') + lexer->state = COMMENT_RECOGNIZED; + else if (!isprint(c)) + lexer->state = GROUND_STATE; + break; #ifdef NMEA_ENABLE case NMEA_DOLLAR: if (c == 'G') @@ -651,6 +660,10 @@ ssize_t packet_parse(struct gps_packet_t *lexer, struct rtcm_t *rtcm, size_t fix if (lexer->state == GROUND_STATE) { character_discard(lexer); } + else if (lexer->state == COMMENT_RECOGNIZED) { + packet_accept(lexer, COMMENT_PACKET); + packet_discard(lexer); + } #ifdef NMEA_ENABLE else if (lexer->state == NMEA_RECOGNIZED) { bool checksum_ok = true; diff --git a/packet_states.h b/packet_states.h index 8f6c174f..d2ea8d85 100644 --- a/packet_states.h +++ b/packet_states.h @@ -1,6 +1,9 @@ /* $Id$ */ GROUND_STATE, /* we don't know what packet type to expect */ + COMMENT_BODY, /* pound comment for a test load */ + COMMENT_RECOGNIZED, /* comment recognized */ + #ifdef NMEA_ENABLE NMEA_DOLLAR, /* we've seen first character of NMEA leader */ NMEA_PUB_LEAD, /* seen second character of NMEA G leader */ |