AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
isobus::InternalControlFunction Class Reference

Describes an internal ECU's NAME and address data. Used to send CAN messages. More...

#include <can_internal_control_function.hpp>

Inheritance diagram for isobus::InternalControlFunction:
[legend]
Collaboration diagram for isobus::InternalControlFunction:
[legend]

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< ParameterGroupNumberRequestProtocolget_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< InternalControlFunctioncreate (NAME desiredName, std::uint8_t preferredAddress, std::uint8_t CANPort)
 The factory function to construct an internal control function.
 
static std::shared_ptr< InternalControlFunctioncreate (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< ControlFunctioncreate (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< ParameterGroupNumberRequestProtocolpgnRequestProtocol
 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ InternalControlFunction()

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.

Parameters
[in]desiredNameThe NAME for this control function to claim as
[in]preferredAddressThe preferred NAME for this control function
[in]CANPortThe CAN channel index for this control function to use

Definition at line 21 of file can_internal_control_function.cpp.

Here is the caller graph for this function:

Member Function Documentation

◆ create() [1/2]

std::shared_ptr< InternalControlFunction > isobus::InternalControlFunction::create ( NAME desiredName,
std::uint8_t CANPort )
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.

Parameters
[in]desiredNameThe NAME for this control function to claim as
[in]CANPortThe CAN channel index for this control function to use
Returns
A shared pointer to an InternalControlFunction object created with the parameters passed in

Definition at line 37 of file can_internal_control_function.cpp.

Here is the call graph for this function:

◆ create() [2/2]

std::shared_ptr< InternalControlFunction > isobus::InternalControlFunction::create ( NAME desiredName,
std::uint8_t preferredAddress,
std::uint8_t CANPort )
static

The factory function to construct an internal control function.

Parameters
[in]desiredNameThe NAME for this control function to claim as
[in]preferredAddressThe preferred NAME for this control function
[in]CANPortThe CAN channel index for this control function to use
Returns
A shared pointer to an InternalControlFunction object created with the parameters passed in

Definition at line 27 of file can_internal_control_function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

bool isobus::InternalControlFunction::destroy ( std::uint32_t expectedRefCount = 1)
overridevirtual

Destroys this control function, by removing it from the network manager.

Parameters
[in]expectedRefCountThe expected number of shared pointers to this control function after removal
Returns
true if the control function was successfully removed from everywhere in the stack, otherwise false

Reimplemented from isobus::ControlFunction.

Definition at line 42 of file can_internal_control_function.cpp.

Here is the call graph for this function:

◆ get_pgn_request_protocol()

std::weak_ptr< ParameterGroupNumberRequestProtocol > isobus::InternalControlFunction::get_pgn_request_protocol ( ) const

Gets the PGN request protocol for this ICF.

Returns
The PGN request protocol for this ICF

Definition at line 69 of file can_internal_control_function.cpp.

◆ on_address_violation()

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.

Note
Address violation occurs when two CFs are using the same source address.

Definition at line 50 of file can_internal_control_function.cpp.

Here is the call graph for this function:

◆ process_commanded_address()

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.

Parameters
[in]commandedAddressThe address that the ICF has been commanded to move to

Definition at line 55 of file can_internal_control_function.cpp.

Here is the call graph for this function:

◆ update_address_claiming()

bool isobus::InternalControlFunction::update_address_claiming ( CANLibBadge< CANNetworkManager > )

Updates the internal control function together with it's associated address claim state machine.

Returns
Wether the control function has changed address by the end of the update

Definition at line 60 of file can_internal_control_function.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ pgnRequestProtocol

std::shared_ptr<ParameterGroupNumberRequestProtocol> isobus::InternalControlFunction::pgnRequestProtocol
private

The PGN request protocol for this ICF.

Definition at line 82 of file can_internal_control_function.hpp.

◆ stateMachine

AddressClaimStateMachine isobus::InternalControlFunction::stateMachine
private

The address claimer for this ICF.

Definition at line 81 of file can_internal_control_function.hpp.


The documentation for this class was generated from the following files: