Ham-APRS-FAP
view release on metacpan or search on metacpan
'dstpath_toomany' => 'Too many destination path components to be AX.25',
'dstcall_none' => 'No destination field in packet',
'dstcall_noax25' => 'Destination callsign is not a valid AX.25 call',
'digicall_noax25' => 'Digipeater callsign is not a valid AX.25 call',
'digicall_badchars' => 'Digipeater callsign contains bad characters',
'timestamp_inv_loc' => 'Invalid timestamp in location',
'timestamp_inv_obj' => 'Invalid timestamp in object',
'timestamp_inv_sta' => 'Invalid timestamp in status',
'timestamp_inv_gpgga' => 'Invalid timestamp in GPGGA sentence',
'timestamp_inv_gpgll' => 'Invalid timestamp in GPGLL sentence',
'packet_invalid' => 'Invalid packet',
'nmea_inv_cval' => 'Invalid coordinate value in NMEA sentence',
'nmea_large_ew' => 'Too large value in NMEA sentence (east/west)',
'nmea_large_ns' => 'Too large value in NMEA sentence (north/south)',
'nmea_inv_sign' => 'Invalid lat/long sign in NMEA sentence',
'nmea_inv_cksum' => 'Invalid checksum in NMEA sentence',
'gprmc_fewfields' => 'Less than ten fields in GPRMC sentence ',
'gprmc_nofix' => 'No GPS fix in GPRMC sentence',
'gprmc_inv_time' => 'Invalid timestamp in GPRMC sentence',
'gprmc_inv_date' => 'Invalid date in GPRMC sentence',
'gprmc_date_out' => 'GPRMC date does not fit in an Unix timestamp',
'gpgga_fewfields' => 'Less than 11 fields in GPGGA sentence',
'gpgga_nofix' => 'No GPS fix in GPGGA sentence',
'gpgll_fewfields' => 'Less than 5 fields in GPGLL sentence',
'gpgll_nofix' => 'No GPS fix in GPGLL sentence',
'nmea_unsupp' => 'Unsupported NMEA sentence type',
'obj_short' => 'Too short object',
'obj_inv' => 'Invalid object',
'obj_dec_err' => 'Error in object location decoding',
'item_short' => 'Too short item',
'item_inv' => 'Invalid item',
'item_dec_err' => 'Error in item location decoding',
return 0;
}
$rethash->{'longitude'} = $longitude;
# we have everything we want, return
return 1;
} elsif ($nmeafields[0] eq 'GPGGA') {
# we want at least 11 fields
if (@nmeafields < 11) {
_a_err($rethash, 'gpgga_fewfields', scalar(@nmeafields));
return 0;
}
# check for position validity
if ($nmeafields[6] =~ /^\s*(\d+)\s*$/o) {
if ($1 < 1) {
_a_err($rethash, 'gpgga_nofix', $1);
return 0;
}
} else {
_a_err($rethash, 'gpgga_nofix');
return 0;
}
# Use the APRS time parsing routines to check
# the time and convert it to timestamp.
# But before that, remove a possible decimal part
$nmeafields[1] =~ s/\.\d+$//;
$rethash->{'timestamp'} = _parse_timestamp($options, $nmeafields[1] . 'h');
if ($rethash->{'timestamp'} == 0) {
_a_err($rethash, 'timestamp_inv_gpgga');
return 0;
}
# latitude and longitude
my $latitude = _nmea_getlatlon($nmeafields[2], $nmeafields[3], $rethash);
if (not(defined($latitude))) {
return 0;
}
$rethash->{'latitude'} = $latitude;
my $longitude = _nmea_getlatlon($nmeafields[4], $nmeafields[5], $rethash);
# force numeric interpretation
$rethash->{'altitude'} = $1 + 0;
}
# ok
return 1;
} elsif ($nmeafields[0] eq 'GPGLL') {
# we want at least 5 fields
if (@nmeafields < 5) {
_a_err($rethash, 'gpgll_fewfields', scalar(@nmeafields));
return 0;
}
# latitude and longitude
my $latitude = _nmea_getlatlon($nmeafields[1], $nmeafields[2], $rethash);
if (not(defined($latitude))) {
return 0;
}
$rethash->{'latitude'} = $latitude;
my $longitude = _nmea_getlatlon($nmeafields[3], $nmeafields[4], $rethash);
}
$rethash->{'longitude'} = $longitude;
# Use the APRS time parsing routines to check
# the time and convert it to timestamp.
# But before that, remove a possible decimal part
if (@nmeafields >= 6) {
$nmeafields[5] =~ s/\.\d+$//;
$rethash->{'timestamp'} = _parse_timestamp($options, $nmeafields[5] . 'h');
if ($rethash->{'timestamp'} == 0) {
_a_err($rethash, 'timestamp_inv_gpgll');
return 0;
}
}
if (@nmeafields >= 7) {
# GPS fix validity supplied
if ($nmeafields[6] ne 'A') {
_a_err($rethash, 'gpgll_nofix');
return 0;
}
}
# ok
return 1;
##} elsif ($nmeafields[0] eq 'GPVTG') {
##} elsif ($nmeafields[0] eq 'GPWPT') {
} else {
( run in 0.560 second using v1.01-cache-2.11-cpan-e1769b4cff6 )