15#ifndef NMEA2000_MESSAGE_DEFINITIONS_HPP
16#define NMEA2000_MESSAGE_DEFINITIONS_HPP
25 namespace NMEA2000Messages
39 NotApplicableOrNull = 3
44 explicit VesselHeading(std::shared_ptr<ControlFunction> source);
118 void serialize(std::vector<std::uint8_t> &buffer)
const;
147 explicit RateOfTurn(std::shared_ptr<ControlFunction> source);
186 void serialize(std::vector<std::uint8_t> &buffer)
const;
257 void serialize(std::vector<std::uint8_t> &buffer)
const;
287 NotApplicableOrNull = 3
353 void serialize(std::vector<std::uint8_t> &buffer)
const;
448 void serialize(std::vector<std::uint8_t> &buffer)
const;
507 NoIntegrityChecking = 0x00,
721 void serialize(std::vector<std::uint8_t> &buffer)
const;
780 explicit Datum(std::shared_ptr<ControlFunction> source);
854 void serialize(std::vector<std::uint8_t> &buffer)
const;
A representation of an ISOBUS ECU that we can send from. Use this class when defining your own contro...
A class that represents a generic CAN message of arbitrary length.
Represents the data sent in the NMEA2K PGN 129026 (0x1F802)
std::uint16_t courseOverGround
This field contains the direction of the path over ground actually followed by the vessel in 0....
CourseOverGroundReference get_course_over_ground_reference() const
Returns the reference to which the course over ground is relative.
static constexpr std::uint32_t CYCLIC_MESSAGE_RATE_MS
The transmit interval for this message as specified in NMEA2000.
CourseOverGroundReference cogReference
Used to indicate the reference for the course over ground, ie true or magnetic north.
std::uint16_t speedOverGround
This field contains the speed of the vessel in 0.01 m/s.
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
std::shared_ptr< ControlFunction > senderControlFunction
The sender of the message data.
std::uint8_t sequenceID
The sequence identifier field is used to tie related PGNs together. Somewhat arbitrary.
bool set_speed_over_ground(std::uint16_t speed)
Sets the speed over ground in units of 0.01 meters per second.
std::uint8_t get_sequence_id() const
Returns the sequence ID. This is used to associate data within other PGNs with this message.
bool deserialize(const CANMessage &receivedMessage)
Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
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 set_course_over_ground(std::uint16_t course)
Sets the course over ground in units of 0.0001 radians.
std::uint32_t get_timestamp() const
Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
float get_speed_over_ground() const
Returns the speed over ground in units of meters per second.
CourseOverGroundReference
Enumerates the references to which the course may be relative to.
@ Magnetic
Magnetic North.
std::shared_ptr< ControlFunction > get_control_function() const
Returns the control function sending this instance of this message.
std::uint16_t get_raw_course_over_ground() const
Returns the course over ground in its base units of 0.0001 radians (between 0 and 2 pi radians)
std::uint16_t get_raw_speed_over_ground() const
Returns the speed over ground in units of 0.01 meters per second.
float get_course_over_ground() const
Returns the course over ground in units of radians.
bool set_timestamp(std::uint32_t timestamp)
Sets the time in milliseconds when the message was last sent or received.
bool set_sequence_id(std::uint8_t sequenceNumber)
Sets the sequence ID for this message.
bool set_course_over_ground_reference(CourseOverGroundReference reference)
Sets the reference to which the course over ground is relative.
std::uint32_t messageTimestamp_ms
A timestamp in milliseconds when this message was last sent or received.
A NMEA2000 message that describes datum (reference frame) information. PGN 129044 (0x1F814) A common ...
std::int32_t deltaLongitude
Position in the local datum is offset from the position in the reference datum as indicated by this l...
std::int32_t deltaLatitude
Position in the local datum is offset from the position in the reference datum as indicated by this l...
bool deserialize(const CANMessage &receivedMessage)
Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
std::shared_ptr< ControlFunction > get_control_function() const
Returns the control function sending this instance of this message.
static constexpr std::uint32_t CYCLIC_MESSAGE_RATE_MS
The transmit interval for this message as specified in NMEA2000.
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 dat...
std::int32_t deltaAltitude
The altitude delta in units of 0.01 meters. Positive values indicate Up.
std::string get_reference_datum() const
Returns the 4 character ascii datum code that identifies the reference datum.
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
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.
static constexpr std::uint8_t DATUM_STRING_LENGTHS
The size of the datum codes in bytes.
bool set_reference_datum(const std::string &datum)
Sets the 4 character ascii datum code that identifies the reference datum.
std::uint32_t get_timestamp() const
Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
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...
float get_delta_altitude() const
Returns the altitude offset of position in the local datum relative to the position in the reference ...
std::uint32_t messageTimestamp_ms
A timestamp in milliseconds when this message was last sent or received.
std::int32_t get_raw_delta_longitude() const
Returns longitude offset of position in the local datum from the position in the reference datum....
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 ...
std::string localDatum
A 4 character ascii datum code. The first three chars are the datum ID.The fourth char is the local d...
double get_delta_latitude() const
Returns latitude offset of position in the local datum from the position in the reference datum....
double get_delta_longitude() const
Returns longitude offset of position in the local datum from the position in the reference datum....
std::string get_local_datum() const
Returns the 4 character ascii datum code.
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 unit...
bool set_local_datum(const std::string &datum)
Sets the local datum's 4 character ascii datum code.
bool set_timestamp(std::uint32_t timestamp)
Sets the time in milliseconds when the message was last sent or received.
std::string referenceDatum
A 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....
std::shared_ptr< ControlFunction > senderControlFunction
The sender of the message data.
static constexpr std::uint8_t LENGTH_BYTES
The size of this message in bytes.
Used to group related reference station data together.
std::uint16_t ageOfDGNSSCorrections
Stores the age of the corrections from this reference.
TypeOfSystem stationType
The type of reference station.
std::uint16_t stationID
The station ID of this reference. Can sometimes be used to infer your correction source.
ReferenceStationData()=default
Default constructor for a ReferenceStationData with default values.
Represents the data sent in the NMEA2K PGN 129029 (0x1F805)
Integrity get_integrity() const
Sets the integrity being reported for this position solution if applicable.
TypeOfSystem get_type_of_system() const
Returns the reported type of GNSS system that produced this position solution.
double get_altitude() const
Returns the altitude portion of the position fix in scaled units of meters. Range is +/- 9....
bool set_geoidal_separation(std::int32_t separation)
Sets the geoidal separation.
double get_position_time() const
Returns the number of seconds since midnight.
bool set_integrity(Integrity integrity)
Sets the integrity reported for this position solution.
std::int64_t get_raw_latitude() const
Returns our current position's latitude in its base units of 1x10E-16 degrees.
std::int64_t get_raw_longitude() const
Returns our current position's longitude in its base units of 1x10E-16 degrees.
GNSSMethod
Enumerates the GNSS methods that can be reported in this message.
@ PreciseGNSS
Solution achieved using Precise Point Positioning (PPP)
@ NoGNSS
Either there is not enough data to compute a navigation solution, or the computed solution is outside...
@ RTKFloat
Solution achieved using radio corrections (from an RTK base station) but using floating point instead...
@ RTKFixedInteger
Solution achieved using radio corrections (from an RTK base station)
@ EstimatedMode
Dead reckoning.
@ GNSSFix
Position solution has been achieved.
@ DGNSSFix
Differential solution achieved based on deviation from a well known reference point.
TypeOfSystem
Enumerates the different GNSS systems that can be reported in this message.
@ Galileo
A GNSS system operated by the European Space Agency.
@ Chayka
A Russian Hyperbolic Radio Navigation System similar to Loran-C.
@ GLONASS
A Russian state operated alternative to GPS.
@ GPS
A GNSS system operated by the United States military.
@ Integrated
Using internally integrated solution (maybe digital dead reckoning)
@ GPSPlusSBAS
Satellite Based Augmentation System (WAAS) enhanced GPS (Run by the US Federal Aviation Administratio...
@ GPSPlusGLONASS
A system using both GPS and GLONASS.
@ GPSPlusSBASPlusGLONASS
A system using SBAS augmented GPS as well as GLONASS.
std::shared_ptr< ControlFunction > senderControlFunction
The sender of the message data.
bool set_horizontal_dilution_of_precision(std::int16_t hdop)
Sets the horizontal dilution of precision (HDOP)
std::shared_ptr< ControlFunction > get_control_function() const
Returns the control function sending this instance of this message.
bool set_sequence_id(std::uint8_t sequenceNumber)
Sets the sequence ID for this message.
std::uint8_t get_number_of_space_vehicles() const
Returns the number of space vehicles used in this position solution.
bool set_position_time(std::uint32_t timeToSet)
Sets the number of seconds since midnight.
std::uint32_t messageTimestamp_ms
A timestamp in milliseconds when this message was last sent or received.
std::uint32_t positionTime
The number of seconds since midnight on the current day. Allows for up to 2 leap seconds per day....
std::int16_t get_raw_horizontal_dilution_of_precision() const
Returns the HDOP for this solution. This Indicates the contribution of satellite configuration geomet...
float get_reference_station_corrections_age(std::size_t index) const
Returns the specified reference station's DGNSS corrections age by index.
bool set_number_of_space_vehicles(std::uint8_t numberOfSVs)
Sets the number of space vehicles in view and used in this position solution.
Integrity integrityChecking
Stores the integrity of the values in the message.
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
std::uint32_t get_timestamp() const
Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
bool set_altitude(std::int64_t altitudeToSet)
Sets the reported altitude in units of 1x10E-6 meters. Range is +/- 9.223 x 10E+12 meters.
std::uint8_t get_number_of_reference_stations() const
Returns the number of reference stations used in this position solution (if applicable to GNSS method...
bool set_gnss_method(GNSSMethod gnssFixMethod)
Sets the GNSS method to report as the source of this position solution, such as RTK float or DGNSS.
std::uint16_t get_reference_station_id(std::size_t index) const
Returns the specified reference station's ID by index.
std::int32_t get_raw_geoidal_separation() const
Returns the geoidal separation in units of 0.01 meters.
std::int64_t get_raw_altitude() const
Returns the altitude portion of the position fix in its base units of 1x10E-6 meters....
static constexpr std::uint8_t MINIMUM_LENGTH_BYTES
The minimum size of this message in bytes.
std::int16_t get_raw_positional_dilution_of_precision() const
Returns the PDOP for this solution. This Indicates the contribution of satellite configuration geomet...
float get_horizontal_dilution_of_precision() const
Returns the HDOP for this solution. This Indicates the contribution of satellite configuration geomet...
std::uint32_t get_raw_position_time() const
Returns the number of seconds since midnight.
std::uint8_t sequenceID
The sequence identifier field is used to tie related PGNs together. Somewhat arbitrary.
bool set_latitude(std::int64_t latitudeToSet)
Sets the reported latitude in its base units of 1x10E-16 degrees.
std::int16_t horizontalDilutionOfPrecision
Indicates the contribution of satellite configuration geometry to positioning error....
static constexpr std::uint32_t CYCLIC_MESSAGE_RATE_MS
The transmit interval for this message as specified in NMEA2000.
TypeOfSystem systemType
The type of GNSS system used when generating this message.
std::int16_t positionalDilutionOfPrecision
Indicates the contribution of satellite configuration geometry to positioning error....
bool set_position_date(std::uint16_t dateToSet)
Sets the date to report relative to UTC since Jan 1 1970. Max normal value is 65532.
double get_longitude() const
Returns our current position's longitude in units of degrees.
GNSSMethod method
Stores the method used to provide the GNSS fix.
bool set_reference_station(std::size_t index, std::uint16_t ID, TypeOfSystem type, std::uint16_t ageOfCorrections)
Sets the data for the specified reference station by index.
std::uint8_t get_sequence_id() const
Returns the sequence ID. This is used to associate data within other PGNs with this message.
bool set_positional_dilution_of_precision(std::int16_t pdop)
Sets the positional dilution of precision (PDOP)
GNSSMethod get_gnss_method() const
Returns the GNSS method being reported as part of this position solution, such as RTK Float or DGNSS.
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 set_longitude(std::int64_t longitudeToSet)
Sets the reported longitude in its base units of 1x10E-16 degrees.
std::uint16_t positionDate
Number of days relative to UTC since Jan 1 1970 (so 0 is equal to Jan 1, 1970). Max value is 65532 da...
std::uint16_t get_position_date() const
Returns the date associated with the current position.
bool set_timestamp(std::uint32_t timestamp)
Sets the time in milliseconds when the message was last sent or received.
double get_latitude() const
Returns our current position's latitude in units of degrees.
bool deserialize(const CANMessage &receivedMessage)
Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
std::int64_t longitude
The current longitude in 1x10E-16 degrees. Range is -90 to 90 degrees. Negative values are west longi...
bool set_type_of_system(TypeOfSystem type)
Sets the reported type of GNSS system that produced this position solution.
TypeOfSystem get_reference_station_system_type(std::size_t index) const
Returns the specified reference station's system type by index.
std::int64_t altitude
The current altitude in 1x10E-6 meters. Range is +/- 9.223 x 10E+12 meters.
std::vector< ReferenceStationData > referenceStations
Stores data about the reference stations used to generate this position solution.
std::uint8_t numberOfSpaceVehicles
Number of GPS satellites in view.
bool set_number_of_reference_stations(std::uint8_t stations)
Sets the number of reference stations used in this position solution.
std::uint16_t get_raw_reference_station_corrections_age(std::size_t index) const
Returns the specified reference station's DGNSS corrections age by index.
std::int64_t latitude
The current latitude in 1x10E-16 degrees. Range is -90 to 90 degrees. Negative values are south latit...
float get_positional_dilution_of_precision() const
Returns the PDOP for this solution. This Indicates the contribution of satellite configuration geomet...
float get_geoidal_separation() const
Returns the geoidal separation in units of meters.
Integrity
Enumerates the integrity checking modes that can be reported in this message. You will most often see...
std::int32_t geoidalSeparation
The difference between the earth ellipsoid and mean-sea-level (geoid) defined by the reference datum ...
This message is a way for a GNSS receiver to provide a current position without using fast packet bas...
std::int32_t get_raw_latitude_delta() const
Returns the latitude delta relative to our last position in 1x10E-16 degrees.
std::uint32_t get_timestamp() const
Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
std::int32_t longitudeDelta
The longitude delta in 1x10E-16 degrees.
bool set_time_delta(std::uint8_t delta)
Sets the time delta, in units of 5x10e-3 seconds.
std::uint32_t messageTimestamp_ms
A timestamp in milliseconds when this message was last sent or received.
std::uint8_t get_raw_time_delta() const
Returns the raw time delta since the last reported time in 5x10e-3 seconds.
double get_latitude_delta() const
Returns the latitude delta relative to our last position in degrees.
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.
double get_longitude_delta() const
Returns the longitude delta relative to our last position in degrees.
static constexpr std::uint32_t CYCLIC_MESSAGE_RATE_MS
The transmit interval for this message as specified in NMEA2000.
std::uint8_t sequenceID
The sequence identifier field is used to tie related PGNs together. In this case, ties back to GNSS P...
bool set_longitude_delta(std::int32_t delta)
Sets the current longitude delta relative to our last position in 1x10E-16 degrees.
bool set_timestamp(std::uint32_t timestamp)
Sets the time in milliseconds when the message was last sent or received.
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
std::shared_ptr< ControlFunction > senderControlFunction
The sender of the message data.
std::int32_t latitudeDelta
The latitude delta in 1x10E-16 degrees.
std::int32_t get_raw_longitude_delta() const
Returns the longitude delta relative to our last position in 1x10E-16 degrees.
double get_time_delta() const
Returns the raw time delta since the last reported time in seconds.
std::shared_ptr< ControlFunction > get_control_function() const
Returns the control function sending this instance of this message.
std::uint8_t timeDelta
The time delta in 5x10e-3 seconds.
bool set_sequence_id(std::uint8_t sequenceNumber)
Sets the sequence ID for this message.
std::uint8_t get_sequence_id() const
Returns the sequence ID. This is used to associate data within other PGNs with this message.
bool set_latitude_delta(std::int32_t delta)
Sets the current latitude delta in units of 1x10E-16 degrees.
bool deserialize(const CANMessage &receivedMessage)
Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
Represents the data sent in the NMEA2K PGN 129025 (0x1F801)
static constexpr std::int32_t NOT_AVAILABLE
A generic value that may be reported if the position solution is invalid.
std::int32_t longitude
The longitude in 1*10E-7 degrees. Negative values indicate west longitudes.
bool set_latitude(std::int32_t latitudeToSet)
Sets the current latitude in units of 1*10E-7 degrees.
std::uint32_t messageTimestamp_ms
A timestamp in milliseconds when this message was last sent or received.
std::int32_t latitude
The latitude in 1*10E-7 degrees. Negative values indicate south latitudes.
std::int32_t get_raw_latitude() const
bool deserialize(const CANMessage &receivedMessage)
Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
std::int32_t get_raw_longitude() const
std::shared_ptr< ControlFunction > senderControlFunction
The sender of the message data.
static constexpr std::uint32_t CYCLIC_MESSAGE_RATE_MS
The transmit interval for this message as specified in NMEA2000.
std::uint32_t get_timestamp() const
Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
bool set_longitude(std::int32_t longitudeToSet)
Sets the current longitude in units of 1*10E-7 degrees.
double get_longitude() const
double get_latitude() const
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.
std::shared_ptr< ControlFunction > get_control_function() const
Returns the control function sending this instance of this message.
bool set_timestamp(std::uint32_t timestamp)
Sets the time in milliseconds when the message was last sent or received.
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
Represents the data sent in the NMEA2K PGN 127251 (0x1F113)
std::shared_ptr< ControlFunction > senderControlFunction
The sender of the message data.
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
std::int32_t rateOfTurn
The rate of turn in 1/32 * 10e-6 rad/s. Positive values indicate turning right (starboard) relative t...
std::shared_ptr< ControlFunction > get_control_function() const
Returns the control function sending this instance of this message.
std::uint32_t messageTimestamp_ms
A timestamp in milliseconds when this 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.
static constexpr std::uint32_t CYCLIC_MESSAGE_RATE_MS
The interval in milliseconds on which this message should be sent/received.
std::uint8_t sequenceID
The sequence identifier field is used to tie related PGNs together. Somewhat arbitrary.
std::uint8_t get_sequence_id() const
Returns the sequence ID. This is used to associate data within other PGNs with this message.
bool set_sequence_id(std::uint8_t sequenceNumber)
Sets the sequence ID for this message.
bool set_rate_of_turn(std::int32_t turnRate)
Sets the rate of turn in units of 1/32 x 10E-6 rad/s.
std::uint32_t get_timestamp() const
Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
double get_rate_of_turn() const
Returns the rate of turn of the vessel/vehicle in rad/s.
bool set_timestamp(std::uint32_t timestamp)
Sets the time in milliseconds when the message was last sent or received.
std::int32_t get_raw_rate_of_turn() const
Returns the rate of turn of the vessel/vehicle in units of 1/32 x 10E-6 rad/s.
bool deserialize(const CANMessage &receivedMessage)
Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
Represents the data sent in the NMEA2K PGN 127250 (0x1F112)
bool set_magnetic_deviation(std::int16_t deviation)
Sets the magnetic deviation in 0.0001 radians.
std::uint16_t get_raw_heading() const
Returns the vessel heading in units of 0.0001 radians, which are the message's base units.
float get_heading() const
Returns the vessel heading in radians.
bool set_heading(std::uint16_t heading)
Sets the vessel heading.
HeadingSensorReference get_sensor_reference() const
Returns the reference to which the reported heading is relative to.
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
bool deserialize(const CANMessage &receivedMessage)
Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
HeadingSensorReference sensorReference
Indicates what the heading is relative to, ie true or magnetic north.
bool set_sensor_reference(HeadingSensorReference reference)
Sets the reference to which the reported heading is relative to.
std::shared_ptr< ControlFunction > get_control_function() const
Returns the control function sending this instance of this message.
std::uint8_t get_sequence_id() const
Returns the sequence ID. This is used to associate data within other PGNs with this message.
std::int16_t get_raw_magnetic_variation() const
Returns the magnetic variation in units of 0.0001 radians.
float get_magnetic_deviation() const
Returns the magnetic deviation in radians.
HeadingSensorReference
The reference which the vessel heading is relative to.
@ Magnetic
Magnetic North.
std::int16_t get_raw_magnetic_deviation() const
Returns the magnetic deviation in 0.0001 radians.
std::uint8_t sequenceID
The sequence identifier field is used to tie related PGNs together. Somewhat arbitrary.
bool set_magnetic_variation(std::int16_t variation)
Sets the magnetic variation, in units of 0.0001 radians.
std::uint32_t messageTimestamp_ms
A timestamp in milliseconds when this message was last sent or received.
bool set_sequence_id(std::uint8_t sequenceNumber)
Sets the sequence ID for this message.
static constexpr std::uint32_t CYCLIC_MESSAGE_RATE_MS
The interval in milliseconds on which this message should be sent/received.
std::uint16_t headingReading
The raw heading in 0.0001 radians, relative to the indicated HeadingSensorReference.
std::uint32_t get_timestamp() const
Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
std::shared_ptr< ControlFunction > senderControlFunction
The sender of the message data.
void serialize(std::vector< std::uint8_t > &buffer) const
Takes the current state of the object and serializes it into a buffer to be sent.
bool set_timestamp(std::uint32_t timestamp)
Sets the time in milliseconds when the message was last sent or received.
float get_magnetic_variation() const
Returns the magnetic variation in units of radians.
std::int16_t magneticVariation
The magnetic variation if applicable in 0.0001 radians. Positive values are easterly....
std::int16_t magneticDeviation
The magnetic deviation if not included in the reading in 0.0001 radians. Positive values are easterly...
constexpr std::uint8_t MAX_SEQUENCE_ID
The max non-special allowable value of a NMEA2K sequence ID.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...