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 
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
46 
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
73 operator&(CanFlag lhs, CanFlag rhs) {
74  return static_cast<CanFlag>(static_cast<int>(lhs) & static_cast<int>(rhs));
75 }
76 
77 constexpr CanFlag
78 operator^(CanFlag lhs, CanFlag rhs) {
79  return static_cast<CanFlag>(static_cast<int>(lhs) ^ static_cast<int>(rhs));
80 }
81 
82 constexpr CanFlag
83 operator|(CanFlag lhs, CanFlag rhs) {
84  return static_cast<CanFlag>(static_cast<int>(lhs) | static_cast<int>(rhs));
85 }
86 
87 inline CanFlag&
88 operator&=(CanFlag& lhs, CanFlag rhs) {
89  return lhs = lhs & rhs;
90 }
91 
92 inline CanFlag&
93 operator^=(CanFlag& lhs, CanFlag rhs) {
94  return lhs = lhs ^ rhs;
95 }
96 
97 inline CanFlag&
98 operator|=(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_ESI
@ CAN_FLAG_ESI
The Error State Indicator (ESI) flag (only available in CAN FD format frames).
Definition: msg.h:67
CAN_FLAG_BRS
@ CAN_FLAG_BRS
The Bit Rate Switch (BRS) flag (only available in CAN FD format frames).
Definition: msg.h:62
msg.h
lely::io::CanFlag
CanFlag
The error flags of a CAN bus, which are not mutually exclusive.
Definition: msg.hpp:33
CAN_FLAG_RTR
@ CAN_FLAG_RTR
The Remote Transmission Request (RTR) flag (unavailable in CAN FD format frames).
Definition: msg.h:48
CAN_FLAG_FDF
@ CAN_FLAG_FDF
The FD Format (FDF) flag, formerly known as Extended Data Length (EDL).
Definition: msg.h:54
CAN_FLAG_IDE
@ CAN_FLAG_IDE
The Identifier Extension (IDE) flag.
Definition: msg.h:43