Commit b9172d42 authored by Vitaly Lipatov's avatar Vitaly Lipatov

overall: use getArgInt instead atoi(getArgParam)

parent aabafa19
...@@ -73,7 +73,7 @@ int main(int argc, char** argv) ...@@ -73,7 +73,7 @@ int main(int argc, char** argv)
string d_fvalue = conf->getArgParam("--d-filter-value"); string d_fvalue = conf->getArgParam("--d-filter-value");
// //
bool dbDumping = atoi(conf->getArgParam("--dbDumping").c_str()); bool dbDumping = conf->getArgInt("--dbDumping");
NullController nc(ID,askfile,s_field,s_fvalue,c_field,c_fvalue,d_field,d_fvalue,dbDumping); NullController nc(ID,askfile,s_field,s_fvalue,c_field,c_fvalue,d_field,d_fvalue,dbDumping);
ObjectsActivator act; ObjectsActivator act;
......
...@@ -36,10 +36,10 @@ int main(int argc, const char **argv) ...@@ -36,10 +36,10 @@ int main(int argc, const char **argv)
for(int i=0; i<size; i++) for(int i=0; i<size; i++)
cout << "id=" << seq[i].si.id << " val=" << seq[i].value << endl; cout << "id=" << seq[i].si.id << " val=" << seq[i].value << endl;
*/ */
bool fullname = atoi(conf->getArgParam("--fullname").c_str()); bool fullname = conf->getArgInt("--fullname");
SViewer sv(conf->getControllersSection(),!fullname); SViewer sv(conf->getControllersSection(),!fullname);
int timeMS = atoi(conf->getArgParam("--polltime").c_str()); timeout_t timeMS = conf->getArgInt("--polltime");
if( timeMS ) if( timeMS )
{ {
cout << "(main): " << timeMS << "[]" << endl; cout << "(main): " << timeMS << "[]" << endl;
......
...@@ -512,26 +512,26 @@ activated(false) ...@@ -512,26 +512,26 @@ activated(false)
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
sleep_msec = atoi(conf->getArgParam("--sleep-msec","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>").c_str()); sleep_msec = conf->getArgInt("--sleep-msec","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>");
if( sleep_msec &lt;=0 ) if( sleep_msec &lt;=0 )
sleep_msec = <xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>; sleep_msec = <xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>;
resetMsgTime = atoi(conf->getProp(cnode,"resetMsgTime").c_str()); resetMsgTime = uni_atoi(conf->getProp(cnode,"resetMsgTime"));
if( resetMsgTime &lt;= 0 ) if( resetMsgTime &lt;= 0 )
resetMsgTime = 200; resetMsgTime = 200;
ptResetMsg.setTiming(resetMsgTime); ptResetMsg.setTiming(resetMsgTime);
smReadyTimeout = atoi(conf->getArgParam("--sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>").c_str()); smReadyTimeout = conf->getArgInt("--sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>");
if( smReadyTimeout == 0 ) if( smReadyTimeout == 0 )
smReadyTimeout = 60000; smReadyTimeout = 60000;
else if( smReadyTimeout &lt; 0 ) else if( smReadyTimeout &lt; 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
activateTimeout = atoi(conf->getArgParam("--activate-timeout").c_str()); activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout&lt;=0 ) if( activateTimeout&lt;=0 )
activateTimeout = 20000; activateTimeout = 20000;
int msec = atoi(conf->getArgParam("--startup-timeout").c_str()); int msec = conf->getArgInt("--startup-timeout");
if( msec&lt;=0 ) if( msec&lt;=0 )
msec = 10000; msec = 10000;
ptStartUpTimeout.setTiming(msec); ptStartUpTimeout.setTiming(msec);
...@@ -709,26 +709,26 @@ activated(false) ...@@ -709,26 +709,26 @@ activated(false)
</xsl:call-template> </xsl:call-template>
</xsl:for-each> </xsl:for-each>
sleep_msec = atoi(conf->getArgParam("--sleep-msec","<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>").c_str()); sleep_msec = conf->getArgInt("--sleep-msec","<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>");
if( sleep_msec &lt;=0 ) if( sleep_msec &lt;=0 )
sleep_msec = <xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>; sleep_msec = <xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>;
resetMsgTime = atoi(conf->getProp(cnode,"resetMsgTime").c_str()); resetMsgTime = uni_atoi(conf->getProp(cnode,"resetMsgTime"));
if( resetMsgTime &lt;= 0 ) if( resetMsgTime &lt;= 0 )
resetMsgTime = 0; resetMsgTime = 0;
ptResetMsg.setTiming(resetMsgTime); ptResetMsg.setTiming(resetMsgTime);
smReadyTimeout = atoi(conf->getArgParam("--sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>").c_str()); smReadyTimeout = conf->getArgInt("--sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>");
if( smReadyTimeout == 0 ) if( smReadyTimeout == 0 )
smReadyTimeout = 60000; smReadyTimeout = 60000;
else if( smReadyTimeout &lt; 0 ) else if( smReadyTimeout &lt; 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
activateTimeout = atoi(conf->getArgParam("--activate-timeout").c_str()); activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout&lt;=0 ) if( activateTimeout&lt;=0 )
activateTimeout = 20000; activateTimeout = 20000;
int msec = atoi(conf->getArgParam("--startup-timeout").c_str()); int msec = conf->getArgInt("--startup-timeout");
if( msec&lt;=0 ) if( msec&lt;=0 )
msec = 10000; msec = 10000;
ptStartUpTimeout.setTiming(msec); ptStartUpTimeout.setTiming(msec);
......
...@@ -109,15 +109,15 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, ...@@ -109,15 +109,15 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
} }
} }
polltime = atoi(conf->getArgParam("--io-polltime",it.getProp("polltime")).c_str()); polltime = conf->getArgInt("--io-polltime",it.getProp("polltime"));
if( !polltime ) if( !polltime )
polltime = 150; polltime = 150;
force = atoi(conf->getArgParam("--io-force",it.getProp("force")).c_str()); force = conf->getArgInt("--io-force",it.getProp("force"));
force_out = atoi(conf->getArgParam("--io-force-out",it.getProp("force_out")).c_str()); force_out = conf->getArgInt("--io-force-out",it.getProp("force_out"));
filtersize = atoi(conf->getArgParam("--io-filtersize",it.getProp("filtersize")).c_str()); filtersize = conf->getArgInt("--io-filtersize",it.getProp("filtersize"));
if( filtersize<=0 ) if( filtersize <= 0 )
filtersize = 1; filtersize = 1;
filterT = atof(conf->getArgParam("--io-filterT",it.getProp("filterT")).c_str()); filterT = atof(conf->getArgParam("--io-filterT",it.getProp("filterT")).c_str());
...@@ -146,13 +146,13 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, ...@@ -146,13 +146,13 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
unideb[Debug::INFO] << myname << "(init): read s_field='" << s_field unideb[Debug::INFO] << myname << "(init): read s_field='" << s_field
<< "' s_fvalue='" << s_fvalue << "'" << endl; << "' s_fvalue='" << s_fvalue << "'" << endl;
int blink_msec = atoi(conf->getArgParam("--io-blink-time",it.getProp("blink-time")).c_str()); int blink_msec = conf->getArgInt("--io-blink-time",it.getProp("blink-time"));
if( blink_msec<=0 ) if( blink_msec<=0 )
blink_msec = 300; blink_msec = 300;
ptBlink.setTiming(blink_msec); ptBlink.setTiming(blink_msec);
smReadyTimeout = atoi(conf->getArgParam("--io-sm-ready-timeout",it.getProp("ready_timeout")).c_str()); smReadyTimeout = conf->getArgInt("--io-sm-ready-timeout",it.getProp("ready_timeout"));
if( smReadyTimeout == 0 ) if( smReadyTimeout == 0 )
smReadyTimeout = 15000; smReadyTimeout = 15000;
else if( smReadyTimeout < 0 ) else if( smReadyTimeout < 0 )
...@@ -160,7 +160,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, ...@@ -160,7 +160,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
string sm_ready_sid = conf->getArgParam("--io-sm-ready-test-sid",it.getProp("sm_ready_test_sid")); string sm_ready_sid = conf->getArgParam("--io-sm-ready-test-sid",it.getProp("sm_ready_test_sid"));
sidTestSMReady = conf->getSensorID(sm_ready_sid.c_str()); sidTestSMReady = conf->getSensorID(sm_ready_sid);
if( sidTestSMReady == DefaultObjectId ) if( sidTestSMReady == DefaultObjectId )
{ {
sidTestSMReady = 4100; /* TestMode_S */ sidTestSMReady = 4100; /* TestMode_S */
...@@ -185,19 +185,19 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, ...@@ -185,19 +185,19 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
throw SystemError(err.str()); throw SystemError(err.str());
} }
int heartbeatTime = atoi(conf->getArgParam("--heartbeat-check-time","1000").c_str()); int heartbeatTime = conf->getArgInt("--heartbeat-check-time","1000");
if( heartbeatTime ) if( heartbeatTime )
ptHeartBeat.setTiming(heartbeatTime); ptHeartBeat.setTiming(heartbeatTime);
else else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime); ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = atoi(conf->getArgParam("--io-heartbeat-max",it.getProp("heartbeat_max")).c_str()); maxHeartBeat = conf->getArgInt("--io-heartbeat-max",it.getProp("heartbeat_max"));
if( maxHeartBeat <=0 ) if( maxHeartBeat <= 0 )
maxHeartBeat = 10; maxHeartBeat = 10;
} }
activateTimeout = atoi(conf->getArgParam("--activate-timeout").c_str()); activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout<=0 ) if( activateTimeout <= 0 )
activateTimeout = 25000; activateTimeout = 25000;
if( !shm->isLocalwork() ) // ic if( !shm->isLocalwork() ) // ic
...@@ -249,7 +249,7 @@ void IOControl::execute() ...@@ -249,7 +249,7 @@ void IOControl::execute()
// - // -
initIOCard(); initIOCard();
bool skip_iout = atoi(conf->getArgParam("--io-skip-init-output").c_str()); bool skip_iout = conf->getArgInt("--io-skip-init-output");
if( !skip_iout ) if( !skip_iout )
initOutputs(); initOutputs();
......
...@@ -7,7 +7,7 @@ using namespace UniSetTypes; ...@@ -7,7 +7,7 @@ using namespace UniSetTypes;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
LProcessor::LProcessor() LProcessor::LProcessor()
{ {
sleepTime = atoi(conf->getArgParam("--sleepTime").c_str()); sleepTime = conf->getArgInt("--sleepTime");
sleepTime = (sleepTime<=0) ? 200 : sleepTime; sleepTime = (sleepTime<=0) ? 200 : sleepTime;
} }
......
...@@ -51,11 +51,11 @@ prefix(prefix) ...@@ -51,11 +51,11 @@ prefix(prefix)
throw UniSetTypes::SystemError(myname+"(MBMaster): Unknown inet addr...(Use: " + pname +")" ); throw UniSetTypes::SystemError(myname+"(MBMaster): Unknown inet addr...(Use: " + pname +")" );
string tmp("--" + prefix + "-port"); string tmp("--" + prefix + "-port");
port = atoi(conf->getArgParam(tmp,it.getProp("port")).c_str()); port = conf->getArgInt(tmp,it.getProp("port"));
if( port<=0 ) if( port <= 0 )
throw UniSetTypes::SystemError(myname+"(MBMaster): Unknown inet port...(Use: " + tmp +")" ); throw UniSetTypes::SystemError(myname+"(MBMaster): Unknown inet port...(Use: " + tmp +")" );
recv_timeout = atoi(conf->getArgParam("--" + prefix + "-recv-timeout",it.getProp("recv_timeout")).c_str()); recv_timeout = conf->getArgInt("--" + prefix + "-recv-timeout",it.getProp("recv_timeout"));
if( recv_timeout <= 0 ) if( recv_timeout <= 0 )
recv_timeout = 2000; recv_timeout = 2000;
...@@ -64,18 +64,18 @@ prefix(prefix) ...@@ -64,18 +64,18 @@ prefix(prefix)
if( saddr.empty() ) if( saddr.empty() )
myaddr = 0x00; myaddr = 0x00;
mbregFromID = atoi(conf->getArgParam("--" + prefix + "-reg-from-id",it.getProp("reg_from_id")).c_str()); mbregFromID = conf->getArgInt("--" + prefix + "-reg-from-id",it.getProp("reg_from_id"));
dlog[Debug::INFO] << myname << "(init): mbregFromID=" << mbregFromID << endl; dlog[Debug::INFO] << myname << "(init): mbregFromID=" << mbregFromID << endl;
polltime = atoi(conf->getArgParam("--" + prefix + "-polltime",it.getProp("polltime")).c_str()); polltime = conf->getArgInt("--" + prefix + "-polltime",it.getProp("polltime"));
if( !polltime ) if( !polltime )
polltime = 100; polltime = 100;
initPause = atoi(conf->getArgParam("--" + prefix + "-initPause",it.getProp("initPause")).c_str()); initPause = conf->getArgInt("--" + prefix + "-initPause",it.getProp("initPause"));
if( !initPause ) if( !initPause )
initPause = 3000; initPause = 3000;
force = atoi(conf->getArgParam("--" + prefix + "-force",it.getProp("force")).c_str()); force = conf->getArgInt("--" + prefix + "-force",it.getProp("force"));
if( shm->isLocalwork() ) if( shm->isLocalwork() )
{ {
...@@ -105,8 +105,8 @@ prefix(prefix) ...@@ -105,8 +105,8 @@ prefix(prefix)
else else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime); ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = atoi(conf->getArgParam("--" + prefix + "-heartbeat-max",it.getProp("heartbeat_max")).c_str()); maxHeartBeat = conf->getArgInt("--" + prefix + "-heartbeat-max",it.getProp("heartbeat_max"));
if( maxHeartBeat <=0 ) if( maxHeartBeat <= 0 )
maxHeartBeat = 10; maxHeartBeat = 10;
test_id = sidHeartBeat; test_id = sidHeartBeat;
...@@ -123,12 +123,12 @@ prefix(prefix) ...@@ -123,12 +123,12 @@ prefix(prefix)
} }
} }
activateTimeout = atoi(conf->getArgParam("--" + prefix + "-activate-timeout").c_str()); activateTimeout = conf->getArgInt("--" + prefix + "-activate-timeout");
if( activateTimeout<=0 ) if( activateTimeout <= 0 )
activateTimeout = 20000; activateTimeout = 20000;
int msec = atoi(conf->getArgParam("--" + prefix + "-timeout",it.getProp("timeout")).c_str()); int msec = conf->getArgInt("--" + prefix + "-timeout",it.getProp("timeout"));
if( msec <=0 ) if( msec <= 0 )
msec = 3000; msec = 3000;
ptTimeout.setTiming(msec); ptTimeout.setTiming(msec);
...@@ -146,7 +146,7 @@ MBMaster::~MBMaster() ...@@ -146,7 +146,7 @@ MBMaster::~MBMaster()
void MBMaster::waitSMReady() void MBMaster::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int ready_timeout = atoi(conf->getArgParam("--" + prefix + "-sm-ready-timeout","15000").c_str()); int ready_timeout = conf->getArgInt("--" + prefix + "-sm-ready-timeout","15000");
if( ready_timeout == 0 ) if( ready_timeout == 0 )
ready_timeout = 15000; ready_timeout = 15000;
else if( ready_timeout < 0 ) else if( ready_timeout < 0 )
......
...@@ -49,7 +49,7 @@ prefix(prefix) ...@@ -49,7 +49,7 @@ prefix(prefix)
dlog[Debug::INFO] << myname << "(init): read s_field='" << s_field dlog[Debug::INFO] << myname << "(init): read s_field='" << s_field
<< "' s_fvalue='" << s_fvalue << "'" << endl; << "' s_fvalue='" << s_fvalue << "'" << endl;
force = uni_atoi(conf->getArgParam("--" + prefix + "-force",it.getProp("force"))); force = conf->getArgInt("--" + prefix + "-force",it.getProp("force"));
// int recv_timeout = atoi(conf->getArgParam("--" + prefix + "-recv-timeout",it.getProp("recv_timeout")).c_str()); // int recv_timeout = atoi(conf->getArgParam("--" + prefix + "-recv-timeout",it.getProp("recv_timeout")).c_str());
...@@ -60,7 +60,7 @@ prefix(prefix) ...@@ -60,7 +60,7 @@ prefix(prefix)
else else
addr = ModbusRTU::str2mbAddr(saddr); addr = ModbusRTU::str2mbAddr(saddr);
mbregFromID = uni_atoi(conf->getArgParam("--" + prefix + "-reg-from-id",it.getProp("reg_from_id"))); mbregFromID = conf->getArgInt("--" + prefix + "-reg-from-id",it.getProp("reg_from_id"));
dlog[Debug::INFO] << myname << "(init): mbregFromID=" << mbregFromID << endl; dlog[Debug::INFO] << myname << "(init): mbregFromID=" << mbregFromID << endl;
string stype = conf->getArgParam("--" + prefix + "-type",it.getProp("type")); string stype = conf->getArgParam("--" + prefix + "-type",it.getProp("type"));
...@@ -157,8 +157,8 @@ prefix(prefix) ...@@ -157,8 +157,8 @@ prefix(prefix)
else else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime); ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = atoi(conf->getArgParam("--" + prefix + "-heartbeat-max",it.getProp("heartbeat_max")).c_str()); maxHeartBeat = conf->getArgInt("--" + prefix + "-heartbeat-max",it.getProp("heartbeat_max"));
if( maxHeartBeat <=0 ) if( maxHeartBeat <= 0 )
maxHeartBeat = 10; maxHeartBeat = 10;
test_id = sidHeartBeat; test_id = sidHeartBeat;
...@@ -184,11 +184,11 @@ prefix(prefix) ...@@ -184,11 +184,11 @@ prefix(prefix)
if( wait_msec < 500 ) if( wait_msec < 500 )
wait_msec = 500; wait_msec = 500;
activateTimeout = atoi(conf->getArgParam("--" + prefix + "-activate-timeout").c_str()); activateTimeout = conf->getArgInt("--" + prefix + "-activate-timeout");
if( activateTimeout<=0 ) if( activateTimeout <= 0 )
activateTimeout = 20000; activateTimeout = 20000;
int msec = atoi(conf->getArgParam("--" + prefix + "-timeout",it.getProp("timeout")).c_str()); int msec = conf->getArgInt("--" + prefix + "-timeout",it.getProp("timeout"));
if( msec <=0 ) if( msec <=0 )
msec = 3000; msec = 3000;
...@@ -256,7 +256,7 @@ MBSlave::~MBSlave() ...@@ -256,7 +256,7 @@ MBSlave::~MBSlave()
void MBSlave::waitSMReady() void MBSlave::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int ready_timeout = atoi(conf->getArgParam("--" + prefix + "-sm-ready-timeout","15000").c_str()); int ready_timeout = conf->getArgInt("--" + prefix + "-sm-ready-timeout","15000");
if( ready_timeout == 0 ) if( ready_timeout == 0 )
ready_timeout = 15000; ready_timeout = 15000;
else if( ready_timeout < 0 ) else if( ready_timeout < 0 )
......
...@@ -55,32 +55,32 @@ allNotRespond(false) ...@@ -55,32 +55,32 @@ allNotRespond(false)
defSpeed = ComPort::getSpeed(speed); defSpeed = ComPort::getSpeed(speed);
recv_timeout = atoi(conf->getArgParam("--rs-recv-timeout",it.getProp("recv_timeout")).c_str()); recv_timeout = conf->getArgInt("--rs-recv-timeout",it.getProp("recv_timeout"));
if( recv_timeout <= 0 ) if( recv_timeout <= 0 )
recv_timeout = 50; recv_timeout = 50;
int alltout = atoi(conf->getArgParam("--rs-all-timeout",it.getProp("all_timeout")).c_str()); int alltout = conf->getArgInt("--rs-all-timeout",it.getProp("all_timeout"));
if( alltout <=0 ) if( alltout <= 0 )
alltout = 2000; alltout = 2000;
ptAllNotRespond.setTiming(alltout); ptAllNotRespond.setTiming(alltout);
rs_pre_clean = atoi(conf->getArgParam("--rs-pre-clean",it.getProp("pre_clean")).c_str()); rs_pre_clean = conf->getArgInt("--rs-pre-clean",it.getProp("pre_clean"));
noQueryOptimization = atoi(conf->getArgParam("--rs-no-query-optimization",it.getProp("no_query_optimization")).c_str()); noQueryOptimization = conf->getArgInt("--rs-no-query-optimization",it.getProp("no_query_optimization"));
mbregFromID = atoi(conf->getArgParam("--mbs-reg-from-id",it.getProp("reg_from_id")).c_str()); mbregFromID = conf->getArgInt("--mbs-reg-from-id",it.getProp("reg_from_id"));
dlog[Debug::INFO] << myname << "(init): mbregFromID=" << mbregFromID << endl; dlog[Debug::INFO] << myname << "(init): mbregFromID=" << mbregFromID << endl;
polltime = atoi(conf->getArgParam("--rs-polltime",it.getProp("polltime")).c_str()); polltime = conf->getArgInt("--rs-polltime",it.getProp("polltime"));
if( !polltime ) if( !polltime )
polltime = 100; polltime = 100;
initPause = atoi(conf->getArgParam("--rs-initPause",it.getProp("initPause")).c_str()); initPause = conf->getArgInt("--rs-initPause",it.getProp("initPause"));
if( !initPause ) if( !initPause )
initPause = 3000; initPause = 3000;
force = atoi(conf->getArgParam("--rs-force",it.getProp("force")).c_str()); force = conf->getArgInt("--rs-force",it.getProp("force"));
force_out = atoi(conf->getArgParam("--rs-force-out",it.getProp("force_out")).c_str()); force_out = conf->getArgInt("--rs-force-out",it.getProp("force_out"));
if( shm->isLocalwork() ) if( shm->isLocalwork() )
{ {
...@@ -110,8 +110,8 @@ allNotRespond(false) ...@@ -110,8 +110,8 @@ allNotRespond(false)
else else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime); ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = atoi(conf->getArgParam("--rs-heartbeat-max",it.getProp("heartbeat_max")).c_str()); maxHeartBeat = conf->getArgInt("--rs-heartbeat-max",it.getProp("heartbeat_max"));
if( maxHeartBeat <=0 ) if( maxHeartBeat <= 0 )
maxHeartBeat = 10; maxHeartBeat = 10;
test_id = sidHeartBeat; test_id = sidHeartBeat;
} }
...@@ -129,8 +129,8 @@ allNotRespond(false) ...@@ -129,8 +129,8 @@ allNotRespond(false)
dlog[Debug::INFO] << myname << "(init): test_id=" << test_id << endl; dlog[Debug::INFO] << myname << "(init): test_id=" << test_id << endl;
activateTimeout = atoi(conf->getArgParam("--activate-timeout").c_str()); activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout<=0 ) if( activateTimeout <= 0 )
activateTimeout = 20000; activateTimeout = 20000;
initMB(false); initMB(false);
...@@ -206,7 +206,7 @@ void RTUExchange::initMB( bool reopen ) ...@@ -206,7 +206,7 @@ void RTUExchange::initMB( bool reopen )
void RTUExchange::waitSMReady() void RTUExchange::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int ready_timeout = atoi(conf->getArgParam("--rs-sm-ready-timeout","15000").c_str()); int ready_timeout = conf->getArgInt("--rs-sm-ready-timeout","15000");
if( ready_timeout == 0 ) if( ready_timeout == 0 )
ready_timeout = 15000; ready_timeout = 15000;
else if( ready_timeout < 0 ) else if( ready_timeout < 0 )
......
...@@ -40,7 +40,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ): ...@@ -40,7 +40,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ):
string d_field = conf->getArgParam("--d-filter-field"); string d_field = conf->getArgParam("--d-filter-field");
string d_fvalue = conf->getArgParam("--d-filter-value"); string d_fvalue = conf->getArgParam("--d-filter-value");
int lock_msec = atoi(conf->getArgParam("--lock-value-pause").c_str()); int lock_msec = conf->getArgInt("--lock-value-pause");
if( lock_msec < 0 ) if( lock_msec < 0 )
lock_msec = 0; lock_msec = 0;
setCheckLockValuePause(lock_msec); setCheckLockValuePause(lock_msec);
...@@ -51,7 +51,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ): ...@@ -51,7 +51,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ):
else else
dlog[Debug::INFO] << myname << "(init): heartbeat-node: " << heartbeat_node << endl; dlog[Debug::INFO] << myname << "(init): heartbeat-node: " << heartbeat_node << endl;
heartbeatCheckTime = atoi(conf->getArgParam("--heartbeat-check-time","1000").c_str()); heartbeatCheckTime = conf->getArgInt("--heartbeat-check-time","1000");
// rxml->setSensorFilter(s_filterField, s_filterValue); // rxml->setSensorFilter(s_filterField, s_filterValue);
...@@ -74,17 +74,17 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ): ...@@ -74,17 +74,17 @@ SharedMemory::SharedMemory( ObjectId id, string datafile ):
dlog[Debug::WARN] << myname << "(init): watchdog timer NOT USED (--wdt-device NULL)" << endl; dlog[Debug::WARN] << myname << "(init): watchdog timer NOT USED (--wdt-device NULL)" << endl;
dblogging = atoi(conf->getArgParam("--db-logging").c_str()); dblogging = conf->getArgInt("--db-logging");
e_filter = conf->getArgParam("--e-filter"); e_filter = conf->getArgParam("--e-filter");
buildEventList(cnode); buildEventList(cnode);
evntPause = atoi(conf->getArgParam("--e-startup-pause").c_str()); evntPause = conf->getArgInt("--e-startup-pause");
if( evntPause<=0 ) if( evntPause <= 0 )
evntPause = 5000; evntPause = 5000;
activateTimeout = atoi(conf->getArgParam("--activate-timeout").c_str()); activateTimeout = conf->getArgInt("--activate-timeout");
if( activateTimeout<=0 ) if( activateTimeout <= 0 )
activateTimeout = 10000; activateTimeout = 10000;
} }
......
...@@ -44,12 +44,10 @@ maxItem(0) ...@@ -44,12 +44,10 @@ maxItem(0)
if( s_host.empty() ) if( s_host.empty() )
throw UniSetTypes::SystemError(myname+"(UDPExchange): Unknown host. Use --udp-host" ); throw UniSetTypes::SystemError(myname+"(UDPExchange): Unknown host. Use --udp-host" );
string s_port = conf->getArgParam("--udp-port",it.getProp("port")); port = conf->getArgInt("--udp-port",it.getProp("port"));
if( s_port.empty() ) if( port <= 0 )
throw UniSetTypes::SystemError(myname+"(UDPExchange): Unknown port address. Use --udp-port" ); throw UniSetTypes::SystemError(myname+"(UDPExchange): Unknown port address. Use --udp-port" );
port = atoi(s_port.c_str());
if( dlog.debugging(Debug::INFO) ) if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "(UDPExchange): UDP set to " << s_host << ":" << port << endl; dlog[Debug::INFO] << "(UDPExchange): UDP set to " << s_host << ":" << port << endl;
...@@ -69,16 +67,16 @@ maxItem(0) ...@@ -69,16 +67,16 @@ maxItem(0)
thr = new ThreadCreator<UDPExchange>(this, &UDPExchange::poll); thr = new ThreadCreator<UDPExchange>(this, &UDPExchange::poll);
recvTimeout = atoi(conf->getArgParam("--udp-recv-timeout",it.getProp("recvTimeout")).c_str()); recvTimeout = conf->getArgInt("--udp-recv-timeout",it.getProp("recvTimeout"));
if( recvTimeout <=0 ) if( recvTimeout <= 0 )
recvTimeout = 5000; recvTimeout = 5000;
sendTimeout = atoi(conf->getArgParam("--udp-send-timeout",it.getProp("sendTimeout")).c_str()); sendTimeout = conf->getArgInt("--udp-send-timeout",it.getProp("sendTimeout"));
if( sendTimeout <=0 ) if( sendTimeout <= 0 )
sendTimeout = 5000; sendTimeout = 5000;
polltime = atoi(conf->getArgParam("--udp-polltime",it.getProp("polltime")).c_str()); polltime = conf->getArgInt("--udp-polltime",it.getProp("polltime"));
if( !polltime ) if( polltime <= 0 )
polltime = 100; polltime = 100;
...@@ -111,8 +109,8 @@ maxItem(0) ...@@ -111,8 +109,8 @@ maxItem(0)
else else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime); ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = atoi(conf->getArgParam("--udp-heartbeat-max",it.getProp("heartbeat_max")).c_str()); maxHeartBeat = conf->getArgInt("--udp-heartbeat-max",it.getProp("heartbeat_max"));
if( maxHeartBeat <=0 ) if( maxHeartBeat <= 0 )
maxHeartBeat = 10; maxHeartBeat = 10;
test_id = sidHeartBeat; test_id = sidHeartBeat;
} }
...@@ -130,12 +128,12 @@ maxItem(0) ...@@ -130,12 +128,12 @@ maxItem(0)
dlog[Debug::INFO] << myname << "(init): test_id=" << test_id << endl; dlog[Debug::INFO] << myname << "(init): test_id=" << test_id << endl;
activateTimeout = atoi(conf->getArgParam("--activate-timeout").c_str()); activateTimeout = conf->getArgInt("--activate-timeout"));
if( activateTimeout<=0 ) if( activateTimeout <= 0 )
activateTimeout = 20000; activateTimeout = 20000;
int msec = atoi(conf->getArgParam("--udp-timeout",it.getProp("timeout")).c_str()); int msec = conf->getArgInt("--udp-timeout",it.getProp("timeout"));
if( msec <=0 ) if( msec <= 0 )
msec = 3000; msec = 3000;
dlog[Debug::INFO] << myname << "(init): udp-timeout=" << msec << " msec" << endl; dlog[Debug::INFO] << myname << "(init): udp-timeout=" << msec << " msec" << endl;
...@@ -151,7 +149,7 @@ UDPExchange::~UDPExchange() ...@@ -151,7 +149,7 @@ UDPExchange::~UDPExchange()
void UDPExchange::waitSMReady() void UDPExchange::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int ready_timeout = atoi(conf->getArgParam("--udp-sm-ready-timeout","15000").c_str()); int ready_timeout = conf->getArgInt("--udp-sm-ready-timeout","15000");
if( ready_timeout == 0 ) if( ready_timeout == 0 )
ready_timeout = 15000; ready_timeout = 15000;
else if( ready_timeout < 0 ) else if( ready_timeout < 0 )
......
...@@ -38,27 +38,27 @@ activated(false) ...@@ -38,27 +38,27 @@ activated(false)
{ {
si.node = conf->getLocalNode(); si.node = conf->getLocalNode();
sleep_msec = atoi(conf->getArgParam("--sleep-msec","200").c_str()); sleep_msec = conf->getArgInt("--sleep-msec","200");
if( sleep_msec <=0 ) if( sleep_msec <= 0 )
sleep_msec = 200; sleep_msec = 200;
resetMsgTime = atoi(conf->getProp(cnode,"resetMsgTime").c_str()); resetMsgTime = conf->getIntProp(cnode,"resetMsgTime");
if( resetMsgTime <= 0 ) if( resetMsgTime <= 0 )
resetMsgTime = 200; resetMsgTime = 200;
ptResetMsg.setTiming(resetMsgTime); ptResetMsg.setTiming(resetMsgTime);
smReadyTimeout = atoi(conf->getArgParam("--sm-ready-timeout","").c_str()); smReadyTimeout = conf->getArgInt("--sm-ready-timeout","");
if( smReadyTimeout == 0 ) if( smReadyTimeout == 0 )
smReadyTimeout = 60000; smReadyTimeout = 60000;
else if( smReadyTimeout < 0 ) else if( smReadyTimeout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
activateTimeout = atoi(conf->getArgParam("--activate-timeout").c_str()); activateTimeout = conf->getArgInt("--activate-timeout"));
if( activateTimeout<=0 ) if( activateTimeout <= 0 )
activateTimeout = 20000; activateTimeout = 20000;
int msec = atoi(conf->getArgParam("--startup-timeout").c_str()); int msec = conf->getArgInt("--startup-timeout");
if( msec<=0 ) if( msec <= 0 )
msec = 10000; msec = 10000;
ptStartUpTimeout.setTiming(msec); ptStartUpTimeout.setTiming(msec);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment