libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
Role.h
Go to the documentation of this file.
1 //
2 // Created by sathya on 17.09.19.
3 //
4 
5 #ifndef LIBHOMEGEAR_BASE_ROLE_H
6 #define LIBHOMEGEAR_BASE_ROLE_H
7 
8 #include <cstdint>
9 
10 namespace BaseLib {
11 
12 enum class RoleLevel {
13  undefined = -1,
14  mainCategory = 0,
15  subCategory = 1,
16  role = 2
17 };
18 
19 enum class RoleDirection {
20  undefined = -1,
21  input = 0,
22  output = 1,
23  both = 2
24 };
25 
26 struct RoleScaleInfo {
27  bool valueSet = false;
28  double valueMin = 0;
29  double valueMax = 0;
30  double scaleMin = 0;
31  double scaleMax = 0;
32 };
33 
34 struct Role {
35  Role() = default;
36 
37  Role(uint64_t id, RoleDirection direction, bool invert, bool scale, RoleScaleInfo scaleInfo) : id(id), direction(direction), invert(invert), scale(scale), scaleInfo(scaleInfo) {
38  if ((id / 10000) * 10000 == id) level = RoleLevel::mainCategory;
39  else if ((id / 100) * 100 == id) level = RoleLevel::subCategory;
40  else level = RoleLevel::role;
41  }
42 
43  uint64_t id;
46  bool invert = false;
47  bool scale = false;
49 };
50 
51 }
52 #endif //LIBHOMEGEAR_BASE_ROLE_H
Definition: Role.h:26
Definition: BaseLib.cpp:34
Role(uint64_t id, RoleDirection direction, bool invert, bool scale, RoleScaleInfo scaleInfo)
Definition: Role.h:37
RoleLevel
Definition: Role.h:12
Definition: Role.h:34
RoleScaleInfo scaleInfo
Definition: Role.h:48
uint64_t id
Definition: Role.h:43
RoleDirection
Definition: Role.h:19