25#include "isobus/utility/system_timing.hpp"
32 bool enableSendingGroundBasedSpeedPeriodically,
33 bool enableSendingWheelBasedSpeedPeriodically,
34 bool enableSendingMachineSelectedSpeedPeriodically,
35 bool enableSendingMachineSelectedSpeedCommandPeriodically) :
36 machineSelectedSpeedTransmitData(
MachineSelectedSpeedData(enableSendingMachineSelectedSpeedPeriodically ? source : nullptr)),
38 groundBasedSpeedTransmitData(
GroundBasedSpeedData(enableSendingGroundBasedSpeedPeriodically ? source : nullptr)),
40 txFlags(static_cast<std::uint32_t>(
TransmitFlags::NumberOfFlags), process_flags, this)
56 controlFunction(sender)
62 std::uint32_t retVal = wheelBasedMachineDistance_mm;
74 bool retVal = (distance != wheelBasedMachineDistance_mm);
75 wheelBasedMachineDistance_mm = distance;
81 std::uint16_t retVal = wheelBasedMachineSpeed_mm_per_sec;
92 bool retVal = (speed != wheelBasedMachineSpeed_mm_per_sec);
93 wheelBasedMachineSpeed_mm_per_sec = speed;
99 return maximumTimeOfTractorPower_min;
104 bool retVal = (maximumTimeOfTractorPower_min != maxTime);
105 maximumTimeOfTractorPower_min = maxTime;
111 return machineDirectionState;
116 bool retVal = (machineDirectionState != direction);
117 machineDirectionState = direction;
123 return keySwitchState;
128 bool retVal = (keySwitchState != state);
129 keySwitchState = state;
135 return implementStartStopOperationsState;
140 bool retVal = (implementStartStopOperationsState != state);
141 implementStartStopOperationsState = state;
147 return operatorDirectionReversedState;
152 bool retVal = (operatorDirectionReversedState != reverseState);
153 operatorDirectionReversedState = reverseState;
159 return controlFunction;
164 timestamp_ms = timestamp;
173 controlFunction(sender)
179 std::uint32_t retVal = machineSelectedSpeedDistance_mm;
191 bool retVal = (machineSelectedSpeedDistance_mm != distance);
192 machineSelectedSpeedDistance_mm = distance;
198 std::uint16_t retVal = machineSelectedSpeed_mm_per_sec;
209 bool retVal = (speed != machineSelectedSpeed_mm_per_sec);
210 machineSelectedSpeed_mm_per_sec = speed;
216 return exitReasonCode;
221 bool retVal = (exitCode != exitReasonCode);
222 exitReasonCode = exitCode;
233 bool retVal = (source != selectedSource);
234 source = selectedSource;
245 bool retVal = (limitStatus != statusToSet);
246 limitStatus = statusToSet;
252 return machineDirectionState;
257 bool retVal = (directionOfTravel != machineDirectionState);
258 machineDirectionState = directionOfTravel;
264 return controlFunction;
269 timestamp_ms = timestamp;
278 controlFunction(sender)
284 std::uint32_t retVal = groundBasedMachineDistance_mm;
296 bool retVal = (distance != groundBasedMachineDistance_mm);
297 groundBasedMachineDistance_mm = distance;
303 std::uint16_t retVal = groundBasedMachineSpeed_mm_per_sec;
314 bool retVal = (speed != groundBasedMachineSpeed_mm_per_sec);
315 groundBasedMachineSpeed_mm_per_sec = speed;
321 return machineDirectionState;
326 bool retVal = (directionOfTravel != machineDirectionState);
327 machineDirectionState = directionOfTravel;
333 return controlFunction;
338 timestamp_ms = timestamp;
347 controlFunction(sender)
353 std::uint16_t retVal = speedCommandedSetpoint;
365 bool retVal = (speed != speedCommandedSetpoint);
366 speedCommandedSetpoint = speed;
372 std::uint16_t retVal = speedSetpointLimit;
384 bool retVal = (speedSetpointLimit != speedLimit);
385 speedSetpointLimit = speedLimit;
391 return machineDirectionCommand;
396 bool retVal = (commandedDirection != machineDirectionCommand);
397 machineDirectionCommand = commandedDirection;
403 return controlFunction;
408 timestamp_ms = timestamp;
422 LOG_WARNING(
"[Speed/Distance]: Use extreme cation! You have configured an interface to command the speed of the machine. The machine may move without warning!");
459 std::shared_ptr<MachineSelectedSpeedData> retVal =
nullptr;
470 std::shared_ptr<WheelBasedMachineSpeedData> retVal =
nullptr;
481 std::shared_ptr<GroundBasedSpeedData> retVal =
nullptr;
492 std::shared_ptr<MachineSelectedSpeedCommandData> retVal =
nullptr;
527 [](std::shared_ptr<MachineSelectedSpeedData> messageInfo) {
528 return SystemTiming::time_expired_ms(messageInfo->get_timestamp_ms(), SPEED_DISTANCE_MESSAGE_RX_TIMEOUT_MS);
533 [](std::shared_ptr<WheelBasedMachineSpeedData> messageInfo) {
534 return SystemTiming::time_expired_ms(messageInfo->get_timestamp_ms(), SPEED_DISTANCE_MESSAGE_RX_TIMEOUT_MS);
539 [](std::shared_ptr<GroundBasedSpeedData> messageInfo) {
540 return SystemTiming::time_expired_ms(messageInfo->get_timestamp_ms(), SPEED_DISTANCE_MESSAGE_RX_TIMEOUT_MS);
545 [](std::shared_ptr<MachineSelectedSpeedCommandData> messageInfo) {
546 return SystemTiming::time_expired_ms(messageInfo->get_timestamp_ms(), SPEED_DISTANCE_MESSAGE_RX_TIMEOUT_MS);
578 LOG_ERROR(
"[Speed/Distance]: ISOBUS speed messages interface has not been initialized yet.");
584 if (
nullptr != parentPointer)
587 bool transmitSuccessful =
false;
593 transmitSuccessful = targetInterface->send_machine_selected_speed();
599 transmitSuccessful = targetInterface->send_wheel_based_speed();
605 transmitSuccessful = targetInterface->send_ground_based_speed();
611 transmitSuccessful = targetInterface->send_machine_selected_speed_command();
619 if (
false == transmitSuccessful)
621 targetInterface->txFlags.set_flag(flag);
628 assert(
nullptr != parentPointer);
633 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::MachineSelectedSpeed):
639 auto result = std::find_if(targetInterface->receivedMachineSelectedSpeedMessages.cbegin(),
640 targetInterface->receivedMachineSelectedSpeedMessages.cend(),
641 [&message](
const std::shared_ptr<MachineSelectedSpeedData> &receivedInfo) {
642 return (nullptr != receivedInfo) && (receivedInfo->get_sender_control_function() == message.get_source_control_function());
645 if (result == targetInterface->receivedMachineSelectedSpeedMessages.end())
648 targetInterface->receivedMachineSelectedSpeedMessages.push_back(std::make_shared<MachineSelectedSpeedData>(message.
get_source_control_function()));
649 result = targetInterface->receivedMachineSelectedSpeedMessages.end() - 1;
652 auto &mssMessage = *result;
653 bool changed =
false;
655 changed |= mssMessage->set_machine_speed(message.
get_uint16_at(0));
656 changed |= mssMessage->set_machine_distance(message.
get_uint32_at(2));
657 changed |= mssMessage->set_exit_reason_code(message.
get_uint8_at(6) & 0x3F);
661 mssMessage->set_timestamp_ms(SystemTiming::get_timestamp_ms());
663 targetInterface->machineSelectedSpeedDataEventPublisher.call(mssMessage, changed);
668 LOG_ERROR(
"[Speed/Distance]: Received a malformed machine selected speed. DLC must be 8.");
673 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::WheelBasedSpeedAndDistance):
679 auto result = std::find_if(targetInterface->receivedWheelBasedSpeedMessages.cbegin(),
680 targetInterface->receivedWheelBasedSpeedMessages.cend(),
681 [&message](
const std::shared_ptr<WheelBasedMachineSpeedData> &receivedInfo) {
682 return (nullptr != receivedInfo) && (receivedInfo->get_sender_control_function() == message.get_source_control_function());
685 if (result == targetInterface->receivedWheelBasedSpeedMessages.end())
688 targetInterface->receivedWheelBasedSpeedMessages.push_back(std::make_shared<WheelBasedMachineSpeedData>(message.
get_source_control_function()));
689 result = targetInterface->receivedWheelBasedSpeedMessages.end() - 1;
692 auto &wheelSpeedMessage = *result;
693 bool changed =
false;
695 changed |= wheelSpeedMessage->set_machine_speed(message.
get_uint16_at(0));
696 changed |= wheelSpeedMessage->set_machine_distance(message.
get_uint32_at(2));
697 changed |= wheelSpeedMessage->set_maximum_time_of_tractor_power(message.
get_uint8_at(6));
702 wheelSpeedMessage->set_timestamp_ms(SystemTiming::get_timestamp_ms());
704 targetInterface->wheelBasedMachineSpeedDataEventPublisher.call(wheelSpeedMessage, changed);
709 LOG_ERROR(
"[Speed/Distance]: Received a malformed wheel-based speed and distance message. DLC must be 8.");
714 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::GroundBasedSpeedAndDistance):
720 auto result = std::find_if(targetInterface->receivedGroundBasedSpeedMessages.cbegin(),
721 targetInterface->receivedGroundBasedSpeedMessages.cend(),
722 [&message](
const std::shared_ptr<GroundBasedSpeedData> &receivedInfo) {
723 return (nullptr != receivedInfo) && (receivedInfo->get_sender_control_function() == message.get_source_control_function());
726 if (result == targetInterface->receivedGroundBasedSpeedMessages.end())
729 targetInterface->receivedGroundBasedSpeedMessages.push_back(std::make_shared<GroundBasedSpeedData>(message.
get_source_control_function()));
730 result = targetInterface->receivedGroundBasedSpeedMessages.end() - 1;
733 auto &groundSpeedMessage = *result;
734 bool changed =
false;
736 changed |= groundSpeedMessage->set_machine_speed(message.
get_uint16_at(0));
737 changed |= groundSpeedMessage->set_machine_distance(message.
get_uint32_at(2));
739 groundSpeedMessage->set_timestamp_ms(SystemTiming::get_timestamp_ms());
741 targetInterface->groundBasedSpeedDataEventPublisher.call(groundSpeedMessage, changed);
746 LOG_ERROR(
"[Speed/Distance]: Received a malformed ground-based speed and distance message. DLC must be 8.");
751 case static_cast<std::uint32_t
>(CANLibParameterGroupNumber::MachineSelectedSpeedCommand):
757 auto result = std::find_if(targetInterface->receivedMachineSelectedSpeedCommandMessages.cbegin(),
758 targetInterface->receivedMachineSelectedSpeedCommandMessages.cend(),
759 [&message](
const std::shared_ptr<MachineSelectedSpeedCommandData> &receivedInfo) {
760 return (nullptr != receivedInfo) && (receivedInfo->get_sender_control_function() == message.get_source_control_function());
763 if (result == targetInterface->receivedMachineSelectedSpeedCommandMessages.end())
766 targetInterface->receivedMachineSelectedSpeedCommandMessages.push_back(std::make_shared<MachineSelectedSpeedCommandData>(message.
get_source_control_function()));
767 result = targetInterface->receivedMachineSelectedSpeedCommandMessages.end() - 1;
770 auto &commandMessage = *result;
771 bool changed =
false;
773 commandMessage->set_machine_speed_setpoint_command(message.
get_uint16_at(0));
774 commandMessage->set_machine_selected_speed_setpoint_limit(message.
get_uint16_at(2));
776 commandMessage->set_timestamp_ms(SystemTiming::get_timestamp_ms());
778 targetInterface->machineSelectedSpeedCommandDataEventPublisher.call(commandMessage, changed);
783 LOG_ERROR(
"[Speed/Distance]: Received a malformed machine selected speed command message. DLC must be 8.");
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)
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::uint32_t get_data_length() const
Returns the length of the data in the CAN message.
std::shared_ptr< ControlFunction > get_source_control_function() const
Gets the source control function that the message is from.
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::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...
CANIdentifier get_identifier() const
Returns the identifier of the message.
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...
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...
Message normally sent by the Tractor ECU on the implement bus on construction and agricultural implem...
MachineDirection get_machine_direction_of_travel() const
Returns A measured signal indicating either forward or reverse as the direction of travel.
GroundBasedSpeedData(std::shared_ptr< ControlFunction > sender)
Constructor for a GroundBasedSpeedData.
std::uint32_t get_timestamp_ms() const
Returns the timestamp for when the message was received, in milliseconds.
bool set_machine_distance(std::uint32_t distance)
Sets the actual distance traveled by a machine, based on measurements from a sensor such as that is n...
std::shared_ptr< ControlFunction > get_sender_control_function() const
Returns a pointer to the sender of the message. If an ICF is the sender, returns the ICF being used t...
bool set_machine_speed(std::uint16_t speed)
Sets the actual ground speed of a machine, measured by a sensor such as that is not susceptible to wh...
bool set_machine_direction_of_travel(MachineDirection directionOfTravel)
Sets a measured signal indicating either forward or reverse as the direction of travel.
void set_timestamp_ms(std::uint32_t timestamp)
Sets the timestamp for when the message was received or sent.
std::uint32_t get_machine_distance() const
Actual distance traveled by a machine, based on measurements from a sensor such as that is not suscep...
std::uint16_t get_machine_speed() const
Returns the actual ground speed of a machine, measured by a sensor such as that is not susceptible to...
Message that provides the control of the machine speed and direction. If you receive this message,...
MachineDirection get_machine_direction_command() const
Returns The commanded direction of the machine.
bool set_machine_selected_speed_setpoint_limit(std::uint16_t speedLimit)
Sets the maximum allowed machine speed in mm/s, which gets communicated to the tractor/machine.
bool set_machine_direction_of_travel(MachineDirection commandedDirection)
Sets the commanded direction of the machine.
void set_timestamp_ms(std::uint32_t timestamp)
Sets the timestamp for when the message was received or sent.
std::shared_ptr< ControlFunction > get_sender_control_function() const
Returns a pointer to the sender of the message. If an ICF is the sender, returns the ICF being used t...
std::uint16_t get_machine_speed_setpoint_command() const
Returns the commanded setpoint value of the machine speed as measured by the selected source in mm/s.
bool set_machine_speed_setpoint_command(std::uint16_t speed)
Sets The commanded setpoint value of the machine speed as measured by the selected source in mm/s.
std::uint32_t get_timestamp_ms() const
Returns the timestamp for when the message was received, in milliseconds.
std::uint16_t get_machine_selected_speed_setpoint_limit() const
Returns the machine's maximum allowed speed in mm/s, which get's communicated to the tractor/machine.
MachineSelectedSpeedCommandData(std::shared_ptr< ControlFunction > sender)
Constructor for a MachineSelectedSpeedCommandData.
Message that provides the current machine selected speed, direction and source parameters.
void set_timestamp_ms(std::uint32_t timestamp)
Sets the timestamp for when the message was received or sent.
std::uint32_t get_timestamp_ms() const
Returns the timestamp for when the message was received, in milliseconds.
bool set_machine_direction_of_travel(MachineDirection directionOfTravel)
Sets a measured signal indicating either forward or reverse as the direction of travel.
std::uint32_t get_machine_distance() const
Returns the Actual distance travelled by the machine based on the value of selected machine speed (SP...
MachineSelectedSpeedData(std::shared_ptr< ControlFunction > sender)
Constructor for a MachineSelectedSpeedData.
std::uint16_t get_machine_speed() const
Returns the current machine selected speed.
bool set_exit_reason_code(std::uint8_t exitCode)
Sets the reason why the vehicle speed control unit cannot currently accept remote commands or has mos...
std::uint8_t get_exit_reason_code() const
Returns the reason why the vehicle speed control unit cannot currently accept remote commands or has ...
SpeedSource get_speed_source() const
Returns the speed source that is currently being reported in the machine selected speed parameter (SP...
bool set_machine_distance(std::uint32_t distance)
Sets the Actual distance travelled by the machine based on the value of selected machine speed (SPN 4...
SpeedSource
An indication of the speed source that is currently being reported in the machine selected speed para...
bool set_machine_speed(std::uint16_t speed)
Sets the machine selected speed.
bool set_limit_status(LimitStatus statusToSet)
Sets the Tractor ECU's present limit status associated with a parameter whose commands are persistent...
std::shared_ptr< ControlFunction > get_sender_control_function() const
Returns a pointer to the sender of the message. If an ICF is the sender, returns the ICF being used t...
MachineDirection get_machine_direction_of_travel() const
Returns A measured signal indicating either forward or reverse as the direction of travel.
LimitStatus get_limit_status() const
Returns The Tractor ECU's present limit status associated with a parameter whose commands are persist...
LimitStatus
This parameter is used to report the Tractor ECU's present limit status associated with a parameter w...
bool set_speed_source(SpeedSource selectedSource)
Sets the speed source that is currently being reported in the machine selected speed parameter (SPN-4...
Groups the data encoded in an ISO "Wheel-based Speed and Distance" message.
ImplementStartStopOperations
Enumerates the states of a switch or operator input to start or enable implement operations.
KeySwitchState
Enumerates the key switch states of the tractor or power unit.
KeySwitchState get_key_switch_state() const
Returns the key switch state of the tractor or power unit.
bool set_machine_direction_of_travel(MachineDirection direction)
Sets a measured signal indicating either forward or reverse as the direction of travel.
OperatorDirectionReversed
This parameter indicates whether the reported direction is reversed from the perspective of the opera...
WheelBasedMachineSpeedData(std::shared_ptr< ControlFunction > sender)
Constructor for a WheelBasedMachineSpeedData.
std::uint16_t get_machine_speed() const
Returns the value of the speed of a machine as calculated from the measured wheel or tail-shaft speed...
void set_timestamp_ms(std::uint32_t timestamp)
Sets the timestamp for when the message was received or sent.
bool set_machine_speed(std::uint16_t speed)
Sets the value of the speed of a machine as calculated from the measured wheel or tail-shaft speed.
std::uint32_t get_machine_distance() const
Returns The distance traveled by a machine as calculated from wheel or tail-shaft speed.
OperatorDirectionReversed get_operator_direction_reversed_state() const
Returns whether the reported direction is reversed from the perspective of the operator.
std::uint32_t get_timestamp_ms() const
Returns the timestamp for when the message was received, in milliseconds.
std::uint8_t get_maximum_time_of_tractor_power() const
Returns the maximum time (in minutes) of remaining tractor or power-unit-supplied electrical power at...
bool set_implement_start_stop_operations_state(ImplementStartStopOperations state)
Sets the state of a switch or other operator input to start or enable implement operations.
ImplementStartStopOperations get_implement_start_stop_operations_state() const
Returns the state of a switch or other operator input to start or enable implement operations.
bool set_key_switch_state(KeySwitchState state)
Sets the reported key switch state of the tractor or power unit.
bool set_machine_distance(std::uint32_t distance)
Sets the distance traveled by a machine as calculated from wheel or tail-shaft speed.
std::shared_ptr< ControlFunction > get_sender_control_function() const
Returns a pointer to the sender of the message. If an ICF is the sender, returns the ICF being used t...
bool set_operator_direction_reversed_state(OperatorDirectionReversed reverseState)
Sets whether the reported direction is reversed from the perspective of the operator.
bool set_maximum_time_of_tractor_power(std::uint8_t maxTime)
Sets the maximum time (in minutes) of remaining tractor or power-unit-supplied electrical power at th...
MachineDirection get_machine_direction_of_travel() const
Returns A measured signal indicating either forward or reverse as the direction of travel.
This interface manages and parses ISOBUS speed messages.
WheelBasedMachineSpeedData wheelBasedSpeedTransmitData
Use this to configure transmission of the wheel-based speed message. If you pass in an internal contr...
EventDispatcher< const std::shared_ptr< GroundBasedSpeedData >, bool > & get_ground_based_machine_speed_data_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated ground-based speed me...
~SpeedMessagesInterface()
Destructor for SpeedMessagesInterface. Cleans up PGN registrations if needed.
ProcessingFlags txFlags
Tx flag for sending messages periodically.
static constexpr std::uint16_t SAEvl01_MAX_VALUE
The maximum valid value for a SAEvl01 slot (see J1939)
bool send_machine_selected_speed_command() const
Sends the machine selected speed command message.
std::uint32_t machineSelectedSpeedTransmitTimestamp_ms
Timestamp used to know when to transmit the machine selected speed message in milliseconds.
MachineSelectedSpeedCommandData machineSelectedSpeedCommandTransmitData
Use this to configure transmission of the machine selected speed command message. If you pass in an i...
std::shared_ptr< GroundBasedSpeedData > get_received_ground_based_speed(std::size_t index)
Returns the content of the ground-based speed message based on the index of the sender....
EventDispatcher< const std::shared_ptr< WheelBasedMachineSpeedData >, bool > & get_wheel_based_machine_speed_data_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated wheel-based speed mes...
std::vector< std::shared_ptr< MachineSelectedSpeedCommandData > > receivedMachineSelectedSpeedCommandMessages
A list of all received ground-based speed messages.
bool send_machine_selected_speed() const
Sends the machine selected speed message.
bool send_ground_based_speed() const
Sends the ground-based speed message.
bool get_initialized() const
Returns if the interface has been initialized.
std::uint32_t groundBasedSpeedTransmitTimestamp_ms
Timestamp used to know when to transmit the ground-based speed message in milliseconds.
std::shared_ptr< MachineSelectedSpeedData > get_received_machine_selected_speed(std::size_t index)
Returns the content of the machine selected speed message based on the index of the sender....
static void process_rx_message(const CANMessage &message, void *parentPointer)
Processes a CAN message.
EventDispatcher< const std::shared_ptr< MachineSelectedSpeedCommandData >, bool > machineSelectedSpeedCommandDataEventPublisher
An event publisher for notifying when new machine selected speed command messages are received.
std::uint32_t wheelBasedSpeedTransmitTimestamp_ms
Timestamp used to know when to transmit the wheel-based speed message in milliseconds.
static constexpr std::uint32_t SAEds05_MAX_VALUE
The maximum valid value for a SAEds05 slot (see J1939)
std::vector< std::shared_ptr< WheelBasedMachineSpeedData > > receivedWheelBasedSpeedMessages
A list of all received wheel-based speed messages.
std::vector< std::shared_ptr< GroundBasedSpeedData > > receivedGroundBasedSpeedMessages
A list of all received ground-based speed messages.
SpeedMessagesInterface(std::shared_ptr< InternalControlFunction > source, bool enableSendingGroundBasedSpeedPeriodically=false, bool enableSendingWheelBasedSpeedPeriodically=false, bool enableSendingMachineSelectedSpeedPeriodically=false, bool enableSendingMachineSelectedSpeedCommandPeriodically=false)
Constructor for a SpeedMessagesInterface.
bool initialized
Stores if the interface has been initialized.
bool send_wheel_based_speed() const
Sends the wheel-based speed message.
EventDispatcher< const std::shared_ptr< MachineSelectedSpeedData >, bool > machineSelectedSpeedDataEventPublisher
An event publisher for notifying when new machine selected speed messages are received.
EventDispatcher< const std::shared_ptr< WheelBasedMachineSpeedData >, bool > wheelBasedMachineSpeedDataEventPublisher
An event publisher for notifying when new wheel-based speed messages are received.
TransmitFlags
Enumerates a set of flags to manage transmitting messages owned by this interface.
@ SendWheelBasedSpeed
A flag to manage sending wheel-based speed.
@ SendGroundBasedSpeed
A flag to manage sending ground-based speed.
@ SendMachineSelectedSpeed
A flag to manage sending machine selected speed.
@ SendMachineSelectedSpeedCommand
A flag to manage sending the machine selected speed command message.
EventDispatcher< const std::shared_ptr< MachineSelectedSpeedCommandData >, bool > & get_machine_selected_speed_command_data_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated machine selected spee...
static void process_flags(std::uint32_t flag, void *parentPointer)
Processes one flag (which sends the associated message)
EventDispatcher< const std::shared_ptr< MachineSelectedSpeedData >, bool > & get_machine_selected_speed_data_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated machine selected spee...
GroundBasedSpeedData groundBasedSpeedTransmitData
Use this to configure transmission of the ground-based speed message. If you pass in an internal cont...
std::size_t get_number_received_wheel_based_speed_sources() const
Returns the number of received, unique wheel-based speed message sources.
static constexpr std::uint32_t SPEED_DISTANCE_MESSAGE_TX_INTERVAL_MS
The interval (in milliseconds) defined in ISO11783-7 for sending this class's messages.
std::shared_ptr< MachineSelectedSpeedCommandData > get_received_machine_selected_speed_command(std::size_t index)
Returns the content of the machine selected speed command message based on the index of the sender....
MachineSelectedSpeedData machineSelectedSpeedTransmitData
Use this to configure transmission of the machine selected speed message. If you pass in an internal ...
std::vector< std::shared_ptr< MachineSelectedSpeedData > > receivedMachineSelectedSpeedMessages
A list of all received machine selected speed messages.
std::uint32_t machineSelectedSpeedCommandTransmitTimestamp_ms
Timestamp used to know when to transmit the ground-based speed message in milliseconds.
EventDispatcher< const std::shared_ptr< GroundBasedSpeedData >, bool > groundBasedSpeedDataEventPublisher
An event publisher for notifying when new ground-based speed messages are received.
std::size_t get_number_received_machine_selected_speed_command_sources() const
Returns the number of received, unique machine selected speed command message sources.
std::shared_ptr< WheelBasedMachineSpeedData > get_received_wheel_based_speed(std::size_t index)
Returns the content of the wheel-based speed message based on the index of the sender....
void initialize()
Sets up the class and registers it to receive callbacks from the network manager for processing guida...
void update()
Call this cyclically to update the interface. Transmits messages if needed and processes timeouts for...
std::size_t get_number_received_ground_based_speed_sources() const
Returns the number of received, unique ground-based speed message sources.
std::size_t get_number_received_machine_selected_speed_sources() const
Returns the number of received, unique machine selected speed message sources.
MachineDirection
Enumerates the values of the direction of travel for the machine.
Defines classes for processing/sending ISOBUS speed messages.
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.