ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lampConfig.hpp
Go to the documentation of this file.
1 
10 #ifndef FCF_DEVMGR_DEVICE_LAMP_CONFIG_HPP
11 #define FCF_DEVMGR_DEVICE_LAMP_CONFIG_HPP
12 
13 // System headers
14 #include <string>
15 
16 // Third party headers
17 #include <yaml-cpp/yaml.h>
18 
19 
20 #include <fcf/common/iComm.hpp>
26 
27 namespace fcf::devmgr::lamp {
28 
29 
30  // Constants for internal mapping
31  constexpr auto CI_ACTIVE_LOW_FAULT = "low_fault";
32  constexpr auto CI_ACTIVE_LOW_ON = "low_on";
33  constexpr auto CI_ACTIVE_LOW_SWITCH = "low_switch";
34  constexpr auto CI_IGNORE_FAULT = "ignore_fault";
35  constexpr auto CI_INVERT_ANALOG = "invert_analog";
36  constexpr auto CI_ANALOG_THRESHOLD = "analog_threshold";
37  constexpr auto CI_ANALOG_RANGE = "analog_range";
38  constexpr auto CI_COOLDDOWN = "cooldown";
39  constexpr auto CI_MAX_ON = "maxon";
40  constexpr auto CI_WARMUP = "warmup";
41  constexpr auto CI_INITIAL_STATE = "initial_state";
42  constexpr auto CI_TIMEOUT = "timeout";
43 
44  // Specifics lamp status values
45  const std::string CI_STAT_INTENSITY = "intensity";
46 
47  // Specific lamp RPC
48  const std::string RPC_ON = "rpcSwitchOn";
49  const std::string RPC_OFF = "rpcSwitchOff";
50 
51  // Specific constant values for lamp device state/substate
52  constexpr int SUBSTATE_READY_OFF = 103;
53  constexpr int SUBSTATE_READY_ON = 104;
54 
55  constexpr int SUBSTATE_OP_DISABLING = 205;
56  constexpr int SUBSTATE_OP_OFF = 206;
57  constexpr int SUBSTATE_OP_SWITCHING_OFF = 207;
58  constexpr int SUBSTATE_OP_COOLING = 208;
59  constexpr int SUBSTATE_OP_ON = 209;
60  constexpr int SUBSTATE_OP_SWITCHING_ON = 210;
61  constexpr int SUBSTATE_OP_WARMING = 211;
62 
63  constexpr auto SUBSTATE_NOTREADY_STR = "NotReady";
64  constexpr auto SUBSTATE_READY_OFF_STR = "Ready/Off";
65  constexpr auto SUBSTATE_READY_ON_STR = "Ready/On";
66  constexpr auto SUBSTATE_OP_DISABLING_STR = "Disabling";
67  constexpr auto SUBSTATE_OP_OFF_STR = "Off";
68  constexpr auto SUBSTATE_OP_SWITCHING_OFF_STR = "Switching off";
69  constexpr auto SUBSTATE_OP_COOLING_STR = "Cooling down";
70  constexpr auto SUBSTATE_OP_ON_STR = "On";
71  constexpr auto SUBSTATE_OP_SWITCHING_ON_STR = "Switching on";
72  constexpr auto SUBSTATE_OP_WARMING_STR = "Warming up";
73 
74 
75  const std::unordered_map<short, std::string> SubstateMap = {
89  };
90 
91  const std::vector<std::string> cfgMapping = {
94  };
95 
96  const std::vector<std::string> statMapping = {
102  };
103 
104  const std::vector<std::string> rpcMapping = {
110  RPC_OFF,
111  RPC_ON
112  };
113 
122  {
123 
124  // Enumerations of configuration paramters
125  enum {
126  CFG_LOWFAULT = 1,
127  CFG_LOWON = 2,
128  CFG_LOWSWITCH = 3,
129  CFG_IGFAULT = 4,
130  CFG_INANALOG = 5,
131  CFG_ANTHRES = 6,
132  CFG_ANRANGE = 7,
133  CFG_COOLDOWN = 8,
134  CFG_MAXON = 9,
135  CFG_WARMUP = 10,
136  CFG_INITSTATE = 11,
137  CFG_TIMEOUT = 12,
138  END_ENUM_LAMP // WARNING: This should be always last enumerator.
139  };
140 
141  public:
142 
148  LampConfig(const std::string filename,
149  const std::string name);
150 
154  virtual ~LampConfig();
155 
156 
157 
158 
159  };
160 
161 } // fcf::devmgr::lamp
162 
163 
164 #endif //FCF_DEVMGR_DEVICE_LAMP_CONFIG_H
constexpr auto CI_STAT_LOCAL
Definition: deviceConfig.hpp:53
constexpr auto RPC_INIT
Definition: deviceConfig.hpp:43
virtual ~LampConfig()
DeviceConfig destructor.
Definition: lampConfig.cpp:62
constexpr auto SUBSTATE_OP_DISABLING_STR
Definition: lampConfig.hpp:66
constexpr int SUBSTATE_INITIALISING
Definition: deviceConfig.hpp:84
constexpr auto SUBSTATE_NOTREADY_STR
Definition: deviceConfig.hpp:87
constexpr auto SUBSTATE_OP_SWITCHING_ON_STR
Definition: lampConfig.hpp:71
constexpr auto SUBSTATE_NOTREADY_STR
Definition: lampConfig.hpp:63
constexpr int SUBSTATE_OP_DISABLING
Definition: lampConfig.hpp:55
const std::vector< std::string > rpcMapping
Definition: lampConfig.hpp:104
constexpr auto CI_IGNORE_FAULT
Definition: lampConfig.hpp:34
constexpr int SUBSTATE_OP_ON
Definition: lampConfig.hpp:59
constexpr int SUBSTATE_OP_SWITCHING_ON
Definition: lampConfig.hpp:60
LampHwErrors header file.
constexpr auto CI_STAT_SUBSTATE
Definition: deviceConfig.hpp:50
constexpr auto RPC_DISABLE
Definition: deviceConfig.hpp:45
LampRpcErrors header file.
constexpr auto CI_ACTIVE_LOW_ON
Definition: lampConfig.hpp:32
constexpr auto CI_TIMEOUT
Definition: lampConfig.hpp:42
constexpr auto SUBSTATE_READY_OFF_STR
Definition: lampConfig.hpp:64
constexpr auto CI_INVERT_ANALOG
Definition: lampConfig.hpp:35
constexpr auto SUBSTATE_OP_WARMING_STR
Definition: lampConfig.hpp:72
const std::string RPC_ON
Definition: lampConfig.hpp:48
constexpr auto CI_WARMUP
Definition: lampConfig.hpp:40
constexpr int SUBSTATE_READY_ON
Definition: lampConfig.hpp:53
constexpr int SUBSTATE_OP_COOLING
Definition: lampConfig.hpp:58
constexpr int SUBSTATE_OP_WARMING
Definition: lampConfig.hpp:61
configSet class header file.
constexpr auto RPC_STOP
Definition: deviceConfig.hpp:46
constexpr auto CI_STAT_STATE
Definition: deviceConfig.hpp:51
constexpr int SUBSTATE_READY_OFF
Definition: lampConfig.hpp:52
constexpr int SUBSTATE_NOTREADY
Definition: deviceConfig.hpp:82
constexpr auto SUBSTATE_OP_SWITCHING_OFF_STR
Definition: lampConfig.hpp:68
constexpr int SUBSTATE_OP_OFF
Definition: lampConfig.hpp:56
const std::string RPC_OFF
Definition: lampConfig.hpp:49
Lamp Configuration class.
Definition: lampConfig.hpp:121
LampConfig(const std::string filename, const std::string name)
DeviceConfig constructor.
Definition: lampConfig.cpp:25
constexpr int SUBSTATE_OP_SWITCHING_OFF
Definition: lampConfig.hpp:57
const std::vector< std::string > statMapping
Definition: lampConfig.hpp:96
DataContext class header file.
constexpr auto SUBSTATE_OP_ERROR_STR
Definition: deviceConfig.hpp:96
constexpr auto SUBSTATE_INITIALISING_STR
Definition: deviceConfig.hpp:88
constexpr auto SUBSTATE_OP_COOLING_STR
Definition: lampConfig.hpp:69
constexpr auto SUBSTATE_OP_ON_STR
Definition: lampConfig.hpp:70
constexpr auto CI_ANALOG_RANGE
Definition: lampConfig.hpp:37
constexpr int SUBSTATE_OP_ERROR
Definition: deviceConfig.hpp:93
const std::unordered_map< short, std::string > SubstateMap
Definition: lampConfig.hpp:75
constexpr auto RPC_RESET
Definition: deviceConfig.hpp:47
constexpr auto CI_MAX_ON
Definition: lampConfig.hpp:39
Device Configuration class.
Definition: deviceConfig.hpp:125
constexpr auto CI_STAT_ERROR_CODE
Definition: deviceConfig.hpp:54
constexpr int SUBSTATE_ERROR
Definition: deviceConfig.hpp:85
constexpr auto SUBSTATE_READY_ON_STR
Definition: lampConfig.hpp:65
const std::vector< std::string > cfgMapping
Definition: lampConfig.hpp:91
constexpr auto CI_ANALOG_THRESHOLD
Definition: lampConfig.hpp:36
constexpr auto CI_ACTIVE_LOW_FAULT
Definition: lampConfig.hpp:31
constexpr auto RPC_ENABLE
Definition: deviceConfig.hpp:44
constexpr auto SUBSTATE_OP_OFF_STR
Definition: lampConfig.hpp:67
DeviceConfig class header file.
constexpr auto SUBSTATE_ERROR_STR
Definition: deviceConfig.hpp:90
constexpr auto CI_INITIAL_STATE
Definition: lampConfig.hpp:41
constexpr auto CI_COOLDDOWN
Definition: lampConfig.hpp:38
const std::string CI_STAT_INTENSITY
Definition: lampConfig.hpp:45
constexpr auto CI_ACTIVE_LOW_SWITCH
Definition: lampConfig.hpp:33