NAME
STANAG - Library for processing STANAG 4586 messages
SYNOPSIS
use STANAG qw(Get_Vehicle_Name Get_Vehicle_Subtype);
use strict;
use warnings;
use Data::Dumper;
my $hashref = STANAG::Vehicle_ID(); #get blank hash
$hashref->{Vehicle_Type} = 22; #stick in some sample data
$hashref->{Vehicle_Subtype} = 101;
print Dumper($hashref); #see what's in it
my $flat = STANAG::Encode_Vehicle_ID($hashref); #package up for sending (computes xsums)
my $hashref2 = STANAG::Decode_Vehicle_ID($flat); #unpackage into hash (checks xsums)
my $hashref3 = STANAG::Vehicle_ID(); #grab a new hash with latest used values
#so this one gets the values we put into $hashref
print Dumper($hashref2);
print Dumper($hashref3); #these print the same thing
print Get_Vehicle_Name($hashref2->{Vehicle_Type}),"\n"; #demo decoding some numeric codes.
print Get_Vehicle_Subtype($hashref2->{Vehicle_Subtype}),"\n";
ABSTRACT
Library acts as a wrapper around Parse::Binary::FixedFormat for STANAG 4586 messages. Most of the internals were autogenerated from the 4586 specification.
The module also stores an internal state hash representing a history of the latest values encoded or decoded. This way when you get a message and decode it, and then want to respond, the new template is prepopulated.
EXPORT
None by default.
Available are: Get_Vehicle_Name Get_Vehicle_Subtype Get_Country_Name
- AUTOLOAD This function handles all access to the messages. This is the main interface to this module.
-
A call of STANAG::<message> will return a hashref for that message
A call of STANAG::Encode_<message>(hashref) will return the message, formatted and with xsums added
A call of STANAG::Decode_<message>(message) will return the hashref corresponding the the message and will issue warnings if the xsums don't match.
- Get_Country_Name($country_code) This function returns a string representing the country which corresponds to the numberic code given.
- Get_Vehicle_Subtype($code) This function returns a string representing the vehicle subtype which corresponds to the numberic code given.
- Checksum($datagram) This function computes a checksum on the given record as the addition of all elements in the record when interpreted as 4 byte unsigned integers.
-
The modulus constrains the result to a 4 byte integer. Perl might allow it to grow past that.
- Get_Vehicle_Name($code) This function returns a string representing the vehicle which corresponds to the numberic code given.
SEE ALSO
Parse::Binary::FixedFormat - Documentation for the objects returned.
COPYRIGHT AND LICENSE
Copyright 2009 Chris Johnson
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.