replace PIConfig::Entry operators to functions

This commit is contained in:
2020-04-29 17:17:59 +03:00
parent 6a6907b136
commit fda8c61c3f
6 changed files with 46 additions and 46 deletions

View File

@@ -124,9 +124,9 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) {
PIConfig::Entry ce(conf.getValue(name_));
PIConfig::Branch db(ce.getValue("device").children()), fb(ce.getValue("filter").children()),
cb(ce.getValue("channel").children()), sb(ce.getValue("sender").children());
PIStringList dev_list(ce.getValue("device").value());
PIStringList dev_list(ce.getValue("device").toString());
PIStringList name_list(ce.getValue("device").name());
PIStringList flt_list(ce.getValue("filter").value());
PIStringList flt_list(ce.getValue("filter").toString());
piForeachC (PIConfig::Entry * e, db) {
dev_list << e->value();
name_list << e->name();
@@ -156,10 +156,10 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) {
setDeviceName(dev, n);
dev->setName(name_ + ".device." + dev_list[i]);
PIConfig::Entry de = ce.getValue("device." + n);
dev->setThreadedReadBufferSize(de.getValue("bufferSize", dev->threadedReadBufferSize()));
dev->setThreadedReadBufferSize(de.getValue("bufferSize", dev->threadedReadBufferSize()).toInt());
PIDiagnostics * diag = diags_.value(dev, 0);
if (diag != 0)
diag->setDisconnectTimeout(de.getValue("disconnectTimeout", diag->disconnectTimeout()));
diag->setDisconnectTimeout(de.getValue("disconnectTimeout", diag->disconnectTimeout()).toFloat());
}
int added(0), padded(-1), tries(0);
bool pdebug = debug();
@@ -224,13 +224,13 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) {
}
PIDiagnostics * diag = diags_.value(pe, 0);
if (diag != 0)
diag->setDisconnectTimeout(e->getValue("disconnectTimeout", diag->disconnectTimeout()));
pe->setBufferSize(e->getValue("bufferSize", pe->bufferSize()));
pe->setPayloadSize(e->getValue("payloadSize", pe->payloadSize()));
pe->setPacketSize(e->getValue("packetSize", pe->packetSize()));
pe->setTimeout(e->getValue("timeout", pe->timeout()));
pe->setHeader(PIByteArray::fromUserInput(e->getValue("header", "").value()));
pe->setFooter(PIByteArray::fromUserInput(e->getValue("footer", "").value()));
diag->setDisconnectTimeout(e->getValue("disconnectTimeout", diag->disconnectTimeout()).toFloat());
pe->setBufferSize(e->getValue("bufferSize", pe->bufferSize()).toInt());
pe->setPayloadSize(e->getValue("payloadSize", pe->payloadSize()).toInt());
pe->setPacketSize(e->getValue("packetSize", pe->packetSize()).toInt());
pe->setTimeout(e->getValue("timeout", pe->timeout()).toDouble());
pe->setHeader(PIByteArray::fromUserInput(e->getValue("header", "").toString()));
pe->setFooter(PIByteArray::fromUserInput(e->getValue("footer", "").toString()));
}
}
setDebug(pdebug);
@@ -248,10 +248,10 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) {
devs << e2->value();
devs.removeStrings("");
if (devs.isEmpty()) continue;
float freq = e->getValue("frequency");
float freq = e->getValue("frequency").toFloat();
piForeachC (PIString & d, devs)
addSender(e->name(), dev_aliases.value(d, d), freq);
PIByteArray fd(PIByteArray::fromUserInput(e->getValue("fixedData").value()));
PIByteArray fd(PIByteArray::fromUserInput(e->getValue("fixedData").toString()));
setSenderFixedData(e->name(), fd);
}
return true;