ifw-fcf  5.0.0-pre2
piezoConfig.hpp
Go to the documentation of this file.
1 
10 #ifndef FCF_DEVMGR_DEVICE_PIEZO_CONFIG_HPP
11 #define FCF_DEVMGR_DEVICE_PIEZO_CONFIG_HPP
12 
13 // System headers
14 #include <string>
15 
16 // Third party headers
17 #include <yaml-cpp/yaml.h>
18 
19 #include <utils/bat/logger.hpp>
20 
25 
26 namespace fcf::devmgr::piezo {
27 
28  constexpr auto LOGGER_NAME = "piezo";
29  // Constants for internal mapping
30  constexpr auto CI_MAX_ON = "max_on";
31  constexpr auto CI_NUM_AXIS = "num_axis";
32  constexpr auto CI_FULL_RANGE1 = "full_range1";
33  constexpr auto CI_FULL_RANGE2 = "full_range2";
34  constexpr auto CI_FULL_RANGE3 = "full_range3";
35  constexpr auto CI_HOME1 = "home1";
36  constexpr auto CI_HOME2 = "home2";
37  constexpr auto CI_HOME3 = "home3";
38  constexpr auto CI_LOWER_LIMIT1 = "lower_limit1";
39  constexpr auto CI_LOWER_LIMIT2 = "lower_limit2";
40  constexpr auto CI_LOWER_LIMIT3 = "lower_limit3";
41  constexpr auto CI_UPPER_LIMIT1 = "upper_limit1";
42  constexpr auto CI_UPPER_LIMIT2 = "upper_limit2";
43  constexpr auto CI_UPPER_LIMIT3 = "upper_limit3";
44  constexpr auto CI_USER_TO_BIT_INPUT1 = "user_to_bit_input1";
45  constexpr auto CI_USER_TO_BIT_INPUT2 = "user_to_bit_input2";
46  constexpr auto CI_USER_TO_BIT_INPUT3 = "user_to_bit_input3";
47  constexpr auto CI_USER_OFFSET_INPUT1 = "user_offset_input1";
48  constexpr auto CI_USER_OFFSET_INPUT2 = "user_offset_input2";
49  constexpr auto CI_USER_OFFSET_INPUT3 = "user_offset_input3";
50  constexpr auto CI_USER_TO_BIT_OUTPUT1 = "user_to_bit_output1";
51  constexpr auto CI_USER_TO_BIT_OUTPUT2 = "user_to_bit_output2";
52  constexpr auto CI_USER_TO_BIT_OUTPUT3 = "user_to_bit_output3";
53  constexpr auto CI_USER_OFFSET_OUTPUT1 = "user_offset_output1";
54  constexpr auto CI_USER_OFFSET_OUTPUT2 = "user_offset_output2";
55  constexpr auto CI_USER_OFFSET_OUTPUT3 = "user_offset_output3";
56 
57  constexpr bool DEFAULT_MAX_ON = 0;
58  constexpr bool DEFAULT_NUM_AXIS = 2;
59  constexpr short DEFAULT_FULL_RANGE = 32767;
60  constexpr short DEFAULT_LOWER_LIMIT = 0;
61  constexpr short DEFAULT_UPPER_LIMIT = 32767;
62  constexpr short DEFAULT_USER_OFFSET = 0;
63  constexpr short DEFAULT_HOME = 0;
64  constexpr double DEFAULT_USER_TO_BIT = 32767/10.0;
65 
66  // Specifics Piezo status values
67 
68  // Specific Piezo RPC
69  constexpr auto RPC_AUTO = "rpcAuto";
70  constexpr auto RPC_HOME = "rpcHome";
71  constexpr auto RPC_POS = "rpcPos";
72  constexpr auto RPC_MOVEBITS = "rpcMoveBits";
73  constexpr auto RPC_MOVEUSER = "rpcMoveUser";
74 
75  // Specific constant values for Piezo device state/substate
76  constexpr short SUBSTATE_OP_POS = 203;
77  constexpr short SUBSTATE_OP_AUTO = 204;
78 
79  constexpr auto SUBSTATE_OP_POS_STR = "Pos";
80  constexpr auto SUBSTATE_OP_AUTO_STR = "Auto";
81 
82  const std::unordered_map<short, std::string> SubstateMap = {
89  };
90 
91  // Status configuration attributes
92  constexpr auto CI_STAT_ACTUAL_POS_BIT = "actual_pos_bit";
93  constexpr auto CI_STAT_ACTUAL_POS_BIT1 = "actual_pos_bit1";
94  constexpr auto CI_STAT_ACTUAL_POS_BIT2 = "actual_pos_bit2";
95  constexpr auto CI_STAT_ACTUAL_POS_BIT3 = "actual_pos_bit3";
96 
97  constexpr auto CI_STAT_ACTUAL_POS_USER = "actual_pos_user";
98  constexpr auto CI_STAT_ACTUAL_POS_USER1 = "actual_pos_user1";
99  constexpr auto CI_STAT_ACTUAL_POS_USER2 = "actual_pos_user2";
100  constexpr auto CI_STAT_ACTUAL_POS_USER3 = "actual_pos_user3";
101 
102  constexpr auto CI_STAT_MON_ACT_POS_BIT = "mon_act_pos_bit";
103  constexpr auto CI_STAT_MON_ACT_POS_BIT1 = "mon_act_pos_bit1";
104  constexpr auto CI_STAT_MON_ACT_POS_BIT2 = "mon_act_pos_bit2";
105  constexpr auto CI_STAT_MON_ACT_POS_BIT3 = "mon_act_pos_bit3";
106 
107  constexpr auto CI_STAT_MON_ACT_POS_USR = "mon_act_pos_usr";
108  constexpr auto CI_STAT_MON_ACT_POS_USR1 = "mon_act_pos_usr1";
109  constexpr auto CI_STAT_MON_ACT_POS_USR2 = "mon_act_pos_usr2";
110  constexpr auto CI_STAT_MON_ACT_POS_USR3 = "mon_act_pos_usr3";
111 
120  {
121 
122  public:
123 
129  PiezoConfig(const std::string filename,
130  const std::string name);
131 
136  PiezoConfig(const std::string name);
137 
141  virtual ~PiezoConfig() = default;
142 
143  short GetNumAxes() const;
144 
145  private:
146  log4cplus::Logger m_logger;
147  };
148 
149 } //namespace
150 
151 
152 #endif //FCF_DEVMGR_DEVICE_PIEZO_CONFIG_H
Device Configuration class.
Definition: deviceConfig.hpp:126
piezo Configuration class
Definition: piezoConfig.hpp:120
virtual ~PiezoConfig()=default
DeviceConfig destructor.
short GetNumAxes() const
Definition: piezoConfig.cpp:22
PiezoConfig(const std::string filename, const std::string name)
DeviceConfig constructor.
Definition: piezoConfig.cpp:15
PiezoConfig(const std::string name)
DeviceConfig constructor.
DataContext class header file.
DeviceConfig class header file.
constexpr int SUBSTATE_OP_ERROR
Definition: deviceConfig.hpp:108
constexpr int SUBSTATE_INITIALISING
Definition: deviceConfig.hpp:99
constexpr auto SUBSTATE_OP_ERROR_STR
Definition: deviceConfig.hpp:111
constexpr auto SUBSTATE_ERROR_STR
Definition: deviceConfig.hpp:105
constexpr int SUBSTATE_ERROR
Definition: deviceConfig.hpp:100
constexpr int SUBSTATE_NOTREADY
Definition: deviceConfig.hpp:97
constexpr auto SUBSTATE_NOTREADY_STR
Definition: deviceConfig.hpp:102
constexpr auto SUBSTATE_INITIALISING_STR
Definition: deviceConfig.hpp:103
Definition: piezo.hpp:19
constexpr auto CI_USER_OFFSET_OUTPUT3
Definition: piezoConfig.hpp:55
constexpr auto RPC_MOVEUSER
Definition: piezoConfig.hpp:73
constexpr auto CI_USER_OFFSET_INPUT1
Definition: piezoConfig.hpp:47
constexpr auto CI_UPPER_LIMIT2
Definition: piezoConfig.hpp:42
constexpr auto CI_STAT_ACTUAL_POS_BIT
Definition: piezoConfig.hpp:92
constexpr bool DEFAULT_NUM_AXIS
Definition: piezoConfig.hpp:58
constexpr auto CI_LOWER_LIMIT3
Definition: piezoConfig.hpp:40
constexpr auto CI_FULL_RANGE2
Definition: piezoConfig.hpp:33
constexpr auto CI_UPPER_LIMIT3
Definition: piezoConfig.hpp:43
constexpr auto CI_STAT_MON_ACT_POS_BIT2
Definition: piezoConfig.hpp:104
constexpr auto CI_USER_TO_BIT_INPUT2
Definition: piezoConfig.hpp:45
constexpr auto CI_STAT_ACTUAL_POS_BIT1
Definition: piezoConfig.hpp:93
constexpr auto CI_USER_TO_BIT_OUTPUT3
Definition: piezoConfig.hpp:52
constexpr auto CI_HOME3
Definition: piezoConfig.hpp:37
constexpr auto CI_UPPER_LIMIT1
Definition: piezoConfig.hpp:41
constexpr auto CI_MAX_ON
Definition: piezoConfig.hpp:30
constexpr auto RPC_POS
Definition: piezoConfig.hpp:71
constexpr auto CI_USER_OFFSET_INPUT2
Definition: piezoConfig.hpp:48
constexpr auto CI_FULL_RANGE3
Definition: piezoConfig.hpp:34
constexpr auto RPC_AUTO
Definition: piezoConfig.hpp:69
constexpr auto CI_STAT_MON_ACT_POS_USR1
Definition: piezoConfig.hpp:108
constexpr auto SUBSTATE_OP_AUTO_STR
Definition: piezoConfig.hpp:80
constexpr auto CI_STAT_MON_ACT_POS_USR
Definition: piezoConfig.hpp:107
constexpr auto CI_STAT_MON_ACT_POS_USR2
Definition: piezoConfig.hpp:109
constexpr auto RPC_HOME
Definition: piezoConfig.hpp:70
constexpr short DEFAULT_USER_OFFSET
Definition: piezoConfig.hpp:62
constexpr auto CI_STAT_MON_ACT_POS_USR3
Definition: piezoConfig.hpp:110
constexpr auto CI_FULL_RANGE1
Definition: piezoConfig.hpp:32
constexpr auto CI_USER_OFFSET_INPUT3
Definition: piezoConfig.hpp:49
constexpr auto CI_STAT_ACTUAL_POS_USER3
Definition: piezoConfig.hpp:100
constexpr auto LOGGER_NAME
Definition: piezoConfig.hpp:28
constexpr auto CI_STAT_ACTUAL_POS_USER2
Definition: piezoConfig.hpp:99
constexpr auto CI_STAT_MON_ACT_POS_BIT1
Definition: piezoConfig.hpp:103
constexpr auto CI_USER_TO_BIT_OUTPUT2
Definition: piezoConfig.hpp:51
constexpr auto CI_STAT_ACTUAL_POS_USER
Definition: piezoConfig.hpp:97
constexpr auto CI_LOWER_LIMIT2
Definition: piezoConfig.hpp:39
constexpr short DEFAULT_UPPER_LIMIT
Definition: piezoConfig.hpp:61
constexpr short SUBSTATE_OP_AUTO
Definition: piezoConfig.hpp:77
constexpr short DEFAULT_LOWER_LIMIT
Definition: piezoConfig.hpp:60
constexpr auto CI_LOWER_LIMIT1
Definition: piezoConfig.hpp:38
constexpr auto CI_USER_TO_BIT_OUTPUT1
Definition: piezoConfig.hpp:50
constexpr short SUBSTATE_OP_POS
Definition: piezoConfig.hpp:76
constexpr auto RPC_MOVEBITS
Definition: piezoConfig.hpp:72
constexpr short DEFAULT_FULL_RANGE
Definition: piezoConfig.hpp:59
constexpr bool DEFAULT_MAX_ON
Definition: piezoConfig.hpp:57
constexpr auto CI_STAT_ACTUAL_POS_BIT2
Definition: piezoConfig.hpp:94
constexpr double DEFAULT_USER_TO_BIT
Definition: piezoConfig.hpp:64
constexpr auto CI_NUM_AXIS
Definition: piezoConfig.hpp:31
const std::unordered_map< short, std::string > SubstateMap
Definition: piezoConfig.hpp:82
constexpr auto CI_HOME1
Definition: piezoConfig.hpp:35
constexpr auto CI_STAT_MON_ACT_POS_BIT3
Definition: piezoConfig.hpp:105
constexpr short DEFAULT_HOME
Definition: piezoConfig.hpp:63
constexpr auto CI_USER_OFFSET_OUTPUT2
Definition: piezoConfig.hpp:54
constexpr auto CI_STAT_ACTUAL_POS_USER1
Definition: piezoConfig.hpp:98
constexpr auto CI_USER_TO_BIT_INPUT1
Definition: piezoConfig.hpp:44
constexpr auto SUBSTATE_OP_POS_STR
Definition: piezoConfig.hpp:79
constexpr auto CI_STAT_ACTUAL_POS_BIT3
Definition: piezoConfig.hpp:95
constexpr auto CI_STAT_MON_ACT_POS_BIT
Definition: piezoConfig.hpp:102
constexpr auto CI_HOME2
Definition: piezoConfig.hpp:36
constexpr auto CI_USER_OFFSET_OUTPUT1
Definition: piezoConfig.hpp:53
constexpr auto CI_USER_TO_BIT_INPUT3
Definition: piezoConfig.hpp:46
PiezoHwErrors header file.
PiezoRpcErrors header file.