From adafdce89464672900c1fcafa45019b73adb715c Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 30 Jan 2010 14:19:42 +0000 Subject: Improved handling and documentation of AIS type 22 messages. --- gpsdecode.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'gpsdecode.c') diff --git a/gpsdecode.c b/gpsdecode.c index d566f5a8..37cf6db2 100644 --- a/gpsdecode.c +++ b/gpsdecode.c @@ -275,20 +275,34 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen) (uint)ais->type21.virtual_aid); break; case 22: /* Channel Management */ - (void)snprintf(buf+strlen(buf), buflen-strlen(buf), - "%u,%u,%u,%u,%d,%d,%d,%d,%u,%u,%u,%u", - ais->type22.channel_a, - ais->type22.channel_b, - ais->type22.txrx, - (uint)ais->type22.power, - ais->type22.ne_lon, - ais->type22.ne_lat, - ais->type22.sw_lon, - ais->type22.sw_lat, - (uint)ais->type22.addressed, - (uint)ais->type22.band_a, - (uint)ais->type22.band_b, - ais->type22.zonesize); + if (!ais->type22.addressed) + (void)snprintf(buf+strlen(buf), buflen-strlen(buf), + "%u,%u,%u,%u,%d,%d,%d,%d,%u,%u,%u,%u", + ais->type22.channel_a, + ais->type22.channel_b, + ais->type22.txrx, + (uint)ais->type22.power, + ais->type22.area.ne_lon, + ais->type22.area.ne_lat, + ais->type22.area.sw_lon, + ais->type22.area.sw_lat, + (uint)ais->type22.addressed, + (uint)ais->type22.band_a, + (uint)ais->type22.band_b, + ais->type22.zonesize); + else + (void)snprintf(buf+strlen(buf), buflen-strlen(buf), + "%u,%u,%u,%u,%u,%u,%u,%u,%u,%u", + ais->type22.channel_a, + ais->type22.channel_b, + ais->type22.txrx, + (uint)ais->type22.power, + ais->type22.mmsi.dest1, + ais->type22.mmsi.dest2, + (uint)ais->type22.addressed, + (uint)ais->type22.band_a, + (uint)ais->type22.band_b, + ais->type22.zonesize); break; case 23: /* Group Management Command*/ (void)snprintf(buf+strlen(buf), buflen-strlen(buf), -- cgit v1.2.1