Library Architecture¶
EasyNMEA is divided into three levels (from outer to inner):
API Level : This level contains all public API, i.e. the classes in the
includedirectory.Implementation Level: This level contains all the internal classes which provide functionality to the library.
Serial Interface Level: This level contains the classes for interacting with the serial port (through Asio).
API Level¶
The API level comprises all the EasyNMEA public classes and structures, and acts as entry point for the
library’s functionalities.
It consists of a main class EasyNmea, which provides application with access to the functionalities, and all
the supporting classes and structures for return types and input and output parameters.
Those companion classes and structures are ReturnCode, GPGGAData, and NMEA0183DataKindMask.
For the actual functionality implementation, EasyNmea relies on the internal class EasyNmeaImpl.
Implementation Level¶
The implementation level comprises two main components:
The
EasyNmeaImplclass, which provides with implementation for theEasyNmeapublic API, i.e opening and closing the serial port, waiting until data of one or more NMEA 0183 types has been received, checking whether the serial port connection is opened, and taking the next unread sample of a given NMEA 0183 type. TheEasyNmeaImplholds aFixedSizeQueueof ten elements for each supported NMEA 0183 type. This way, keeping outdated samples, as well as dynamic allocation of data samples, is avoided. The managing of the serial port is enabled through theSerialInterfaceclass.The
EasyNmeaCoderclass, which provides APIs for decode NMEA 0183 sentences (and to encode them in the future).
Serial Interface Level¶
The serial interface level is comprised of the SerialInterface class, which provides member functions to open and
close a serial port, as well as for reading data from it.
SerialInterface is a template class with a template parameter SerialPort that defines the serial port
implementation, which defaults to :class: asio::serial_port.