nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
nmealib::nmea0183::APB Class Reference

Represents a parsed NMEA 0183 APB (Autopilot Sentence "B") sentence. More...

#include <apb.h>

Inheritance diagram for nmealib::nmea0183::APB:
Inheritance graph
[legend]
Collaboration diagram for nmealib::nmea0183::APB:
Collaboration graph
[legend]

Public Member Functions

 APB (std::string talkerId, char status1, char status2, double crossTrackErrorMagnitude, char directionToSteer, char crossTrackUnits, char arrivalCircleStatus, char perpendicularPassedAtWaypoint, double bearingOriginToDestination, char bearingOriginToDestinationType, std::string destinationWaypointId, double bearingPresentToDestination, char bearingPresentToDestinationType, double headingToSteerToDestinationWaypoint, char headingToSteerToDestinationWaypointType)
 Construct an APB message from individual field values.
 
 APB (const APB &)=default
 
APBoperator= (const APB &)=default
 
 APB (APB &&) noexcept=default
 
APBoperator= (APB &&) noexcept=default
 
 ~APB () override=default
 
std::unique_ptr< nmealib::Messageclone () const override
 Create a polymorphic copy of this APB message.
 
char getStatus1 () const noexcept
 Get primary APB status flag.
 
char getStatus2 () const noexcept
 Get secondary APB status flag.
 
double getCrossTrackErrorMagnitude () const noexcept
 Get cross-track error magnitude in nautical miles.
 
char getDirectionToSteer () const noexcept
 Get steering direction indicator ('L' or 'R').
 
char getCrossTrackUnits () const noexcept
 Get cross-track units indicator.
 
char getArrivalCircleStatus () const noexcept
 Get arrival circle status flag.
 
char getPerpendicularPassedAtWaypoint () const noexcept
 Get perpendicular-passed status flag.
 
double getBearingOriginToDestination () const noexcept
 Get bearing from origin to destination.
 
char getBearingOriginToDestinationType () const noexcept
 Get bearing type for origin-to-destination ('M' or 'T').
 
std::string getDestinationWaypointId () const noexcept
 Get destination waypoint identifier.
 
double getBearingPresentToDestination () const noexcept
 Get bearing from present position to destination.
 
char getBearingPresentToDestinationType () const noexcept
 Get bearing type for present-to-destination ('M' or 'T').
 
double getHeadingToSteerToDestinationWaypoint () const noexcept
 Get heading to steer to destination waypoint.
 
char getHeadingToSteerToDestinationWaypointType () const noexcept
 Get heading type for heading-to-steer ('M' or 'T').
 
std::string getStringContent (bool verbose) const noexcept override
 Return a human-readable string representation of this message.
 
bool operator== (const APB &other) const noexcept
 Compare two APB messages for equality.
 
- Public Member Functions inherited from nmealib::nmea0183::Message0183
 Message0183 (const Message0183 &)=default
 Copy constructor.
 
Message0183operator= (const Message0183 &)=default
 Copy assignment operator.
 
 Message0183 (Message0183 &&) noexcept=default
 Move constructor.
 
Message0183operator= (Message0183 &&) noexcept=default
 Move assignment operator.
 
 ~Message0183 () override=default
 Destructor.
 
std::unique_ptr< nmealib::Messageclone () const override
 Creates a polymorphic deep copy of this Message0183.
 
char getStartChar () const noexcept
 Returns the start character of the NMEA 0183 sentence.
 
std::string getTalker () const noexcept
 Returns the talker identifier extracted from the sentence.
 
std::string getSentenceType () const noexcept
 Returns the sentence type identifier extracted from the sentence.
 
std::string getPayload () const noexcept
 Returns the payload of the NMEA 0183 sentence.
 
std::string getChecksumStr () const
 Get the checksum string extracted from the raw sentence.
 
std::string getCalculatedChecksumStr () const noexcept
 Get the calculated checksum string for the sentence payload.
 
std::string serialize () const override
 Returns the wire-format representation of the NMEA 0183 sentence, that is, the raw information that was passed when the message was created.
 
bool operator== (const Message0183 &other) const noexcept
 Compares two Message0183 objects for equality based on their content and timestamp.
 
bool validate () const noexcept override
 Returns whether the message is valid or not.
 
- Public Member Functions inherited from nmealib::Message
 Message ()
 
 Message (std::string raw, Type type=Type::Unknown, TimePoint ts=std::chrono::system_clock::now()) noexcept
 
virtual ~Message ()
 
 Message (const Message &)=default
 
Messageoperator= (const Message &)=default
 
 Message (Message &&) noexcept=default
 
Messageoperator= (Message &&) noexcept=default
 
Type getType () const noexcept
 Returns the message type.
 
