ControlFunction API

class ControlFunction : public std::enable_shared_from_this<ControlFunction>

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

Subclassed by isobus::InternalControlFunction, isobus::PartneredControlFunction

Public Types

enum class Type

The type of the control function.

Values:

enumerator Internal

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

enumerator External

The control function is some other device on the bus.

enumerator Partnered

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

Public Functions

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

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

Parameters:

expectedRefCount[in] The 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

std::uint8_t get_address() const

Returns the current address of the control function.

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)

Returns:

true if the address is < 0xFE

std::uint8_t get_can_port() const

Returns the CAN channel index the control function communicates on.

Returns:

The control function’s CAN channel index

NAME get_NAME() const

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

Returns:

The control function’s NAME

Type get_type() const

Returns the Type of the control function.

Returns:

The control function type

std::string get_type_string() const

Returns the ‘Type’ of the control function as a string.

Returns:

The control function type as a string

Public Static Functions

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

The factory function to construct a control function.

Parameters:
  • NAMEValue[in] The NAME of the control function

  • addressValue[in] The current address of the control function

  • CANPort[in] The CAN channel index that the control function communicates on

Returns:

A shared pointer to a ControlFunction object created with the parameters passed in