AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
can_control_function.hpp
Go to the documentation of this file.
1//================================================================================================
9//================================================================================================
10
11#ifndef CAN_CONTROL_FUNCTION_HPP
12#define CAN_CONTROL_FUNCTION_HPP
13
15#include "isobus/utility/thread_synchronization.hpp"
16
17#include <memory>
18#include <string>
19
20namespace isobus
21{
22 //================================================================================================
26 //================================================================================================
27 class ControlFunction : public std::enable_shared_from_this<ControlFunction>
28 {
29 public:
31 enum class Type
32 {
33 Internal,
34 External,
36 };
37
38 virtual ~ControlFunction() = default;
39
45 static std::shared_ptr<ControlFunction> create(NAME NAMEValue, std::uint8_t addressValue, std::uint8_t CANPort);
46
50 virtual bool destroy(std::uint32_t expectedRefCount = 1);
51
54 std::uint8_t get_address() const;
55
58 bool get_address_valid() const;
59
62 std::uint8_t get_can_port() const;
63
66 NAME get_NAME() const;
67
70 Type get_type() const;
71
74 std::string get_type_string() const;
75
76 protected:
82 ControlFunction(NAME NAMEValue, std::uint8_t addressValue, std::uint8_t CANPort, Type type = Type::External);
83
84 friend class CANNetworkManager;
89 std::uint8_t address;
90 const std::uint8_t canPortIndex;
91 };
92
93} // namespace isobus
94
95#endif // CAN_CONTROL_FUNCTION_HPP
A class that represents a control function's NAME.
The main CAN network manager object, handles protocol management and updating other stack components....
A class that describes an ISO11783 control function, which includes a NAME and address.
static Mutex controlFunctionProcessingMutex
Protects the control function tables.
std::string get_type_string() const
Returns the 'Type' of the control function as a string.
bool claimedAddressSinceLastAddressClaimRequest
Used to mark CFs as stale if they don't claim within a certain time.
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.
static std::shared_ptr< ControlFunction > create(NAME NAMEValue, std::uint8_t addressValue, std::uint8_t CANPort)
The factory function to construct a control function.
std::uint8_t address
The address of the control function.
NAME controlFunctionNAME
The NAME of the control function.
Type
The type of the control function.
@ 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.
NAME get_NAME() const
Returns the NAME of the control function as described by its address claim message.
std::uint8_t get_address() const
Returns the current address of the control function.
const Type controlFunctionType
The Type of the control function.
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 functi...
Type get_type() const
Returns the Type of the control function.
virtual bool destroy(std::uint32_t expectedRefCount=1)
Destroys this control function, by removing it from the network manager.
const std::uint8_t canPortIndex
The CAN channel index of the control function.
A class that represents an ISO11783 control function NAME from an address claim.
Definition can_NAME.hpp:24
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...