STANAG - Library for processing STANAG 4586 messages
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";
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.
None by default.
Available are: Get_Vehicle_Name Get_Vehicle_Subtype Get_Country_Name
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.
The modulus constrains the result to a 4 byte integer. Perl might allow it to grow past that.
Parse::Binary::FixedFormat - Documentation for the objects returned.
Copyright 2009 Chris Johnson
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install STANAG, copy and paste the appropriate command in to your terminal.
cpanm
cpanm STANAG
CPAN shell
perl -MCPAN -e shell install STANAG
For more information on module installation, please visit the detailed CPAN module installation guide.