AISTrack SDK is a source-code software library for decoding NMEA 0183 formatted AIVDO or AIVDM strings from AIS hardware. The simple and flexible C++ library API allows programmers to save time when developing software for AIS. The VHF Data Link (VDL) binary messages defined in the following documents are decoded:
ITU-R M.1371 Recommendation.
The technical clarifications for ITU-R M.1371.
IEC 62287 (Class B AIS using CSTDMA).
Features
Complete: Capable of decoding all 24 AIS messages.
Correct: Tested with PMG1 and AITS-R from Sine Qua Non – the de facto standard for AIS test and measurement.
Easy to use: Input: NMEA string. Output: AIS Message object.
Flexible: Visitor design-pattern classes are provided for messages and message fields. Subclass these to integrate AIS decoding into your code.
Robust: No assumptions are made about the input data. Malformed strings and invalid combinations of input are handled correctly.
Fast: Decodes 8,800 messages per second on a P3 Celeron 1.2Ghz.
Portable: Pure ISO C++ code that works on multiple compilers and platforms.
SDK Contents
The SDK includes:
Complete C++ source-code.
HTML and PDF documentation.
Example code and project/make files.
30 days email support.
Access to free minor-version upgrades.
Example Usage
Here we decode a two NMEA sentence message and output the MMSI contained in the
message. Next we check if it is message 21 (Aids to navigation report), and if so we output one of the unique fields of that message:
#include<fstream>
#include<sstream>
#include<stdexcept>
#include<iostream>
#include<Decoder.h>
#include<AidsToNavigationReport.h>
using namespace AISTrackSDK;
intmain(int argc, char **argv) {
Decoder dec;
std::string nmea1 = "!AIVDO,2,1,0,A,E>jQPVIR:W60WST0Ta2P0""0000000b?0Tn=jWP30@H@PO@PSm,0*6B";
std::string nmea2 = "!AIVDO,2,2,0,A,FE1Dm0,4*3B";
dec.input(nmea1);
dec.input(nmea2);
if (dec.ready()) {
Message *msg = dec.output();
// print out the MMSI of the vessel that sent this message
std::cout << msg->userID << std::endl;
// Here we attempt a dynamic_cast, if it succeeds,
// we can manipulate the message we’re looking for.
if (AidsToNavigationReport *p =
dynamic_cast<AidsToNavigationReport*>(msg)) {
std::cout << p->nameOfATON<< std::endl;
}
delete msg;
}
return 0;
}
Running this program produces the output:
992501913
DUNLAOGHAIRE@@@@@@@@
The dynamic_cast above is used to test the type of the Message object
and to obtain a pointer to the subclass. The message number is available as an integer in the Message object, so an "if" or "case" statement would also work to test the message type.
A good alternative to type testing is to make use of the Vistor design pattern. AISTrackSDK includes a visitor class hierarchy for the AIS messages and a visitor for message fields. As an example, we provide a MessageVisitor called CoordVisitor, which updates its’ latitude and longitude when it visits an AIS message with coordinate fields. Finally, we implemented an example FieldVisitor that converts AIS messages to simple XML documents:
#include<fstream>
#include<sstream>
#include<stdexcept>
#include<iostream>
#include<Decoder.h>
#include<CoordVisitor.h>
#include<XMLGenerator.h>
using namespace AISTrackSDK;
intmain(int argc, char **argv) {
Decoder dec;
std::string nmea1 = "!AIVDO,2,1,0,A,E>jQPVIR:W60WST0Ta2P0""0000000b?0Tn=jWP30@H@PO@PSm,0*6B";
std::string nmea2 = "!AIVDO,2,2,0,A,FE1Dm0,4*3B";
CoordVisitor coordinate; // Construct a CoordVisitor
XMLGenerator xml; // Construct an XMLGenerator visitor
dec.input(nmea1);
dec.input(nmea2);
if (dec.ready()) {
Message *msg = dec.output();
// Let the coordinate be updated by visiting the message
msg->accept(coordinate);
// If the message’s visitor is’t subclassed by the coordinate
// visitor (because it doesn’t contain coordinate information),
// then the visitor will not update it’s coordinate, and we can
// skip output for this message:
if (coordinate.hasUpdate()) {
std::cout << coordinate; // Print out the coordinate
}
msg->accept(xml); // Let the xml generator visit the message
std::cout << xml << std::endl; // Output XML
delete msg;
}
return 0;
}
Writing your own visitor implementation is easy and provides a powerful tool for interfacing with navigational or vessel tracking code.
Pricing
The AISTrack SDK source-code library license for royalty-free binary redistribution is $2999 US. For information on academic discounts please contact sales@aistrack.com.
Ordering
To obtain an invoice please send your order via email to sales@aistrack.com. Alternatively, you may use our online credit-card facility:
Buy now
To download a copy of AISTrack SDK, click the “Buy now” button below. You will be redirected to the Monsterpay.com secure payment page. Once your payment has been processed, you will receive a unique download link via email.
AISTrack SDK
Overview
AISTrack SDK is a source-code software library for decoding NMEA 0183 formatted AIVDO or AIVDM strings from AIS hardware. The simple and flexible C++ library API allows programmers to save time when developing software for AIS. The VHF Data Link (VDL) binary messages defined in the following documents are decoded:
Features
SDK Contents
The SDK includes:
Example Usage
Here we decode a two NMEA sentence message and output the MMSI contained in the
message. Next we check if it is message 21 (Aids to navigation report), and if so we output one of the unique fields of that message:
#include <fstream> #include <sstream> #include <stdexcept> #include <iostream> #include <Decoder.h> #include <AidsToNavigationReport.h> using namespace AISTrackSDK; int main(int argc, char **argv) { Decoder dec; std::string nmea1 = "!AIVDO,2,1,0,A,E>jQPVIR:W60WST0Ta2P0" "0000000b?0Tn=jWP30@H@PO@PSm,0*6B"; std::string nmea2 = "!AIVDO,2,2,0,A,FE1Dm0,4*3B"; dec.input(nmea1); dec.input(nmea2); if (dec.ready()) { Message *msg = dec.output(); // print out the MMSI of the vessel that sent this message std::cout << msg->userID << std::endl; // Here we attempt a dynamic_cast, if it succeeds, // we can manipulate the message we’re looking for. if (AidsToNavigationReport *p = dynamic_cast<AidsToNavigationReport*>(msg)) { std::cout << p->nameOfATON<< std::endl; } delete msg; } return 0; }Running this program produces the output:
The dynamic_cast above is used to test the type of the Message object
and to obtain a pointer to the subclass. The message number is available as an integer in the Message object, so an "if" or "case" statement would also work to test the message type.
A good alternative to type testing is to make use of the Vistor design pattern. AISTrackSDK includes a visitor class hierarchy for the AIS messages and a visitor for message fields. As an example, we provide a MessageVisitor called CoordVisitor, which updates its’ latitude and longitude when it visits an AIS message with coordinate fields. Finally, we implemented an example FieldVisitor that converts AIS messages to simple XML documents:
#include <fstream> #include <sstream> #include <stdexcept> #include <iostream> #include <Decoder.h> #include <CoordVisitor.h> #include <XMLGenerator.h> using namespace AISTrackSDK; int main(int argc, char **argv) { Decoder dec; std::string nmea1 = "!AIVDO,2,1,0,A,E>jQPVIR:W60WST0Ta2P0" "0000000b?0Tn=jWP30@H@PO@PSm,0*6B"; std::string nmea2 = "!AIVDO,2,2,0,A,FE1Dm0,4*3B"; CoordVisitor coordinate; // Construct a CoordVisitor XMLGenerator xml; // Construct an XMLGenerator visitor dec.input(nmea1); dec.input(nmea2); if (dec.ready()) { Message *msg = dec.output(); // Let the coordinate be updated by visiting the message msg->accept(coordinate); // If the message’s visitor is’t subclassed by the coordinate // visitor (because it doesn’t contain coordinate information), // then the visitor will not update it’s coordinate, and we can // skip output for this message: if (coordinate.hasUpdate()) { std::cout << coordinate; // Print out the coordinate } msg->accept(xml); // Let the xml generator visit the message std::cout << xml << std::endl; // Output XML delete msg; } return 0; }Program output:
CoordVisitor: long=18.4525 lat=-34.1994 <?xml version="1.0"?> <aisvdl messageID="21" repeatIndicator="0"> <userID value="992501913"/> <typeOfATON value="19"/> <nameOfATON value="DUNLAOGHAIRE@@@@@@@@"/> <positionAccuracy value="0"/> <longitude value="11071524"/> <latitude value="113698108"/> <dimensionAndReference value="6299842"/> <EPFDType value="1"/> <timeStamp value="0"/> <offPositionIndicator value="1"/> <reservedForRegionalApp value="244"/> <RAIMFlag value="0"/> <virtualPseudoAtoNFlag value="0"/> <assignedModeFlag value="1"/> <spare1 value="0"/> <nameOfATONExtension value="BOUYTEST%`X&)!"/> <spare2 value="56"/> </aisvdl>Writing your own visitor implementation is easy and provides a powerful tool for interfacing with navigational or vessel tracking code.
Pricing
The AISTrack SDK source-code library license for royalty-free binary redistribution is $2999 US. For information on academic discounts please contact sales@aistrack.com.
Ordering
To obtain an invoice please send your order via email to sales@aistrack.com. Alternatively, you may use our online credit-card facility:
Buy now
To download a copy of AISTrack SDK, click the “Buy now” button below. You will be redirected to the Monsterpay.com secure payment page. Once your payment has been processed, you will receive a unique download link via email.