summaryrefslogtreecommitdiff
path: root/driver_ais.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-27 17:40:48 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-27 17:40:48 -0400
commitd77d96c6d6150ffe24f1d57fd021d18f0c20901b (patch)
tree3f2c30d539431d552e9c9132c29f5304ad413420 /driver_ais.c
parent0a113e2f39e179e84b03e1da1947f401966d981e (diff)
downloadgpsd-d77d96c6d6150ffe24f1d57fd021d18f0c20901b.tar.gz
All gpsd_reportcalls are gone. Only the unused definitins are left.
Next, implement labeled reporting and fix up gpson to do the right thing. All regression tests pass.
Diffstat (limited to 'driver_ais.c')
-rw-r--r--driver_ais.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/driver_ais.c b/driver_ais.c
index 9b5065ab..675955d2 100644
--- a/driver_ais.c
+++ b/driver_ais.c
@@ -59,7 +59,7 @@ static void from_sixbit(unsigned char *bitvec, uint start, int count, char *to)
}
/*@ +charint @*/
-bool ais_binary_decode(const int debug,
+bool ais_binary_decode(const struct errout_t *errout,
struct ais_t *ais,
const unsigned char *bits, size_t bitlen,
struct ais_type24_queue_t *type24_queue)
@@ -78,24 +78,24 @@ bool ais_binary_decode(const int debug,
ais->type = UBITS(0, 6);
ais->repeat = UBITS(6, 2);
ais->mmsi = UBITS(8, 30);
- gpsd_report(debug, LOG_INF,
+ gpsd_notify(errout, LOG_INF,
"AIVDM message type %d, MMSI %09d:\n",
ais->type, ais->mmsi);
#define PERMISSIVE_LENGTH_CHECK(correct) \
if (bitlen < correct) { \
- gpsd_report(debug, LOG_ERROR, \
+ gpsd_notify(errout, LOG_ERROR, \
"AIVDM message type %d size < %d bits (%zd).\n", \
ais->type, correct, bitlen); \
return false; \
} else if (bitlen > correct) { \
- gpsd_report(debug, LOG_WARN, \
+ gpsd_notify(errout, LOG_WARN, \
"AIVDM message type %d size > %d bits (%zd).\n", \
ais->type, correct, bitlen); \
}
#define RANGE_CHECK(min, max) \
if (bitlen < min || bitlen > max) { \
- gpsd_report(debug, LOG_ERROR, \
+ gpsd_notify(errout, LOG_ERROR, \
"AIVDM message type %d size is out of range (%zd).\n", \
ais->type, bitlen); \
return false; \
@@ -145,7 +145,7 @@ bool ais_binary_decode(const int debug,
break;
case 5: /* Ship static and voyage related data */
if (bitlen != 424) {
- gpsd_report(debug, LOG_WARN,
+ gpsd_notify(errout, LOG_WARN,
"AIVDM message type 5 size not 424 bits (%zd).\n",
bitlen);
/*
@@ -944,7 +944,7 @@ bool ais_binary_decode(const int debug,
{
struct ais_type24a_t *saveptr = &type24_queue->ships[type24_queue->index];
- gpsd_report(debug, LOG_PROG,
+ gpsd_notify(errout, LOG_PROG,
"AIVDM: 24A from %09u stashed.\n",
ais->mmsi);
saveptr->mmsi = ais->mmsi;
@@ -991,7 +991,7 @@ bool ais_binary_decode(const int debug,
(void)strlcpy(ais->type24.shipname,
type24_queue->ships[i].shipname,
sizeof(type24_queue->ships[i].shipname));
- gpsd_report(debug, LOG_PROG,
+ gpsd_notify(errout, LOG_PROG,
"AIVDM 24B from %09u matches a 24A.\n",
ais->mmsi);
/* prevent false match if a 24B is repeated */
@@ -1005,7 +1005,7 @@ bool ais_binary_decode(const int debug,
ais->type24.part = part_b;
return true;
default:
- gpsd_report(debug, LOG_WARN,
+ gpsd_notify(errout, LOG_WARN,
"AIVDM message type 24 of subtype unknown.\n");
return false;
}
@@ -1013,7 +1013,7 @@ bool ais_binary_decode(const int debug,
case 25: /* Binary Message, Single Slot */
/* this check and the following one reject line noise */
if (bitlen < 40 || bitlen > 168) {
- gpsd_report(debug, LOG_WARN,
+ gpsd_notify(errout, LOG_WARN,
"AIVDM message type 25 size not between 40 to 168 bits (%zd).\n",
bitlen);
return false;
@@ -1021,7 +1021,7 @@ bool ais_binary_decode(const int debug,
ais->type25.addressed = (bool)UBITS(38, 1);
ais->type25.structured = (bool)UBITS(39, 1);
if (bitlen < (unsigned)(40 + (16*ais->type25.structured) + (30*ais->type25.addressed))) {
- gpsd_report(debug, LOG_WARN,
+ gpsd_notify(errout, LOG_WARN,
"AIVDM message type 25 too short for mode.\n");
return false;
}
@@ -1049,7 +1049,7 @@ bool ais_binary_decode(const int debug,
ais->type26.addressed = (bool)UBITS(38, 1);
ais->type26.structured = (bool)UBITS(39, 1);
if ((signed)bitlen < 40 + 16*ais->type26.structured + 30*ais->type26.addressed + 20) {
- gpsd_report(debug, LOG_WARN,
+ gpsd_notify(errout, LOG_WARN,
"AIVDM message type 26 too short for mode.\n");
return false;
}
@@ -1064,7 +1064,7 @@ bool ais_binary_decode(const int debug,
break;
case 27: /* Long Range AIS Broadcast message */
if (bitlen != 96 && bitlen != 168) {
- gpsd_report(debug, LOG_WARN,
+ gpsd_notify(errout, LOG_WARN,
"unexpected AIVDM message type 27 (%zd).\n",
bitlen);
return false;
@@ -1073,7 +1073,7 @@ bool ais_binary_decode(const int debug,
* This is an implementation error observed in the wild,
* sending a full 168-bit slot rather than just 96 bits.
*/
- gpsd_report(debug, LOG_WARN,
+ gpsd_notify(errout, LOG_WARN,
"oversized 169=8-bit AIVDM message type 27.\n");
}
ais->type27.accuracy = (bool)UBITS(38, 1);
@@ -1086,7 +1086,7 @@ bool ais_binary_decode(const int debug,
ais->type27.gnss = (bool)UBITS(94, 1);
break;
default:
- gpsd_report(debug, LOG_ERROR,
+ gpsd_notify(errout, LOG_ERROR,
"Unparsed AIVDM message type %d.\n",ais->type);
return false;
}