96 Bottle groupDEBUG = cfgtotal.findGroup(
"DEBUG");
97 if ((! groupDEBUG.isNull()) && (groupDEBUG.check(
"embBoardsConnected")))
104 yDebug() <<
"ATTENTION: NO EMBEDDED BOARDS CONNECTED. YOU ARE IN DEBUG MODE";
109 Bottle groupPC104 = Bottle(cfgtotal.findGroup(
"PC104"));
110 if (groupPC104.isNull())
112 yError() <<
"eth::parser::read() cannot find PC104 group in config files";
118 if (!groupPC104.check(
"PC104IpAddress", value))
120 yError() <<
"eth::parser::read(): missing PC104/PC104IpAddress in config files";
123 if (!groupPC104.check(
"PC104IpPort", value))
125 yError() <<
"eth::parser::read(): missing PC104/PC104IpPort in config files";
129 Bottle paramIPaddress(groupPC104.find(
"PC104IpAddress").asString());
130 uint16_t port = groupPC104.find(
"PC104IpPort").asInt32();
131 char strIP[64] = {0};
134 snprintf(strIP,
sizeof(strIP),
"%s", paramIPaddress.toString().c_str());
136 int ip1, ip2, ip3, ip4;
137 sscanf(strIP,
"\"%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4);
139 pc104data.
localaddressing.addr = eo_common_ipv4addr(ip1, ip2, ip3, ip4);
143 snprintf(ss,
sizeof(ss),
"%d.%d.%d.%d:%d", ip1, ip2, ip3, ip4, port);
149 if(cfgtotal.findGroup(
"PC104").check(
"PC104TXrate"))
151 int value = cfgtotal.findGroup(
"PC104").find(
"PC104TXrate").asInt32();
159 yWarning () <<
"eth::parser::read() cannot find ETH/PC104TXrate. thus using default value" << pc104data.
txrate;
163 if(cfgtotal.findGroup(
"PC104").check(
"PC104RXrate"))
165 int value = cfgtotal.findGroup(
"PC104").find(
"PC104RXrate").asInt32();
173 yWarning () <<
"eth::parser::read() cannot find ETH/PC104RXrate. thus using default value" << pc104data.
rxrate;
186 Bottle groupEthBoard = Bottle(cfgtotal.findGroup(
"ETH_BOARD"));
187 if(groupEthBoard.isNull())
189 yError() <<
"eth::parser::read() cannot find ETH_BOARD group in config files";
192 Bottle groupEthBoardProps = Bottle(groupEthBoard.findGroup(
"ETH_BOARD_PROPERTIES"));
193 if(groupEthBoardProps.isNull())
195 yError() <<
"eth::parser::read() cannot find ETH_BOARD_PROPERTIES group in config files";
198 Bottle groupEthBoardSettings = Bottle(groupEthBoard.findGroup(
"ETH_BOARD_SETTINGS"));
199 if(groupEthBoardSettings.isNull())
201 yError() <<
"eth::parser::read() cannot find ETH_BOARD_PROPERTIES group in config files";
210 if(
true == groupEthBoardProps.check(
"IpAddress"))
212 Bottle paramIPboard(groupEthBoardProps.find(
"IpAddress").asString());
214 strcpy(str, paramIPboard.toString().c_str());
215 int ip1, ip2, ip3, ip4;
216 sscanf(str,
"\"%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4);
221 yError() <<
"eth::parser::read() cannot find ETH_BOARD_PROPERTIES/IpAddress group in config files";
225 char ipinfo[20] = {0};
231 if(
true == groupEthBoardProps.check(
"IpPort"))
238 yWarning() <<
"eth::parser::read() cannot find ETH_BOARD_PROPERTIES/IpPort group in config files." <<
" using:" << boarddata.
properties.
ipv4addressing.port;
246 Bottle b_ETH_BOARD_PROPERTIES_Type = groupEthBoardProps.findGroup(
"Type");
247 std::string Type = b_ETH_BOARD_PROPERTIES_Type.get(1).asString();
248 const char *strType = Type.c_str();
250 if(0 == strcmp(strType,
"EMS4"))
254 else if(0 == strcmp(strType,
"MC4PLUS"))
258 else if(0 == strcmp(strType,
"MC2PLUS"))
264 eObrd_type_t brd = eobrd_unknown;
265 if(eobrd_unknown == (brd = eoboards_string2type2(strType, eobool_true)))
267 brd = eoboards_string2type2(strType, eobool_false);
274 char boardTypeString[30];
275 snprintf(boardTypeString,
sizeof(boardTypeString),
"%s", eoboards_type2string2(eoboards_ethtype2type(boarddata.
properties.
type), eobool_true));
280 if(
true == groupEthBoardProps.check(
"maxSizeRXpacket"))
292 if(
true == groupEthBoardProps.check(
"maxSizeROP"))
310 Bottle paramNameBoard(groupEthBoardSettings.find(
"Name").asString());
311 char xmlboardname[64] = {0};
312 snprintf(xmlboardname,
sizeof(xmlboardname),
"%s", paramNameBoard.toString().c_str());
315 if(0 != strlen(xmlboardname))
327 Bottle groupEthBoardSettings_RunningMode = Bottle(groupEthBoardSettings.findGroup(
"RUNNINGMODE"));
328 if(groupEthBoardSettings_RunningMode.isNull())
330 yWarning() <<
"eth::parser::read(): cannot find ETH_BOARD_PROPERTIES/RUNNINGMODE group in config files for BOARD w/ IP" << boarddata.
properties.
ipv4string <<
" and will use default values";
331 yWarning() <<
"Default values for ETH_BOARD_PROPERTIES/RUNNINGMODE group: (period, maxTimeOfRXactivity, maxTimeOfDOactivity, maxTimeOfTXactivity, TXrateOfRegularROPs) = " <<
337 if(
true == groupEthBoardSettings_RunningMode.check(
"period"))
339 int tmp = groupEthBoardSettings_RunningMode.find(
"period").asInt32();
343 yWarning() <<
"eth::parser::read() for BOARD" << boarddata.
properties.
ipv4string <<
"ETH_BOARD_SETTINGS::RUNNINGMODE::period can be only 1000 (so far) and it was:" << tmp;
349 if(
true == groupEthBoardSettings_RunningMode.check(
"maxTimeOfRXactivity"))
351 int tmp = groupEthBoardSettings_RunningMode.find(
"maxTimeOfRXactivity").asInt32();
353 if((tmp < 5) || (tmp > 990))
355 yWarning() <<
"eth::parser::read() for BOARD" << boarddata.
properties.
ipv4string <<
"ETH_BOARD_SETTINGS::RUNNINGMODE::maxTimeOfRXactivity must be in [5, 990] (so far) and it was:" << tmp <<
"Using default value";
362 if(
true == groupEthBoardSettings_RunningMode.check(
"maxTimeOfDOactivity"))
364 int tmp = groupEthBoardSettings_RunningMode.find(
"maxTimeOfDOactivity").asInt32();
366 if((tmp < 5) || (tmp > 990))
368 yWarning() <<
"eth::parser::read() for BOARD" << boarddata.
properties.
ipv4string <<
"ETH_BOARD_SETTINGS::RUNNINGMODE::maxtimeOfDOactivity must be in [5, 990] (so far) and it was:" << tmp <<
"Using default value";
375 if(
true == groupEthBoardSettings_RunningMode.check(
"maxTimeOfTXactivity"))
377 int tmp = groupEthBoardSettings_RunningMode.find(
"maxTimeOfTXactivity").asInt32();
379 if((tmp < 5) || (tmp > 990))
381 yWarning() <<
"eth::parser::read() for BOARD" << boarddata.
properties.
ipv4string <<
"ETH_BOARD_SETTINGS::RUNNINGMODE::maxTimeOfTXactivity must be in [5, 990] (so far) and it was:" << tmp <<
"Using default value";
389 if(
true == groupEthBoardSettings_RunningMode.check(
"TXrateOfRegularROPs"))
391 int tmp = groupEthBoardSettings_RunningMode.find(
"TXrateOfRegularROPs").asInt32();
395 yWarning() <<
"eth::parser::read() for BOARD" << boarddata.
properties.
ipv4string <<
"ETH_BOARD_SETTINGS::RUNNINGMODE::TXrateOfRegularROPs must be in [1, 20] and it was:" << tmp <<
"Using value = 1";
400 yWarning() <<
"eth::parser::read() for BOARD" << boarddata.
properties.
ipv4string <<
"ETH_BOARD_SETTINGS::RUNNINGMODE::TXrateOfRegularROPs must be in [1, 20] and it was:" << tmp <<
"Using value = 20";
409 yWarning() <<
"eth::parser::read() for BOARD" << boarddata.
properties.
ipv4string <<
"In ETH_BOARD_SETTINGS::RUNNINGMODE sum(maxTimeOfRXactivity, maxTimeOfDOactivity, maxTimeOfTXactivity) != period !!! Using default values";
427 bool sigOVRFL {
true};
432 bool sigSTATS {
false};
440 immediate.sigOVRFL =
true;
442 periodic.sigSTATS =
false;
446 parseLOGGING pLOG {};
454 Bottle groupEthBoardSettings_RunningMode_Logging = Bottle(groupEthBoardSettings_RunningMode.findGroup(
"LOGGING"));
455 if(groupEthBoardSettings_RunningMode_Logging.isNull())
457 yWarning() <<
"eth::parser::read(): cannot find ETH_BOARD_PROPERTIES/RUNNINGMODE/LOGGING group in config files for BOARD w/ IP" << boarddata.
properties.
ipv4string <<
" and will use default values";
458 yWarning() <<
"Default values for ETH_BOARD_PROPERTIES/RUNNINGMODE/LOGGING group: (IMMEDIATE.emitRXDOTXoverflow = true, PERIODIC.period = 0, PERIODIC.emitRXDOTXstatistics = false";
464 Bottle groupEthBoardSettings_RunningMode_Logging_Immediate = Bottle(groupEthBoardSettings_RunningMode_Logging.findGroup(
"IMMEDIATE"));
465 if(groupEthBoardSettings_RunningMode_Logging_Immediate.isNull())
471 if(
false == groupEthBoardSettings_RunningMode_Logging_Immediate.check(
"emitRXDOTXoverflow"))
477 if(groupEthBoardSettings_RunningMode_Logging_Immediate.find(
"emitRXDOTXoverflow").isBool())
480 pLOG.immediate.sigOVRFL = groupEthBoardSettings_RunningMode_Logging_Immediate.find(
"emitRXDOTXoverflow").asBool();
485 Bottle groupEthBoardSettings_RunningMode_Logging_Periodic = Bottle(groupEthBoardSettings_RunningMode_Logging.findGroup(
"PERIODIC"));
486 if(groupEthBoardSettings_RunningMode_Logging_Periodic.isNull())
494 if(
false == groupEthBoardSettings_RunningMode_Logging_Periodic.check(
"period"))
501 if(
true == groupEthBoardSettings_RunningMode_Logging_Periodic.find(
"period").isFloat64())
503 double tmp = groupEthBoardSettings_RunningMode_Logging_Periodic.find(
"period").asFloat64();
504 pLOG.periodic.period = (tmp<0.0) ? (0.0) : ( (tmp < 600.0) ? tmp : 600.0 );
508 if(
false == groupEthBoardSettings_RunningMode_Logging_Periodic.check(
"emitRXDOTXstatistics"))
514 pLOG.periodic.sigSTATS = groupEthBoardSettings_RunningMode_Logging_Periodic.find(
"emitRXDOTXstatistics").asBool();
519 yInfo() <<
"ETH_BOARD_PROPERTIES/RUNNINGMODE/LOGGING group for BOARD w/ IP" << boarddata.
properties.
ipv4string <<
" has values: " <<
520 "IMMEDIATE.emitRXDOTXoverflow = " << pLOG.immediate.sigOVRFL <<
" PERIODIC.period = " << pLOG.periodic.period <<
" PERIODIC.emitRXDOTXstatistics = " << pLOG.periodic.sigSTATS;
526 constexpr uint16_t maskOverflow = (0x0001 << eomn_appl_log_asynchro_exectime_overflow);
527 constexpr uint16_t maskStatistics = (0x0001 << eomn_appl_log_periodic_exectime_statistics);
529 if(
true == pLOG.immediate.sigOVRFL) { boarddata.
settings.
txconfig.logging.flags |= maskOverflow; }
530 if(
true == pLOG.periodic.sigSTATS) { boarddata.
settings.
txconfig.logging.flags |= maskStatistics; }
531 boarddata.
settings.
txconfig.logging.period10ms =
static_cast<uint16_t
>(100.0*pLOG.periodic.period);
548 Bottle groupEthBoardActions = Bottle(groupEthBoard.findGroup(
"ETH_BOARD_ACTIONS"));
549 if(!groupEthBoardActions.isNull())
551 Bottle groupEthBoardActions_Monitor = Bottle(groupEthBoardActions.findGroup(
"MONITOR_ITS_PRESENCE"));
552 if(!groupEthBoardActions_Monitor.isNull())
554 Bottle groupEthBoardActions_Monitor_enabled = groupEthBoardActions_Monitor.findGroup(
"enabled");
555 std::string Ena = groupEthBoardActions_Monitor_enabled.get(1).asString();
556 const char *strEna = Ena.c_str();
558 if(0 == strcmp(strEna,
"true"))
567 if(
true == groupEthBoardActions_Monitor.check(
"timeout"))
569 double presenceTimeout = groupEthBoardActions_Monitor.find(
"timeout").asFloat64();
571 if(presenceTimeout <= 0)
577 if(presenceTimeout > 0.100)
579 presenceTimeout = 0.100;
587 if(
true == groupEthBoardActions_Monitor.check(
"periodOfMissingReport"))
589 double reportMissingPeriod = groupEthBoardActions_Monitor.find(
"periodOfMissingReport").asFloat64();
591 if(reportMissingPeriod <= 0)
593 reportMissingPeriod = 0.0;
596 if(reportMissingPeriod > 600)
598 reportMissingPeriod = 600;