1 #include "otsdaq-core/ConfigurationInterface/ConfigurationManager.h"
2 #include "otsdaq-core/Macros/TablePluginMacros.h"
3 #include "otsdaq-core/TablePluginDataFormats/MessageFacilityTable.h"
11 std::string(getenv("USER_DATA")) + \
12 "/MessageFacilityConfigurations/MessageFacilityGen.fcl"
14 std::string(getenv("USER_DATA")) + \
15 "/MessageFacilityConfigurations/QTMessageViewerGen.fcl"
16 #define QUIET_CFG_FILE \
17 std::string(getenv("USER_DATA")) + \
18 "/MessageFacilityConfigurations/QuietForwarderGen.cfg"
19 #define USE_WEB_BOOL_FILE \
20 std::string(getenv("USER_DATA")) + \
21 "/MessageFacilityConfigurations/" \
23 #define USE_QT_BOOL_FILE \
24 std::string(getenv("USER_DATA")) + "/MessageFacilityConfigurations/UseQTViewer.bool"
27 #define COL_NAME "UID"
28 #define COL_STATUS TableViewColumnInfo::COL_NAME_STATUS
29 #define COL_ENABLE_FWD "EnableUDPForwarding"
31 #define COL_USE_WEB "ForwardToWebConsoleGUI"
32 #define COL_WEB_IP "WebConsoleForwardingIPAddress"
33 #define COL_WEB_PORT0 "WebConsoleForwardingPort0"
34 #define COL_WEB_PORT1 "WebConsoleForwardingPort1"
36 #define COL_USE_QT "ForwardToQTViewerGUI"
37 #define COL_QT_IP "QTViewerForwardingIPAddress"
38 #define COL_QT_PORT "QTViewerForwardingPort"
40 MessageFacilityTable::MessageFacilityTable(
void) :
TableBase(
"MessageFacilityTable")
82 MessageFacilityTable::~MessageFacilityTable(
void) {}
89 bool status, enableFwd, useWeb, useQT;
93 auto childrenMap = configManager->__SELF_NODE__.getChildren();
97 fs.open(MF_CFG_FILE, std::fstream::out | std::fstream::trunc);
100 __SS__ <<
"Failed to open Message Facility table file: " << MF_CFG_FILE
105 __COUT__ <<
"Opened.. " << MF_CFG_FILE << __E__;
109 for(
auto& child : childrenMap)
111 child.second.getNode(COL_STATUS).getValue(status);
116 child.second.getNode(COL_ENABLE_FWD).getValue(enableFwd);
118 child.second.getNode(COL_USE_WEB).getValue(useWeb);
119 child.second.getNode(COL_USE_QT).getValue(useQT);
124 __SS__ <<
"Illegal Message Facility table: "
125 <<
"Can only enable Web Console or QT Viewer, not both." << std::endl;
131 bfs.open(USE_WEB_BOOL_FILE, std::fstream::out | std::fstream::trunc);
135 __SS__ <<
"Failed to open boolean Use of Web Console table file: "
136 << USE_WEB_BOOL_FILE << std::endl;
139 bfs << (useWeb ? 1 : 0);
143 bfs.open(USE_QT_BOOL_FILE, std::fstream::out | std::fstream::trunc);
147 __SS__ <<
"Failed to open boolean Use of QT Viewer table file: "
148 << USE_QT_BOOL_FILE << std::endl;
151 bfs << (useQT ? 1 : 0);
159 __COUT__ <<
"Forwarding to Web GUI with UDP forward MesageFacility "
163 child.second.getNode(COL_WEB_PORT0).getValue(fwdPort);
164 child.second.getNode(COL_WEB_IP).getValue(fwdIP);
170 <<
"threshold: DEBUG\n";
172 <<
"port: " << fwdPort <<
"\n";
174 <<
"host: \"" << fwdIP <<
"\"\n";
179 qtfs.open(QUIET_CFG_FILE, std::fstream::out | std::fstream::trunc);
183 __SS__ <<
"Failed to open Web Console's 'Quiet Forwarder' "
185 << QUIET_CFG_FILE << std::endl;
188 qtfs <<
"RECEIVE_PORT \t " << fwdPort <<
"\n";
189 child.second.getNode(COL_WEB_PORT1).getValue(fwdPort);
190 qtfs <<
"DESTINATION_PORT \t " << fwdPort <<
"\n";
191 qtfs <<
"DESTINATION_IP \t " << fwdIP <<
"\n";
198 __COUT__ <<
"Forwarding to Web GUI with UDP forward MesageFacility "
202 child.second.getNode(COL_QT_PORT).getValue(fwdPort);
203 child.second.getNode(COL_QT_IP).getValue(fwdIP);
209 <<
"threshold: DEBUG\n";
211 <<
"port: " << fwdPort <<
"\n";
213 <<
"host: \"" << fwdIP <<
"\"\n";
218 qtfs.open(QT_CFG_FILE, std::fstream::out | std::fstream::trunc);
222 __SS__ <<
"Failed to open QT Message Viewer table file: "
223 << QT_CFG_FILE << std::endl;
226 qtfs <<
"receivers: \n{\n";
234 <<
"port: " << fwdPort <<
"\n";
238 qtfs <<
"threshold: "
246 __COUT__ <<
"Using cout-only MesageFacility table." << std::endl;
247 fs <<
"console: {\n";
249 <<
"type: \"cout\"\n";
251 <<
"threshold: \"DEBUG\"\n";
253 <<
"noTimeStamps: true\n";
255 <<
"noLineBreaks: true\n";