const std::string & getRawData () const noexcept
 Returns the raw, unmodified data string as received.
 
TimePoint getTimestamp () const noexcept
 Returns the timestamp associated with this message.
 
bool operator== (const Message &other) const noexcept
 Compares two Message objects for equality based on their content.
 

Friends

class Nmea0183Factory
 
class MessageRegistry
 

Additional Inherited Members

- Public Types inherited from nmealib::Message
enum class  Type { Unknown , NMEA0183 , NMEA2000 }
 Defines the type of NMEA message, allowing for differentiation between various standards. More...
 
using TimePoint = std::chrono::system_clock::time_point
 
- Static Public Member Functions inherited from nmealib::nmea0183::Message0183
static double convertNmeaCoordinateToDecimalDegrees (const std::string &nmeaCoordinate)
 Converts an NMEA coordinate in ddmm.mmmm / dddmm.mmmm format to decimal degrees.
 
- Static Public Member Functions inherited from nmealib::Message
static std::string typeToString (Type t)
 Converts a Message::Type enum value to its string representation.
 
- Protected Member Functions inherited from nmealib::nmea0183::Message0183
std::string toString (bool verbose) const noexcept
 Provides the common string representation for every NMEA 0183 message, which can be used by derived classes to implement their own getStringContent method.
 
- Protected Member Functions inherited from nmealib::Message
void setType (Type t) noexcept
 Sets the message type.
 
void setRaw (std::string r) noexcept
 Sets the raw data string.
 
void setTimestamp (TimePoint ts) noexcept
 Sets the message timestamp.
 
- Static Protected Member Functions inherited from nmealib::nmea0183::Message0183
static std::unique_ptr< Message0183create (const std::string &raw, TimePoint ts=std::chrono::system_clock::now())
 Protected factory method to create a Message0183 from a raw sentence string.
 
- Protected Attributes inherited from nmealib::nmea0183::Message0183
char startChar_
 
std::string talker_
 
std::string sentenceType_
 
std::string payload_
 
std::string checksumStr_
 
std::string calculatedChecksumStr_
 
- Protected Attributes inherited from nmealib::Message
std::string rawData_
 
Type type_ {Type::Unknown}
 
TimePoint timestamp_ {}
 

Detailed Description

Represents a parsed NMEA 0183 APB (Autopilot Sentence "B") sentence.

APB contains cross-track error, steering direction, waypoint arrival flags, and bearings/headings used by autopilot systems.

Sentence format:

$--APB,A,A,x.x,a,N,A,A,x.x,a,c--c,x.x,a,x.x,a*hh<CR><LF>
Represents a parsed NMEA 0183 APB (Autopilot Sentence "B") sentence.
Definition apb.h:37

Definition at line 37 of file apb.h.

Constructor & Destructor Documentation

◆ APB() [1/3]

nmealib::nmea0183::APB::APB ( std::string  talkerId,
char  status1,
char  status2,
double  crossTrackErrorMagnitude,
char  directionToSteer,
char  crossTrackUnits,
char  arrivalCircleStatus,
char  perpendicularPassedAtWaypoint,
double  bearingOriginToDestination,
char  bearingOriginToDestinationType,
std::string  destinationWaypointId,
double  bearingPresentToDestination,
char  bearingPresentToDestinationType,
double  headingToSteerToDestinationWaypoint,
char  headingToSteerToDestinationWaypointType 
)

Construct an APB message from individual field values.

Parameters
talkerIdTwo-character talker identifier.
status1Data validity status flag.
status2Cycle lock / secondary status flag.
crossTrackErrorMagnitudeCross-track error magnitude in nautical miles.
directionToSteerSteering direction indicator ('L' or 'R').
crossTrackUnitsCross-track units indicator (typically 'N').
arrivalCircleStatusArrival circle status flag.
perpendicularPassedAtWaypointPerpendicular-passed status flag.
bearingOriginToDestinationBearing from origin to destination.
bearingOriginToDestinationTypeBearing type for origin-to-destination ('M' or 'T').
destinationWaypointIdDestination waypoint identifier.
bearingPresentToDestinationBearing from present position to destination.
bearingPresentToDestinationTypeBearing type for present-to-destination ('M' or 'T').
headingToSteerToDestinationWaypointHeading to steer toward destination waypoint.
headingToSteerToDestinationWaypointTypeHeading type for heading-to-steer ('M' or 'T').

Definition at line 110 of file apb.cpp.

◆ APB() [2/3]

nmealib::nmea0183::APB::APB ( const APB )
default

◆ APB() [3/3]

nmealib::nmea0183::APB::APB ( APB &&  )
defaultnoexcept

◆ ~APB()

nmealib::nmea0183::APB::~APB ( )
overridedefault

Member Function Documentation

