AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
Represents the data sent in the NMEA2K PGN 127250 (0x1F112) More...
#include <nmea2000_message_definitions.hpp>
Public Types | |
enum class | HeadingSensorReference : std::uint8_t { True = 0 , Magnetic = 1 , Error = 2 , NotApplicableOrNull = 3 } |
The reference which the vessel heading is relative to. More... | |
Public Member Functions | |
VesselHeading (std::shared_ptr< ControlFunction > source) | |
Constructor for a VesselHeading message data object. | |
std::shared_ptr< ControlFunction > | get_control_function () const |
Returns the control function sending this instance of this message. | |
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. | |
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. | |
std::int16_t | get_raw_magnetic_deviation () const |
Returns the magnetic deviation in 0.0001 radians. | |
float | get_magnetic_deviation () const |
Returns the magnetic deviation in radians. | |
bool | set_magnetic_deviation (std::int16_t deviation) |
Sets the magnetic deviation in 0.0001 radians. | |
std::int16_t | get_raw_magnetic_variation () const |
Returns the magnetic variation in units of 0.0001 radians. | |
float | get_magnetic_variation () const |
Returns the magnetic variation in units of radians. | |
bool | set_magnetic_variation (std::int16_t variation) |
Sets the magnetic variation, in units of 0.0001 radians. | |
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. | |
HeadingSensorReference | get_sensor_reference () const |
Returns the reference to which the reported heading is relative to. | |
bool | set_sensor_reference (HeadingSensorReference reference) |
Sets the reference to which the reported heading is relative to. | |
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 | 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< ControlFunction > | senderControlFunction |
The sender of the message data. | |
std::uint32_t | messageTimestamp_ms = 0 |
A timestamp in milliseconds when this message was last sent or received. | |
std::uint16_t | headingReading = 0 |
The raw heading in 0.0001 radians, relative to the indicated HeadingSensorReference. | |
std::int16_t | magneticDeviation = 0 |
The magnetic deviation if not included in the reading in 0.0001 radians. Positive values are easterly. | |
std::int16_t | magneticVariation = 0 |
The magnetic variation if applicable in 0.0001 radians. Positive values are easterly. If the reference is magnetic, you can add this to the heading to get data relative to true north. | |
std::uint8_t | sequenceID = 0 |
The sequence identifier field is used to tie related PGNs together. Somewhat arbitrary. | |
HeadingSensorReference | sensorReference = HeadingSensorReference::NotApplicableOrNull |
Indicates what the heading is relative to, ie true or magnetic north. | |
Static Private Attributes | |
static constexpr std::uint32_t | CYCLIC_MESSAGE_RATE_MS = 100 |
The interval in milliseconds on which this message should be sent/received. | |
Represents the data sent in the NMEA2K PGN 127250 (0x1F112)
Definition at line 30 of file nmea2000_message_definitions.hpp.
|
strong |
The reference which the vessel heading is relative to.
Enumerator | |
---|---|
True | True North. |
Magnetic | Magnetic North. |
Definition at line 34 of file nmea2000_message_definitions.hpp.
|
explicit |
Constructor for a VesselHeading message data object.
[in] | source | The control function sending this message |
Definition at line 24 of file nmea2000_message_definitions.cpp.
bool isobus::NMEA2000Messages::VesselHeading::deserialize | ( | const CANMessage & | receivedMessage | ) |
Deserializes a CAN message to populate this object's contents. Updates the timestamp when called.
[in] | receivedMessage | The CAN message to parse when deserializing |
Definition at line 135 of file nmea2000_message_definitions.cpp.
std::shared_ptr< ControlFunction > isobus::NMEA2000Messages::VesselHeading::get_control_function | ( | ) | const |
Returns the control function sending this instance of this message.
Definition at line 29 of file nmea2000_message_definitions.cpp.
float isobus::NMEA2000Messages::VesselHeading::get_heading | ( | ) | const |
Returns the vessel heading in radians.
Definition at line 51 of file nmea2000_message_definitions.cpp.
float isobus::NMEA2000Messages::VesselHeading::get_magnetic_deviation | ( | ) | const |
Returns the magnetic deviation in radians.
Definition at line 68 of file nmea2000_message_definitions.cpp.
float isobus::NMEA2000Messages::VesselHeading::get_magnetic_variation | ( | ) | const |
Returns the magnetic variation in units of radians.
Definition at line 85 of file nmea2000_message_definitions.cpp.
std::uint16_t isobus::NMEA2000Messages::VesselHeading::get_raw_heading | ( | ) | const |
Returns the vessel heading in units of 0.0001 radians, which are the message's base units.
Definition at line 46 of file nmea2000_message_definitions.cpp.
std::int16_t isobus::NMEA2000Messages::VesselHeading::get_raw_magnetic_deviation | ( | ) | const |
Returns the magnetic deviation in 0.0001 radians.
Definition at line 63 of file nmea2000_message_definitions.cpp.
std::int16_t isobus::NMEA2000Messages::VesselHeading::get_raw_magnetic_variation | ( | ) | const |
Returns the magnetic variation in units of 0.0001 radians.
Definition at line 80 of file nmea2000_message_definitions.cpp.
VesselHeading::HeadingSensorReference isobus::NMEA2000Messages::VesselHeading::get_sensor_reference | ( | ) | const |
Returns the reference to which the reported heading is relative to.
Definition at line 109 of file nmea2000_message_definitions.cpp.
std::uint8_t isobus::NMEA2000Messages::VesselHeading::get_sequence_id | ( | ) | const |
Returns the sequence ID. This is used to associate data within other PGNs with this message.
Definition at line 97 of file nmea2000_message_definitions.cpp.
|
static |
Returns the timeout (the sending interval) for this message in milliseconds.
Definition at line 155 of file nmea2000_message_definitions.cpp.
std::uint32_t isobus::NMEA2000Messages::VesselHeading::get_timestamp | ( | ) | const |
Returns a timestamp in milliseconds corresponding to when the message was last sent or received.
Definition at line 34 of file nmea2000_message_definitions.cpp.
void isobus::NMEA2000Messages::VesselHeading::serialize | ( | std::vector< std::uint8_t > & | buffer | ) | const |
Takes the current state of the object and serializes it into a buffer to be sent.
[in] | buffer | A vector to populate with the message data |
Definition at line 121 of file nmea2000_message_definitions.cpp.
bool isobus::NMEA2000Messages::VesselHeading::set_heading | ( | std::uint16_t | heading | ) |
Sets the vessel heading.
[in] | heading | The heading to set in 0.0001 radians |
Definition at line 56 of file nmea2000_message_definitions.cpp.
bool isobus::NMEA2000Messages::VesselHeading::set_magnetic_deviation | ( | std::int16_t | deviation | ) |
Sets the magnetic deviation in 0.0001 radians.
[in] | deviation | The magnetic deviation to set, in units of 0.0001 radians |
Definition at line 73 of file nmea2000_message_definitions.cpp.
bool isobus::NMEA2000Messages::VesselHeading::set_magnetic_variation | ( | std::int16_t | variation | ) |
Sets the magnetic variation, in units of 0.0001 radians.
[in] | variation | The magnetic variation to set, in units of 0.0001 radians |
Definition at line 90 of file nmea2000_message_definitions.cpp.
bool isobus::NMEA2000Messages::VesselHeading::set_sensor_reference | ( | HeadingSensorReference | reference | ) |
Sets the reference to which the reported heading is relative to.
[in] | reference | The reference to set |
Definition at line 114 of file nmea2000_message_definitions.cpp.
bool isobus::NMEA2000Messages::VesselHeading::set_sequence_id | ( | std::uint8_t | sequenceNumber | ) |
Sets the sequence ID for this message.
[in] | sequenceNumber | The sequence number to set. Max value is 252. |
Definition at line 102 of file nmea2000_message_definitions.cpp.
bool isobus::NMEA2000Messages::VesselHeading::set_timestamp | ( | std::uint32_t | timestamp | ) |
Sets the time in milliseconds when the message was last sent or received.
[in] | timestamp | The timestamp (in milliseconds) to set for when this message was sent or received |
Definition at line 39 of file nmea2000_message_definitions.cpp.
|
staticconstexprprivate |
The interval in milliseconds on which this message should be sent/received.
Definition at line 130 of file nmea2000_message_definitions.hpp.
|
private |
The raw heading in 0.0001 radians, relative to the indicated HeadingSensorReference.
Definition at line 134 of file nmea2000_message_definitions.hpp.
|
private |
The magnetic deviation if not included in the reading in 0.0001 radians. Positive values are easterly.
Definition at line 135 of file nmea2000_message_definitions.hpp.
|
private |
The magnetic variation if applicable in 0.0001 radians. Positive values are easterly. If the reference is magnetic, you can add this to the heading to get data relative to true north.
Definition at line 136 of file nmea2000_message_definitions.hpp.
|
private |
A timestamp in milliseconds when this message was last sent or received.
Definition at line 133 of file nmea2000_message_definitions.hpp.
|
private |
The sender of the message data.
Definition at line 132 of file nmea2000_message_definitions.hpp.
|
private |
Indicates what the heading is relative to, ie true or magnetic north.
Definition at line 138 of file nmea2000_message_definitions.hpp.
|
private |
The sequence identifier field is used to tie related PGNs together. Somewhat arbitrary.
Definition at line 137 of file nmea2000_message_definitions.hpp.