consts.hh
Go to the documentation of this file.
1 
9 #pragma once
10 
11 
12 namespace dfti {
13 
14 
16 const QString app_name{"dfti"};
17 
19 
23 const QString app_version{DFTI_VERSION};
24 
26 enum class AvailableSensors : quint8 {
27  NONE = 0,
28  HAVE_AP = 1 << 0,
29  HAVE_UADC = 1 << 1,
30  HAVE_VN200 = 1 << 2
31 };
32 
33 
35 enum class DebugMode : quint8
36 {
37  DEBUG_NONE = 0,
38  DEBUG_RC = 1 << 0,
39  DEBUG_SERIAL = 1 << 1,
40  DEBUG_DATA = 1 << 2
41 };
42 
43 
44 // -----------------------------------------------------------------------------
45 // Operator Overloading for Enum Classes
46 // -----------------------------------------------------------------------------
47 
49 inline AvailableSensors
51 {
52  return static_cast<AvailableSensors>(
53  static_cast<quint8>(lhs) | static_cast<quint8>(rhs)
54  );
55 }
56 
57 
59 inline AvailableSensors&
61 {
62 
63  lhs = static_cast<AvailableSensors>(
64  static_cast<quint8>(lhs) | static_cast<quint8>(rhs)
65  );
66  return lhs;
67 }
68 
69 
71 inline AvailableSensors
73 {
74  return static_cast<AvailableSensors>(
75  static_cast<quint8>(lhs) & static_cast<quint8>(rhs)
76  );
77 }
78 
79 
81 inline bool
83 {
84  return static_cast<quint8>(x) ? true : false;
85 }
86 
87 
89 inline DebugMode
90 operator| (DebugMode lhs, DebugMode rhs)
91 {
92  return static_cast<DebugMode>(
93  static_cast<quint8>(lhs) | static_cast<quint8>(rhs)
94  );
95 }
96 
97 
99 inline DebugMode&
101 {
102 
103  lhs = static_cast<DebugMode>(
104  static_cast<quint8>(lhs) | static_cast<quint8>(rhs)
105  );
106  return lhs;
107 }
108 
109 
111 inline DebugMode
112 operator& (DebugMode lhs, DebugMode rhs)
113 {
114  return static_cast<DebugMode>(
115  static_cast<quint8>(lhs) & static_cast<quint8>(rhs)
116  );
117 }
118 
119 
121 inline bool
123 {
124  return static_cast<quint8>(x) ? true : false;
125 }
126 
127 
128 }; // namespace dfti
const QString app_name
App info.
Definition: dfti_test.cc:28
AvailableSensors operator|(AvailableSensors lhs, AvailableSensors rhs)
Implement bitwise-or for AvailableSensors.
Definition: consts.hh:50
Definition: autopilot.cc:12
const QString app_version
DFTI application version.
Definition: consts.hh:23
AvailableSensors & operator|=(AvailableSensors &lhs, AvailableSensors rhs)
Implement bitwise-or assignment for AvailableSensors.
Definition: consts.hh:60
AvailableSensors operator&(AvailableSensors lhs, AvailableSensors rhs)
Implement bitwise-and for AvailableSensors.
Definition: consts.hh:72
DebugMode
Debugging Mode enumeration.
Definition: consts.hh:35
bool check(AvailableSensors x)
Check an AvailableSensors value.
Definition: consts.hh:82
AvailableSensors
Available sensors enumeration.
Definition: consts.hh:26