AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
isobus::NMEA2000Messages::Datum Class Reference

A NMEA2000 message that describes datum (reference frame) information. PGN 129044 (0x1F814) A common one might be the WGS84 datum or the NSRS, for example. More...

#include <nmea2000_message_definitions.hpp>

Public Member Functions

 Datum (std::shared_ptr< ControlFunction > source)
 Constructor for a Datum message data object.
 
std::shared_ptr< ControlFunctionget_control_function () const
 Returns the control function sending this instance of this message.
 
std::string get_local_datum () const
 Returns the 4 character ascii datum code.
 
bool set_local_datum (const std::string &datum)
 Sets the local datum's 4 character ascii datum code.
 
std::string get_reference_datum () const
 Returns the 4 character ascii datum code that identifies the reference datum.
 
bool set_reference_datum (const std::string &datum)
 Sets the 4 character ascii datum code that identifies the reference datum.
 
std::int32_t get_raw_delta_latitude () const
 Returns latitude offset of position in the local datum from the position in the reference datum. In units of 1x10E-7 degrees.
 
double get_delta_latitude () const
 Returns latitude offset of position in the local datum from the position in the reference datum. In units of degrees.
 
bool set_delta_latitude (std::int32_t delta)
 Sets latitude offset of position in the local datum from the position in the reference datum in units of 1x10E-7 degrees.
 
std::int32_t get_raw_delta_longitude () const
 Returns longitude offset of position in the local datum from the position in the reference datum. In units of 1x10E-7 degrees.
 
double get_delta_longitude () const
 Returns longitude offset of position in the local datum from the position in the reference datum. In units of degrees.
 
bool set_delta_longitude (std::int32_t delta)
 Sets longitude offset of position in the local datum from the position in the reference datum in units of 1x10E-7 degrees.
 
std::int32_t get_raw_delta_altitude () const
 Returns the altitude offset of position in the local datum relative to the position in the reference datum in units of The altitude delta in units of 0.01 meters.
 
float get_delta_altitude () const
 Returns the altitude offset of position in the local datum relative to the position in the reference datum in units of The altitude delta in units of meters.
 
bool set_delta_altitude (std::int32_t delta)
 Sets the altitude offset of position in the local datum relative to the position in the reference datum in units of The altitude delta in units of 0.01 meters.
 
std::uint32_t get_timestamp () const
 Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
 
bool set_timestamp (std::uint32_t timestamp)
 Sets the time in milliseconds when the message was last sent or received.
 
void serialize (std::vector< std::uint8_t > &buffer) const
 Serializes the current state of this object into a buffer to be sent on the CAN bus.
 
bool deserialize (const CANMessage &receivedMessage)
 Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
 

Static Public Member Functions

static std::uint32_t get_timeout ()
 Returns the timeout (the sending interval) for this message in milliseconds.
 

Private Attributes

std::shared_ptr< ControlFunctionsenderControlFunction
 The sender of the message data.
 
std::string localDatum
 A 4 character ascii datum code. The first three chars are the datum ID.The fourth char is the local datum subdivision code or a null character if it is unknown or unused.
 
std::string referenceDatum
 A 4 character ascii datum code that identifies the reference datum.
 
std::int32_t deltaLatitude = 0
 Position in the local datum is offset from the position in the reference datum as indicated by this latitude delta. In units of 1x10E-7 degrees.
 
std::int32_t deltaLongitude = 0
 Position in the local datum is offset from the position in the reference datum as indicated by this longitude delta. In units of 1x10E-7 degrees.
 
std::int32_t deltaAltitude = 0
 The altitude delta in units of 0.01 meters. Positive values indicate Up.
 
std::uint32_t messageTimestamp_ms = 0
 A timestamp in milliseconds when this message was last sent or received.
 

Static Private Attributes

static constexpr std::uint32_t CYCLIC_MESSAGE_RATE_MS = 10000
 The transmit interval for this message as specified in NMEA2000.
 
static constexpr std::uint8_t LENGTH_BYTES = 20
 The size of this message in bytes.
 
static constexpr std::uint8_t DATUM_STRING_LENGTHS = 4
 The size of the datum codes in bytes.
 

Detailed Description

A NMEA2000 message that describes datum (reference frame) information. PGN 129044 (0x1F814) A common one might be the WGS84 datum or the NSRS, for example.

This provides local geodetic datum and datum offsets from a reference datum. This PGN is used to define the datum to which a position location output by the same device in other PGNs is referenced.

Definition at line 775 of file nmea2000_message_definitions.hpp.

Constructor & Destructor Documentation

◆ Datum()

isobus::NMEA2000Messages::Datum::Datum ( std::shared_ptr< ControlFunction > source)
explicit

Constructor for a Datum message data object.

Parameters
[in]sourceThe control function sending the message

Definition at line 985 of file nmea2000_message_definitions.cpp.

Member Function Documentation

◆ deserialize()

bool isobus::NMEA2000Messages::Datum::deserialize ( const CANMessage & receivedMessage)

Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.

