HLCC Documentation 3.0.0
Loading...
Searching...
No Matches
config.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2020-2025 European Southern Observatory (ESO)
2//
3// SPDX-License-Identifier: LGPL-3.0-only
4
13#ifndef HLCC_TELIF_ELTPK_CONFIG_HPP
14#define HLCC_TELIF_ELTPK_CONFIG_HPP
15
16#include <string>
17#include <config-ng/ciiConfigApi.hpp>
18#include <rad/config.hpp>
19
20#include "eltpk/logger.hpp"
21
22
23
24namespace hlcc::eltpk {
25
26class ConfigError : public std::runtime_error {
27public:
28 explicit ConfigError(const std::string& message)
29 : std::runtime_error(message)
30 {}
31};
32
33/*
34 * Type for the LSV data used to configure LSVs to be used.
35 */
36struct LsvApp {
37 std::string name;
38 std::string oldb;
39 std::string cmds;
40};
41
42} // namespace hlcc::eltpk
43
44
45namespace elt::configng {
46
47// Implementation of converter between hlcc::eltpk::LsvApp and CiiConfigInstanceNode hierarchy
48// Decode method: Extract node values into hlcc::eltpk::LsvApp
49// Encode method: construct nodes from values of hlcc::eltpk::LsvApp
50template<>
51struct CiiConfigValueConverter<hlcc::eltpk::LsvApp, CiiConfigInstanceNode> {
52 static bool Decode(const CiiConfigInstanceNode& node, hlcc::eltpk::LsvApp &target) {
53 if (node.GetKind() != CiiConfigNodeKind::MAP || node.GetDataTypeName() != "LsvApp") {
54 std::cerr << "Conversion to LsvApp not possible" << std::endl;
55 return false;
56 }
57 target.name = node["name"].As<std::string>();
58 target.oldb = node["oldb"].As<std::string>();
59 target.cmds = node["cmds"].As<std::string>();
60 return true;
61 }
62
63 static bool Encode(CiiConfigInstanceNode &node, const hlcc::eltpk::LsvApp &source) {
64 if (node.GetKind() != elt::configng::CiiConfigNodeKind::MAP) {
65 return false;
66 }
67 node.Set("name", elt::configng::CiiConfigInstanceNode::From(source.name));
68 node.Set("oldb", elt::configng::CiiConfigInstanceNode::From(source.oldb));
69 node.Set("cmds", elt::configng::CiiConfigInstanceNode::From(source.cmds));
70 return true;
71 }
72};
73
74} // namespace elt::configng
75
76
77namespace hlcc::eltpk {
78
80// const char KEY_SEPARATOR_CFG = '.';
81// const std::string CONFIG_ROOT_NODE = "app";
82
83/*
84 * Configuration OLDB Attributes.
85 * Note that CII OLDB convert all keys to lowercase.
86 *
87 * The following definitions are handled in rad/cpp/app/src/include/rad/config.hpp
88 * const std::string KEY_CONFIG = "cfg/";
89 * const std::string KEY_CONFIG_VERSION = KEY_CONFIG + "version";
90 * const std::string KEY_CONFIG_PROCNAME = KEY_CONFIG + "procname";
91 * const std::string KEY_CONFIG_FILENAME = KEY_CONFIG + "filename";
92 * const std::string KEY_CONFIG_LOG_LEVEL = KEY_CONFIG + "log_level";
93 * const std::string KEY_CONFIG_LOG_PROPERTIES = KEY_CONFIG + "log_properties";
94 * const std::string KEY_CONFIG_SM_SCXML = KEY_CONFIG + "sm_scxml";
95 * const std::string KEY_CONFIG_SM_APPEND = KEY_CONFIG + "sm_scxml_append";
96 * const std::string KEY_CONFIG_REQ_ENDPOINT = KEY_CONFIG + "req_endpoint";
97 * const std::string KEY_CONFIG_OLDB_URI_PREFIX = KEY_CONFIG + "oldb_uri_prefix";
98 * const std::string KEY_CONFIG_OLDB_CONN_TIMEOUT = KEY_CONFIG + "oldb_conn_timeout";
99 * const std::string KEY_CONFIG_OLDB_ASYNC_PERIOD = KEY_CONFIG + "oldb_async_period";
100 * const std::string KEY_CONFIG_TRS_HEALTH_ENABLED = KEY_CONFIG + "trs_health_enabled";
101 */
102const std::string KEY_CONFIG = rad::KEY_CONFIG;
103const std::string KEY_CONFIG_SIMULATE_LSV_MS = KEY_CONFIG + "simulate_lsv_ms";
104const std::string KEY_CONFIG_SIMULATE_LSV_PFS = KEY_CONFIG + "simulate_lsv_pfs";
105const std::string KEY_CONFIG_DET_PUBLISH_MODE = KEY_CONFIG + "det_publish_mode";
106const std::string KEY_CONFIG_LLNETIO_SRC_IP = KEY_CONFIG + "llnetio/src_ip";
107const std::string KEY_CONFIG_LLNETIO_DST_IP = KEY_CONFIG + "llnetio/dst_ip";
108const std::string KEY_CONFIG_LLNETIO_DST_PORT = KEY_CONFIG + "llnetio/dst_port";
109const std::string KEY_CONFIG_LSVS = KEY_CONFIG + "lsvs";
110const std::string KEY_CONFIG_TRSHKS_CMDS = KEY_CONFIG + "trs-hks/cmds";
111const std::string KEY_CONFIG_PUB_DETERM_DEST = KEY_CONFIG + "pub/determ/dest";
112const std::string KEY_CONFIG_PUB_DETERM_NIC = KEY_CONFIG + "pub/determ/nic";
113const std::string KEY_CONFIG_PUB_DETERM_DEST2 = KEY_CONFIG + "pub/determ/dest2";
114const std::string KEY_CONFIG_PUB_DETERM_DEST3 = KEY_CONFIG + "pub/determ/dest3";
115const std::string KEY_CONFIG_PUB_DETERM_DEST4 = KEY_CONFIG + "pub/determ/dest4";
116const std::string KEY_CONFIG_PUB_DETERM_DEST5 = KEY_CONFIG + "pub/determ/dest5";
117const std::string KEY_CONFIG_PUB_DETERM_DEST6 = KEY_CONFIG + "pub/determ/dest6";
118const std::string KEY_CONFIG_PUB_DDS_PROFILE = KEY_CONFIG + "pub/dds/profile";
119const std::string KEY_CONFIG_PUB_DDS_NIC = KEY_CONFIG + "pub/dds/nic";
120const std::string KEY_CONFIG_PUB_DDS_FILE = KEY_CONFIG + "pub/dds/file";
121const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_HLCC = KEY_CONFIG + "pub/dds/domain_id_hlcc";
122const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_CCS_INS = KEY_CONFIG + "pub/dds/domain_id_ccs_ins";
123const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_GENERAL = KEY_CONFIG + "pub/dds/domain_id_general";
124const std::string KEY_CONFIG_PARAMS_TRACKING_ERROR = KEY_CONFIG + "params/tracking_error";
125const std::string KEY_CONFIG_PARAMS_ALT_SPEED_DEG_PER_S = KEY_CONFIG + "params/alt_speed_deg_per_s";
126const std::string KEY_CONFIG_PARAMS_AZ_SPEED_DEG_PER_S = KEY_CONFIG + "params/az_speed_deg_per_s";
127const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_OP = KEY_CONFIG + "altaz/alt_upper_limit_op";
128const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_OP = KEY_CONFIG + "altaz/alt_lower_limit_op";
129const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_OP = KEY_CONFIG + "altaz/az_upper_limit_op";
130const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_OP = KEY_CONFIG + "altaz/az_lower_limit_op";
131const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_FCT = KEY_CONFIG + "altaz/alt_upper_limit_fct";
132const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_FCT = KEY_CONFIG + "altaz/alt_lower_limit_fct";
133const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_FCT = KEY_CONFIG + "altaz/az_upper_limit_fct";
134const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_FCT = KEY_CONFIG + "altaz/az_lower_limit_fct";
135const std::string KEY_CONFIG_SITE_INFO_ELEVATION = KEY_CONFIG + "site/info/elevation";
136const std::string KEY_CONFIG_SITE_INFO_LATITUDE = KEY_CONFIG + "site/info/latitude";
137const std::string KEY_CONFIG_SITE_INFO_LONGITUDE = KEY_CONFIG + "site/info/longitude";
138const std::string KEY_CONFIG_SITE_INFO_ID = KEY_CONFIG + "site/info/id";
139
156
173
180
181const std::vector<std::string> OLDB_CFG_KEYS_BOOL = {
184};
185
193const std::string CONFIG_DEFAULT_VERSION = std::string(VERSION);
194const std::string CONFIG_DEFAULT_MODNAME = "eltpk";
195const std::string CONFIG_DEFAULT_PROCNAME = "eltpk";
196const std::string CONFIG_DEFAULT_FILENAME = "config/eltpk/definitions.yaml";
197const std::string CONFIG_DEFAULT_SCXML_FILENAME = "config/eltpk/sm.xml";
198const std::string CONFIG_DEFAULT_SCXML_APPEND = "";
199const std::string CONFIG_DEFAULT_LOG_LEVEL = "INFO";
200const std::string CONFIG_DEFAULT_LOG_PROPERTIES = "config/eltpk/log.properties";
201const std::string CONFIG_DEFAULT_REQ_ENDPOINT = "zpb.rr://127.0.0.1:12081/"; // the potentially unsafe zpb.rr://0.0.0.0:12081/ we use only in the yaml file.
202const std::string CONFIG_DEFAULT_OLDB_URI_PREFIX = "cii.oldb:///elt/cs/hlcc/";
204const int CONFIG_DEFAULT_OLDB_ASYNC_PERIOD = 0; // ms; we currently do not use RAD async OLDB writes, but still configure all standard attributes.
206
207const std::string CONFIG_DEFAULT_DET_PUBLISH_MODE = "LLNETIO, MUDPI"; // deterministic publish mode LLNETIO, MUDPI or both
208const std::string CONFIG_DEFAULT_LLNETIO_SRC_IP = "127.0.0.1"; // llnetio publish on loopback ip
209const uint32_t CONFIG_DEFAULT_LLNETIO_DST_PORT = 10001;
210const std::string CONFIG_DEFAULT_LLNETIO_DST_IP = "239.128.7.1";
213const std::vector<LsvApp> CONFIG_DEFAULT_LSVS = {}; //[{name: \"msTrackCtr\", oldb: \"cii.oldb:///elt/tel/ms/lsv/trackctr\", stdcmds: \"zpb.rr://localhost:12082/TrackCmds\"}]";
214const std::string CONFIG_DEFAULT_PUB_DETERM_DEST = "239.128.7.1:10000"; // override telif:ccs:deterministic (CCsInsTopics.xml)
215const std::string CONFIG_DEFAULT_PUB_DETERM_NIC = "127.0.0.1"; // iface for mcast
216const std::string CONFIG_DEFAULT_PUB_DETERM_DEST2 = "";
217const std::string CONFIG_DEFAULT_PUB_DETERM_DEST3 = "";
218const std::string CONFIG_DEFAULT_PUB_DETERM_DEST4 = "";
219const std::string CONFIG_DEFAULT_PUB_DETERM_DEST5 = "";
220const std::string CONFIG_DEFAULT_PUB_DETERM_DEST6 = "";
221const std::string CONFIG_DEFAULT_PUB_DDS_PROFILE = "";
222const std::string CONFIG_DEFAULT_PUB_DDS_NIC = "";
223const std::string CONFIG_DEFAULT_PUB_DDS_FILE = "";
227const double CONFIG_DEFAULT_PARAMS_TRACKING_ERROR = 0.5; // arcsec - double
228const double CONFIG_DEFAULT_PARAMS_ALT_SPEED_DEG_PER_S = 5.0; // degree - double
229const double CONFIG_DEFAULT_PARAMS_AZ_SPEED_DEG_PER_S = 5.0; // degree - double
230const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_OP = 1.544616; // radians - double
231const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_OP = 0.349066; // radians - double
232const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_OP = 6.283185; // radians - double
233const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_OP = -3.141593; // radians - double
234const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_FCT = 1.570796; // radians - double
235const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_FCT = 0.0; // radians - double
236const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_FCT = 6.283185; // radians - double
237const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_FCT = -3.141593; // radians - double
238const double CONFIG_DEFAULT_SITE_INFO_ELEVATION = 3046; // meters - double
239const double CONFIG_DEFAULT_SITE_INFO_LATITUDE = -0.429164; // radians - double
240const double CONFIG_DEFAULT_SITE_INFO_LONGITUDE = 1.225075; // radians - double
241const std::string CONFIG_DEFAULT_SITE_INFO_ID = "ELT"; //
242
243
248class Config : public rad::Config {
249 public:
257 Config();
258
262 virtual ~Config();
263
264 Config(const Config&) = delete;
265 Config& operator=(const Config&) = delete;
266
267};
268
269} // namespace hlcc::eltpk
270
271#endif // HLCC_TELIF_ELTPK_CONFIG_HPP
Default logger name.
ConfigError(const std::string &message)
Definition config.hpp:28
Config()
Definition config.cpp:22
Config(const Config &)=delete
virtual ~Config()
Definition config.cpp:77
Config & operator=(const Config &)=delete
Disable copy constructor.
Definition guideStarHelper.cpp:19
Definition actionMgr.cpp:31
const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_OP
Definition config.hpp:233
const std::string KEY_CONFIG_LSVS
Definition config.hpp:109
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_HLCC
Definition config.hpp:121
const std::string CONFIG_DEFAULT_FILENAME
Definition config.hpp:196
const std::vector< LsvApp > CONFIG_DEFAULT_LSVS
Definition config.hpp:213
const std::string CONFIG_DEFAULT_LLNETIO_DST_IP
Definition config.hpp:210
const uint32_t CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_CCS_INS
Definition config.hpp:225
const std::string KEY_CONFIG_PUB_DETERM_DEST6
Definition config.hpp:117
const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_FCT
Definition config.hpp:131
const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_FCT
Definition config.hpp:237
const std::string CONFIG_DEFAULT_SCXML_APPEND
Definition config.hpp:198
const std::string KEY_CONFIG_PUB_DETERM_DEST2
Definition config.hpp:113
const double CONFIG_DEFAULT_PARAMS_AZ_SPEED_DEG_PER_S
Definition config.hpp:229
const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_OP
Definition config.hpp:127
const std::vector< std::string > OLDB_CFG_KEYS_DOUBLE
Definition config.hpp:157
const std::string KEY_CONFIG_PUB_DETERM_DEST4
Definition config.hpp:115
const std::string KEY_CONFIG_SITE_INFO_ID
Definition config.hpp:138
const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_FCT
Definition config.hpp:134
const std::string KEY_CONFIG_LLNETIO_DST_PORT
Definition config.hpp:108
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST3
Definition config.hpp:217
const uint32_t CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_HLCC
Definition config.hpp:224
const std::string CONFIG_DEFAULT_SCXML_FILENAME
Definition config.hpp:197
const std::string KEY_CONFIG_PARAMS_AZ_SPEED_DEG_PER_S
Definition config.hpp:126
const bool CONFIG_DEFAULT_TRS_HEALTH_ENABLED
Definition config.hpp:205
const std::string CONFIG_DEFAULT_MODNAME
Definition config.hpp:194
const uint32_t CONFIG_DEFAULT_LLNETIO_DST_PORT
Definition config.hpp:209
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST4
Definition config.hpp:218
const std::string KEY_CONFIG_DET_PUBLISH_MODE
Definition config.hpp:105
const std::string KEY_CONFIG_TRSHKS_CMDS
Definition config.hpp:110
const std::string KEY_CONFIG_PARAMS_TRACKING_ERROR
Definition config.hpp:124
const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_OP
Definition config.hpp:231
const char CONFIG_KEY_SEPARATOR_OLDB
Definition config.hpp:79
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST6
Definition config.hpp:220
const std::vector< std::string > OLDB_CFG_KEYS_UINT32
Definition config.hpp:174
const std::string KEY_CONFIG_LLNETIO_SRC_IP
Definition config.hpp:106
const std::string CONFIG_DEFAULT_PUB_DETERM_NIC
Definition config.hpp:215
const std::string KEY_CONFIG_SITE_INFO_ELEVATION
Definition config.hpp:135
const std::string KEY_CONFIG_PARAMS_ALT_SPEED_DEG_PER_S
Definition config.hpp:125
const std::string KEY_CONFIG_PUB_DETERM_DEST5
Definition config.hpp:116
const std::string CONFIG_DEFAULT_VERSION
Definition config.hpp:193
const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_FCT
Definition config.hpp:234
const std::string CONFIG_DEFAULT_PUB_DDS_FILE
Definition config.hpp:223
const std::string KEY_CONFIG
Definition config.hpp:102
const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_OP
Definition config.hpp:232
const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_OP
Definition config.hpp:130
const double CONFIG_DEFAULT_SITE_INFO_ELEVATION
Definition config.hpp:238
const std::string CONFIG_DEFAULT_LLNETIO_SRC_IP
Definition config.hpp:208
const double CONFIG_DEFAULT_PARAMS_TRACKING_ERROR
Definition config.hpp:227
const std::string KEY_CONFIG_PUB_DDS_FILE
Definition config.hpp:120
const double CONFIG_DEFAULT_SITE_INFO_LONGITUDE
Definition config.hpp:240
const std::string CONFIG_DEFAULT_PROCNAME
Definition config.hpp:195
const std::string CONFIG_DEFAULT_PUB_DDS_PROFILE
Definition config.hpp:221
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_GENERAL
Definition config.hpp:123
const std::string KEY_CONFIG_PUB_DDS_PROFILE
Definition config.hpp:118
const std::string CONFIG_DEFAULT_DET_PUBLISH_MODE
Definition config.hpp:207
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST5
Definition config.hpp:219
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST2
Definition config.hpp:216
const std::string CONFIG_DEFAULT_LOG_LEVEL
Definition config.hpp:199
const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_OP
Definition config.hpp:230
const double CONFIG_DEFAULT_PARAMS_ALT_SPEED_DEG_PER_S
Definition config.hpp:228
const std::string KEY_CONFIG_PUB_DETERM_DEST
Definition config.hpp:111
const int CONFIG_DEFAULT_OLDB_ASYNC_PERIOD
Definition config.hpp:204
const double CONFIG_DEFAULT_SITE_INFO_LATITUDE
Definition config.hpp:239
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST
Definition config.hpp:214
const std::string CONFIG_DEFAULT_PUB_DDS_NIC
Definition config.hpp:222
const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_OP
Definition config.hpp:129
const std::string KEY_CONFIG_SIMULATE_LSV_PFS
Definition config.hpp:104
const std::string CONFIG_DEFAULT_REQ_ENDPOINT
Definition config.hpp:201
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_CCS_INS
Definition config.hpp:122
const uint32_t CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_GENERAL
Definition config.hpp:226
const std::string KEY_CONFIG_LLNETIO_DST_IP
Definition config.hpp:107
const std::vector< std::string > OLDB_CFG_KEYS_STRING
Definition config.hpp:140
const int CONFIG_DEFAULT_OLDB_CONN_TIMEOUT
Definition config.hpp:203
const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_OP
Definition config.hpp:128
const std::string KEY_CONFIG_PUB_DETERM_DEST3
Definition config.hpp:114
const std::string CONFIG_DEFAULT_OLDB_URI_PREFIX
Definition config.hpp:202
const bool CONFIG_DEFAULT_SIMULATE_LSV_MS
Definition config.hpp:211
const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_FCT
Definition config.hpp:133
const bool CONFIG_DEFAULT_SIMULATE_LSV_PFS
Definition config.hpp:212
const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_FCT
Definition config.hpp:235
const std::string KEY_CONFIG_SIMULATE_LSV_MS
Definition config.hpp:103
const std::string KEY_CONFIG_SITE_INFO_LONGITUDE
Definition config.hpp:137
const std::string KEY_CONFIG_PUB_DETERM_NIC
Definition config.hpp:112
const std::string KEY_CONFIG_PUB_DDS_NIC
Definition config.hpp:119
const std::string CONFIG_DEFAULT_SITE_INFO_ID
Definition config.hpp:241
const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_FCT
Definition config.hpp:236
const std::vector< std::string > OLDB_CFG_KEYS_BOOL
Definition config.hpp:181
const std::string CONFIG_DEFAULT_LOG_PROPERTIES
Definition config.hpp:200
const std::string KEY_CONFIG_SITE_INFO_LATITUDE
Definition config.hpp:136
const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_FCT
Definition config.hpp:132
Definition ccsinsoldb.hpp:10
static bool Decode(const CiiConfigInstanceNode &node, hlcc::eltpk::LsvApp &target)
Definition config.hpp:52
static bool Encode(CiiConfigInstanceNode &node, const hlcc::eltpk::LsvApp &source)
Definition config.hpp:63
Definition config.hpp:36
std::string name
Definition config.hpp:37
std::string cmds
Definition config.hpp:39
std::string oldb
Definition config.hpp:38