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

A class that describes an ISO11783 control function, which includes a NAME and address. More...

#include <can_control_function.hpp>

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

Public Types

enum class  Type { Internal , External , Partnered }
 The type of the control function. More...
 

Public Member Functions

virtual bool destroy (std::uint32_t expectedRefCount=1)
 Destroys this control function, by removing it from the network manager.
 
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< ControlFunctioncreate (NAME NAMEValue, std::uint8_t addressValue, std::uint8_t CANPort)
 The factory function to construct a control function.
 

Protected Member Functions

 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

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

static Mutex controlFunctionProcessingMutex
 Protects the control function tables.
 

Friends

class CANNetworkManager
 The network manager needs access to the control function's internals.
 

Detailed Description

A class that describes an ISO11783 control function, which includes a NAME and address.

Definition at line 27 of file can_control_function.hpp.

Member Enumeration Documentation

◆ Type

enum class isobus::ControlFunction::Type
strong

The type of the control function.

Enumerator
Internal 

The control function is part of our stack and can address claim.

External 

The control function is some other device on the bus.

Partnered 

An external control function that you explicitly want to talk to.

Definition at line 31 of file can_control_function.hpp.

Constructor & Destructor Documentation

◆ ControlFunction()

isobus::ControlFunction::ControlFunction ( NAME NAMEValue,
std::uint8_t addressValue,
std::uint8_t CANPort,
Type type = Type::External )
protected

The protected constructor for the control function, which is called by the (inherited) factory function.

Parameters
[in]NAMEValueThe NAME of the control function
[in]addressValueThe current address of the control function
[in]CANPortThe CAN channel index that the control function communicates on
[in]typeThe 'Type' of control function to create

Definition at line 22 of file can_control_function.cpp.

Here is the caller graph for this function:

Member Function Documentation

◆ create()

std::shared_ptr< ControlFunction > isobus::ControlFunction::create ( NAME NAMEValue,
std::uint8_t addressValue,
std::uint8_t CANPort )
static

The factory function to construct a control function.

Parameters
[in]NAMEValueThe NAME of the control function
[in]addressValueThe current address of the control function
[in]CANPortThe CAN channel index that the control function communicates on
Returns
A shared pointer to a ControlFunction object created with the parameters passed in

Definition at line 30 of file can_control_function.cpp.

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

◆ destroy()

bool isobus::ControlFunction::destroy ( std::uint32_t expectedRefCount = 1)
virtual

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 in isobus::InternalControlFunction.

Definition at line 38 of file can_control_function.cpp.

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

◆ get_address()

std::uint8_t isobus::ControlFunction::get_address ( ) const

Returns the current address of the control function.

Returns
The current address of the control function

Definition at line 47 of file can_control_function.cpp.

◆ get_address_valid()

bool isobus::ControlFunction::get_address_valid ( ) const

Describes if the control function has a valid address (not NULL or global)

Returns
true if the address is < 0xFE

Definition at line 52 of file can_control_function.cpp.

◆ get_can_port()

std::uint8_t isobus::ControlFunction::get_can_port ( ) const

Returns the CAN channel index the control function communicates on.

Returns
The control function's CAN channel index

Definition at line 57 of file can_control_function.cpp.

◆ get_NAME()

NAME isobus::ControlFunction::get_NAME ( ) const

Returns the NAME of the control function as described by its address claim message.

Returns
The control function's NAME

Definition at line 62 of file can_control_function.cpp.

◆ get_type()

ControlFunction::Type isobus::ControlFunction::get_type ( ) const

Returns the Type of the control function.

Returns
The control function type

Definition at line 67 of file can_control_function.cpp.

◆ get_type_string()

std::string isobus::ControlFunction::get_type_string ( ) const

Returns the 'Type' of the control function as a string.

Returns
The control function type as a string

Definition at line 72 of file can_control_function.cpp.

Friends And Related Symbol Documentation

◆ CANNetworkManager

friend class CANNetworkManager
friend

The network manager needs access to the control function's internals.

Definition at line 84 of file can_control_function.hpp.

Member Data Documentation

◆ address

std::uint8_t isobus::ControlFunction::address
protected

The address of the control function.

Definition at line 89 of file can_control_function.hpp.

◆ canPortIndex

const std::uint8_t isobus::ControlFunction::canPortIndex
protected

The CAN channel index of the control function.

Definition at line 90 of file can_control_function.hpp.

◆ claimedAddressSinceLastAddressClaimRequest

bool isobus::ControlFunction::claimedAddressSinceLastAddressClaimRequest = false
protected

Used to mark CFs as stale if they don't claim within a certain time.

Definition at line 88 of file can_control_function.hpp.

◆ controlFunctionNAME

NAME isobus::ControlFunction::controlFunctionNAME
protected

The NAME of the control function.

Definition at line 87 of file can_control_function.hpp.

◆ controlFunctionProcessingMutex

Mutex isobus::ControlFunction::controlFunctionProcessingMutex
staticprotected

Protects the control function tables.

Definition at line 85 of file can_control_function.hpp.

◆ controlFunctionType

const Type isobus::ControlFunction::controlFunctionType
protected

The Type of the control function.

Definition at line 86 of file can_control_function.hpp.


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