18#include "isobus/utility/system_timing.hpp"
22 namespace NMEA2000Messages
25 senderControlFunction(source)
126 buffer.at(2) =
static_cast<std::uint8_t
>((
headingReading >> 8) & 0xFF);
132 buffer.at(7) |= 0xFC;
150 LOG_WARNING(
"[NMEA2K]: Can't deserialize vessel heading. DLC must be 8.");
161 senderControlFunction(source)
189 return (
static_cast<double>(
rateOfTurn) * (1.0 / 32.0 * 1E-6));
216 buffer.at(1) =
static_cast<std::uint8_t
>(
rateOfTurn & 0xFF);
217 buffer.at(2) =
static_cast<std::uint8_t
>((
rateOfTurn >> 8) & 0xFF);
218 buffer.at(3) =
static_cast<std::uint8_t
>((
rateOfTurn >> 16) & 0xFF);
219 buffer.at(4) =
static_cast<std::uint8_t
>((
rateOfTurn >> 24) & 0xFF);
231 auto turnRate =
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(1));
232 turnRate |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(2)) << 8);
233 turnRate |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(3)) << 16);
234 turnRate |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(4)) << 24);
241 LOG_WARNING(
"[NMEA2K]: Can't deserialize rate of turn. DLC must be 8.");
252 senderControlFunction(source)
280 return (
static_cast<double>(
latitude) * 1E-7);
285 return (
static_cast<double>(
longitude) * 1E-7);
295 bool retVal = (
latitude != latitudeToSet);
302 bool retVal = (
longitude != longitudeToSet);
311 buffer.at(0) =
static_cast<std::uint8_t
>(
latitude & 0xFF);
312 buffer.at(1) =
static_cast<std::uint8_t
>((
latitude >> 8) & 0xFF);
313 buffer.at(2) =
static_cast<std::uint8_t
>((
latitude >> 16) & 0xFF);
314 buffer.at(3) =
static_cast<std::uint8_t
>((
latitude >> 24) & 0xFF);
315 buffer.at(4) =
static_cast<std::uint8_t
>(
longitude & 0xFF);
316 buffer.at(5) =
static_cast<std::uint8_t
>((
longitude >> 8) & 0xFF);
317 buffer.at(6) =
static_cast<std::uint8_t
>((
longitude >> 16) & 0xFF);
318 buffer.at(7) =
static_cast<std::uint8_t
>((
longitude >> 24) & 0xFF);
327 auto decodedLatitude =
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(0));
328 decodedLatitude |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(1)) << 8);
329 decodedLatitude |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(2)) << 16);
330 decodedLatitude |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(3)) << 24);
331 auto decodedLongitude =
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(4));
332 decodedLongitude |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(5)) << 8);
333 decodedLongitude |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(6)) << 16);
334 decodedLongitude |= (
static_cast<std::int32_t
>(receivedMessage.
get_uint8_at(7)) << 24);
341 LOG_WARNING(
"[NMEA2K]: Can't deserialize position rapid update. DLC must be 8.");
352 senderControlFunction(source)
436 buffer.at(1) = (0xFC |
static_cast<std::uint8_t
>(
cogReference));
440 buffer.at(5) =
static_cast<std::uint8_t
>((
speedOverGround >> 8) & 0xFF);
459 LOG_WARNING(
"[NMEA2K]: Can't deserialize COG/SOG rapid update. DLC must be 8.");
470 senderControlFunction(source)
544 return ((
static_cast<double>(
timeDelta) * 5.0) / 1000.0);
560 buffer.at(2) =
static_cast<std::uint8_t
>(
latitudeDelta & 0xFF);
561 buffer.at(3) =
static_cast<std::uint8_t
>((
latitudeDelta >> 8) & 0xFF);
562 buffer.at(4) =
static_cast<std::uint8_t
>((
latitudeDelta >> 16) & 0xFF);
564 buffer.at(6) =
static_cast<std::uint8_t
>((
longitudeDelta >> 8) & 0xFF);
565 buffer.at(7) =
static_cast<std::uint8_t
>((
longitudeDelta >> 16) & 0xFF);
582 LOG_WARNING(
"[NMEA2K]: Cannot deserialize position delta high precision rapid update. DLC must be 8 bytes.");
593 senderControlFunction(source)
609 return (
static_cast<double>(
altitude) * 1E-6);
614 bool retVal = (
altitude != altitudeToSet);
626 return (
static_cast<double>(
latitude) * 1E-16);
631 bool retVal = (
latitude != latitudeToSet);
643 return (
static_cast<double>(
longitude) * 1E-16);
648 bool retVal = (
longitude != longitudeToSet);
713 bool retVal = (
method != gnssFixMethod);
790 std::uint16_t retVal = 0;
801 std::uint16_t retVal = 0;
874 buffer.at(1) =
static_cast<std::uint8_t
>(
positionDate & 0xFF);
875 buffer.at(2) =
static_cast<std::uint8_t
>((
positionDate >> 8) & 0xFF);
876 buffer.at(3) =
static_cast<std::uint8_t
>(
positionTime & 0xFF);
877 buffer.at(4) =
static_cast<std::uint8_t
>((
positionTime >> 8) & 0xFF);
878 buffer.at(5) =
static_cast<std::uint8_t
>((
positionTime >> 16) & 0xFF);
879 buffer.at(6) =
static_cast<std::uint8_t
>((
positionTime >> 24) & 0xFF);
880 buffer.at(7) =
static_cast<std::uint8_t
>(
latitude & 0xFF);
881 buffer.at(8) =
static_cast<std::uint8_t
>((
latitude >> 8) & 0xFF);
882 buffer.at(9) =
static_cast<std::uint8_t
>((
latitude >> 16) & 0xFF);
883 buffer.at(10) =
static_cast<std::uint8_t
>((
latitude >> 24) & 0xFF);
884 buffer.at(11) =
static_cast<std::uint8_t
>((
latitude >> 32) & 0xFF);
885 buffer.at(12) =
static_cast<std::uint8_t
>((
latitude >> 40) & 0xFF);
886 buffer.at(13) =
static_cast<std::uint8_t
>((
latitude >> 48) & 0xFF);
887 buffer.at(14) =
static_cast<std::uint8_t
>((
latitude >> 56) & 0xFF);
888 buffer.at(15) =
static_cast<std::uint8_t
>(
longitude & 0xFF);
889 buffer.at(16) =
static_cast<std::uint8_t
>((
longitude >> 8) & 0xFF);
890 buffer.at(17) =
static_cast<std::uint8_t
>((
longitude >> 16) & 0xFF);
891 buffer.at(18) =
static_cast<std::uint8_t
>((
longitude >> 24) & 0xFF);
892 buffer.at(19) =
static_cast<std::uint8_t
>((
longitude >> 32) & 0xFF);
893 buffer.at(20) =
static_cast<std::uint8_t
>((
longitude >> 40) & 0xFF);
894 buffer.at(21) =
static_cast<std::uint8_t
>((
longitude >> 48) & 0xFF);
895 buffer.at(22) =
static_cast<std::uint8_t
>((
longitude >> 56) & 0xFF);
896 buffer.at(23) =
static_cast<std::uint8_t
>(
altitude & 0xFF);
897 buffer.at(24) =
static_cast<std::uint8_t
>((
altitude >> 8) & 0xFF);
898 buffer.at(25) =
static_cast<std::uint8_t
>((
altitude >> 16) & 0xFF);
899 buffer.at(26) =
static_cast<std::uint8_t
>((
altitude >> 24) & 0xFF);
900 buffer.at(27) =
static_cast<std::uint8_t
>((
altitude >> 32) & 0xFF);
901 buffer.at(28) =
static_cast<std::uint8_t
>((
altitude >> 40) & 0xFF);
902 buffer.at(29) =
static_cast<std::uint8_t
>((
altitude >> 48) & 0xFF);
903 buffer.at(30) =
static_cast<std::uint8_t
>((
altitude >> 56) & 0xFF);
904 buffer.at(31) = (
static_cast<std::uint8_t
>(
systemType) & 0x0F);
905 buffer.at(31) |= ((
static_cast<std::uint8_t
>(
method) & 0x0F) << 4);
920 buffer.push_back((
static_cast<std::uint8_t
>(
referenceStations.at(i).stationType) & 0x0F) |
922 buffer.push_back(
static_cast<std::uint8_t
>(
referenceStations.at(i).stationID >> 4));
923 buffer.push_back(
static_cast<std::uint8_t
>(
referenceStations.at(i).ageOfDGNSSCorrections & 0xFF));
924 buffer.push_back(
static_cast<std::uint8_t
>((
referenceStations.at(i).ageOfDGNSSCorrections >> 8) & 0xFF));
961 LOG_WARNING(
"[NMEA2K]: Can't fully parse GNSS position data reference station info because message length is not long enough.");
968 LOG_WARNING(
"[NMEA2K]: Cannot deserialize GNSS position data. DLC must be >= 43 bytes.");
981 ageOfDGNSSCorrections(age)
1102 buffer.at(4) =
static_cast<std::uint8_t
>(
deltaLatitude & 0xFF);
1103 buffer.at(5) =
static_cast<std::uint8_t
>((
deltaLatitude >> 8) & 0xFF);
1104 buffer.at(6) =
static_cast<std::uint8_t
>((
deltaLatitude >> 16) & 0xFF);
1105 buffer.at(7) =
static_cast<std::uint8_t
>((
deltaLatitude >> 24) & 0xFF);
1107 buffer.at(9) =
static_cast<std::uint8_t
>((
deltaLongitude >> 8) & 0xFF);
1108 buffer.at(10) =
static_cast<std::uint8_t
>((
deltaLongitude >> 16) & 0xFF);
1109 buffer.at(11) =
static_cast<std::uint8_t
>((
deltaLongitude >> 24) & 0xFF);
1110 buffer.at(12) =
static_cast<std::uint8_t
>(
deltaAltitude & 0xFF);
1111 buffer.at(13) =
static_cast<std::uint8_t
>((
deltaAltitude >> 8) & 0xFF);
1112 buffer.at(14) =
static_cast<std::uint8_t
>((
deltaAltitude >> 16) & 0xFF);
1113 buffer.at(15) =
static_cast<std::uint8_t
>((
deltaAltitude >> 24) & 0xFF);
1122 bool retVal =
false;
1126 std::string tempString;
1127 tempString.push_back(
static_cast<char>(receivedMessage.
get_uint8_at(0)));
1128 tempString.push_back(
static_cast<char>(receivedMessage.
get_uint8_at(1)));
1129 tempString.push_back(
static_cast<char>(receivedMessage.
get_uint8_at(2)));
1130 tempString.push_back(
static_cast<char>(receivedMessage.
get_uint8_at(3)));
1136 tempString.push_back(
static_cast<char>(receivedMessage.
get_uint8_at(16)));
1137 tempString.push_back(
static_cast<char>(receivedMessage.
get_uint8_at(17)));
1138 tempString.push_back(
static_cast<char>(receivedMessage.
get_uint8_at(18)));
1139 tempString.push_back(
static_cast<char>(receivedMessage.
get_uint8_at(19)));
1144 LOG_WARNING(
"[NMEA2K]: Can't deserialize Datum message. Message length must be at least 20 bytes.");
An abstraction of a CAN message, could be > 8 data bytes.
A class that acts as a logging sink. The intent is that someone could make their own derived class of...
A class that represents a generic CAN message of arbitrary length.
std::int16_t get_int16_at(const std::uint32_t index, const ByteFormat format=ByteFormat::LittleEndian) const
Get a 16-bit signed integer from the buffer at a specific index. A 16-bit signed integer can hold a v...
std::uint32_t get_data_length() const
Returns the length of the data in the CAN message.
std::uint32_t get_uint24_at(const std::uint32_t index, const ByteFormat format=ByteFormat::LittleEndian) const
Get a right-aligned 24-bit integer from the buffer (returned as a uint32_t) at a specific index....
std::uint8_t get_uint8_at(const std::uint32_t index) const
Get a 8-bit unsigned byte from the buffer at a specific index. A 8-bit unsigned byte can hold a value...
std::int32_t get_int32_at(const std::uint32_t index, const ByteFormat format=ByteFormat::LittleEndian) const
Get a 32-bit signed integer from the buffer at a specific index. A 32-bit signed integer can hold a v...
std::uint16_t get_uint16_at(const std::uint32_t index, const ByteFormat format=ByteFormat::LittleEndian) const
Get a 16-bit unsigned integer from the buffer at a specific index. A 16-bit unsigned integer can hold...
std::int64_t get_int64_at(const std::uint32_t index, const ByteFormat format=ByteFormat::LittleEndian) const
Get a 64-bit signed integer from the buffer at a specific index. A 64-bit signed integer can hold a v...
std::uint32_t get_uint32_at(const std::uint32_t index, const ByteFormat format=ByteFormat::LittleEndian) const
Get a 32-bit unsigned integer from the buffer at a specific index. A 32-bit unsigned integer can hold...
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.
CourseOverGroundSpeedOverGroundRapidUpdate(std::shared_ptr< ControlFunction > source)
Constructor for a CourseOverGroundSpeedOverGroundRapidUpdate message data object.
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.
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.
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.
Datum(std::shared_ptr< ControlFunction > source)
Constructor for a Datum message data object.
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.
ReferenceStationData()=default
Default constructor for a ReferenceStationData with default values.
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.
TypeOfSystem
Enumerates the different GNSS systems that can be reported in this message.
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...
GNSSPositionData(std::shared_ptr< ControlFunction > source)
Constructor for a GNSSPositionData message data object.
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 ...
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.
PositionDeltaHighPrecisionRapidUpdate(std::shared_ptr< ControlFunction > source)
Constructor for a PositionDeltaHighPrecisionRapidUpdate message data object.
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.
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
PositionRapidUpdate(std::shared_ptr< ControlFunction > source)
Constructor for a PositionRapidUpdate message data object.
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.
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.
RateOfTurn(std::shared_ptr< ControlFunction > source)
Constructor for a RateOfTurn message data object.
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.
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.
VesselHeading(std::shared_ptr< ControlFunction > source)
Constructor for a VesselHeading message data object.
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.
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...
constexpr std::uint8_t CAN_DATA_LENGTH
The length of a classical CAN frame.
This file contains class definitions that will comprise the individual components of the NMEA2000 mes...