24#include "isobus/utility/system_timing.hpp"
30 using namespace NMEA2000Messages;
33 bool enableSendingCogSogCyclically,
34 bool enableSendingDatumCyclically,
35 bool enableSendingGNSSPositionDataCyclically,
36 bool enableSendingPositionDeltaHighPrecisionRapidUpdateCyclically,
37 bool enableSendingPositionRapidUpdateCyclically,
38 bool enableSendingRateOfTurnCyclically,
39 bool enableSendingVesselHeadingCyclically) :
40 txFlags(static_cast<std::uint32_t>(
TransmitFlags::NumberOfFlags), process_flags, this),
41 cogSogTransmitMessage(sendingControlFunction),
42 datumTransmitMessage(sendingControlFunction),
43 gnssPositionDataTransmitMessage(sendingControlFunction),
44 positionDeltaHighPrecisionRapidUpdateTransmitMessage(sendingControlFunction),
45 positionRapidUpdateTransmitMessage(sendingControlFunction),
46 rateOfTurnTransmitMessage(sendingControlFunction),
47 vesselHeadingTransmitMessage(sendingControlFunction),
48 sendCogSogCyclically(enableSendingCogSogCyclically),
49 sendDatumCyclically(enableSendingDatumCyclically),
50 sendGNSSPositionDataCyclically(enableSendingGNSSPositionDataCyclically),
51 sendPositionDeltaHighPrecisionRapidUpdateCyclically(enableSendingPositionDeltaHighPrecisionRapidUpdateCyclically),
52 sendPositionRapidUpdateCyclically(enableSendingPositionRapidUpdateCyclically),
53 sendRateOfTurnCyclically(enableSendingRateOfTurnCyclically),
54 sendVesselHeadingCyclically(enableSendingVesselHeadingCyclically)
135 std::shared_ptr<CourseOverGroundSpeedOverGroundRapidUpdate> retVal =
nullptr;
146 std::shared_ptr<Datum> retVal =
nullptr;
157 std::shared_ptr<GNSSPositionData> retVal =
nullptr;
168 std::shared_ptr<PositionDeltaHighPrecisionRapidUpdate> retVal =
nullptr;
179 std::shared_ptr<PositionRapidUpdate> retVal =
nullptr;
190 std::shared_ptr<RateOfTurn> retVal =
nullptr;
201 std::shared_ptr<VesselHeading> retVal =
nullptr;
320 fastPacketProtocol->register_multipacket_message_callback(
static_cast<std::uint32_t
>(CANLibParameterGroupNumber::Datum),
process_rx_message,
this);
321 fastPacketProtocol->register_multipacket_message_callback(
static_cast<std::uint32_t
>(CANLibParameterGroupNumber::GNSSPositionData),
process_rx_message,
this);
341 fastPacketProtocol->remove_multipacket_message_callback(
static_cast<std::uint32_t
>(CANLibParameterGroupNumber::Datum),
process_rx_message,
this);
342 fastPacketProtocol->remove_multipacket_message_callback(
static_cast<std::uint32_t
>(CANLibParameterGroupNumber::GNSSPositionData),
process_rx_message,
this);
362 LOG_ERROR(
"[NMEA2K]: Interface not initialized!");
368 if ((
nullptr != parentPointer) &&
369 (flag <
static_cast<std::uint32_t
>(TransmitFlags::NumberOfFlags)))
372 std::vector<std::uint8_t> messageBuffer;
373 bool transmitSuccessful =
true;
377 case TransmitFlags::CourseOverGroundSpeedOverGroundRapidUpdate:
379 if (
nullptr != targetInterface->cogSogTransmitMessage.get_control_function())
383 messageBuffer.data(),
384 messageBuffer.size(),
385 std::static_pointer_cast<InternalControlFunction>(targetInterface->cogSogTransmitMessage.get_control_function()),
392 case TransmitFlags::Datum:
394 if (
nullptr != targetInterface->datumTransmitMessage.get_control_function())
396 targetInterface->datumTransmitMessage.serialize(messageBuffer);
398 messageBuffer.data(),
399 messageBuffer.size(),
400 std::static_pointer_cast<InternalControlFunction>(targetInterface->datumTransmitMessage.get_control_function()),
407 case TransmitFlags::GNSSPositionData:
409 if (
nullptr != targetInterface->gnssPositionDataTransmitMessage.get_control_function())
411 targetInterface->gnssPositionDataTransmitMessage.serialize(messageBuffer);
413 messageBuffer.data(),
414 messageBuffer.size(),
415 std::static_pointer_cast<InternalControlFunction>(targetInterface->gnssPositionDataTransmitMessage.get_control_function()),
422 case TransmitFlags::PositionDeltaHighPrecisionRapidUpdate:
424 if (
nullptr != targetInterface->positionDeltaHighPrecisionRapidUpdateTransmitMessage.get_control_function())
426 targetInterface->positionDeltaHighPrecisionRapidUpdateTransmitMessage.serialize(messageBuffer);
428 messageBuffer.data(),
429 messageBuffer.size(),
430 std::static_pointer_cast<InternalControlFunction>(targetInterface->positionDeltaHighPrecisionRapidUpdateTransmitMessage.get_control_function()),
437 case TransmitFlags::PositionRapidUpdate:
439 if (
nullptr != targetInterface->positionRapidUpdateTransmitMessage.get_control_function())
441 targetInterface->positionRapidUpdateTransmitMessage.serialize(messageBuffer);
443 messageBuffer.data(),
444 messageBuffer.size(),
445 std::static_pointer_cast<InternalControlFunction>(targetInterface->positionRapidUpdateTransmitMessage.get_control_function()),
452 case TransmitFlags::RateOfTurn:
454 if (
nullptr != targetInterface->rateOfTurnTransmitMessage.get_control_function())
456 targetInterface->rateOfTurnTransmitMessage.serialize(messageBuffer);
458 messageBuffer.data(),
459 messageBuffer.size(),
460 std::static_pointer_cast<InternalControlFunction>(targetInterface->rateOfTurnTransmitMessage.get_control_function()),
467 case TransmitFlags::VesselHeading:
469 if (
nullptr != targetInterface->vesselHeadingTransmitMessage.get_control_function())
471 targetInterface->vesselHeadingTransmitMessage.serialize(messageBuffer);
473 messageBuffer.data(),
474 messageBuffer.size(),
475 std::static_pointer_cast<InternalControlFunction>(targetInterface->vesselHeadingTransmitMessage.get_control_function()),
486 if (!transmitSuccessful)
488 targetInterface->txFlags.set_flag(
static_cast<std::uint32_t
>(flag));
495 if (
nullptr != parentPointer)
501 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::CourseOverGroundSpeedOverGroundRapidUpdate):
505 auto result = std::find_if(targetInterface->receivedCogSogMessages.begin(),
506 targetInterface->receivedCogSogMessages.end(),
507 [&message](
const std::shared_ptr<CourseOverGroundSpeedOverGroundRapidUpdate> &receivedCommand) {
508 return (nullptr != receivedCommand) && (receivedCommand->get_control_function() == message.get_source_control_function());
511 if (result == targetInterface->receivedCogSogMessages.end())
514 targetInterface->receivedCogSogMessages.push_back(std::make_shared<CourseOverGroundSpeedOverGroundRapidUpdate>(message.
get_source_control_function()));
515 result = targetInterface->receivedCogSogMessages.end() - 1;
518 bool anySignalChanged = (*result)->deserialize(message);
519 targetInterface->cogSogEventPublisher.call(*result, anySignalChanged);
524 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::Datum):
528 auto result = std::find_if(targetInterface->receivedDatumMessages.begin(),
529 targetInterface->receivedDatumMessages.end(),
530 [&message](
const std::shared_ptr<Datum> &receivedCommand) {
531 return (nullptr != receivedCommand) && (receivedCommand->get_control_function() == message.get_source_control_function());
534 if (result == targetInterface->receivedDatumMessages.end())
538 result = targetInterface->receivedDatumMessages.end() - 1;
541 bool anySignalChanged = (*result)->deserialize(message);
542 targetInterface->datumEventPublisher.call(*result, anySignalChanged);
547 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::GNSSPositionData):
551 auto result = std::find_if(targetInterface->receivedGNSSPositionDataMessages.begin(),
552 targetInterface->receivedGNSSPositionDataMessages.end(),
553 [&message](
const std::shared_ptr<GNSSPositionData> &receivedCommand) {
554 return (nullptr != receivedCommand) && (receivedCommand->get_control_function() == message.get_source_control_function());
557 if (result == targetInterface->receivedGNSSPositionDataMessages.end())
560 targetInterface->receivedGNSSPositionDataMessages.push_back(std::make_shared<GNSSPositionData>(message.
get_source_control_function()));
561 result = targetInterface->receivedGNSSPositionDataMessages.end() - 1;
564 bool anySignalChanged = (*result)->deserialize(message);
565 targetInterface->gnssPositionDataEventPublisher.call(*result, anySignalChanged);
570 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::PositionDeltaHighPrecisionRapidUpdate):
574 auto result = std::find_if(targetInterface->receivedPositionDeltaHighPrecisionRapidUpdateMessages.begin(),
575 targetInterface->receivedPositionDeltaHighPrecisionRapidUpdateMessages.end(),
576 [&message](
const std::shared_ptr<PositionDeltaHighPrecisionRapidUpdate> &receivedCommand) {
577 return (nullptr != receivedCommand) && (receivedCommand->get_control_function() == message.get_source_control_function());
580 if (result == targetInterface->receivedPositionDeltaHighPrecisionRapidUpdateMessages.end())
583 targetInterface->receivedPositionDeltaHighPrecisionRapidUpdateMessages.push_back(std::make_shared<PositionDeltaHighPrecisionRapidUpdate>(message.
get_source_control_function()));
584 result = targetInterface->receivedPositionDeltaHighPrecisionRapidUpdateMessages.end() - 1;
587 bool anySignalChanged = (*result)->deserialize(message);
588 targetInterface->positionDeltaHighPrecisionRapidUpdateEventPublisher.call(*result, anySignalChanged);
593 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::PositionRapidUpdate):
597 auto result = std::find_if(targetInterface->receivedPositionRapidUpdateMessages.begin(),
598 targetInterface->receivedPositionRapidUpdateMessages.end(),
599 [&message](
const std::shared_ptr<PositionRapidUpdate> &receivedCommand) {
600 return (nullptr != receivedCommand) && (receivedCommand->get_control_function() == message.get_source_control_function());
603 if (result == targetInterface->receivedPositionRapidUpdateMessages.end())
606 targetInterface->receivedPositionRapidUpdateMessages.push_back(std::make_shared<PositionRapidUpdate>(message.
get_source_control_function()));
607 result = targetInterface->receivedPositionRapidUpdateMessages.end() - 1;
610 bool anySignalChanged = (*result)->deserialize(message);
611 targetInterface->positionRapidUpdateEventPublisher.call(*result, anySignalChanged);
616 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::RateOfTurn):
620 auto result = std::find_if(targetInterface->receivedRateOfTurnMessages.begin(),
621 targetInterface->receivedRateOfTurnMessages.end(),
622 [&message](
const std::shared_ptr<RateOfTurn> &receivedCommand) {
623 return (nullptr != receivedCommand) && (receivedCommand->get_control_function() == message.get_source_control_function());
626 if (result == targetInterface->receivedRateOfTurnMessages.end())
630 result = targetInterface->receivedRateOfTurnMessages.end() - 1;
633 bool anySignalChanged = (*result)->deserialize(message);
634 targetInterface->rateOfTurnEventPublisher.call(*result, anySignalChanged);
639 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::VesselHeading):
643 auto result = std::find_if(targetInterface->receivedVesselHeadingMessages.begin(),
644 targetInterface->receivedVesselHeadingMessages.end(),
645 [&message](
const std::shared_ptr<VesselHeading> &receivedCommand) {
646 return (nullptr != receivedCommand) && (receivedCommand->get_control_function() == message.get_source_control_function());
649 if (result == targetInterface->receivedVesselHeadingMessages.end())
653 result = targetInterface->receivedVesselHeadingMessages.end() - 1;
656 bool anySignalChanged = (*result)->deserialize(message);
657 targetInterface->vesselHeadingEventPublisher.call(*result, anySignalChanged);
674 [](std::shared_ptr<CourseOverGroundSpeedOverGroundRapidUpdate> message) {
675 if (SystemTiming::time_expired_ms(message->get_timestamp(), 3 * CourseOverGroundSpeedOverGroundRapidUpdate::get_timeout()))
677 LOG_WARNING(
"[NMEA2K]: COG & SOG message Rx timeout.");
685 [](std::shared_ptr<Datum> message) {
686 if (SystemTiming::time_expired_ms(message->get_timestamp(), 3 *
Datum::get_timeout()))
688 LOG_WARNING(
"[NMEA2K]: Datum message Rx timeout.");
696 [](std::shared_ptr<GNSSPositionData> message) {
699 LOG_WARNING(
"[NMEA2K]: GNSS position data message Rx timeout.");
707 [](std::shared_ptr<PositionDeltaHighPrecisionRapidUpdate> message) {
710 LOG_WARNING(
"[NMEA2K]: Position Delta High Precision Rapid Update Rx timeout.");
718 [](std::shared_ptr<PositionRapidUpdate> message) {
721 LOG_WARNING(
"[NMEA2K]: Position delta high precision rapid update message Rx timeout.");
729 [](std::shared_ptr<RateOfTurn> message) {
732 LOG_WARNING(
"[NMEA2K]: Rate of turn message Rx timeout.");
740 [](std::shared_ptr<VesselHeading> message) {
743 LOG_WARNING(
"[NMEA2K]: Vessel heading message Rx timeout.");
752 void NMEA2000MessageInterface::check_transmit_timeouts()
754 if (sendCogSogCyclically && SystemTiming::time_expired_ms(cogSogTransmitMessage.get_timestamp(), CourseOverGroundSpeedOverGroundRapidUpdate::get_timeout()))
756 txFlags.set_flag(
static_cast<std::uint32_t
>(TransmitFlags::CourseOverGroundSpeedOverGroundRapidUpdate));
757 cogSogTransmitMessage.set_timestamp(SystemTiming::get_timestamp_ms());
759 if (sendDatumCyclically && SystemTiming::time_expired_ms(datumTransmitMessage.get_timestamp(), Datum::get_timeout()))
761 txFlags.set_flag(
static_cast<std::uint32_t
>(TransmitFlags::Datum));
762 datumTransmitMessage.set_timestamp(SystemTiming::get_timestamp_ms());
764 if (sendPositionDeltaHighPrecisionRapidUpdateCyclically && SystemTiming::time_expired_ms(positionDeltaHighPrecisionRapidUpdateTransmitMessage.get_timestamp(), PositionDeltaHighPrecisionRapidUpdate::get_timeout()))
766 txFlags.set_flag(
static_cast<std::uint32_t
>(TransmitFlags::PositionDeltaHighPrecisionRapidUpdate));
767 positionDeltaHighPrecisionRapidUpdateTransmitMessage.set_timestamp(SystemTiming::get_timestamp_ms());
769 if (sendGNSSPositionDataCyclically && SystemTiming::time_expired_ms(gnssPositionDataTransmitMessage.get_timestamp(), GNSSPositionData::get_timeout()))
771 txFlags.set_flag(
static_cast<std::uint32_t
>(TransmitFlags::GNSSPositionData));
772 gnssPositionDataTransmitMessage.set_timestamp(SystemTiming::get_timestamp_ms());
774 if (sendPositionRapidUpdateCyclically && SystemTiming::time_expired_ms(positionRapidUpdateTransmitMessage.get_timestamp(), PositionRapidUpdate::get_timeout()))
776 txFlags.set_flag(
static_cast<std::uint32_t
>(TransmitFlags::PositionRapidUpdate));
777 positionRapidUpdateTransmitMessage.set_timestamp(SystemTiming::get_timestamp_ms());
779 if (sendRateOfTurnCyclically && SystemTiming::time_expired_ms(rateOfTurnTransmitMessage.get_timestamp(), RateOfTurn::get_timeout()))
781 txFlags.set_flag(
static_cast<std::uint32_t
>(TransmitFlags::RateOfTurn));
782 rateOfTurnTransmitMessage.set_timestamp(SystemTiming::get_timestamp_ms());
784 if (sendVesselHeadingCyclically && SystemTiming::time_expired_ms(vesselHeadingTransmitMessage.get_timestamp(), VesselHeading::get_timeout()))
786 txFlags.set_flag(
static_cast<std::uint32_t
>(TransmitFlags::VesselHeading));
787 vesselHeadingTransmitMessage.set_timestamp(SystemTiming::get_timestamp_ms());
Defines some PGNs that are used in the library or are very common.
The main class that manages the ISOBUS stack including: callbacks, Name to Address management,...
A class that acts as a logging sink. The intent is that someone could make their own derived class of...
@ Priority3
Priority highest - 3 (Control messages priority)
@ Priority2
Priority highest - 2.
@ PriorityDefault6
The default priority.
std::uint32_t get_parameter_group_number() const
Returns the PGN encoded in the identifier.
A class that represents a generic CAN message of arbitrary length.
std::shared_ptr< ControlFunction > get_source_control_function() const
Gets the source control function that the message is from.
CANIdentifier get_identifier() const
Returns the identifier of the message.
std::unique_ptr< FastPacketProtocol > & get_fast_packet_protocol(std::uint8_t canPortIndex)
Returns the class instance of the NMEA2k fast packet protocol. Use this to register for FP multipacke...
static CANNetworkManager CANNetwork
Static singleton of the one network manager. Use this to access stack functionality.
void add_any_control_function_parameter_group_number_callback(std::uint32_t parameterGroupNumber, CANLibCallback callback, void *parent)
Registers a callback for ANY control function sending the associated PGN.
bool send_can_message(std::uint32_t parameterGroupNumber, const std::uint8_t *dataBuffer, std::uint32_t dataLength, std::shared_ptr< InternalControlFunction > sourceControlFunction, std::shared_ptr< ControlFunction > destinationControlFunction=nullptr, CANIdentifier::CANPriority priority=CANIdentifier::CANPriority::PriorityDefault6, TransmitCompleteCallback txCompleteCallback=nullptr, void *parentPointer=nullptr, DataChunkCallback frameChunkCallback=nullptr)
This is the main way to send a CAN message of any length.
void remove_any_control_function_parameter_group_number_callback(std::uint32_t parameterGroupNumber, CANLibCallback callback, void *parent)
This is how you remove a callback added with add_any_control_function_parameter_group_number_callback...
An interface for sending and receiving common NMEA2000 messages on an ISO11783 network.
void check_transmit_timeouts()
Checks to see if any transmit flags need to be set based on the last time the message was sent,...
NMEA2000Messages::GNSSPositionData gnssPositionDataTransmitMessage
Stores a set of data specifically for transmitting the PGN 129029 (0x1F805) if enabled.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::Datum >, bool > datumEventPublisher
An event dispatcher for notifying when new guidance machine info messages are received.
std::vector< std::shared_ptr< NMEA2000Messages::PositionRapidUpdate > > receivedPositionRapidUpdateMessages
Stores all received (and not timed out) sources of the position rapid update message.
std::shared_ptr< NMEA2000Messages::RateOfTurn > get_received_rate_of_turn_message(std::size_t index) const
Returns the content of the rate of turn message based on the index of the sender. Use this to read th...
EventDispatcher< const std::shared_ptr< NMEA2000Messages::GNSSPositionData >, bool > & get_gnss_position_data_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated GNSS position data me...
bool get_enable_sending_cog_sog_cyclically() const
Returns if the interface has cyclic sending of the course/speed over ground message enabled.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::PositionDeltaHighPrecisionRapidUpdate >, bool > positionDeltaHighPrecisionRapidUpdateEventPublisher
An event dispatcher for notifying when new guidance machine info messages are received.
void set_enable_sending_vessel_heading_cyclically(bool enable)
Instructs the interface to enable or disable sending the vessel heading message cyclically.
std::vector< std::shared_ptr< NMEA2000Messages::VesselHeading > > receivedVesselHeadingMessages
Stores all received (and not timed out) sources of the vessel heading message.
std::shared_ptr< NMEA2000Messages::Datum > get_received_datum_message(std::size_t index) const
Returns the content of the Datum message based on the index of the sender. Use this to read the recei...
NMEA2000Messages::VesselHeading vesselHeadingTransmitMessage
Stores a set of data specifically for transmitting the PGN 127250 (0x1F112) if enabled.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::VesselHeading >, bool > vesselHeadingEventPublisher
An event dispatcher for notifying when new guidance machine info messages are received.
bool get_enable_sending_rate_of_turn_cyclically() const
Returns if the interface has cyclic sending of the rate of turn message enabled.
void set_enable_sending_datum_cyclically(bool enable)
Instructs the interface to enable or disable sending the datum data message cyclically.
NMEA2000Messages::RateOfTurn rateOfTurnTransmitMessage
Stores a set of data specifically for transmitting the PGN 127251 (0x1F113) if enabled.
bool sendGNSSPositionDataCyclically
Determines if the interface will try to send the GNSS position data message cyclically.
static void process_flags(std::uint32_t flag, void *parentPointer)
A generic callback for a the class to process flags from the ProcessingFlags
NMEA2000Messages::RateOfTurn & get_rate_of_turn_transmit_message()
Returns a RateOfTurn object that you can use to set the message's individual signal values,...
std::vector< std::shared_ptr< NMEA2000Messages::Datum > > receivedDatumMessages
Stores all received (and not timed out) sources of the Datum message.
ProcessingFlags txFlags
A set of flags used to track what messages need to be transmitted or retried.
void set_enable_sending_position_rapid_update_cyclically(bool enable)
Instructs the interface to enable or disable sending the position rapid update message cyclically.
NMEA2000MessageInterface(std::shared_ptr< InternalControlFunction > sendingControlFunction, bool enableSendingCogSogCyclically, bool enableSendingDatumCyclically, bool enableSendingGNSSPositionDataCyclically, bool enableSendingPositionDeltaHighPrecisionRapidUpdateCyclically, bool enableSendingPositionRapidUpdateCyclically, bool enableSendingRateOfTurnCyclically, bool enableSendingVesselHeadingCyclically)
Constructor for a NMEA2000MessageInterface.
bool get_enable_sending_datum_cyclically() const
Returns if the interface has cyclic sending of the datum message enabled.
void update()
Updates the diagnostic protocol. Must be called periodically. 50ms Is a good minimum interval for thi...
EventDispatcher< const std::shared_ptr< NMEA2000Messages::PositionRapidUpdate >, bool > positionRapidUpdateEventPublisher
An event dispatcher for notifying when new guidance machine info messages are received.
void check_receive_timeouts()
Checks to see if any received messages are timed out and prunes them if needed.
void set_enable_sending_gnss_position_data_cyclically(bool enable)
Instructs the interface to enable or disable sending the GNSS position data message cyclically.
bool get_enable_sending_position_rapid_update_cyclically() const
Returns if the interface has cyclic sending of the position rapid update message enabled.
bool sendVesselHeadingCyclically
Determines if the interface will try to send the vessel heading message cyclically.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::CourseOverGroundSpeedOverGroundRapidUpdate >, bool > & get_course_speed_over_ground_rapid_update_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated COG & SOG messages ar...
bool sendDatumCyclically
Determines if the interface will try to send the Datum message cyclically.
NMEA2000Messages::GNSSPositionData & get_gnss_position_data_transmit_message()
Returns a GNSSPositionData object that you can use to set the message's individual signal values,...
NMEA2000Messages::PositionDeltaHighPrecisionRapidUpdate positionDeltaHighPrecisionRapidUpdateTransmitMessage
Stores a set of data specifically for transmitting the PGN 129027 (0x1F803) if enabled.
NMEA2000Messages::Datum & get_datum_transmit_message()
Returns a Datum object that you can use to set the message's individual signal values,...
bool get_enable_sending_vessel_heading_cyclically() const
Returns if the interface has cyclic sending of the vessel heading message enabled.
std::size_t get_number_received_rate_of_turn_message_sources() const
Returns the number of unique rate of turn message senders.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::GNSSPositionData >, bool > gnssPositionDataEventPublisher
An event dispatcher for notifying when new guidance machine info messages are received.
NMEA2000Messages::Datum datumTransmitMessage
Stores a set of data specifically for transmitting the PGN 129044 (0x1F814) if enabled.
bool sendPositionRapidUpdateCyclically
Determines if the interface will try to send the position rapid update message cyclically.
std::shared_ptr< NMEA2000Messages::GNSSPositionData > get_received_gnss_position_data_message(std::size_t index) const
Returns the content of the GNSS position data message based on the index of the sender....
std::size_t get_number_received_datum_message_sources() const
Returns the number of unique datum message senders.
std::size_t get_number_received_vessel_heading_message_sources() const
Returns the number of unique vessel heading message senders.
bool get_initialized() const
Returns if initialize has been called.
static void process_rx_message(const CANMessage &message, void *parentPointer)
Processes a CAN message destined for an instance of this interface.
NMEA2000Messages::PositionDeltaHighPrecisionRapidUpdate & get_position_delta_high_precision_rapid_update_transmit_message()
Returns a PositionDeltaHighPrecisionRapidUpdate object that you can use to set the message's individu...
std::size_t get_number_received_gnss_position_data_message_sources() const
Returns the number of unique GNSS position data message senders.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::CourseOverGroundSpeedOverGroundRapidUpdate >, bool > cogSogEventPublisher
An event dispatcher for notifying when new guidance machine info messages are received.
void initialize()
Initializes the interface. Registers it with the network manager. Must be called before the interface...
std::shared_ptr< NMEA2000Messages::PositionDeltaHighPrecisionRapidUpdate > get_received_position_delta_high_precision_rapid_update_message(std::size_t index) const
Returns the content of the position delta high precision rapid update message based on the index of t...
std::shared_ptr< NMEA2000Messages::CourseOverGroundSpeedOverGroundRapidUpdate > get_received_course_speed_over_ground_message(std::size_t index) const
Returns the content of the COG & SOG message based on the index of the sender. Use this to read the r...
void set_enable_sending_position_delta_high_precision_rapid_update_cyclically(bool enable)
Instructs the interface to enable or disable sending the position delta high precision rapid update m...
EventDispatcher< const std::shared_ptr< NMEA2000Messages::VesselHeading >, bool > & get_vessel_heading_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated vessel heading messag...
EventDispatcher< const std::shared_ptr< NMEA2000Messages::RateOfTurn >, bool > rateOfTurnEventPublisher
An event dispatcher for notifying when new guidance machine info messages are received.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::PositionRapidUpdate >, bool > & get_position_rapid_update_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated position rapid update...
bool get_enable_sending_position_delta_high_precision_rapid_update_cyclically() const
Returns if the interface has cyclic sending of the position delta high precision rapid update message...
std::shared_ptr< NMEA2000Messages::PositionRapidUpdate > get_received_position_rapid_update_message(std::size_t index) const
Returns the content of the position rapid update message based on the index of the sender....
std::size_t get_number_received_position_rapid_update_message_sources() const
Returns the number of unique position rapid update message senders.
NMEA2000Messages::CourseOverGroundSpeedOverGroundRapidUpdate cogSogTransmitMessage
Stores a set of data specifically for transmitting the PGN 129026 (0x1F802) if enabled.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::RateOfTurn >, bool > & get_rate_of_turn_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated rate of turn messages...
NMEA2000Messages::PositionRapidUpdate positionRapidUpdateTransmitMessage
Stores a set of data specifically for transmitting the PGN 129025 (0x1F801) if enabled.
void set_enable_sending_cog_sog_cyclically(bool enable)
Instructs the interface to enable or disable sending the course/speed over ground message cyclically.
void set_enable_sending_rate_of_turn_cyclically(bool enable)
Instructs the interface to enable or disable sending the rate of turn message cyclically.
EventDispatcher< const std::shared_ptr< NMEA2000Messages::Datum >, bool > & get_datum_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated datum messages are re...
std::size_t get_number_received_position_delta_high_precision_rapid_update_message_sources() const
Returns the number of unique delta position message senders.
bool sendCogSogCyclically
Determines if the interface will try to send the COG & SOG message cyclically.
NMEA2000Messages::VesselHeading & get_vessel_heading_transmit_message()
Returns a VesselHeading object that you can use to set the message's individual signal values,...
void terminate()
Unregisters the interface from the network manager.
std::shared_ptr< NMEA2000Messages::VesselHeading > get_received_vessel_heading_message(std::size_t index) const
Returns the content of the vessel heading message based on the index of the sender....
bool get_enable_sending_gnss_position_data_cyclically() const
Returns if the interface has cyclic sending of the GNSS position data message enabled.
NMEA2000Messages::CourseOverGroundSpeedOverGroundRapidUpdate & get_cog_sog_transmit_message()
Returns a CourseOverGroundSpeedOverGroundRapidUpdate object that you can use to set the message's ind...
EventDispatcher< const std::shared_ptr< NMEA2000Messages::PositionDeltaHighPrecisionRapidUpdate >, bool > & get_position_delta_high_precision_rapid_update_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated position delta high p...
NMEA2000Messages::PositionRapidUpdate & get_position_rapid_update_transmit_message()
Returns a PositionRapidUpdate object that you can use to set the message's individual signal values,...
std::vector< std::shared_ptr< NMEA2000Messages::PositionDeltaHighPrecisionRapidUpdate > > receivedPositionDeltaHighPrecisionRapidUpdateMessages
Stores all received (and not timed out) sources of the position delta message.
std::vector< std::shared_ptr< NMEA2000Messages::RateOfTurn > > receivedRateOfTurnMessages
Stores all received (and not timed out) sources of the rate of turn message.
~NMEA2000MessageInterface()
Destructor for a NMEA2000MessageInterface.
std::vector< std::shared_ptr< NMEA2000Messages::GNSSPositionData > > receivedGNSSPositionDataMessages
Stores all received (and not timed out) sources of the GNSS position data message.
TransmitFlags
Enumerates a set of flags to manage sending various NMEA2000 messages from this interface.
bool sendRateOfTurnCyclically
Determines if the interface will try to send the rate of turn message cyclically.
std::vector< std::shared_ptr< NMEA2000Messages::CourseOverGroundSpeedOverGroundRapidUpdate > > receivedCogSogMessages
Stores all received (and not timed out) sources of the COG & SOG message.
bool sendPositionDeltaHighPrecisionRapidUpdateCyclically
Determines if the interface will try to send the position delta high precision rapid update message m...
std::size_t get_number_received_course_speed_over_ground_message_sources() const
Returns the number of unique senders of the COG & SOG message.
bool initialized
Tracks if initialize has been called.
Represents the data sent in the NMEA2K PGN 129026 (0x1F802)
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.
A NMEA2000 message that describes datum (reference frame) information. PGN 129044 (0x1F814) A common ...
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 129029 (0x1F805)
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
This message is a way for a GNSS receiver to provide a current position without using fast packet bas...
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 129025 (0x1F801)
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)
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 127250 (0x1F112)
static std::uint32_t get_timeout()
Returns the timeout (the sending interval) for this message in milliseconds.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
A protocol that handles the NMEA 2000 (IEC 61162-3) fast packet protocol.
A message interface for processing or sending NMEA2K messages commonly used on an ISO 11783 network.