Parameters
[in]receivedMessageThe CAN message to parse when deserializing
Returns
True if the message was successfully deserialized and the data content was different than the stored content.

Definition at line 1120 of file nmea2000_message_definitions.cpp.

Here is the call graph for this function:

◆ get_control_function()

std::shared_ptr< ControlFunction > isobus::NMEA2000Messages::Datum::get_control_function ( ) const

Returns the control function sending this instance of this message.

Returns
The control function sending this instance of this message

Definition at line 992 of file nmea2000_message_definitions.cpp.

◆ get_delta_altitude()

float isobus::NMEA2000Messages::Datum::get_delta_altitude ( ) const

Returns the altitude offset of position in the local datum relative to the position in the reference datum in units of The altitude delta in units of meters.

Returns
The altitude offset of position in the local datum relative to the position in the reference datum in units of The altitude delta in units of meters.

Definition at line 1082 of file nmea2000_message_definitions.cpp.

◆ get_delta_latitude()

double isobus::NMEA2000Messages::Datum::get_delta_latitude ( ) const

Returns latitude offset of position in the local datum from the position in the reference datum. In units of degrees.

Returns
Latitude offset of position in the local datum from the position in the reference datum. In units of degrees

Definition at line 1048 of file nmea2000_message_definitions.cpp.

◆ get_delta_longitude()

double isobus::NMEA2000Messages::Datum::get_delta_longitude ( ) const

Returns longitude offset of position in the local datum from the position in the reference datum. In units of degrees.

Returns
Longitude offset of position in the local datum from the position in the reference datum. In units of degrees

Definition at line 1060 of file nmea2000_message_definitions.cpp.

◆ get_local_datum()

std::string isobus::NMEA2000Messages::Datum::get_local_datum ( ) const

Returns the 4 character ascii datum code.

Returns
The 4 character ascii datum code

Definition at line 1009 of file nmea2000_message_definitions.cpp.

◆ get_raw_delta_altitude()

std::int32_t isobus::NMEA2000Messages::Datum::get_raw_delta_altitude ( ) const

Returns the altitude offset of position in the local datum relative to the position in the reference datum in units of The altitude delta in units of 0.01 meters.

Returns
The altitude offset of position in the local datum relative to the position in the reference datum in units of The altitude delta in units of 0.01 meters.

Definition at line 1077 of file nmea2000_message_definitions.cpp.

◆ get_raw_delta_latitude()

std::int32_t isobus::NMEA2000Messages::Datum::get_raw_delta_latitude ( ) const

Returns latitude offset of position in the local datum from the position in the reference datum. In units of 1x10E-7 degrees.

Returns
Latitude offset of position in the local datum from the position in the reference datum. In units of 1x10E-7 degrees

Definition at line 1043 of file nmea2000_message_definitions.cpp.

◆ get_raw_delta_longitude()

std::int32_t isobus::NMEA2000Messages::Datum::get_raw_delta_longitude ( ) const

Returns longitude offset of position in the local datum from the position in the reference datum. In units of 1x10E-7 degrees.

Returns
Longitude offset of position in the local datum from the position in the reference datum. In units of 1x10E-7 degrees

Definition at line 1065 of file nmea2000_message_definitions.cpp.

◆ get_reference_datum()

std::string isobus::NMEA2000Messages::Datum::get_reference_datum ( ) const

Returns the 4 character ascii datum code that identifies the reference datum.

Returns
The 4 character ascii datum code that identifies the reference datum

Definition at line 1026 of file nmea2000_message_definitions.cpp.

◆ get_timeout()

std::uint32_t isobus::NMEA2000Messages::Datum::get_timeout ( )
static

Returns the timeout (the sending interval) for this message in milliseconds.

Returns
This message's timeout (the sending interval) in milliseconds

Definition at line 1149 of file nmea2000_message_definitions.cpp.

Here is the caller graph for this function:

◆ get_timestamp()

std::uint32_t isobus::NMEA2000Messages::Datum::get_timestamp ( ) const

Returns a timestamp in milliseconds corresponding to when the message was last sent or received.

Returns
A timestamp in milliseconds corresponding to when the message was last sent or received

Definition at line 997 of file nmea2000_message_definitions.cpp.

◆ serialize()

void isobus::NMEA2000Messages::Datum::serialize ( std::vector< std::uint8_t > & buffer) const

Serializes the current state of this object into a buffer to be sent on the CAN bus.

Parameters
[in]bufferA buffer to serialize the message data into

Definition at line 1094 of file nmea2000_message_definitions.cpp.

◆ set_delta_altitude()

bool isobus::NMEA2000Messages::Datum::set_delta_altitude ( std::int32_t delta)

Sets the altitude offset of position in the local datum relative to the position in the reference datum in units of The altitude delta in units of 0.01 meters.

Parameters
[in]deltaThe altitude delta to set in units of 0.01 meters
Returns
True if the value that was set differed from the stored value

Definition at line 1087 of file nmea2000_message_definitions.cpp.

