parse_aprs: Fix logging of "Unknown NMEA" to use hlog_packet

This commit is contained in:
Heikki Hannikainen 2013-03-07 21:23:54 +02:00
parent d05829bcad
commit 8540eb7752
2 changed files with 9 additions and 2 deletions

View File

@ -509,7 +509,7 @@ static int parse_aprs_nmea(struct pbuf_t *pb, const char *body, const char *body
} }
if (!latp || !lngp) { if (!latp || !lngp) {
hlog(LOG_DEBUG, "Unknown NMEA: '%.11s' %.*s", pb->data, (int)(body_end - body), body); hlog_packet(LOG_DEBUG, pb->data, pb->packet_len-2, "Unknown NMEA: ");
return 0; /* Well.. Not NMEA frame */ return 0; /* Well.. Not NMEA frame */
} }

View File

@ -6,7 +6,7 @@
# #
use Test; use Test;
BEGIN { plan tests => 11 }; BEGIN { plan tests => 12 };
use runproduct; use runproduct;
use istest; use istest;
use Ham::APRS::IS; use Ham::APRS::IS;
@ -55,6 +55,13 @@ istest::should_drop(\&ok, $i_tx, $i_rx,
$tx, # should drop $tx, # should drop
$dummy, 1, 1); # will pass (helper packet) $dummy, 1, 1); # will pass (helper packet)
# 11: should drop, invalid char in coordinates
$tx = "OH4XYZ>GPSMW:\$GPRMO,182051.\xf000,A,6039.8655,N,01708.3799,E,20.07,243.41,070313,,,A*5A";
$dummy = "OH5XYZ>GPSMV:\$GPRMC,212052,A,4609.1157,N,12258.8145,W,0.168,13.4,130909,17.9,E*6B";
istest::should_drop(\&ok, $i_tx, $i_rx,
$tx, # should drop
$dummy, 1, 1); # will pass (helper packet)
# stop # stop
ok($p->stop(), 1, "Failed to stop product"); ok($p->stop(), 1, "Failed to stop product");