Lely core libraries  2.2.5
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 
29 namespace lely {
30 namespace io {
31 
33 enum class CanFlag : int {
39  IDE = CAN_FLAG_IDE,
44  RTR = CAN_FLAG_RTR,
45 #if !LELY_NO_CANFD
50  FDF = CAN_FLAG_FDF,
57  BRS = CAN_FLAG_BRS,
62  ESI = CAN_FLAG_ESI,
63 #endif // !LELY_NO_CANFD
64  NONE = 0
65 };
66 
67 constexpr CanFlag
68 operator~(CanFlag rhs) {
69  return static_cast<CanFlag>(~static_cast<int>(rhs));
70 }
71 
72 constexpr CanFlag operator&(CanFlag lhs, CanFlag rhs) {
73  return static_cast<CanFlag>(static_cast<int>(lhs) & static_cast<int>(rhs));
74 }
75 
76 constexpr CanFlag
77 operator^(CanFlag lhs, CanFlag rhs) {
78  return static_cast<CanFlag>(static_cast<int>(lhs) ^ static_cast<int>(rhs));
79 }
80 
81 constexpr CanFlag
82 operator|(CanFlag lhs, CanFlag rhs) {
83  return static_cast<CanFlag>(static_cast<int>(lhs) | static_cast<int>(rhs));
84 }
85 
86 inline CanFlag&
87 operator&=(CanFlag& lhs, CanFlag rhs) {
88  return lhs = lhs & rhs;
89 }
90 
91 inline CanFlag&
92 operator^=(CanFlag& lhs, CanFlag rhs) {
93  return lhs = lhs ^ rhs;
94 }
95 
96 inline CanFlag&
97 operator|=(CanFlag& lhs, CanFlag rhs) {
98  return lhs = lhs | rhs;
99 }
100 
101 } // namespace io
102 } // namespace lely
103 
104 #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.
CanFlag
The error flags of a CAN bus, which are not mutually exclusive.
Definition: msg.hpp:33
@ BRS
The Bit Rate Switch (BRS) flag (only available in CAN FD format frames).
@ RTR
The Remote Transmission Request (RTR) flag (unavailable in CAN FD format frames).
@ IDE
The Identifier Extension (IDE) flag.
@ FDF
The FD Format (FDF) flag, formerly known as Extended Data Length (EDL).
@ ESI
The Error State Indicator (ESI) flag (only available in CAN FD format frames).