summaryrefslogtreecommitdiff
path: root/gpsdecode.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-01-30 14:19:42 +0000
committerEric S. Raymond <esr@thyrsus.com>2010-01-30 14:19:42 +0000
commitadafdce89464672900c1fcafa45019b73adb715c (patch)
treebcfba55d1488e605f770819bcce291df369b5025 /gpsdecode.c
parentcc8599a7f1c56985fc106085e81e6de7a3dbe2ed (diff)
downloadgpsd-adafdce89464672900c1fcafa45019b73adb715c.tar.gz
Improved handling and documentation of AIS type 22 messages.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r--gpsdecode.c42
1 files changed, 28 insertions, 14 deletions
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),