1 #include "otsdaq-core/ConfigurationInterface/ConfigurationManager.h"
2 #include "otsdaq-core/Macros/TablePluginMacros.h"
3 #include "otsdaq-core/TablePluginDataFormats/MessageFacilityTable.h"
11 std::string(__ENV__("USER_DATA")) + \
12 "/MessageFacilityConfigurations/MessageFacilityGen.fcl"
14 std::string(__ENV__("USER_DATA")) + \
15 "/MessageFacilityConfigurations/QTMessageViewerGen.fcl"
16 #define QUIET_CFG_FILE \
17 std::string(__ENV__("USER_DATA")) + \
18 "/MessageFacilityConfigurations/QuietForwarderGen.cfg"
19 #define USE_WEB_BOOL_FILE \
20 std::string(__ENV__("USER_DATA")) + \
21 "/MessageFacilityConfigurations/" \
23 #define USE_QT_BOOL_FILE \
24 std::string(__ENV__("USER_DATA")) + "/MessageFacilityConfigurations/" \
28 #define COL_NAME "UID"
29 #define COL_STATUS TableViewColumnInfo::COL_NAME_STATUS
30 #define COL_ENABLE_FWD "EnableUDPForwarding"
32 #define COL_USE_WEB "ForwardToWebConsoleGUI"
33 #define COL_WEB_IP "WebConsoleForwardingIPAddress"
34 #define COL_WEB_PORT0 "WebConsoleForwardingPort0"
35 #define COL_WEB_PORT1 "WebConsoleForwardingPort1"
37 #define COL_USE_QT "ForwardToQTViewerGUI"
38 #define COL_QT_IP "QTViewerForwardingIPAddress"
39 #define COL_QT_PORT "QTViewerForwardingPort"
41 MessageFacilityTable::MessageFacilityTable(
void) :
TableBase(
"MessageFacilityTable")
83 MessageFacilityTable::~MessageFacilityTable(
void) {}
90 bool status, enableFwd, useWeb, useQT;
94 auto childrenMap = configManager->__SELF_NODE__.getChildren();
98 fs.open(MF_CFG_FILE, std::fstream::out | std::fstream::trunc);
101 __SS__ <<
"Failed to open Message Facility table file: " << MF_CFG_FILE
106 __COUT__ <<
"Opened.. " << MF_CFG_FILE << __E__;
110 for(
auto& child : childrenMap)
112 child.second.getNode(COL_STATUS).getValue(status);
117 child.second.getNode(COL_ENABLE_FWD).getValue(enableFwd);
119 child.second.getNode(COL_USE_WEB).getValue(useWeb);
120 child.second.getNode(COL_USE_QT).getValue(useQT);
125 __SS__ <<
"Illegal Message Facility table: "
126 <<
"Can only enable Web Console or QT Viewer, not both." << std::endl;
132 bfs.open(USE_WEB_BOOL_FILE, std::fstream::out | std::fstream::trunc);
136 __SS__ <<
"Failed to open boolean Use of Web Console table file: "
137 << USE_WEB_BOOL_FILE << std::endl;
140 bfs << (useWeb ? 1 : 0);
144 bfs.open(USE_QT_BOOL_FILE, std::fstream::out | std::fstream::trunc);
148 __SS__ <<
"Failed to open boolean Use of QT Viewer table file: "
149 << USE_QT_BOOL_FILE << std::endl;
152 bfs << (useQT ? 1 : 0);
160 __COUT__ <<
"Forwarding to Web GUI with UDP forward MesageFacility "
164 child.second.getNode(COL_WEB_PORT0).getValue(fwdPort);
165 child.second.getNode(COL_WEB_IP).getValue(fwdIP);
171 <<
"threshold: DEBUG\n";
173 <<
"port: " << fwdPort <<
"\n";
175 <<
"host: \"" << fwdIP <<
"\"\n";
180 qtfs.open(QUIET_CFG_FILE, std::fstream::out | std::fstream::trunc);
184 __SS__ <<
"Failed to open Web Console's 'Quiet Forwarder' "
186 << QUIET_CFG_FILE << std::endl;
189 qtfs <<
"RECEIVE_PORT \t " << fwdPort <<
"\n";
190 child.second.getNode(COL_WEB_PORT1).getValue(fwdPort);
191 qtfs <<
"DESTINATION_PORT \t " << fwdPort <<
"\n";
192 qtfs <<
"DESTINATION_IP \t " << fwdIP <<
"\n";
199 __COUT__ <<
"Forwarding to Web GUI with UDP forward MesageFacility "
203 child.second.getNode(COL_QT_PORT).getValue(fwdPort);
204 child.second.getNode(COL_QT_IP).getValue(fwdIP);
210 <<
"threshold: DEBUG\n";
212 <<
"port: " << fwdPort <<
"\n";
214 <<
"host: \"" << fwdIP <<
"\"\n";
219 qtfs.open(QT_CFG_FILE, std::fstream::out | std::fstream::trunc);
223 __SS__ <<
"Failed to open QT Message Viewer table file: "
224 << QT_CFG_FILE << std::endl;
227 qtfs <<
"receivers: \n{\n";
235 <<
"port: " << fwdPort <<
"\n";
239 qtfs <<
"threshold: "
247 __COUT__ <<
"Using cout-only MesageFacility table." << std::endl;
248 fs <<
"console: {\n";
250 <<
"type: \"cout\"\n";
252 <<
"threshold: \"DEBUG\"\n";
254 <<
"noTimeStamps: true\n";
256 <<
"noLineBreaks: true\n";