summaryrefslogtreecommitdiff
path: root/driver_nmea2000.c
diff options
context:
space:
mode:
authorReinhard Arlt <reinhard.arlt@t-online.de>2015-05-07 17:24:48 +0200
committerReinhard Arlt <reinhard.arlt@t-online.de>2015-05-07 17:24:48 +0200
commitd6d606e4ddb3dd3f293fef4a98a5b656fffe19e4 (patch)
treeec45d8641e8afef686719ea23907f98530dc0ab1 /driver_nmea2000.c
parenta11329e1dc986a02710e258f588a93ad02e9ed9e (diff)
downloadgpsd-d6d606e4ddb3dd3f293fef4a98a5b656fffe19e4.tar.gz
Basic support for AIS MSG 4 and 11 in NMEA2000.
Diffstat (limited to 'driver_nmea2000.c')
-rw-r--r--driver_nmea2000.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/driver_nmea2000.c b/driver_nmea2000.c
index a56b7cd4..028e05e6 100644
--- a/driver_nmea2000.c
+++ b/driver_nmea2000.c
@@ -590,6 +590,30 @@ static gps_mask_t hnd_129040(unsigned char *bu, int len, PGN *pgn, struct gps_de
/*
+ * PGN 129793: AIS UTC and Date Report
+ */
+static gps_mask_t hnd_129793(unsigned char *bu, int len, PGN *pgn, struct gps_device_t *session)
+{
+ struct ais_t *ais;
+
+ ais = &session->gpsdata.ais;
+ print_data(session->context, bu, len, pgn);
+ gpsd_log(&session->context->errout, LOG_DATA,
+ "pgn %6d(%3d):\n", pgn->pgn, session->driver.nmea2000.unit);
+
+ if (decode_ais_header(session->context, bu, len, ais, 0xffffffffU) != 0) {
+ ais->type4.lon = (int) scale_int(getles32(bu, 5), (int64_t)(SHIFT32 *.06L));
+ ais->type4.lat = (int) scale_int(getles32(bu, 9), (int64_t)(SHIFT32 *.06L));
+ ais->type4.accuracy = (bool) ((bu[13] >> 0) & 0x01);
+ ais->type4.raim = (bool) ((bu[13] >> 1) & 0x01);
+
+ return(ONLINE_SET | AIS_SET);
+ }
+ return(0);
+}
+
+
+/*
* PGN 129794: AIS Class A Static and Voyage Related Data
*/
static gps_mask_t hnd_129794(unsigned char *bu, int len, PGN *pgn, struct gps_device_t *session)
@@ -1170,6 +1194,7 @@ static const char msg_129540[] = {"GNSS Satellites in View"};
static const char msg_129038[] = {"AIS Class A Position Report"};
static const char msg_129039[] = {"AIS Class B Position Report"};
static const char msg_129040[] = {"AIS Class B Extended Position Report"};
+static const char msg_129793[] = {"AIS UTC and Date report"};
static const char msg_129794[] = {"AIS Class A Static and Voyage Related Data"};
static const char msg_129798[] = {"AIS SAR Aircraft Position Report"};
static const char msg_129802[] = {"AIS Safty Related Broadcast Message"};
@@ -1218,6 +1243,7 @@ static PGN aispgn[] = {{ 59392, 0, 0, hnd_059392, &msg_059392[0]},
{129038, 1, 2, hnd_129038, &msg_129038[0]},
{129039, 1, 2, hnd_129039, &msg_129039[0]},
{129040, 1, 2, hnd_129040, &msg_129040[0]},
+ {129793, 1, 2, hnd_129793, &msg_129793[0]},
{129794, 1, 2, hnd_129794, &msg_129794[0]},
{129798, 1, 2, hnd_129798, &msg_129798[0]},
{129802, 1, 2, hnd_129802, &msg_129802[0]},