Here is the caller graph for this function:

◆ set_delta_latitude()

bool isobus::NMEA2000Messages::Datum::set_delta_latitude ( std::int32_t delta)

Sets latitude offset of position in the local datum from the position in the reference datum in units of 1x10E-7 degrees.

Parameters
[in]deltaThe latitude offset to set in units of 1x10E-7 degrees
Returns
True if the value that was set differed from the stored value

Definition at line 1053 of file nmea2000_message_definitions.cpp.

Here is the caller graph for this function:

◆ set_delta_longitude()

bool isobus::NMEA2000Messages::Datum::set_delta_longitude ( std::int32_t delta)

Sets longitude offset of position in the local datum from the position in the reference datum in units of 1x10E-7 degrees.

Parameters
[in]deltaThe longitude offset to set in units of 1x10E-7 degrees
Returns
True if the value that was set differed from the stored value

Definition at line 1070 of file nmea2000_message_definitions.cpp.

Here is the caller graph for this function:

◆ set_local_datum()

bool isobus::NMEA2000Messages::Datum::set_local_datum ( const std::string & datum)

Sets the local datum's 4 character ascii datum code.

Parameters
[in]datumThe datum code to set
Returns
True if the value that was set differed from the stored value

Definition at line 1014 of file nmea2000_message_definitions.cpp.

Here is the caller graph for this function:

◆ set_reference_datum()

bool isobus::NMEA2000Messages::Datum::set_reference_datum ( const std::string & datum)

Sets the 4 character ascii datum code that identifies the reference datum.

Parameters
[in]datumThe datum code to set, must be 4 characters
Returns
True if the value that was set differed from the stored value

Definition at line 1031 of file nmea2000_message_definitions.cpp.

Here is the caller graph for this function:

◆ set_timestamp()

bool isobus::NMEA2000Messages::Datum::set_timestamp ( std::uint32_t timestamp)

Sets the time in milliseconds when the message was last sent or received.

Parameters
[in]timestampThe timestamp (in milliseconds) to set for when this message was sent or received
Returns
True if the value that was set differed from the stored value, otherwise false

Definition at line 1002 of file nmea2000_message_definitions.cpp.

Member Data Documentation

◆ CYCLIC_MESSAGE_RATE_MS

constexpr std::uint32_t isobus::NMEA2000Messages::Datum::CYCLIC_MESSAGE_RATE_MS = 10000
staticconstexprprivate

The transmit interval for this message as specified in NMEA2000.

Definition at line 866 of file nmea2000_message_definitions.hpp.

◆ DATUM_STRING_LENGTHS

constexpr std::uint8_t isobus::NMEA2000Messages::Datum::DATUM_STRING_LENGTHS = 4
staticconstexprprivate

The size of the datum codes in bytes.

Definition at line 868 of file nmea2000_message_definitions.hpp.

◆ deltaAltitude

std::int32_t isobus::NMEA2000Messages::Datum::deltaAltitude = 0
private

The altitude delta in units of 0.01 meters. Positive values indicate Up.

Definition at line 875 of file nmea2000_message_definitions.hpp.

◆ deltaLatitude

std::int32_t isobus::NMEA2000Messages::Datum::deltaLatitude = 0
private

Position in the local datum is offset from the position in the reference datum as indicated by this latitude delta. In units of 1x10E-7 degrees.

Definition at line 873 of file nmea2000_message_definitions.hpp.

◆ deltaLongitude

std::int32_t isobus::NMEA2000Messages::Datum::deltaLongitude = 0
private

Position in the local datum is offset from the position in the reference datum as indicated by this longitude delta. In units of 1x10E-7 degrees.

Definition at line 874 of file nmea2000_message_definitions.hpp.

◆ LENGTH_BYTES

constexpr std::uint8_t isobus::NMEA2000Messages::Datum::LENGTH_BYTES = 20
staticconstexprprivate

The size of this message in bytes.

Definition at line 867 of file nmea2000_message_definitions.hpp.

◆ localDatum

std::string isobus::NMEA2000Messages::Datum::localDatum
private

A 4 character ascii datum code. The first three chars are the datum ID.The fourth char is the local datum subdivision code or a null character if it is unknown or unused.

Definition at line 871 of file nmea2000_message_definitions.hpp.

◆ messageTimestamp_ms

std::uint32_t isobus::NMEA2000Messages::Datum::messageTimestamp_ms = 0
private

A timestamp in milliseconds when this message was last sent or received.

Definition at line 876 of file nmea2000_message_definitions.hpp.

◆ referenceDatum

std::string isobus::NMEA2000Messages::Datum::referenceDatum
private

A 4 character ascii datum code that identifies the reference datum.

Definition at line 872 of file nmea2000_message_definitions.hpp.

◆ senderControlFunction

std::shared_ptr<ControlFunction> isobus::NMEA2000Messages::Datum::senderControlFunction
private

The sender of the message data.

Definition at line 870 of file nmea2000_message_definitions.hpp.


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