AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
Describes an internal ECU's NAME and address data. Used to send CAN messages. More...
#include <can_internal_control_function.hpp>
Public Member Functions | |
bool | destroy (std::uint32_t expectedRefCount=1) override |
Destroys this control function, by removing it from the network manager. | |
InternalControlFunction (NAME desiredName, std::uint8_t preferredAddress, std::uint8_t CANPort, CANLibBadge< InternalControlFunction >) | |
The protected constructor for the internal control function, which is called by the (inherited) factory function. | |
void | on_address_violation (CANLibBadge< CANNetworkManager >) |
Used to inform the member address claim state machine that two CFs are using the same source address. | |
void | process_commanded_address (std::uint8_t commandedAddress, CANLibBadge< CANNetworkManager >) |
Used by the network manager to tell the ICF that the address claim state machine needs to process a J1939 command to move address. | |
bool | update_address_claiming (CANLibBadge< CANNetworkManager >) |
Updates the internal control function together with it's associated address claim state machine. | |
std::weak_ptr< ParameterGroupNumberRequestProtocol > | get_pgn_request_protocol () const |
Gets the PGN request protocol for this ICF. | |
Public Member Functions inherited from isobus::ControlFunction | |
std::uint8_t | get_address () const |
Returns the current address of the control function. | |
bool | get_address_valid () const |
Describes if the control function has a valid address (not NULL or global) | |
std::uint8_t | get_can_port () const |
Returns the CAN channel index the control function communicates on. | |
NAME | get_NAME () const |
Returns the NAME of the control function as described by its address claim message. | |
Type | get_type () const |
Returns the Type of the control function. | |
std::string | get_type_string () const |
Returns the 'Type' of the control function as a string. | |
Static Public Member Functions | |
static std::shared_ptr< InternalControlFunction > | create (NAME desiredName, std::uint8_t preferredAddress, std::uint8_t CANPort) |
The factory function to construct an internal control function. | |
static std::shared_ptr< InternalControlFunction > | create (NAME desiredName, std::uint8_t CANPort) |
The factory function to construct an internal control function. This version of the factory function will automatically assign the preferred address somewhere in the arbitrary address range, which means your NAME must have the arbitrary address bit set. | |
Static Public Member Functions inherited from isobus::ControlFunction | |
static std::shared_ptr< ControlFunction > | create (NAME NAMEValue, std::uint8_t addressValue, std::uint8_t CANPort) |
The factory function to construct a control function. | |
Private Attributes | |
AddressClaimStateMachine | stateMachine |
The address claimer for this ICF. | |
std::shared_ptr< ParameterGroupNumberRequestProtocol > | pgnRequestProtocol |
The PGN request protocol for this ICF. | |
Additional Inherited Members | |
Public Types inherited from isobus::ControlFunction | |
enum class | Type { Internal , External , Partnered } |
The type of the control function. More... | |
Protected Member Functions inherited from isobus::ControlFunction | |
ControlFunction (NAME NAMEValue, std::uint8_t addressValue, std::uint8_t CANPort, Type type=Type::External) | |
The protected constructor for the control function, which is called by the (inherited) factory function. | |
Protected Attributes inherited from isobus::ControlFunction | |
const Type | controlFunctionType |
The Type of the control function. | |
NAME | controlFunctionNAME |
The NAME of the control function. | |
bool | claimedAddressSinceLastAddressClaimRequest = false |
Used to mark CFs as stale if they don't claim within a certain time. | |
std::uint8_t | address |
The address of the control function. | |
const std::uint8_t | canPortIndex |
The CAN channel index of the control function. | |
Static Protected Attributes inherited from isobus::ControlFunction | |
static Mutex | controlFunctionProcessingMutex |
Protects the control function tables. | |
Describes an internal ECU's NAME and address data. Used to send CAN messages.
This class is used to define your own ECU's NAME, and is used to transmit messages. Each instance of this class will claim a unique address on the bus, and can be used to send messages.
Definition at line 34 of file can_internal_control_function.hpp.
isobus::InternalControlFunction::InternalControlFunction | ( | NAME | desiredName, |
std::uint8_t | preferredAddress, | ||
std::uint8_t | CANPort, | ||
CANLibBadge< InternalControlFunction > | ) |
The protected constructor for the internal control function, which is called by the (inherited) factory function.
[in] | desiredName | The NAME for this control function to claim as |
[in] | preferredAddress | The preferred NAME for this control function |
[in] | CANPort | The CAN channel index for this control function to use |
Definition at line 21 of file can_internal_control_function.cpp.
|
static |
The factory function to construct an internal control function. This version of the factory function will automatically assign the preferred address somewhere in the arbitrary address range, which means your NAME must have the arbitrary address bit set.
[in] | desiredName | The NAME for this control function to claim as |
[in] | CANPort | The CAN channel index for this control function to use |
Definition at line 37 of file can_internal_control_function.cpp.
|
static |
The factory function to construct an internal control function.
[in] | desiredName | The NAME for this control function to claim as |
[in] | preferredAddress | The preferred NAME for this control function |
[in] | CANPort | The CAN channel index for this control function to use |
Definition at line 27 of file can_internal_control_function.cpp.
|
overridevirtual |
Destroys this control function, by removing it from the network manager.
[in] | expectedRefCount | The expected number of shared pointers to this control function after removal |
Reimplemented from isobus::ControlFunction.
Definition at line 42 of file can_internal_control_function.cpp.
std::weak_ptr< ParameterGroupNumberRequestProtocol > isobus::InternalControlFunction::get_pgn_request_protocol | ( | ) | const |
Gets the PGN request protocol for this ICF.
Definition at line 69 of file can_internal_control_function.cpp.
void isobus::InternalControlFunction::on_address_violation | ( | CANLibBadge< CANNetworkManager > | ) |
Used to inform the member address claim state machine that two CFs are using the same source address.
Definition at line 50 of file can_internal_control_function.cpp.
void isobus::InternalControlFunction::process_commanded_address | ( | std::uint8_t | commandedAddress, |
CANLibBadge< CANNetworkManager > | ) |
Used by the network manager to tell the ICF that the address claim state machine needs to process a J1939 command to move address.
[in] | commandedAddress | The address that the ICF has been commanded to move to |
Definition at line 55 of file can_internal_control_function.cpp.
bool isobus::InternalControlFunction::update_address_claiming | ( | CANLibBadge< CANNetworkManager > | ) |
Updates the internal control function together with it's associated address claim state machine.
Definition at line 60 of file can_internal_control_function.cpp.
|
private |
The PGN request protocol for this ICF.
Definition at line 82 of file can_internal_control_function.hpp.
|
private |
The address claimer for this ICF.
Definition at line 81 of file can_internal_control_function.hpp.