AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
can_NAME_filter.cpp
Go to the documentation of this file.
1//================================================================================================
9//================================================================================================
11
12namespace isobus
13{
14 NAMEFilter::NAMEFilter(NAME::NAMEParameters nameParameter, std::uint32_t parameterMatchValue) :
15 parameter(nameParameter),
16 value(parameterMatchValue)
17 {
18 }
19
24
25 std::uint32_t NAMEFilter::get_value() const
26 {
27 return value;
28 }
29
30 bool NAMEFilter::check_name_matches_filter(const NAME &nameToCompare) const
31 {
32 bool retVal = false;
33
34 switch (parameter)
35 {
37 {
38 retVal = (nameToCompare.get_identity_number() == value);
39 }
40 break;
41
43 {
44 retVal = (nameToCompare.get_manufacturer_code() == value);
45 }
46 break;
47
49 {
50 retVal = (nameToCompare.get_ecu_instance() == value);
51 }
52 break;
53
55 {
56 retVal = (nameToCompare.get_function_instance() == value);
57 }
58 break;
59
61 {
62 retVal = (nameToCompare.get_function_code() == value);
63 }
64 break;
65
67 {
68 retVal = (nameToCompare.get_device_class() == value);
69 }
70 break;
71
73 {
74 retVal = (nameToCompare.get_device_class_instance() == value);
75 }
76 break;
77
79 {
80 retVal = (nameToCompare.get_industry_group() == value);
81 }
82 break;
83
85 {
86 retVal = (nameToCompare.get_arbitrary_address_capable() == (0 != value));
87 }
88 break;
89
90 default:
91 {
92 }
93 break;
94 }
95 return retVal;
96 }
97
98} // namespace isobus
Defines a filter value for an ISONAME component. Used to tell the stack what kind of ECU you want to ...
std::uint32_t value
The value of the data associated with the filter component.
NAMEFilter(NAME::NAMEParameters nameParameter, std::uint32_t parameterMatchValue)
Constructor for the NAMEFilter.
NAME::NAMEParameters get_parameter() const
Returns the parameter data associated with this filter.
bool check_name_matches_filter(const NAME &nameToCompare) const
Returns true if a NAME matches this filter class's components.
std::uint32_t get_value() const
Returns the value associated with this filter.
NAME::NAMEParameters parameter
The NAME component to filter against.
A class that represents an ISO11783 control function NAME from an address claim.
Definition can_NAME.hpp:24
std::uint8_t get_ecu_instance() const
Gets the ecu instance encoded in the NAME.
Definition can_NAME.cpp:106
bool get_arbitrary_address_capable() const
Returns if the ECU is capable of address arbitration.
Definition can_NAME.cpp:24
std::uint8_t get_function_instance() const
Gets the function instance encoded in the NAME.
Definition can_NAME.cpp:91
NAMEParameters
The encoded components that comprise a NAME.
Definition can_NAME.hpp:28
@ IndustryGroup
The industry group associated with this ECU, such as "agricultural".
@ DeviceClass
Also known as the vehicle system from J1939, describes general ECU type.
@ DeviceClassInstance
The instance number of this device class.
@ ArbitraryAddressCapable
Defines if this ECU supports address arbitration.
@ FunctionCode
The function of the ECU, as defined by ISO11783.
@ EcuInstance
The ECU instance of the ECU with this NAME. Usually increments in NAME order with similar CFs.
@ FunctionInstance
The function instance of the ECU. Similar to Virtual Terminal number.
@ ManufacturerCode
The J1939/ISO11783 manufacturer code of the ECU with this NAME.
@ IdentityNumber
Usually the serial number of the ECU, unique for all similar control functions.
std::uint16_t get_manufacturer_code() const
Gets the manufacturer code encoded in the NAME.
Definition can_NAME.cpp:121
std::uint8_t get_function_code() const
Gets the function code encoded in the NAME.
Definition can_NAME.cpp:80
std::uint8_t get_device_class_instance() const
Returns the device class (vehicle system) encoded in the NAME.
Definition can_NAME.cpp:50
std::uint8_t get_industry_group() const
Returns the industry group encoded in the NAME.
Definition can_NAME.cpp:35
std::uint8_t get_device_class() const
Returns the device class (vehicle system) encoded in the NAME.
Definition can_NAME.cpp:65
std::uint32_t get_identity_number() const
Gets the identity number encoded in the NAME.
Definition can_NAME.cpp:136
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...