Lely core libraries 2.3.4
msg.hpp
Go to the documentation of this file.
1
24#ifndef LELY_IO2_CAN_MSG_HPP_
25#define LELY_IO2_CAN_MSG_HPP_
26
27#include <lely/io2/can/msg.h>
28
29namespace lely {
30namespace io {
31
33enum class CanFlag : int {
45#if !LELY_NO_CANFD
63#endif // !LELY_NO_CANFD
64 NONE = 0
65};
66
67constexpr CanFlag
68operator~(CanFlag rhs) {
69 return static_cast<CanFlag>(~static_cast<int>(rhs));
70}
71
72constexpr CanFlag
73operator&(CanFlag lhs, CanFlag rhs) {
74 return static_cast<CanFlag>(static_cast<int>(lhs) & static_cast<int>(rhs));
75}
76
77constexpr CanFlag
78operator^(CanFlag lhs, CanFlag rhs) {
79 return static_cast<CanFlag>(static_cast<int>(lhs) ^ static_cast<int>(rhs));
80}
81
82constexpr CanFlag
83operator|(CanFlag lhs, CanFlag rhs) {
84 return static_cast<CanFlag>(static_cast<int>(lhs) | static_cast<int>(rhs));
85}
86
87inline CanFlag&
88operator&=(CanFlag& lhs, CanFlag rhs) {
89 return lhs = lhs & rhs;
90}
91
92inline CanFlag&
93operator^=(CanFlag& lhs, CanFlag rhs) {
94 return lhs = lhs ^ rhs;
95}
96
97inline CanFlag&
98operator|=(CanFlag& lhs, CanFlag rhs) {
99 return lhs = lhs | rhs;
100}
101
102} // namespace io
103} // namespace lely
104
105#endif // !LELY_IO2_CAN_MSG_HPP_
@ CAN_FLAG_IDE
The Identifier Extension (IDE) flag.
Definition: msg.h:43
@ CAN_FLAG_RTR
The Remote Transmission Request (RTR) flag (unavailable in CAN FD format frames).
Definition: msg.h:48
@ CAN_FLAG_FDF
The FD Format (FDF) flag, formerly known as Extended Data Length (EDL).
Definition: msg.h:54
@ CAN_FLAG_BRS
The Bit Rate Switch (BRS) flag (only available in CAN FD format frames).
Definition: msg.h:62
@ CAN_FLAG_ESI
The Error State Indicator (ESI) flag (only available in CAN FD format frames).
Definition: msg.h:67
This header file is part of the I/O library; it contains the CAN frame declarations.
@ BRS
Bit Rate Switch support is enabled.
@ FDF
FD Format (formerly Extended Data Length) support is enabled.
CanFlag
The error flags of a CAN bus, which are not mutually exclusive.
Definition: msg.hpp:33
@ RTR
The Remote Transmission Request (RTR) flag (unavailable in CAN FD format frames).
@ IDE
The Identifier Extension (IDE) flag.
@ ESI
The Error State Indicator (ESI) flag (only available in CAN FD format frames).