Commit a2465224 authored by Pavel Vainerman's avatar Pavel Vainerman

(codegen): Сделал ключ forceOut (определяемый из командной строки,

из. конф. файла и со значением по умолчанию false), определяющий будут ли принудительно обновляться "выходы" в SM на каждом шаге (не зависимо от того, менялись ли они). По умолчанию - false, т.е. запись только по изменению.
parent 59446e94
...@@ -31,7 +31,7 @@ Version 2.0 ...@@ -31,7 +31,7 @@ Version 2.0
- использовать везде где нужно(и можно) вместо прямых указателей.. shared_ptr и т.п. (например для conf и других глобальных переменных) - использовать везде где нужно(и можно) вместо прямых указателей.. shared_ptr и т.п. (например для conf и других глобальных переменных)
- встроить различные сигналы (sigc).. в ModbusExchange и другие классы.. - встроить различные сигналы (sigc).. в ModbusExchange и другие классы..
- (uniset-codegen): сделать управление ключом "force" для updateOutputs(force) (из командной строки, конф.файла и src.xml) - uniset-codegen: дописать функцию help со всеми параметрами для _SK, тесты
- ТЕСТЫ! ТЕСТЫ! ТЕСТЫ! - ТЕСТЫ! ТЕСТЫ! ТЕСТЫ!
......
...@@ -69,7 +69,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -69,7 +69,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
processingMessage(&amp;msg); processingMessage(&amp;msg);
// обновление выходов // обновление выходов
updateOutputs(false); updateOutputs(forceOut);
// updatePreviousValues(); // updatePreviousValues();
} }
...@@ -84,7 +84,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -84,7 +84,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
} }
// обновление выходов // обновление выходов
updateOutputs(false); updateOutputs(forceOut);
updatePreviousValues(); updatePreviousValues();
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
......
...@@ -87,7 +87,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -87,7 +87,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
} }
// обновление выходов // обновление выходов
updateOutputs(false); updateOutputs(forceOut);
// обновление списка предыдущих состояний // обновление списка предыдущих состояний
updatePreviousValues(); updatePreviousValues();
......
...@@ -68,7 +68,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -68,7 +68,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
if( !receiveMessage(msg) ) if( !receiveMessage(msg) )
break; break;
processingMessage(&amp;msg); processingMessage(&amp;msg);
updateOutputs(false); updateOutputs(forceOut);
// updatePreviousValues(); // updatePreviousValues();
} }
...@@ -83,7 +83,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -83,7 +83,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
} }
// обновление выходов // обновление выходов
updateOutputs(false); updateOutputs(forceOut);
updatePreviousValues(); updatePreviousValues();
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
......
...@@ -87,8 +87,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -87,8 +87,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
} }
// Формирование выходов // Формирование выходов
updateOutputs(false); updateOutputs(forceOut);
updatePreviousValues(); updatePreviousValues();
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
......
...@@ -245,6 +245,7 @@ ...@@ -245,6 +245,7 @@
int askPause; /*!&lt; пауза между неудачными попытками заказать датчики */ int askPause; /*!&lt; пауза между неудачными попытками заказать датчики */
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
bool forceOut; /*!&lt; флаг принудительного обноления "выходов" */
</xsl:template> </xsl:template>
<xsl:template name="COMMON-HEAD-PRIVATE"> <xsl:template name="COMMON-HEAD-PRIVATE">
...@@ -529,6 +530,7 @@ confnode(0), ...@@ -529,6 +530,7 @@ confnode(0),
smReadyTimeout(0), smReadyTimeout(0),
activated(false), activated(false),
askPause(2000), askPause(2000),
forceOut(false),
<xsl:for-each select="//variables/item"> <xsl:for-each select="//variables/item">
<xsl:if test="normalize-space(@private)!=''"> <xsl:if test="normalize-space(@private)!=''">
<xsl:call-template name="default-init-variables"/> <xsl:call-template name="default-init-variables"/>
...@@ -593,6 +595,7 @@ confnode(cnode), ...@@ -593,6 +595,7 @@ confnode(cnode),
smReadyTimeout(0), smReadyTimeout(0),
activated(false), activated(false),
askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)), askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)),
forceOut(false),
<xsl:for-each select="//variables/item"> <xsl:for-each select="//variables/item">
<xsl:if test="normalize-space(@private)!=''"> <xsl:if test="normalize-space(@private)!=''">
<xsl:call-template name="init-variables"/> <xsl:call-template name="init-variables"/>
...@@ -611,6 +614,9 @@ end_private(false) ...@@ -611,6 +614,9 @@ end_private(false)
throw SystemError( err.str() ); throw SystemError( err.str() );
} }
<xsl:for-each select="//smap/item"> <xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@no_check_id)!='1'"> <xsl:if test="normalize-space(@no_check_id)!='1'">
if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId ) if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
...@@ -646,7 +652,10 @@ end_private(false) ...@@ -646,7 +652,10 @@ end_private(false)
</xsl:for-each> </xsl:for-each>
UniXML::iterator it(cnode); UniXML::iterator it(cnode);
string heart = conf->getArgParam("--heartbeat-id",it.getProp("heartbeat_id"));
forceOut = conf->getArgPInt("--" + argprefix + "force-out",it.getProp("forceOut"),false);
string heart = conf->getArgParam("--" + argprefix + "heartbeat-id",it.getProp("heartbeat_id"));
if( !heart.empty() ) if( !heart.empty() )
{ {
idHeartBeat = conf->getSensorID(heart); idHeartBeat = conf->getSensorID(heart);
...@@ -657,13 +666,13 @@ end_private(false) ...@@ -657,13 +666,13 @@ end_private(false)
throw SystemError(err.str()); throw SystemError(err.str());
} }
int heartbeatTime = conf->getArgPInt("--heartbeat-time",it.getProp("heartbeatTime"),conf-&gt;getHeartBeatTime()); int heartbeatTime = conf->getArgPInt("--" + argprefix + "heartbeat-time",it.getProp("heartbeatTime"),conf-&gt;getHeartBeatTime());
if( heartbeatTime>0 ) if( heartbeatTime>0 )
ptHeartBeat.setTiming(heartbeatTime); ptHeartBeat.setTiming(heartbeatTime);
else else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime); ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgPInt("--heartbeat-max",it.getProp("heartbeat_max"), 10); maxHeartBeat = conf->getArgPInt("--" + argprefix + "heartbeat-max",it.getProp("heartbeat_max"), 10);
} }
// Инициализация значений // Инициализация значений
...@@ -685,12 +694,12 @@ end_private(false) ...@@ -685,12 +694,12 @@ end_private(false)
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
sleep_msec = conf->getArgPInt("--sleep-msec","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>", <xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>); sleep_msec = conf->getArgPInt("--" + argprefix + "sleep-msec","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>", <xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>);
resetMsgTime = conf->getPIntProp(cnode,"resetMsgTime", 2000); resetMsgTime = conf->getPIntProp(cnode,"resetMsgTime", 2000);
ptResetMsg.setTiming(resetMsgTime); ptResetMsg.setTiming(resetMsgTime);
smReadyTimeout = conf->getArgInt("--sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>"); smReadyTimeout = conf->getArgInt("--" + argprefix + "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 )
...@@ -704,9 +713,9 @@ end_private(false) ...@@ -704,9 +713,9 @@ end_private(false)
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
activateTimeout = conf->getArgPInt("--activate-timeout", 20000); activateTimeout = conf->getArgPInt("--" + argprefix + "activate-timeout", 20000);
int msec = conf->getArgPInt("--startup-timeout", 10000); int msec = conf->getArgPInt("--" + argprefix + "startup-timeout", 10000);
ptStartUpTimeout.setTiming(msec); ptStartUpTimeout.setTiming(msec);
// ===================== &lt;variables&gt; ===================== // ===================== &lt;variables&gt; =====================
...@@ -880,7 +889,8 @@ idHeartBeat(DefaultObjectId), ...@@ -880,7 +889,8 @@ idHeartBeat(DefaultObjectId),
maxHeartBeat(10), maxHeartBeat(10),
confnode(0), confnode(0),
activated(false), activated(false),
askPause(2000) askPause(2000),
forceOut(false)
{ {
ucrit &lt;&lt; "<xsl:value-of select="$CLASSNAME"/>: init failed!!!!!!!!!!!!!!!" &lt;&lt; endl; ucrit &lt;&lt; "<xsl:value-of select="$CLASSNAME"/>: init failed!!!!!!!!!!!!!!!" &lt;&lt; endl;
throw Exception( string(myname+": init failed!!!") ); throw Exception( string(myname+": init failed!!!") );
...@@ -927,6 +937,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)) ...@@ -927,6 +937,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
si.node = conf->getLocalNode(); si.node = conf->getLocalNode();
<xsl:for-each select="//sensors/item"> <xsl:for-each select="//sensors/item">
<xsl:call-template name="setmsg"> <xsl:call-template name="setmsg">
<xsl:with-param name="GENTYPE" select="'CHECK'"/> <xsl:with-param name="GENTYPE" select="'CHECK'"/>
...@@ -934,7 +945,10 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)) ...@@ -934,7 +945,10 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
</xsl:for-each> </xsl:for-each>
UniXML::iterator it(cnode); UniXML::iterator it(cnode);
string heart = conf->getArgParam("--heartbeat-id",it.getProp("heartbeat_id"));
forceOut = conf->getArgPInt("--" + argprefix + "force-out",it.getProp("forceOut"),false);
string heart = conf->getArgParam("--" + argprefix + "heartbeat-id",it.getProp("heartbeat_id"));
if( !heart.empty() ) if( !heart.empty() )
{ {
idHeartBeat = conf->getSensorID(heart); idHeartBeat = conf->getSensorID(heart);
...@@ -945,23 +959,23 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)) ...@@ -945,23 +959,23 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
throw SystemError(err.str()); throw SystemError(err.str());
} }
int heartbeatTime = conf->getArgPInt("--heartbeat-time",it.getProp("heartbeatTime"),conf-&gt;getHeartBeatTime()); int heartbeatTime = conf->getArgPInt("--" + argprefix + "heartbeat-time",it.getProp("heartbeatTime"),conf-&gt;getHeartBeatTime());
if( heartbeatTime>0 ) if( heartbeatTime>0 )
ptHeartBeat.setTiming(heartbeatTime); ptHeartBeat.setTiming(heartbeatTime);
else else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime); ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgPInt("--heartbeat-max",it.getProp("heartbeat_max"), 10); maxHeartBeat = conf->getArgPInt("--" + argprefix + "heartbeat-max",it.getProp("heartbeat_max"), 10);
} }
sleep_msec = conf->getArgPInt("--sleep-msec","<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>", <xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>); sleep_msec = conf->getArgPInt("--" + argprefix + "sleep-msec","<xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>", <xsl:call-template name="settings-alone"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>);
resetMsgTime = conf->getPIntProp(cnode,"resetMsgTime", 2000); resetMsgTime = conf->getPIntProp(cnode,"resetMsgTime", 2000);
ptResetMsg.setTiming(resetMsgTime); ptResetMsg.setTiming(resetMsgTime);
smReadyTimeout = conf->getArgInt("--sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>"); smReadyTimeout = conf->getArgInt("--" + argprefix + "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 )
...@@ -969,9 +983,9 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)) ...@@ -969,9 +983,9 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
smTestID = conf->getSensorID(init3_str(conf->getArgParam("--" + argprefix + "sm-test-id"),conf->getProp(cnode,"smTestID"),"")); smTestID = conf->getSensorID(init3_str(conf->getArgParam("--" + argprefix + "sm-test-id"),conf->getProp(cnode,"smTestID"),""));
activateTimeout = conf->getArgPInt("--activate-timeout", 20000); activateTimeout = conf->getArgPInt("--" + argprefix + "activate-timeout", 20000);
int msec = conf->getArgPInt("--startup-timeout", 10000); int msec = conf->getArgPInt("--" + argprefix + "startup-timeout", 10000);
ptStartUpTimeout.setTiming(msec); ptStartUpTimeout.setTiming(msec);
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
if HAVE_EXTENTIONS if HAVE_EXTENTIONS
SUBDIRS = lib include SharedMemory IOControl LogicProcessor \ SUBDIRS = lib include SharedMemory IOControl LogicProcessor \
ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP DBServer-MySQL DBServer-SQLite \ ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP DBServer-MySQL DBServer-SQLite \
RRDServer SharedMemoryPlus tests RRDServer SharedMemoryPlus tests ModbusSlave/tests
#SMDBServer #SMDBServer
#SharedMemoryPlus #SharedMemoryPlus
......
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