◆ clone()

std::unique_ptr< nmealib::Message > nmealib::nmea0183::APB::clone ( ) const
overridevirtual

Create a polymorphic copy of this APB message.

Returns
std::unique_ptr<nmealib::Message> A heap-allocated copy of this object.

Implements nmealib::Message.

Definition at line 155 of file apb.cpp.

◆ getArrivalCircleStatus()

char nmealib::nmea0183::APB::getArrivalCircleStatus ( ) const
noexcept

Get arrival circle status flag.

Definition at line 248 of file apb.cpp.

◆ getBearingOriginToDestination()

double nmealib::nmea0183::APB::getBearingOriginToDestination ( ) const
noexcept

Get bearing from origin to destination.

Definition at line 256 of file apb.cpp.

◆ getBearingOriginToDestinationType()

char nmealib::nmea0183::APB::getBearingOriginToDestinationType ( ) const
noexcept

Get bearing type for origin-to-destination ('M' or 'T').

Definition at line 260 of file apb.cpp.

◆ getBearingPresentToDestination()

double nmealib::nmea0183::APB::getBearingPresentToDestination ( ) const
noexcept

Get bearing from present position to destination.

Definition at line 268 of file apb.cpp.

◆ getBearingPresentToDestinationType()

char nmealib::nmea0183::APB::getBearingPresentToDestinationType ( ) const
noexcept

Get bearing type for present-to-destination ('M' or 'T').

Definition at line 272 of file apb.cpp.

◆ getCrossTrackErrorMagnitude()

double nmealib::nmea0183::APB::getCrossTrackErrorMagnitude ( ) const
noexcept

Get cross-track error magnitude in nautical miles.

Definition at line 236 of file apb.cpp.

◆ getCrossTrackUnits()

char nmealib::nmea0183::APB::getCrossTrackUnits ( ) const
noexcept

Get cross-track units indicator.

Definition at line 244 of file apb.cpp.

◆ getDestinationWaypointId()

std::string nmealib::nmea0183::APB::getDestinationWaypointId ( ) const
noexcept

Get destination waypoint identifier.

Definition at line 264 of file apb.cpp.

◆ getDirectionToSteer()

char nmealib::nmea0183::APB::getDirectionToSteer ( ) const
noexcept

Get steering direction indicator ('L' or 'R').

Definition at line 240 of file apb.cpp.

◆ getHeadingToSteerToDestinationWaypoint()

double nmealib::nmea0183::APB::getHeadingToSteerToDestinationWaypoint ( ) const
noexcept

Get heading to steer to destination waypoint.

Definition at line 276 of file apb.cpp.

◆ getHeadingToSteerToDestinationWaypointType()

char nmealib::nmea0183::APB::getHeadingToSteerToDestinationWaypointType ( ) const
noexcept

Get heading type for heading-to-steer ('M' or 'T').

Definition at line 280 of file apb.cpp.

◆ getPerpendicularPassedAtWaypoint()

char nmealib::nmea0183::APB::getPerpendicularPassedAtWaypoint ( ) const
noexcept

Get perpendicular-passed status flag.

Definition at line 252 of file apb.cpp.

◆ getStatus1()

char nmealib::nmea0183::APB::getStatus1 ( ) const
noexcept

Get primary APB status flag.

Definition at line 228 of file apb.cpp.

◆ getStatus2()

char nmealib::nmea0183::APB::getStatus2 ( ) const
noexcept

Get secondary APB status flag.

Definition at line 232 of file apb.cpp.

◆ getStringContent()

std::string nmealib::nmea0183::APB::getStringContent ( bool  verbose) const
overridevirtualnoexcept

Return a human-readable string representation of this message.

Parameters
verboseWhen true, returns a multi-line detailed representation.
Returns
std::string Formatted string content.

Reimplemented from nmealib::nmea0183::Message0183.

Definition at line 159 of file apb.cpp.

◆ operator=() [1/2]

APB & nmealib::nmea0183::APB::operator= ( APB &&  )
defaultnoexcept

◆ operator=() [2/2]

APB & nmealib::nmea0183::APB::operator= ( const APB )
default

◆ operator==()

bool nmealib::nmea0183::APB::operator== ( const APB other) const
noexcept

Compare two APB messages for equality.

Equality delegates to Message0183::operator==.

Parameters
otherThe APB message to compare with.
Returns
bool true if equal, false otherwise.

Definition at line 284 of file apb.cpp.

Friends And Related Symbol Documentation

◆ MessageRegistry

friend class MessageRegistry
friend

Definition at line 189 of file apb.h.

◆ Nmea0183Factory

friend class Nmea0183Factory
friend

Definition at line 188 of file apb.h.


The documentation for this class was generated from the following files: