diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-10-11 10:00:27 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-10-11 10:00:27 -0400 |
commit | 3c1b35615925d4597e475a8422e0021ab288f7ed (patch) | |
tree | 01395920116bcc41cd48d6fc91d4f2c02334a7f1 /driver_nmea0183.c | |
parent | 33ff413e345ad5e4a4d571dfb6c708bb77954a23 (diff) | |
download | gpsd-3c1b35615925d4597e475a8422e0021ab288f7ed.tar.gz |
Move the MTK extension parset to where it belongs in the NMEA 0183 driver.
Diffstat (limited to 'driver_nmea0183.c')
-rw-r--r-- | driver_nmea0183.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/driver_nmea0183.c b/driver_nmea0183.c index 25b8615f..1be5d1d8 100644 --- a/driver_nmea0183.c +++ b/driver_nmea0183.c @@ -1089,6 +1089,46 @@ static gps_mask_t processPASHR(int c UNUSED, char *field[], } #endif /* ASHTECH_ENABLE */ +#ifdef MTK3301_ENABLE +static gps_mask_t processMTK3301(int c UNUSED, char *field[], + struct gps_device_t *session) +{ + int msg, reason; + + msg = atoi(&(session->driver.nmea.field[0])[4]); + switch (msg) { + case 705: /* */ + (void)strlcat(session->subtype, session->driver.nmea.field[1], sizeof(session->subtype)); + (void)strlcat(session->subtype, "-", sizeof(session->subtype)); + (void)strlcat(session->subtype, session->driver.nmea.field[2], sizeof(session->subtype)); + return ONLINE_SET; + case 001: /* ACK / NACK */ + reason = atoi(session->driver.nmea.field[2]); + if (atoi(session->driver.nmea.field[1]) == -1) + gpsd_report(session->context->debug, LOG_WARN, + "MTK NACK: unknown sentence\n"); + else if (reason < 3) { + const char *mtk_reasons[] = { + "Invalid", + "Unsupported", + "Valid but Failed", + "Valid success" + }; + gpsd_report(session->context->debug, LOG_WARN, + "MTK NACK: %s, reason: %s\n", + session->driver.nmea.field[1], + mtk_reasons[reason]); + } + else + gpsd_report(session->context->debug, LOG_WARN, + "MTK ACK: %s\n", session->driver.nmea.field[1]); + return ONLINE_SET; + default: + return ONLINE_SET; /* ignore */ + } +} +#endif /* MTK3301_ENABLE */ + /************************************************************************** * * Entry points begin here @@ -1150,6 +1190,9 @@ gps_mask_t nmea_parse(char *sentence, struct gps_device_t * session) {"OHPR", 18, false, processOHPR}, #endif /* OCEANSERVER_ENABLE */ /*@ +nullassign @*/ +#ifdef MTK3301_ENABLE + {"PMTK", 3, false, processMTK3301}, +#endif /* MTK3301_ENABLE */ }; int count; |