summaryrefslogtreecommitdiff
path: root/gpsdecode.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-10 14:00:30 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-10 14:00:30 -0500
commit2f72253be9a6de623b0b28d77f29998414558326 (patch)
treea3e8afd40ba112bd87fa03a84ad0b30dede9e04f /gpsdecode.c
parent652bef980071328ad83a3a88fe78d6d47f6c7db4 (diff)
downloadgpsd-2f72253be9a6de623b0b28d77f29998414558326.tar.gz
Make interpretation of the split24 flag propperly per-subscriber.
This involved moving some out of the AIS driver. There is a related small change in behavior; now, if split24 is on, the Type B half of a matched pair will be shipped with type 'both'. All regression tests pass. PPS is live.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r--gpsdecode.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gpsdecode.c b/gpsdecode.c
index 35b5cc7f..22238817 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -51,6 +51,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
{
char scratchbuf[MAX_PACKET_LENGTH*2+1];
bool imo = false;
+
(void)snprintf(buf, buflen, "%u|%u|%09u|", ais->type, ais->repeat,
ais->mmsi);
/*@ -formatcode @*/
@@ -548,7 +549,6 @@ static void decode(FILE *fpin, FILE*fpout)
gpsd_clear(&session);
session.gpsdata.gps_fd = fileno(fpin);
session.gpsdata.dev.baudrate = 38400; /* hack to enable subframes */
- session.gpsdata.policy.split24 = split24;
(void)strlcpy(session.gpsdata.dev.path,
"stdin",
sizeof(session.gpsdata.dev.path));
@@ -574,6 +574,10 @@ static void decode(FILE *fpin, FILE*fpout)
}
#ifdef SOCKET_EXPORT_ENABLE
else {
+ if ((changed & AIS_SET)!=0) {
+ if (session.gpsdata.ais.type == 24 && session.gpsdata.ais.type24.part != both && !split24)
+ continue;
+ }
json_data_report(changed,
&session, &policy,
buf, sizeof(buf));
@@ -583,6 +587,8 @@ static void decode(FILE *fpin, FILE*fpout)
#ifdef AIVDM_ENABLE
} else if (session.packet.type == AIVDM_PACKET) {
if ((changed & AIS_SET)!=0) {
+ if (session.gpsdata.ais.type == 24 && session.gpsdata.ais.type24.part != both && !split24)
+ continue;
aivdm_csv_dump(&session.gpsdata.ais, buf, sizeof(buf));
(void)fputs(buf, fpout);
}