AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
An interface for communicating as or interpreting the messages of ISOBUS Shortcut Buttons. More...
#include <isobus_shortcut_button_interface.hpp>
Classes | |
class | ISBServerData |
Stores data about a sender of the stop all implement operations switch state. More... | |
Public Types | |
enum class | StopAllImplementOperationsState : std::uint8_t { StopImplementOperations = 0 , PermitAllImplementsToOperationOn = 1 , Error = 2 , NotAvailable = 3 } |
Enumerates the states that can be sent in the main ISB message (pgn 64770, 0xFD02) More... | |
Public Member Functions | |
ShortcutButtonInterface (std::shared_ptr< InternalControlFunction > internalControlFunction, bool serverEnabled=false) | |
Constructor for a ShortcutButtonInterface. | |
virtual | ~ShortcutButtonInterface () |
Destructor for a ShortcutButtonInterface. | |
void | initialize () |
Used to initialize the interface. Registers for PGNs with the network manager. | |
bool | get_is_initialized () const |
Returns if the interface has been initialized. | |
EventDispatcher< StopAllImplementOperationsState > & | get_stop_all_implement_operations_state_event_dispatcher () |
Gets the event dispatcher for when the assigned bus' ISB state changes. The assigned bus is determined by which internal control function you pass into the constructor. | |
void | set_stop_all_implement_operations_state (StopAllImplementOperationsState newState) |
Sets the state that the interface will broadcast on the bus. | |
StopAllImplementOperationsState | get_state () const |
Returns the current ISB state for the bus, which is a combination of the internal commanded state and the states reported by all other CFs. | |
void | update () |
This must be called cyclically to update the interface. This processes transmits and timeouts. | |
Private Types | |
enum class | TransmitFlags : std::uint32_t { SendStopAllImplementOperationsSwitchState = 0 , NumberOfFlags } |
Enumerates a set of flags that the interface uses to know if it should transmit a message. More... | |
Private Member Functions | |
void | process_message (const CANMessage &message) |
A generic way for a protocol to process a received message. | |
bool | send_stop_all_implement_operations_switch_state () const |
Sends the Stop all implement operations switch state message. | |
Static Private Member Functions | |
static void | process_rx_message (const CANMessage &message, void *parentPointer) |
Parses incoming CAN messages for the interface. | |
static void | process_flags (std::uint32_t flag, void *parent) |
Processes the internal Tx flags. | |
Private Attributes | |
std::list< ISBServerData > | isobusShorcutButtonList |
A list of all senders of the ISB messages used to track transition counts. | |
std::shared_ptr< InternalControlFunction > | sourceControlFunction = nullptr |
The internal control function that the interface is assigned to and will use to transmit. | |
EventDispatcher< StopAllImplementOperationsState > | ISBEventDispatcher |
Manages callbacks about ISB states. | |
ProcessingFlags | txFlags |
A set of flags to manage retries while sending messages. | |
std::uint32_t | allImplementsStopOperationsSwitchStateTimestamp_ms = 0 |
A timestamp to track the need for cyclic transmission of PGN 0xFD02. | |
std::uint8_t | stopAllImplementOperationsTransitionNumber = 0 |
A counter used to track our transitions from "stop" to "permit" when acting as a server. | |
StopAllImplementOperationsState | commandedState = StopAllImplementOperationsState::NotAvailable |
The state set by the user to transmit if we're acting as a server. | |
bool | actAsISBServer = false |
A setting that enables sending the ISB messages rather than just receiving them. | |
bool | initialized = false |
Stores if the interface has been initialized. | |
Static Private Attributes | |
static constexpr std::uint32_t | TRANSMISSION_RATE_MS = 1000 |
The cyclic transmission time for PGN 0xFD02. | |
static constexpr std::uint32_t | TRANSMISSION_TIMEOUT_MS = 3000 |
Amount of time between messages until we consider an ISB stale (arbitrary, but similar to VT timeout) | |
An interface for communicating as or interpreting the messages of ISOBUS Shortcut Buttons.
This interface parses the "All implements stop operations switch state" message that is sent by ISOBUS shortcut buttons, and also allows you to optionally transmit the same message as an ISOBUS shortcut button.
This message may be sent by any control function connected to the implement bus on forestry or agriculture implements providing to connected systems the current state of the all implement stop operations switch. At least one of these switches shall be in each operator location of the connected system.
All implements shall start a process to stop all operations when this broadcast message is received from any CF with a value of "Stop implement operations" (SPN 5140). Before an implement turns off all implement operations, it shall assume a failsafe condition. If an implement is operating in an automation mode, it may enter a failsafe condition before requesting the tractor ECU to exit the automation mode, e.g. PTO, Auxiliary valve, and/or tractor movement.
The working set master for the implement shall then inform the operator that the implement has stopped all operations due to the activation of the Stop All Implement Operations switch. Implement working set masters shall include, on their home screen, an indication, e.g. icon or a function name, if it supports Stop All Implement Operations. The Working Set shall monitor the number of transitions for each ISB server upon receiving first the message from a given ISB server. A Working Set shall consider an increase in the transitions without detecting a corresponding transition of the Stop all implement operations state as an error and react accordingly.
Definition at line 63 of file isobus_shortcut_button_interface.hpp.
|
strong |
Enumerates the states that can be sent in the main ISB message (pgn 64770, 0xFD02)
Enumerator | |
---|---|
StopImplementOperations | Stop implement operations. |
PermitAllImplementsToOperationOn | Permit all implements to operation ON. |
Error | Error indication. |
NotAvailable | Not available. |
Definition at line 67 of file isobus_shortcut_button_interface.hpp.
|
strongprivate |
Enumerates a set of flags that the interface uses to know if it should transmit a message.
Enumerator | |
---|---|
SendStopAllImplementOperationsSwitchState | A flag to send the main ISB message. |
NumberOfFlags | The number of flags defined in this enumeration. |
Definition at line 124 of file isobus_shortcut_button_interface.hpp.
isobus::ShortcutButtonInterface::ShortcutButtonInterface | ( | std::shared_ptr< InternalControlFunction > | internalControlFunction, |
bool | serverEnabled = false ) |
Constructor for a ShortcutButtonInterface.
[in] | internalControlFunction | The InternalControlFunction that the interface will use to send messages (not nullptr) |
[in] | serverEnabled | Enables the interface's transmission of the "Stop all implement operations" message. |
Definition at line 22 of file isobus_shortcut_button_interface.cpp.
|
virtual |
Destructor for a ShortcutButtonInterface.
Definition at line 30 of file isobus_shortcut_button_interface.cpp.
bool isobus::ShortcutButtonInterface::get_is_initialized | ( | ) | const |
Returns if the interface has been initialized.
Definition at line 49 of file isobus_shortcut_button_interface.cpp.
ShortcutButtonInterface::StopAllImplementOperationsState isobus::ShortcutButtonInterface::get_state | ( | ) | const |
Returns the current ISB state for the bus, which is a combination of the internal commanded state and the states reported by all other CFs.
Definition at line 84 of file isobus_shortcut_button_interface.cpp.
EventDispatcher< ShortcutButtonInterface::StopAllImplementOperationsState > & isobus::ShortcutButtonInterface::get_stop_all_implement_operations_state_event_dispatcher | ( | ) |
Gets the event dispatcher for when the assigned bus' ISB state changes. The assigned bus is determined by which internal control function you pass into the constructor.
Definition at line 54 of file isobus_shortcut_button_interface.cpp.
void isobus::ShortcutButtonInterface::initialize | ( | ) |
Used to initialize the interface. Registers for PGNs with the network manager.
Definition at line 38 of file isobus_shortcut_button_interface.cpp.
|
staticprivate |
Processes the internal Tx flags.
[in] | flag | The flag to process |
[in] | parent | A context variable to find the relevant interface class |
Definition at line 128 of file isobus_shortcut_button_interface.cpp.
|
private |
A generic way for a protocol to process a received message.
[in] | message | A received CAN message |
Definition at line 150 of file isobus_shortcut_button_interface.cpp.
|
staticprivate |
Parses incoming CAN messages for the interface.
message | The CAN message to parse |
parentPointer | A generic context variable, usually the this pointer for this interface instance |
Definition at line 121 of file isobus_shortcut_button_interface.cpp.
|
private |
Sends the Stop all implement operations switch state message.
Definition at line 216 of file isobus_shortcut_button_interface.cpp.
void isobus::ShortcutButtonInterface::set_stop_all_implement_operations_state | ( | StopAllImplementOperationsState | newState | ) |
Sets the state that the interface will broadcast on the bus.
[in] | newState | The state to broadcast on the bus if the interface is a server |
Definition at line 59 of file isobus_shortcut_button_interface.cpp.
void isobus::ShortcutButtonInterface::update | ( | ) |
This must be called cyclically to update the interface. This processes transmits and timeouts.
Definition at line 106 of file isobus_shortcut_button_interface.cpp.
|
private |
A setting that enables sending the ISB messages rather than just receiving them.
Definition at line 159 of file isobus_shortcut_button_interface.hpp.
|
private |
A timestamp to track the need for cyclic transmission of PGN 0xFD02.
Definition at line 156 of file isobus_shortcut_button_interface.hpp.
|
private |
The state set by the user to transmit if we're acting as a server.
Definition at line 158 of file isobus_shortcut_button_interface.hpp.
|
private |
Stores if the interface has been initialized.
Definition at line 160 of file isobus_shortcut_button_interface.hpp.
|
private |
Manages callbacks about ISB states.
Definition at line 154 of file isobus_shortcut_button_interface.hpp.
|
private |
A list of all senders of the ISB messages used to track transition counts.
Definition at line 152 of file isobus_shortcut_button_interface.hpp.
|
private |
The internal control function that the interface is assigned to and will use to transmit.
Definition at line 153 of file isobus_shortcut_button_interface.hpp.
|
private |
A counter used to track our transitions from "stop" to "permit" when acting as a server.
Definition at line 157 of file isobus_shortcut_button_interface.hpp.
|
staticconstexprprivate |
The cyclic transmission time for PGN 0xFD02.
Definition at line 149 of file isobus_shortcut_button_interface.hpp.
|
staticconstexprprivate |
Amount of time between messages until we consider an ISB stale (arbitrary, but similar to VT timeout)
Definition at line 150 of file isobus_shortcut_button_interface.hpp.
|
private |
A set of flags to manage retries while sending messages.
Definition at line 155 of file isobus_shortcut_button_interface.hpp.