summaryrefslogtreecommitdiff
path: root/driver_nmea2000.c
diff options
context:
space:
mode:
authorReinhard Arlt <reinhard.arlt@t-online.de>2013-11-10 01:50:54 +0100
committerReinhard Arlt <reinhard.arlt@t-online.de>2013-11-10 01:50:54 +0100
commitcea67fceceb9851cc77321292879429876b04df8 (patch)
tree842e5fafecce71ee17593e376365d666e0437ccc /driver_nmea2000.c
parent474e009ad13ed28e8eec4329c4adcdf4bef52c59 (diff)
downloadgpsd-cea67fceceb9851cc77321292879429876b04df8.tar.gz
Isolate the access to split24 flag.
Diffstat (limited to 'driver_nmea2000.c')
-rw-r--r--driver_nmea2000.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/driver_nmea2000.c b/driver_nmea2000.c
index 353d4960..8ccf9dcc 100644
--- a/driver_nmea2000.c
+++ b/driver_nmea2000.c
@@ -178,6 +178,16 @@ static double ais_direction(unsigned int val, double scale)
}
+static bool get_split24(struct gps_device_t *session)
+{
+ bool split24;
+
+ split24 = session->gpsdata.policy.split24;
+
+ return split24;
+}
+
+
/*
* PGN 59392: ISO Acknowledgment
*/
@@ -781,7 +791,9 @@ static gps_mask_t hnd_129802(unsigned char *bu, int len, PGN *pgn, struct gps_de
static gps_mask_t hnd_129809(unsigned char *bu, int len, PGN *pgn, struct gps_device_t *session)
{
struct ais_t *ais;
+ bool split24;
+ split24 = get_split24(session);
ais = &session->gpsdata.ais;
print_data(session->context, bu, len, pgn);
gpsd_report(session->context->debug, LOG_DATA,
@@ -796,7 +808,7 @@ static gps_mask_t hnd_129809(unsigned char *bu, int len, PGN *pgn, struct gps_de
"NMEA2000: AIS message 24A from %09u stashed.\n",
ais->mmsi);
- if (session->gpsdata.policy.split24 == true) {
+ if (split24 == true) {
for (l=0;l<AIS_SHIPNAME_MAXLEN;l++) {
ais->type24.shipname[l] = (char) bu[ 5+l];
}
@@ -815,7 +827,7 @@ static gps_mask_t hnd_129809(unsigned char *bu, int len, PGN *pgn, struct gps_de
}
decode_ais_channel_info(bu, len, 200, session);
- if (session->gpsdata.policy.split24 == true) {
+ if (split24 == true) {
ais->type24.part = part_a;
return(ONLINE_SET | AIS_SET);
} else {
@@ -832,7 +844,9 @@ static gps_mask_t hnd_129809(unsigned char *bu, int len, PGN *pgn, struct gps_de
static gps_mask_t hnd_129810(unsigned char *bu, int len, PGN *pgn, struct gps_device_t *session)
{
struct ais_t *ais;
+ bool split24;
+ split24 = get_split24(session);
ais = &session->gpsdata.ais;
print_data(session->context, bu, len, pgn);
gpsd_report(session->context->debug, LOG_DATA,
@@ -876,7 +890,7 @@ static gps_mask_t hnd_129810(unsigned char *bu, int len, PGN *pgn, struct gps_de
}
}
- if (session->gpsdata.policy.split24 == true) {
+ if (split24 == true) {
#if NMEA2000_DEBUG_AIS
printf("AIS: MMSI : %09u\n", ais->mmsi);
printf("AIS: vendor: %-8.8s c:%-8.8s b:%6u s:%6u p:%6u s:%6u\n",