Commit 16e0864b authored by Pavel Vainerman's avatar Pavel Vainerman

ГЛОБАЛЬНАЯ ПЕРЕДЕЛКА В СВЯЗИ С ПЕРЕХОДОМ НА ДВЕ ФУНКЦИИ getValue и setValue.

parent 08e088e0
...@@ -79,7 +79,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -79,7 +79,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
// "сердцебиение" // "сердцебиение"
if( idHeartBeat!=DefaultObjectId &amp;&amp; ptHeartBeat.checkTime() ) if( idHeartBeat!=DefaultObjectId &amp;&amp; ptHeartBeat.checkTime() )
{ {
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput); ui.setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
...@@ -194,27 +194,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si ...@@ -194,27 +194,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
ui.setValue(_sid, _val);
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{
ui.askRemoteSensor(_sid,_cmd,_node,getId());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node ) void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{ {
ui.askRemoteSensor(_sid,_cmd,_node,getId()); ui.askRemoteSensor(_sid,_cmd,_node,getId());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool <xsl:value-of select="$CLASSNAME"/>_SK::getState( UniSetTypes::ObjectId _sid )
{
return (bool)getValue(_sid);
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid ) long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
{ {
try try
...@@ -224,38 +211,24 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si ...@@ -224,38 +211,24 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
<xsl:if test="normalize-space(../../@msg)!='1'"> <xsl:if test="normalize-space(../../@msg)!='1'">
if( _sid == <xsl:value-of select="../../@name"/> ) if( _sid == <xsl:value-of select="../../@name"/> )
{ {
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DI'">
<xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getState(<xsl:value-of select="../../@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>;
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DO'">
<xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getState(<xsl:value-of select="../../@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>;
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
<xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>); <xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; return <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>;
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
<xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>;
</xsl:when>
</xsl:choose>
} }
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid="
&lt;&lt; _sid &lt;&lt; endl;
return ui.getValue(_sid); return 0;
} }
catch(Exception&amp; ex) catch(Exception&amp; ex)
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getState): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
return 0;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force ) void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
...@@ -265,9 +238,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force ) ...@@ -265,9 +238,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
<xsl:if test="normalize-space(../../@msg)!='1'"> <xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:choose> <xsl:choose>
<xsl:when test="normalize-space(@vartype)='out'"> <xsl:when test="normalize-space(@vartype)='out'">
<xsl:if test="normalize-space(../../@force)=''">
if( _force || prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> ) if( _force || prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if>
{ {
<xsl:call-template name="setdata"/> <xsl:call-template name="setdata"/>
prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>;
...@@ -284,7 +255,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force ) ...@@ -284,7 +255,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
if( _force || prev_m_<xsl:value-of select="../../@name"/> != m_<xsl:value-of select="../../@name"/> ) if( _force || prev_m_<xsl:value-of select="../../@name"/> != m_<xsl:value-of select="../../@name"/> )
{ {
si.id = mid_<xsl:value-of select="../../@name"/>; si.id = mid_<xsl:value-of select="../../@name"/>;
ui.saveState( si,m_<xsl:value-of select="../../@name"/>, UniversalIO::DigitalInput, getId() ); ui.setValue( si,m_<xsl:value-of select="../../@name"/>, getId() );
prev_m_<xsl:value-of select="../../@name"/> = m_<xsl:value-of select="../../@name"/>; prev_m_<xsl:value-of select="../../@name"/> = m_<xsl:value-of select="../../@name"/>;
} }
</xsl:if> </xsl:if>
...@@ -315,26 +286,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -315,26 +286,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
{ {
<xsl:if test="normalize-space(../../@msg)!='1'"> <xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID"> <xsl:if test="normalize-space(@name)=$OID">
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getState(<xsl:value-of select="../../@name"/>);
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>);
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DO'">
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getState(<xsl:value-of select="../../@name"/>);
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>); <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>);
</xsl:when>
</xsl:choose>
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
} }
catch(Exception&amp; ex) catch(Exception&amp; ex)
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
</xsl:template> </xsl:template>
...@@ -363,28 +322,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -363,28 +322,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
<xsl:template name="gensetdata"> <xsl:template name="gensetdata">
try try
{ {
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DO'">
ui.setState( <xsl:value-of select="../../@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, node_<xsl:value-of select="../../@name"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
ui.setValue( <xsl:value-of select="../../@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, node_<xsl:value-of select="../../@name"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DI'">
si.id = <xsl:value-of select="../../@name"/>; si.id = <xsl:value-of select="../../@name"/>;
si.node = node_<xsl:value-of select="../../@name"/>; si.node = node_<xsl:value-of select="../../@name"/>;
ui.saveState( si, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>,UniversalIO::DigitalInput, getId() ); ui.setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
si.id = <xsl:value-of select="../../@name"/>;
si.node = node_<xsl:value-of select="../../@name"/>;
ui.saveValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
</xsl:choose>
} }
catch(Exception&amp; ex) catch(Exception&amp; ex)
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
</xsl:template> </xsl:template>
...@@ -393,28 +338,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -393,28 +338,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
<xsl:param name="setval"></xsl:param> <xsl:param name="setval"></xsl:param>
try try
{ {
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DO'">
ui.setState( <xsl:value-of select="../../@name"/>,<xsl:value-of select="$setval"/>,node_<xsl:value-of select="../../@name"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
ui.setValue( <xsl:value-of select="../../@name"/>,<xsl:value-of select="$setval"/>,node_<xsl:value-of select="../../@name"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DI'">
si.id = <xsl:value-of select="../../@name"/>; si.id = <xsl:value-of select="../../@name"/>;
si.node = node_<xsl:value-of select="../../@name"/>; si.node = node_<xsl:value-of select="../../@name"/>;
ui.saveState( si,<xsl:value-of select="$setval"/>, UniversalIO::DigitalInput, getId() ); ui.setValue( si,<xsl:value-of select="$setval"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
si.id = <xsl:value-of select="../../@name"/>;
si.node = node_<xsl:value-of select="../../@name"/>;
ui.saveValue( si,<xsl:value-of select="$setval"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
</xsl:choose>
} }
catch(Exception&amp; ex) catch(Exception&amp; ex)
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
</xsl:template> </xsl:template>
...@@ -423,72 +354,18 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -423,72 +354,18 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
<xsl:param name="onlymsg"></xsl:param> <xsl:param name="onlymsg"></xsl:param>
<xsl:if test="normalize-space(../../@msg)!='1'"> <xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID"> <xsl:if test="normalize-space(@name)=$OID">
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DI'">
<xsl:if test="normalize-space($onlymsg)=''"> <xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> ) if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if> </xsl:if>
{ {
<xsl:if test="normalize-space($onlymsg)=''"> // приходится искуственно использовать третий параметр,
// cout &lt;&lt; myname &lt;&lt; ": (DI) change state <xsl:value-of select="../../@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> &lt;&lt; endl;
</xsl:if>
SensorMessage _sm( <xsl:value-of select="../../@name"/>, (bool)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, Message::Medium);
_sm.sensor_type = UniversalIO::DigitalInput;
sensorInfo(&amp;_sm);
}
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (AI) change value <xsl:value-of select="../../@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> &lt;&lt; endl;
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал // что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage // правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci; IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="../../@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, _ci); SensorMessage _sm( <xsl:value-of select="../../@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, _ci);
_sm.sensor_type = UniversalIO::AnalogInput; _sm.sensor_type = UniversalIO::AI;
sensorInfo(&amp;_sm); sensorInfo(&amp;_sm);
} }
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DO'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (DO) change state <xsl:value-of select="../../@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> &lt;&lt; endl;
</xsl:if>
SensorMessage _sm( <xsl:value-of select="../../@name"/>, (bool)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, Message::Medium);
_sm.sensor_type = UniversalIO::DigitalOutput;
sensorInfo(&amp;_sm);
}
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (AO) change value <xsl:value-of select="../../@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> &lt;&lt; endl;
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="../../@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, _ci);
_sm.sensor_type = UniversalIO::AnalogOutput;
sensorInfo(&amp;_sm);
}
</xsl:when>
</xsl:choose>
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
......
...@@ -82,7 +82,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -82,7 +82,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
// "сердцебиение" // "сердцебиение"
if( idHeartBeat!=DefaultObjectId &amp;&amp; ptHeartBeat.checkTime() ) if( idHeartBeat!=DefaultObjectId &amp;&amp; ptHeartBeat.checkTime() )
{ {
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput); ui.setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
...@@ -130,28 +130,17 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorM ...@@ -130,28 +130,17 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorM
sensorInfo(_sm); sensorInfo(_sm);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node ) void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{
if( _cmd == UniversalIO::UIONotify )
{
SensorMessage _sm( _sid, (bool)ui.getState(_sid,_node), Message::Medium );
_sm.sensor_type = UniversalIO::DigitalInput;
_sm.node = _node;
sensorInfo(&amp;_sm);
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{ {
if( _cmd == UniversalIO::UIONotify ) if( _cmd == UniversalIO::UIONotify )
{ {
// приходится искуственно использовать третий параметр, // приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал // что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage // правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci; IOController_i::CalibrateIo _ci;
SensorMessage _sm( _sid, (long)ui.getValue(_sid,_node), _ci ); SensorMessage _sm( _sid, (long)ui.getValue(_sid,_node), _ci );
_sm.node = _node; _sm.node = _node;
_sm.sensor_type = UniversalIO::AnalogInput; _sm.sensor_type = UniversalIO::AI;
sensorInfo(&amp;_sm); sensorInfo(&amp;_sm);
} }
} }
...@@ -176,11 +165,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si ...@@ -176,11 +165,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool <xsl:value-of select="$CLASSNAME"/>_SK::getState( UniSetTypes::ObjectId _sid )
{
return (bool)getValue(_sid);
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid ) long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
{ {
<xsl:for-each select="//sensors/item/consumers/consumer"> <xsl:for-each select="//sensors/item/consumers/consumer">
...@@ -192,7 +176,8 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si ...@@ -192,7 +176,8 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getState): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid=" if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid="
&lt;&lt; _sid &lt;&lt; endl; &lt;&lt; _sid &lt;&lt; endl;
return 0; return 0;
...@@ -237,22 +222,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -237,22 +222,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
{ {
<xsl:if test="normalize-space(../../@msg)!='1'"> <xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID"> <xsl:if test="normalize-space(@name)=$OID">
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getState(<xsl:value-of select="../../@name"/>);
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>);
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DO'">
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getState(<xsl:value-of select="../../@name"/>);
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>); <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = ui.getValue(<xsl:value-of select="../../@name"/>);
</xsl:when>
</xsl:choose>
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
} }
...@@ -287,28 +257,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -287,28 +257,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
<xsl:template name="gensetdata"> <xsl:template name="gensetdata">
try try
{ {
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DO'">
ui.setState( <xsl:value-of select="../../@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
ui.setValue( <xsl:value-of select="../../@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DI'">
si.id = <xsl:value-of select="../../@name"/>; si.id = <xsl:value-of select="../../@name"/>;
si.node = node_<xsl:value-of select="../../@name"/>; si.node = node_<xsl:value-of select="../../@name"/>;
ui.saveState( si, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, UniversalIO::DigitalInput, getId() ); ui.setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
si.id = <xsl:value-of select="../../@name"/>;
si.node = node_<xsl:value-of select="../../@name"/>;
ui.saveValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
</xsl:choose>
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
</xsl:template> </xsl:template>
...@@ -317,28 +273,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -317,28 +273,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
<xsl:param name="setval"></xsl:param> <xsl:param name="setval"></xsl:param>
try try
{ {
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DO'">
ui.setState( <xsl:value-of select="../../@name"/>,<xsl:value-of select="$setval"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
ui.setValue( <xsl:value-of select="../../@name"/>,<xsl:value-of select="$setval"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DI'">
si.id = <xsl:value-of select="../../@name"/>; si.id = <xsl:value-of select="../../@name"/>;
si.node = node_<xsl:value-of select="../../@name"/>; si.node = node_<xsl:value-of select="../../@name"/>;
ui.saveState( si,<xsl:value-of select="$setval"/>, UniversalIO::DigitalInput, getId() ); ui.setValue( si,<xsl:value-of select="$setval"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
si.id = <xsl:value-of select="../../@name"/>;
si.node = node_<xsl:value-of select="../../@name"/>;
ui.saveValue( si,<xsl:value-of select="$setval"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
</xsl:choose>
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
...@@ -348,54 +290,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -348,54 +290,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
<xsl:param name="onlymsg"></xsl:param> <xsl:param name="onlymsg"></xsl:param>
<xsl:if test="normalize-space(../../@msg)!='1'"> <xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID"> <xsl:if test="normalize-space(@name)=$OID">
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DI'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (DI) change state <xsl:value-of select="../../@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> &lt;&lt; endl;
</xsl:if>
SensorMessage _sm( <xsl:value-of select="../../@name"/>, (bool)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, Message::Medium);
_sm.sensor_type = UniversalIO::DigitalInput;
sensorInfo(&amp;_sm);
}
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (AI) change value <xsl:value-of select="../../@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> &lt;&lt; endl;
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="../../@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, _ci);
_sm.sensor_type = UniversalIO::AnalogInput;
sensorInfo(&amp;_sm);
}
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DO'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (DO) change state <xsl:value-of select="../../@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> &lt;&lt; endl;
</xsl:if>
SensorMessage _sm( <xsl:value-of select="../../@name"/>, (bool)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, Message::Medium);
_sm.sensor_type = UniversalIO::DigitalOutput;
sensorInfo(&amp;_sm);
}
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
<xsl:if test="normalize-space($onlymsg)=''"> <xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> ) if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> )
</xsl:if> </xsl:if>
...@@ -407,13 +301,10 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -407,13 +301,10 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
// приходится искуственно использовать третий параметр, // приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал // что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage // правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci; SensorMessage _sm( <xsl:value-of select="../../@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>);
SensorMessage _sm( <xsl:value-of select="../../@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, _ci); _sm.sensor_type = UniversalIO::AI;
_sm.sensor_type = UniversalIO::AnalogOutput;
sensorInfo(&amp;_sm); sensorInfo(&amp;_sm);
} }
</xsl:when>
</xsl:choose>
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
......
...@@ -78,7 +78,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -78,7 +78,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
// "сердцебиение" // "сердцебиение"
if( idHeartBeat!=DefaultObjectId &amp;&amp; ptHeartBeat.checkTime() ) if( idHeartBeat!=DefaultObjectId &amp;&amp; ptHeartBeat.checkTime() )
{ {
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput); ui.setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
...@@ -140,7 +140,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force ) ...@@ -140,7 +140,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
if( prev_m_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != m_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> ) if( prev_m_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != m_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
{ {
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
ui.saveState( si,m_<xsl:value-of select="@name"/>,UniversalIO::DigitalInput,getId() ); ui.setValue( si,m_<xsl:value-of select="@name"/>,getId() );
prev_m_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = m_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>; prev_m_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = m_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
} }
</xsl:for-each> </xsl:for-each>
...@@ -168,21 +168,11 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorM ...@@ -168,21 +168,11 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorM
sensorInfo(_sm); sensorInfo(_sm);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node ) void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{ {
ui.askRemoteSensor(_sid,_cmd,_node,getId()); ui.askRemoteSensor(_sid,_cmd,_node,getId());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{
ui.askRemoteSensor(_sid,_cmd,_node,getId());
}
// -----------------------------------------------------------------------------
bool <xsl:value-of select="$CLASSNAME"/>_SK::getState( UniSetTypes::ObjectId _sid )
{
return (bool)getValue(_sid);
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid ) long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
{ {
try try
...@@ -190,32 +180,18 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si ...@@ -190,32 +180,18 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
<xsl:for-each select="//smap/item"> <xsl:for-each select="//smap/item">
if( _sid == <xsl:value-of select="@name"/> &amp;&amp; <xsl:value-of select="@name"/> != DefaultObjectId ) if( _sid == <xsl:value-of select="@name"/> &amp;&amp; <xsl:value-of select="@name"/> != DefaultObjectId )
{ {
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
<xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getState(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
<xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getState(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
<xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
<xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>); <xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>; return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:when>
</xsl:choose>
} }
</xsl:for-each> </xsl:for-each>
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getState): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid=" if( unideb.debugging(Debug::CRIT) )
&lt;&lt; _sid &lt;&lt; endl; unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid="
&lt;&lt; _sid &lt;&lt; endl;
} }
catch(Exception&amp; ex) catch(Exception&amp; ex)
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getState): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
...@@ -288,24 +264,12 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -288,24 +264,12 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
{ {
try try
{ {
<xsl:choose> <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
<xsl:when test="normalize-space(@iotype)='DI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getState(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getState(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
</xsl:when>
</xsl:choose>
} }
catch( UniSetTypes::Exception&amp; ex ) catch( UniSetTypes::Exception&amp; ex )
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
} }
...@@ -316,28 +280,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -316,28 +280,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
{ {
try try
{ {
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>,UniversalIO::DigitalInput,getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
ui.setState( <xsl:value-of select="@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/> );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>; si.node = node_<xsl:value-of select="@name"/>;
ui.saveValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>,UniversalIO::AnalogInput, getId() ); ui.setValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
ui.setValue( <xsl:value-of select="@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/> );
</xsl:when>
</xsl:choose>
} }
catch( UniSetTypes::Exception&amp; ex ) catch( UniSetTypes::Exception&amp; ex )
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
} }
...@@ -349,114 +299,17 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -349,114 +299,17 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
{ {
try try
{ {
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si,<xsl:value-of select="$setval"/>,UniversalIO::DigitalInput,getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
ui.setState( <xsl:value-of select="@name"/>,<xsl:value-of select="$setval"/>, node_<xsl:value-of select="@name"/>);
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>; si.node = node_<xsl:value-of select="@name"/>;
ui.saveValue( si,<xsl:value-of select="$setval"/>,UniversalIO::AnalogInput, getId() ); ui.setValue( si,<xsl:value-of select="$setval"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
ui.setValue( <xsl:value-of select="@name"/>,<xsl:value-of select="$setval"/>, node_<xsl:value-of select="@name"/> );
</xsl:when>
</xsl:choose>
} }
catch( UniSetTypes::Exception&amp; ex ) catch( UniSetTypes::Exception&amp; ex )
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
} }
</xsl:template> </xsl:template>
<xsl:template name="check_changes">
<xsl:param name="onlymsg"></xsl:param>
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
if( <xsl:value-of select="@name"/> != DefaultObjectId )
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (DI) change state <xsl:value-of select="@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> &lt;&lt; endl;
</xsl:if>
SensorMessage _sm( <xsl:value-of select="@name"/>, (bool)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, Message::Medium);
_sm.sensor_type = UniversalIO::DigitalInput;
sensorInfo(&amp;_sm);
}
}
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
if( <xsl:value-of select="@name"/> != DefaultObjectId )
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (AI) change value <xsl:value-of select="@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> &lt;&lt; endl;
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, _ci);
_sm.sensor_type = UniversalIO::AnalogInput;
sensorInfo(&amp;_sm);
}
}
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
if( <xsl:value-of select="@name"/> != DefaultObjectId )
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (DO) change state <xsl:value-of select="@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> &lt;&lt; endl;
</xsl:if>
SensorMessage _sm( <xsl:value-of select="@name"/>, (bool)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, Message::Medium);
_sm.sensor_type = UniversalIO::DigitalOutput;
sensorInfo(&amp;_sm);
}
}
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
if( <xsl:value-of select="@name"/> != DefaultObjectId )
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (AO) change value <xsl:value-of select="@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> &lt;&lt; endl;
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, _ci);
_sm.sensor_type = UniversalIO::AnalogOutput;
sensorInfo(&amp;_sm);
}
}
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
...@@ -82,7 +82,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() ...@@ -82,7 +82,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
// "сердцебиение" // "сердцебиение"
if( idHeartBeat!=DefaultObjectId &amp;&amp; ptHeartBeat.checkTime() ) if( idHeartBeat!=DefaultObjectId &amp;&amp; ptHeartBeat.checkTime() )
{ {
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput); ui.setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
...@@ -124,8 +124,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId sid ...@@ -124,8 +124,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId sid
} }
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
ui.setValue( sid, val );
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool force ) void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool force )
...@@ -140,7 +138,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool force ) ...@@ -140,7 +138,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool force )
// update messages // update messages
<xsl:for-each select="//msgmap/item"> <xsl:for-each select="//msgmap/item">
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
ui.saveState( si,m_<xsl:value-of select="@name"/>,UniversalIO::DigitalInput,getId() ); ui.setValue( si,m_<xsl:value-of select="@name"/>,getId() );
</xsl:for-each> </xsl:for-each>
--> -->
} }
...@@ -154,37 +152,21 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm ...@@ -154,37 +152,21 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each> </xsl:for-each>
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node ) void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{ {
if( cmd == UniversalIO::UIONotify ) if( cmd == UniversalIO::UIONotify )
{ {
SensorMessage sm( sid, (bool)ui.getState(sid,node), Message::Medium ); // приходится искуственно использовать третий параметр,
sm.sensor_type = UniversalIO::DigitalInput;
sm.node = node;
sensorInfo(&amp;sm);
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
if( cmd == UniversalIO::UIONotify )
{
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал // что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage // правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci; IOController_i::CalibrateInfo _ci;
SensorMessage sm( sid, (long)ui.getValue(sid,node), _ci ); SensorMessage sm( sid, (long)ui.getValue(sid,node), _ci );
sm.sensor_type = UniversalIO::AnalogInput; sm.sensor_type = UniversalIO::AI;
sm.node = node; sm.node = node;
sensorInfo(&amp;sm); sensorInfo(&amp;sm);
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool <xsl:value-of select="$CLASSNAME"/>_SK::getState( UniSetTypes::ObjectId _sid )
{
return (bool)getValue(_sid);
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid ) long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
{ {
<xsl:for-each select="//smap/item"> <xsl:for-each select="//smap/item">
...@@ -192,7 +174,9 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si ...@@ -192,7 +174,9 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>; return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:for-each> </xsl:for-each>
return ui.getValue(_sid); unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getValue): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid="
&lt;&lt; _sid &lt;&lt; endl;
return 0;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorMessage* sm ) void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorMessage* sm )
...@@ -221,28 +205,12 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code, ...@@ -221,28 +205,12 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
try try
{ {
if( <xsl:value-of select="@name"/> != DefaultObjectId ) if( <xsl:value-of select="@name"/> != DefaultObjectId )
{ <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getState(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DO'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getState(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getValue(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
</xsl:when>
</xsl:choose>
}
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
</xsl:template> </xsl:template>
...@@ -252,29 +220,15 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code, ...@@ -252,29 +220,15 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
{ {
if( <xsl:value-of select="@name"/> != DefaultObjectId ) if( <xsl:value-of select="@name"/> != DefaultObjectId )
{ {
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>; si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>,UniversalIO::DigitalInput,getId() ); ui.setValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
ui.setState( <xsl:value-of select="@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/> );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>;
ui.saveValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
ui.setValue( <xsl:value-of select="@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/> );
</xsl:when>
</xsl:choose>
} }
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
</xsl:template> </xsl:template>
...@@ -285,29 +239,15 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code, ...@@ -285,29 +239,15 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
{ {
if( <xsl:value-of select="@name"/> != DefaultObjectId ) if( <xsl:value-of select="@name"/> != DefaultObjectId )
{ {
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si,<xsl:value-of select="$setval"/>,UniversalIO::DigitalInput,getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
ui.setState( <xsl:value-of select="@name"/>,<xsl:value-of select="$setval"/>, node_<xsl:value-of select="@name"/>);
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>; si.node = node_<xsl:value-of select="@name"/>;
ui.saveValue( si,<xsl:value-of select="$setval"/>,UniversalIO::AnalogInput, getId() ); ui.setValue( si,<xsl:value-of select="$setval"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
ui.setValue( <xsl:value-of select="@name"/>,<xsl:value-of select="$setval"/>,node_<xsl:value-of select="@name"/> );
</xsl:when>
</xsl:choose>
} }
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
{ {
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw; throw;
} }
</xsl:template> </xsl:template>
...@@ -317,24 +257,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code, ...@@ -317,24 +257,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
{ {
if( <xsl:value-of select="@name"/> != DefaultObjectId ) if( <xsl:value-of select="@name"/> != DefaultObjectId )
{ {
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si,m_<xsl:value-of select="@name"/>,UniversalIO::DigitalInput,getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
ui.setState( <xsl:value-of select="@name"/>,m_<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>; si.node = node_<xsl:value-of select="@name"/>;
ui.saveValue( si,(long)m_<xsl:value-of select="@name"/>,UniversalIO::AnalogInput, getId() ); ui.setValue( si,(long)m_<xsl:value-of select="@name"/>, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
ui.setValue( <xsl:value-of select="@name"/>, (long)m_<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/> );
</xsl:when>
</xsl:choose>
} }
} }
catch( Exception&amp; ex ) catch( Exception&amp; ex )
...@@ -344,84 +269,4 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code, ...@@ -344,84 +269,4 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
} }
</xsl:template> </xsl:template>
<xsl:template name="check_changes">
<xsl:param name="onlymsg"></xsl:param>
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
if( <xsl:value-of select="@name"/> != DefaultObjectId )
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (DI) change state <xsl:value-of select="@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> &lt;&lt; endl;
</xsl:if>
SensorMessage _sm( <xsl:value-of select="@name"/>, (bool)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, Message::Medium);
_sm.sensor_type = UniversalIO::DigitalInput;
sensorInfo(&amp;_sm);
}
}
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AI'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (AI) change value <xsl:value-of select="@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> &lt;&lt; endl;
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, _ci);
_sm.sensor_type = UniversalIO::AnalogInput;
sensorInfo(&amp;_sm);
}
</xsl:when>
<xsl:when test="normalize-space(@iotype)='DO'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
if( <xsl:value-of select="@name"/> != DefaultObjectId )
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (DO) change state <xsl:value-of select="@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> &lt;&lt; endl;
</xsl:if>
SensorMessage _sm( <xsl:value-of select="@name"/>, (bool)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, Message::Medium);
_sm.sensor_type = UniversalIO::DigitalOutput;
sensorInfo(&amp;_sm);
}
}
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
if( <xsl:value-of select="@name"/> != DefaultObjectId )
{
<xsl:if test="normalize-space($onlymsg)=''">
// cout &lt;&lt; myname &lt;&lt; ": (AO) change value <xsl:value-of select="@name"/> set "
// &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> &lt;&lt; endl;
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, _ci);
_sm.sensor_type = UniversalIO::AnalogOutput;
sensorInfo(&amp;_sm);
}
}
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
...@@ -4,25 +4,6 @@ ...@@ -4,25 +4,6 @@
<xsl:output method="text" indent="yes" encoding="utf-8"/> <xsl:output method="text" indent="yes" encoding="utf-8"/>
<xsl:template name="settype">
<xsl:param name="iotype"/>
<xsl:choose>
<xsl:when test="$iotype='DO'">bool</xsl:when>
<xsl:when test="$iotype='DI'">bool</xsl:when>
<xsl:when test="$iotype='AO'">long</xsl:when>
<xsl:when test="$iotype='AI'">long</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="gettype">
<xsl:param name="iotype"/>
<xsl:choose>
<xsl:when test="$iotype='DO'">UniversalIO::DigitalOutput</xsl:when>
<xsl:when test="$iotype='DI'">UniversalIO::DigitalInput</xsl:when>
<xsl:when test="$iotype='AO'">UniversalIO::AnalogOutput</xsl:when>
<xsl:when test="$iotype='AI'">UniversalIO::AnalogInput</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="setprefix"> <xsl:template name="setprefix">
<xsl:choose> <xsl:choose>
<xsl:when test="normalize-space(@vartype)='in'">in_</xsl:when> <xsl:when test="normalize-space(@vartype)='in'">in_</xsl:when>
...@@ -59,8 +40,8 @@ ...@@ -59,8 +40,8 @@
<xsl:if test="normalize-space(@vartype)!='io'"> <xsl:if test="normalize-space(@vartype)!='io'">
const UniSetTypes::ObjectId <xsl:value-of select="../../@name"/>; /*!&lt; <xsl:value-of select="../../@textname"/> */ const UniSetTypes::ObjectId <xsl:value-of select="../../@name"/>; /*!&lt; <xsl:value-of select="../../@textname"/> */
UniSetTypes::ObjectId node_<xsl:value-of select="../../@name"/>; UniSetTypes::ObjectId node_<xsl:value-of select="../../@name"/>;
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="../../@iotype" /></xsl:call-template><xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; /*!&lt; текущее значение */ long <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; /*!&lt; текущее значение */
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="../../@iotype" /></xsl:call-template><xsl:text> prev_</xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; /*!&lt; предыдущее значение */ long prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; /*!&lt; предыдущее значение */
</xsl:if> </xsl:if>
<xsl:if test="normalize-space(@vartype)='io'">#warning (uniset-codegen): vartype='io' NO LONGER SUPPORTED! (ignore variable: '<xsl:value-of select="../../@name"/>') <xsl:if test="normalize-space(@vartype)='io'">#warning (uniset-codegen): vartype='io' NO LONGER SUPPORTED! (ignore variable: '<xsl:value-of select="../../@name"/>')
</xsl:if> </xsl:if>
...@@ -115,18 +96,19 @@ ...@@ -115,18 +96,19 @@
</xsl:when> </xsl:when>
<xsl:when test="$GENTYPE='U'"> <xsl:when test="$GENTYPE='U'">
si.id = mid_<xsl:value-of select="../../@name"/>; si.id = mid_<xsl:value-of select="../../@name"/>;
ui.saveState( si,m_<xsl:value-of select="../../@name"/>, UniversalIO::DigitalInput, getId() ); ui.setValue( si,( m_<xsl:value-of select="../../@name"/> ? 1:0), getId() );
</xsl:when> </xsl:when>
<xsl:when test="$GENTYPE='A'"> <xsl:when test="$GENTYPE='A'">
if( _code == mid_<xsl:value-of select="../../@name"/> ) if( _code == mid_<xsl:value-of select="../../@name"/> )
{ {
unideb(Debug::LEVEL8) &lt;&lt; "<xsl:value-of select="../../@name"/>" &lt;&lt; endl; if( unideb.debugging(Debug::LEVEL8) )
unideb(Debug::LEVEL8) &lt;&lt; "<xsl:value-of select="../../@name"/>" &lt;&lt; endl;
m_<xsl:value-of select="../../@name"/> = _state; m_<xsl:value-of select="../../@name"/> = _state;
try try
{ {
// сохраняем сразу... // сохраняем сразу...
si.id = mid_<xsl:value-of select="../../@name"/>; si.id = mid_<xsl:value-of select="../../@name"/>;
ui.saveState( si,m_<xsl:value-of select="../../@name"/>,UniversalIO::DigitalInput,getId() ); ui.setValue( si,(m_<xsl:value-of select="../../@name"/> ? 1:0), getId() );
return true; return true;
} }
catch(...){} catch(...){}
...@@ -140,11 +122,12 @@ ...@@ -140,11 +122,12 @@
try try
{ {
si.id = mid_<xsl:value-of select="../../@name"/>; si.id = mid_<xsl:value-of select="../../@name"/>;
ui.saveState( si,false,UniversalIO::DigitalInput,getId() ); ui.setValue( si,0,getId() );
} }
catch( UniSetTypes::Exception&amp; ex ) catch( UniSetTypes::Exception&amp; ex )
{ {
unideb[Debug::LEVEL1] &lt;&lt; getName() &lt;&lt; ex &lt;&lt; endl; if( unideb.debugging(Debug::LEVEL1) )
unideb[Debug::LEVEL1] &lt;&lt; getName() &lt;&lt; ex &lt;&lt; endl;
} }
} }
</xsl:when> </xsl:when>
...@@ -175,18 +158,13 @@ ...@@ -175,18 +158,13 @@
</xsl:template> </xsl:template>
<xsl:template name="COMMON-HEAD-PUBLIC"> <xsl:template name="COMMON-HEAD-PUBLIC">
bool alarm( UniSetTypes::ObjectId sid, bool state ); bool alarm( UniSetTypes::ObjectId sid, bool state );
bool getState( UniSetTypes::ObjectId sid );
long getValue( UniSetTypes::ObjectId sid ); long getValue( UniSetTypes::ObjectId sid );
void setValue( UniSetTypes::ObjectId sid, long value ); void setValue( UniSetTypes::ObjectId sid, long value );
void setState( UniSetTypes::ObjectId sid, bool state ); void askSensor( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void updateValues(); void updateValues();
void setMsg( UniSetTypes::ObjectId code, bool state ); void setMsg( UniSetTypes::ObjectId code, bool state );
DebugStream dlog; DebugStream dlog;
void init_dlog(DebugStream&amp; dlog); void init_dlog(DebugStream&amp; dlog);
</xsl:template> </xsl:template>
...@@ -349,11 +327,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::sysCommand( SystemMessage* _sm ) ...@@ -349,11 +327,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::sysCommand( SystemMessage* _sm )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setState( UniSetTypes::ObjectId _sid, bool _state )
{
setValue(_sid, _state ? 1 : 0 );
}
// -----------------------------------------------------------------------------
<xsl:if test="normalize-space($TESTMODE)!=''"> <xsl:if test="normalize-space($TESTMODE)!=''">
bool <xsl:value-of select="$CLASSNAME"/>_SK::checkTestMode() bool <xsl:value-of select="$CLASSNAME"/>_SK::checkTestMode()
{ {
...@@ -635,16 +608,6 @@ end_private(false) ...@@ -635,16 +608,6 @@ end_private(false)
<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 )
throw Exception( myname + ": Not found ID for (<xsl:value-of select="@name"/>) " + conf->getProp(cnode,"<xsl:value-of select="@name"/>") ); throw Exception( myname + ": Not found ID for (<xsl:value-of select="@name"/>) " + conf->getProp(cnode,"<xsl:value-of select="@name"/>") );
<xsl:if test="normalize-space(@no_check_iotype)!='1'">
if( conf->getIOType( <xsl:value-of select="normalize-space(@name)"/> ) != <xsl:call-template name="gettype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template> )
{
ostringstream err;
err &lt;&lt; myname &lt;&lt; "(init): Invalid 'iotype' for '<xsl:value-of select="normalize-space(@name)"/>' set '<xsl:value-of select="normalize-space(@iotype)"/>' but "
&lt;&lt; conf->getProp(cnode,"<xsl:value-of select="normalize-space(@name)"/>") &lt;&lt; "='" &lt;&lt; conf->getIOType( <xsl:value-of select="normalize-space(@name)"/> ) &lt;&lt; "'";
throw Exception( err.str() );
}
</xsl:if>
</xsl:if> </xsl:if>
if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId ) if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
...@@ -767,8 +730,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateValues() ...@@ -767,8 +730,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateValues()
{ {
// Опрашиваем все входы... // Опрашиваем все входы...
<xsl:if test="normalize-space($TESTMODE)!=''"> <xsl:if test="normalize-space($TESTMODE)!=''">
in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui.getState(idTestMode_S):false; in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui.getValue(idTestMode_S):false;
in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui.getState(idLocalTestMode_S):false; in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui.getValue(idLocalTestMode_S):false;
</xsl:if> </xsl:if>
<xsl:for-each select="//smap/item"> <xsl:for-each select="//smap/item">
<xsl:choose> <xsl:choose>
...@@ -830,7 +793,7 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId _code, ...@@ -830,7 +793,7 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId _code,
// сохраняем сразу... // сохраняем сразу...
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>; si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si,m_<xsl:value-of select="@name"/>,UniversalIO::DigitalInput,getId() ); ui.setValue( si,m_<xsl:value-of select="@name"/>,getId() );
return true; return true;
} }
catch(...){} catch(...){}
...@@ -853,7 +816,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::resetMsg() ...@@ -853,7 +816,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::resetMsg()
{ {
si.id = <xsl:value-of select="@name"/>; si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>; si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si,false,UniversalIO::DigitalInput,getId() ); ui.setValue( si, 0, getId() );
} }
catch( UniSetTypes::Exception&amp; ex ) catch( UniSetTypes::Exception&amp; ex )
{ {
...@@ -1014,8 +977,8 @@ askPause(conf->getPIntProp(cnode,"askPause",2000)) ...@@ -1014,8 +977,8 @@ askPause(conf->getPIntProp(cnode,"askPause",2000))
void <xsl:value-of select="$CLASSNAME"/>_SK::updateValues() void <xsl:value-of select="$CLASSNAME"/>_SK::updateValues()
{ {
<xsl:if test="normalize-space($TESTMODE)!=''"> <xsl:if test="normalize-space($TESTMODE)!=''">
in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui.getState(idTestMode_S):false; in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui.getValue(idTestMode_S):false;
in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui.getState(idLocalTestMode_S):false; in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui.getValue(idLocalTestMode_S):false;
</xsl:if> </xsl:if>
// Опрашиваем все входы... // Опрашиваем все входы...
<xsl:for-each select="//sensors/item/consumers/consumer"> <xsl:for-each select="//sensors/item/consumers/consumer">
...@@ -1101,4 +1064,22 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId _code, ...@@ -1101,4 +1064,22 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId _code,
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
</xsl:template> </xsl:template>
<xsl:template name="check_changes">
<xsl:param name="onlymsg"></xsl:param>
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, _ci);
_sm.sensor_type = UniversalIO::AI;
sensorInfo(&amp;_sm);
}
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
...@@ -81,8 +81,8 @@ class <xsl:value-of select="$CLASSNAME"/>_SK: ...@@ -81,8 +81,8 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
// Текущее значение и предыдущее значение // Текущее значение и предыдущее значение
<xsl:for-each select="//smap/item"> <xsl:for-each select="//smap/item">
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template><xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>; long <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template><xsl:text> prev_</xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>; long prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:for-each> </xsl:for-each>
// --- public variables --- // --- public variables ---
......
...@@ -13,10 +13,10 @@ GENERATED=TestGen_SK.h TestGen_SK.cc TestGen-main.cc ...@@ -13,10 +13,10 @@ GENERATED=TestGen_SK.h TestGen_SK.cc TestGen-main.cc
GENERATED2=TestGenAlone_SK.h TestGenAlone_SK.cc TestGenAlone-main.cc GENERATED2=TestGenAlone_SK.h TestGenAlone_SK.cc TestGenAlone-main.cc
GENUOBJ=UObject_SK.cc UObject_SK.h GENUOBJ=UObject_SK.cc UObject_SK.h
$(GENERATED): ../@PACKAGE@-codegen testgen.src.xml ../*.xsl TestGen_SK.cc: ../@PACKAGE@-codegen testgen.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include -n TestGen testgen.src.xml ../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include -n TestGen testgen.src.xml
$(GENERATED2): ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl TestGenAlone_SK.cc: ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include --alone -n TestGenAlone testgen-alone.src.xml ../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include --alone -n TestGenAlone testgen-alone.src.xml
$(GENUOBJ): ../@PACKAGE@-codegen uobject.src.xml ../*.xsl $(GENUOBJ): ../@PACKAGE@-codegen uobject.src.xml ../*.xsl
......
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
</variables> </variables>
<smap> <smap>
<!-- name - название переменной в конф. файле --> <!-- name - название переменной в конф. файле -->
<item name="input1_s" vartype="in" iotype="DI" comment="comment for input1" smTestID="1"/> <item name="input1_s" vartype="in" comment="comment for input1" smTestID="1"/>
<item name="input2_s" vartype="in" iotype="DI" comment="comment for input2" /> <item name="input2_s" vartype="in" comment="comment for input2" />
<item name="output1_c" vartype="out" iotype="DO" omment="comment for output1" no_check_id="1"/> <item name="output1_c" vartype="out" omment="comment for output1" no_check_id="1"/>
<item name="loglevel_s" vartype="in" iotype="AI" omment="log level control" loglevel="1"/> <item name="loglevel_s" vartype="in" comment="log level control" loglevel="1"/>
</smap> </smap>
<msgmap> <msgmap>
......
...@@ -347,6 +347,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -347,6 +347,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
- remove deprecated intefaces: MessageInterface - remove deprecated intefaces: MessageInterface
- remove deprecated messages: AlarmMessage, InfoMessage, DBMessage - remove deprecated messages: AlarmMessage, InfoMessage, DBMessage
- remove 'state' from SensorMessage - remove 'state' from SensorMessage
- remove deprecated function setState,getState,askState
use simple function: setValue,getValue,askSensor
- possible use of the property 'iotype' in uniset-codegen
* Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3 * Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3
- add RRDServer - add RRDServer
......
...@@ -274,12 +274,11 @@ void IOControl::execute() ...@@ -274,12 +274,11 @@ void IOControl::execute()
else else
{ {
iomap.resize(maxItem); iomap.resize(maxItem);
// init iterators // init iterators
for( IOMap::iterator it=iomap.begin(); it!=iomap.end(); ++it ) for( IOMap::iterator it=iomap.begin(); it!=iomap.end(); ++it )
{ shm->initIterator(it->ioit);
shm->initAIterator(it->ait);
shm->initDIterator(it->dit);
}
readconf_ok = true; // т.к. waitSM() уже был... readconf_ok = true; // т.к. waitSM() уже был...
} }
...@@ -295,9 +294,9 @@ void IOControl::execute() ...@@ -295,9 +294,9 @@ void IOControl::execute()
if( !skip_iout ) if( !skip_iout )
initOutputs(); initOutputs();
shm->initAIterator(aitHeartBeat); shm->initIterator(itHeartBeat);
shm->initDIterator(ditTestLamp); shm->initIterator(itTestLamp);
shm->initAIterator(aitTestMode); shm->initIterator(itTestMode);
PassiveTimer ptAct(activateTimeout); PassiveTimer ptAct(activateTimeout);
while( !activated && !ptAct.checkTime() ) while( !activated && !ptAct.checkTime() )
...@@ -373,7 +372,7 @@ void IOControl::execute() ...@@ -373,7 +372,7 @@ void IOControl::execute()
if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() ) if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
{ {
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,myid); shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,myid);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
} }
...@@ -560,7 +559,7 @@ void IOControl::ioread( IOInfo* it ) ...@@ -560,7 +559,7 @@ void IOControl::ioread( IOInfo* it )
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
long prev_val = it->value; long prev_val = it->value;
if( force_out ) if( force_out )
it->value = shm->localGetValue(it->ait,it->si.id); it->value = shm->localGetValue(it->ioit,it->si.id);
switch( it->value ) switch( it->value )
{ {
...@@ -1008,7 +1007,7 @@ void IOControl::check_testmode() ...@@ -1008,7 +1007,7 @@ void IOControl::check_testmode()
try try
{ {
if( force_out ) if( force_out )
testmode = shm->localGetValue( aitTestMode, testMode_as ); testmode = shm->localGetValue( itTestMode, testMode_as );
if( prev_testmode == testmode ) if( prev_testmode == testmode )
return; return;
...@@ -1078,7 +1077,7 @@ void IOControl::check_testlamp() ...@@ -1078,7 +1077,7 @@ void IOControl::check_testlamp()
try try
{ {
if( force_out ) if( force_out )
isTestLamp = shm->localGetState( ditTestLamp, testLamp_S ); isTestLamp = shm->localGetValue( itTestLamp, testLamp_S );
if( !trTestLamp.change(isTestLamp) ) if( !trTestLamp.change(isTestLamp) )
return; // если состояние не менялось, то продолжаем работу... return; // если состояние не менялось, то продолжаем работу...
...@@ -1399,8 +1398,9 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm ) ...@@ -1399,8 +1398,9 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm )
if( sm->id == testLamp_S ) if( sm->id == testLamp_S )
{ {
dlog[Debug::INFO] << myname << "(sensorInfo): test_lamp=" << sm->state << endl; if( dlog.debugging(Debug::INFO) )
isTestLamp = sm->state; dlog[Debug::INFO] << myname << "(sensorInfo): test_lamp=" << sm->value << endl;
isTestLamp = (bool)sm->value;
} }
else if( sm->id == testMode_as ) else if( sm->id == testMode_as )
{ {
...@@ -1415,7 +1415,6 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm ) ...@@ -1415,7 +1415,6 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm )
if( unideb.debugging(Debug::INFO) ) if( unideb.debugging(Debug::INFO) )
{ {
dlog[Debug::INFO] << myname << "(sensorInfo): sid=" << sm->id dlog[Debug::INFO] << myname << "(sensorInfo): sid=" << sm->id
<< " state=" << sm->state
<< " value=" << sm->value << " value=" << sm->value
<< endl; << endl;
} }
...@@ -1521,7 +1520,7 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm ) ...@@ -1521,7 +1520,7 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm )
<< " val=" << sm->value << endl; << " val=" << sm->value << endl;
} }
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
it->value = sm->state ? 1:0; it->value = sm->value ? 1:0;
} }
break; break;
} }
......
...@@ -354,12 +354,12 @@ class IOControl: ...@@ -354,12 +354,12 @@ class IOControl:
UniSetTypes::ObjectId testLamp_S; UniSetTypes::ObjectId testLamp_S;
Trigger trTestLamp; Trigger trTestLamp;
bool isTestLamp; bool isTestLamp;
IOController::DIOStateList::iterator ditTestLamp; IOController::IOStateList::iterator itTestLamp;
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator itHeartBeat;
bool force; /*!< флаг, означающий, что надо сохранять в SM, даже если значение не менялось */ bool force; /*!< флаг, означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out; /*!< флаг, включающий принудительное чтения выходов */ bool force_out; /*!< флаг, включающий принудительное чтения выходов */
...@@ -376,7 +376,7 @@ class IOControl: ...@@ -376,7 +376,7 @@ class IOControl:
UniSetTypes::ObjectId testMode_as; UniSetTypes::ObjectId testMode_as;
IOController::IOStateList::iterator aitTestMode; IOController::IOStateList::iterator itTestMode;
long testmode; long testmode;
long prev_testmode; long prev_testmode;
......
...@@ -120,7 +120,7 @@ void LProcessor::getInputs() ...@@ -120,7 +120,7 @@ void LProcessor::getInputs()
{ {
// try // try
// { // {
it->state = ui.getState(it->sid); it->state = (bool)ui.getValue(it->sid);
// } // }
} }
} }
...@@ -143,20 +143,7 @@ void LProcessor::setOuts() ...@@ -143,20 +143,7 @@ void LProcessor::setOuts()
{ {
try try
{ {
switch(it->iotype) ui.setValue(it->sid,it->lnk->from->getOut(),DefaultObjectId);
{
case UniversalIO::DI:
ui.saveState(it->sid,it->lnk->from->getOut(),it->iotype);
break;
case UniversalIO::DO:
ui.setState(it->sid,it->lnk->from->getOut());
break;
default:
dlog[Debug::CRIT] << "(LProcessor::setOuts): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
......
...@@ -6,14 +6,36 @@ using namespace std; ...@@ -6,14 +6,36 @@ using namespace std;
using namespace UniSetTypes; using namespace UniSetTypes;
using namespace UniSetExtensions; using namespace UniSetExtensions;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId objId, PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId objId,
UniSetTypes::ObjectId shmID, SharedMemory* ic ): UniSetTypes::ObjectId shmID, SharedMemory* ic, const std::string& prefix ):
UniSetObject_LT(objId), UniSetObject_LT(objId),
shm(0) shm(0)
{ {
logname = myname; logname = myname;
shm = new SMInterface(shmID,&(UniSetObject_LT::ui),objId,ic); shm = new SMInterface(shmID,&(UniSetObject_LT::ui),objId,ic);
build(lfile); build(lfile);
// ********** HEARTBEAT *************
string heart = conf->getArgParam("--" + prefix + "-heartbeat-id",""); // it.getProp("heartbeat_id"));
if( !heart.empty() )
{
sidHeartBeat = conf->getSensorID(heart);
if( sidHeartBeat == DefaultObjectId )
{
ostringstream err;
err << myname << ": ID not found ('HeartBeat') for " << heart;
dlog[Debug::CRIT] << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
int heartbeatTime = getHeartBeatTime();
if( heartbeatTime )
ptHeartBeat.setTiming(heartbeatTime);
else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgPInt("--" + prefix + "-heartbeat-max","10", 10);
}
} }
PassiveLProcessor::~PassiveLProcessor() PassiveLProcessor::~PassiveLProcessor()
...@@ -32,12 +54,12 @@ void PassiveLProcessor::step() ...@@ -32,12 +54,12 @@ void PassiveLProcessor::step()
dlog[Debug::CRIT] << myname dlog[Debug::CRIT] << myname
<< "(step): (hb) " << ex << std::endl; << "(step): (hb) " << ex << std::endl;
} }
if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() ) if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
{ {
try try
{ {
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId()); shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch(Exception& ex) catch(Exception& ex)
...@@ -73,7 +95,7 @@ void PassiveLProcessor::sensorInfo( UniSetTypes::SensorMessage*sm ) ...@@ -73,7 +95,7 @@ void PassiveLProcessor::sensorInfo( UniSetTypes::SensorMessage*sm )
for( EXTList::iterator it=extInputs.begin(); it!=extInputs.end(); ++it ) for( EXTList::iterator it=extInputs.begin(); it!=extInputs.end(); ++it )
{ {
if( it->sid == sm->id ) if( it->sid == sm->id )
it->state = sm->state; it->state = (bool)sm->value;
} }
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
...@@ -96,6 +118,7 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm ) ...@@ -96,6 +118,7 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
return; return;
} }
UniSetTypes::uniset_mutex_lock l(mutex_start, 10000);
askSensors(UniversalIO::UIONotify); askSensors(UniversalIO::UIONotify);
askTimer(tidStep,LProcessor::sleepTime); askTimer(tidStep,LProcessor::sleepTime);
break; break;
...@@ -105,11 +128,11 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm ) ...@@ -105,11 +128,11 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
case SystemMessage::Finish: case SystemMessage::Finish:
askSensors(UniversalIO::UIODontNotify); askSensors(UniversalIO::UIODontNotify);
break; break;
case SystemMessage::WatchDog: case SystemMessage::WatchDog:
{ {
// ОПТИМИЗАЦИЯ (защита от двойного перезаказа при старте) // ОПТИМИЗАЦИЯ (защита от двойного перезаказа при старте)
// Если идёт локальная работа // Если идёт локальная работа
// (т.е. RTUExchange запущен в одном процессе с SharedMemory2) // (т.е. RTUExchange запущен в одном процессе с SharedMemory2)
// то обрабатывать WatchDog не надо, т.к. мы и так ждём готовности SM // то обрабатывать WatchDog не надо, т.к. мы и так ждём готовности SM
// при заказе датчиков, а если SM вылетит, то вместе с этим процессом(RTUExchange) // при заказе датчиков, а если SM вылетит, то вместе с этим процессом(RTUExchange)
...@@ -146,6 +169,25 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm ) ...@@ -146,6 +169,25 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
} }
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
bool PassiveLProcessor::activateObject()
{
// блокирование обработки Starsp
// пока не пройдёт инициализация датчиков
// см. sysCommand()
{
UniSetTypes::uniset_mutex_lock l(mutex_start, 5000);
UniSetObject_LT::activateObject();
initIterators();
}
return true;
}
// ------------------------------------------------------------------------------------------
void PassiveLProcessor::initIterators()
{
shm->initIterator(itHeartBeat);
}
// -------------------------------------------------------------------------
void PassiveLProcessor::setOuts() void PassiveLProcessor::setOuts()
{ {
// выcтавляем выходы // выcтавляем выходы
...@@ -153,20 +195,7 @@ void PassiveLProcessor::setOuts() ...@@ -153,20 +195,7 @@ void PassiveLProcessor::setOuts()
{ {
try try
{ {
switch(it->iotype) shm->setValue( it->sid,it->lnk->from->getOut() );
{
case UniversalIO::DI:
shm->saveLocalState(it->sid,it->lnk->from->getOut(),it->iotype);
break;
case UniversalIO::DO:
shm->setState(it->sid,it->lnk->from->getOut());
break;
default:
dlog[Debug::CRIT] << myname << "(setOuts): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
...@@ -185,20 +214,7 @@ void PassiveLProcessor::sigterm( int signo ) ...@@ -185,20 +214,7 @@ void PassiveLProcessor::sigterm( int signo )
{ {
try try
{ {
switch(it->iotype) shm->setValue(it->sid,0);
{
case UniversalIO::DI:
shm->saveLocalState(it->sid,false,it->iotype);
break;
case UniversalIO::DO:
shm->setState(it->sid,false);
break;
default:
dlog[Debug::CRIT] << myname << "(sigterm): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
...@@ -240,7 +256,7 @@ void PassiveLProcessor::processingMessage( UniSetTypes::VoidMessage* msg ) ...@@ -240,7 +256,7 @@ void PassiveLProcessor::processingMessage( UniSetTypes::VoidMessage* msg )
default: default:
break; break;
} }
} }
catch(Exception& ex) catch(Exception& ex)
{ {
......
...@@ -51,7 +51,7 @@ class PassiveLProcessor: ...@@ -51,7 +51,7 @@ class PassiveLProcessor:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::uniset_mutex mutex_start; UniSetTypes::uniset_mutex mutex_start;
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
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
#SMDBServer #SMDBServer
#SharedMemoryPlus #SharedMemoryPlus
#UDPExchange #UDPExchange
......
...@@ -213,7 +213,7 @@ void MBExchange::step() ...@@ -213,7 +213,7 @@ void MBExchange::step()
{ {
try try
{ {
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId()); shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch(Exception& ex) catch(Exception& ex)
...@@ -298,20 +298,17 @@ MBExchange::DeviceType MBExchange::getDeviceType( const std::string& dtype ) ...@@ -298,20 +298,17 @@ MBExchange::DeviceType MBExchange::getDeviceType( const std::string& dtype )
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void MBExchange::initIterators() void MBExchange::initIterators()
{ {
shm->initAIterator(aitHeartBeat); shm->initIterator(itHeartBeat);
shm->initAIterator(aitExchangeMode); shm->initIterator(itExchangeMode);
for( MBExchange::RTUDeviceMap::iterator it1=rmap.begin(); it1!=rmap.end(); ++it1 ) for( MBExchange::RTUDeviceMap::iterator it1=rmap.begin(); it1!=rmap.end(); ++it1 )
{ {
RTUDevice* d(it1->second); RTUDevice* d(it1->second);
shm->initDIterator(d->resp_dit); shm->initIterator(d->resp_it);
shm->initAIterator(d->mode_ait); shm->initIterator(d->mode_it);
for( MBExchange::RegMap::iterator it=d->regmap.begin(); it!=d->regmap.end(); ++it ) for( MBExchange::RegMap::iterator it=d->regmap.begin(); it!=d->regmap.end(); ++it )
{ {
for( PList::iterator it2=it->second->slst.begin();it2!=it->second->slst.end(); ++it2 ) for( PList::iterator it2=it->second->slst.begin();it2!=it->second->slst.end(); ++it2 )
{ shm->initIterator(it2->ioit);
shm->initDIterator(it2->dit);
shm->initAIterator(it2->ait);
}
} }
} }
} }
...@@ -992,7 +989,7 @@ void MBExchange::updateSM() ...@@ -992,7 +989,7 @@ void MBExchange::updateSM()
try try
{ {
if( !shm->isLocalwork() ) if( !shm->isLocalwork() )
d->mode = shm->localGetValue(d->mode_ait,d->mode_id); d->mode = shm->localGetValue(d->mode_it,d->mode_id);
} }
catch(IOController_i::NameNotFound &ex) catch(IOController_i::NameNotFound &ex)
{ {
...@@ -2917,7 +2914,7 @@ void MBExchange::updateRespondSensors() ...@@ -2917,7 +2914,7 @@ void MBExchange::updateRespondSensors()
try try
{ {
bool set = d->resp_invert ? !d->resp_state : d->resp_state; bool set = d->resp_invert ? !d->resp_state : d->resp_state;
shm->localSaveState(d->resp_dit,d->resp_id,set,getId()); shm->localSetValue(d->resp_it,d->resp_id,( set ? 1:0 ),getId());
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
......
...@@ -161,7 +161,7 @@ class MBExchange: ...@@ -161,7 +161,7 @@ class MBExchange:
DeviceType dtype; /*!< тип устройства */ DeviceType dtype; /*!< тип устройства */
UniSetTypes::ObjectId resp_id; UniSetTypes::ObjectId resp_id;
IOController::DIOStateList::iterator resp_dit; IOController::IOStateList::iterator resp_it;
PassiveTimer resp_ptTimeout; PassiveTimer resp_ptTimeout;
Trigger resp_trTimeout; Trigger resp_trTimeout;
bool resp_state; bool resp_state;
...@@ -170,7 +170,7 @@ class MBExchange: ...@@ -170,7 +170,7 @@ class MBExchange:
bool resp_init; bool resp_init;
bool ask_every_reg; bool ask_every_reg;
UniSetTypes::ObjectId mode_id; UniSetTypes::ObjectId mode_id;
IOController::IOStateList::iterator mode_ait; IOController::IOStateList::iterator mode_it;
long mode; // режим работы с устройством (см. ExchangeMode) long mode; // режим работы с устройством (см. ExchangeMode)
// return TRUE if state changed // return TRUE if state changed
...@@ -292,11 +292,11 @@ class MBExchange: ...@@ -292,11 +292,11 @@ class MBExchange:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::ObjectId test_id; UniSetTypes::ObjectId test_id;
UniSetTypes::ObjectId sidExchangeMode; /*!< иденидентификатор для датчика режима работы */ UniSetTypes::ObjectId sidExchangeMode; /*!< иденидентификатор для датчика режима работы */
IOController::IOStateList::iterator aitExchangeMode; IOController::IOStateList::iterator itExchangeMode;
long exchangeMode; /*!< режим работы см. ExchangeMode */ long exchangeMode; /*!< режим работы см. ExchangeMode */
UniSetTypes::uniset_rwmutex actMutex; UniSetTypes::uniset_rwmutex actMutex;
......
...@@ -146,7 +146,7 @@ void MBTCPMaster::poll_thread() ...@@ -146,7 +146,7 @@ void MBTCPMaster::poll_thread()
try try
{ {
if( sidExchangeMode != DefaultObjectId && force ) if( sidExchangeMode != DefaultObjectId && force )
exchangeMode = shm->localGetValue(aitExchangeMode,sidExchangeMode); exchangeMode = shm->localGetValue(itExchangeMode,sidExchangeMode);
} }
catch(...){} catch(...){}
try try
......
...@@ -285,7 +285,7 @@ void MBTCPMultiMaster::poll_thread() ...@@ -285,7 +285,7 @@ void MBTCPMultiMaster::poll_thread()
try try
{ {
if( sidExchangeMode != DefaultObjectId && force ) if( sidExchangeMode != DefaultObjectId && force )
exchangeMode = shm->localGetValue(aitExchangeMode,sidExchangeMode); exchangeMode = shm->localGetValue(itExchangeMode,sidExchangeMode);
} }
catch(...){} catch(...){}
try try
...@@ -318,7 +318,7 @@ void MBTCPMultiMaster::check_thread() ...@@ -318,7 +318,7 @@ void MBTCPMultiMaster::check_thread()
if( it->respond_id != DefaultObjectId && (force_out || r != it->respond) ) if( it->respond_id != DefaultObjectId && (force_out || r != it->respond) )
{ {
bool set = it->respond_invert ? !it->respond : it->respond; bool set = it->respond_invert ? !it->respond : it->respond;
shm->localSaveState(it->respond_dit,it->respond_id,set,getId()); shm->localSetValue(it->respond_it,it->respond_id,(set ? 1:0),getId());
} }
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -351,7 +351,7 @@ void MBTCPMultiMaster::initIterators() ...@@ -351,7 +351,7 @@ void MBTCPMultiMaster::initIterators()
{ {
MBExchange::initIterators(); MBExchange::initIterators();
for( MBGateList::iterator it=mblist.begin(); it!=mblist.end(); ++it ) for( MBGateList::iterator it=mblist.begin(); it!=mblist.end(); ++it )
shm->initDIterator(it->respond_dit); shm->initIterator(it->respond_it);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MBTCPMultiMaster::help_print( int argc, const char* const* argv ) void MBTCPMultiMaster::help_print( int argc, const char* const* argv )
......
...@@ -256,7 +256,7 @@ class MBTCPMultiMaster: ...@@ -256,7 +256,7 @@ class MBTCPMultiMaster:
bool respond; bool respond;
UniSetTypes::ObjectId respond_id; UniSetTypes::ObjectId respond_id;
IOController::DIOStateList::iterator respond_dit; IOController::IOStateList::iterator respond_it;
bool respond_invert; bool respond_invert;
inline bool operator < ( const MBSlaveInfo& mbs ) const inline bool operator < ( const MBSlaveInfo& mbs ) const
......
...@@ -158,7 +158,7 @@ void RTUExchange::step() ...@@ -158,7 +158,7 @@ void RTUExchange::step()
try try
{ {
if( sidExchangeMode != DefaultObjectId && force ) if( sidExchangeMode != DefaultObjectId && force )
exchangeMode = shm->localGetValue(aitExchangeMode,sidExchangeMode); exchangeMode = shm->localGetValue(itExchangeMode,sidExchangeMode);
} }
catch(...){} catch(...){}
......
...@@ -411,7 +411,7 @@ void MBSlave::execute_rtu() ...@@ -411,7 +411,7 @@ void MBSlave::execute_rtu()
{ {
try try
{ {
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId()); shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch(Exception& ex) catch(Exception& ex)
...@@ -429,7 +429,7 @@ void MBSlave::execute_rtu() ...@@ -429,7 +429,7 @@ void MBSlave::execute_rtu()
try try
{ {
shm->localSaveState(ditRespond,respond_id,state,getId()); shm->localSetValue(itRespond,respond_id,state,getId());
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -442,7 +442,7 @@ void MBSlave::execute_rtu() ...@@ -442,7 +442,7 @@ void MBSlave::execute_rtu()
{ {
try try
{ {
shm->localSaveValue(aitAskCount,askcount_id,askCount,getId()); shm->localSetValue(itAskCount,askcount_id,askCount,getId());
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -492,7 +492,7 @@ void MBSlave::execute_tcp() ...@@ -492,7 +492,7 @@ void MBSlave::execute_tcp()
{ {
try try
{ {
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId()); shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch(Exception& ex) catch(Exception& ex)
...@@ -509,7 +509,7 @@ void MBSlave::execute_tcp() ...@@ -509,7 +509,7 @@ void MBSlave::execute_tcp()
state ^= true; state ^= true;
try try
{ {
shm->localSaveState(ditRespond,respond_id,state,getId()); shm->localSetValue(itRespond,respond_id,state,getId());
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -522,7 +522,7 @@ void MBSlave::execute_tcp() ...@@ -522,7 +522,7 @@ void MBSlave::execute_tcp()
{ {
try try
{ {
shm->localSaveValue(aitAskCount,askcount_id,askCount,getId()); shm->localSetValue(itAskCount,askcount_id,askCount,getId());
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -712,7 +712,7 @@ void MBSlave::sensorInfo( UniSetTypes::SensorMessage* sm ) ...@@ -712,7 +712,7 @@ void MBSlave::sensorInfo( UniSetTypes::SensorMessage* sm )
p->stype == UniversalIO::DI ) p->stype == UniversalIO::DI )
{ {
uniset_rwmutex_wrlock lock(p->val_lock); uniset_rwmutex_wrlock lock(p->val_lock);
p->value = sm->state ? 1 : 0; p->value = sm->value ? 1 : 0;
} }
else if( p->stype == UniversalIO::AO || else if( p->stype == UniversalIO::AO ||
p->stype == UniversalIO::AI ) p->stype == UniversalIO::AI )
...@@ -893,14 +893,11 @@ void MBSlave::initIterators() ...@@ -893,14 +893,11 @@ void MBSlave::initIterators()
{ {
IOMap::iterator it=iomap.begin(); IOMap::iterator it=iomap.begin();
for( ; it!=iomap.end(); it++ ) for( ; it!=iomap.end(); it++ )
{ shm->initIterator(it->second.ioit);
shm->initDIterator(it->second.dit);
shm->initAIterator(it->second.ait);
}
shm->initAIterator(aitHeartBeat); shm->initIterator(itHeartBeat);
shm->initAIterator(aitAskCount); shm->initIterator(itAskCount);
shm->initDIterator(ditRespond); shm->initIterator(itRespond);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MBSlave::help_print( int argc, const char* const* argv ) void MBSlave::help_print( int argc, const char* const* argv )
......
...@@ -174,13 +174,13 @@ class MBSlave: ...@@ -174,13 +174,13 @@ class MBSlave:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::ObjectId test_id; UniSetTypes::ObjectId test_id;
IOController::IOStateList::iterator aitAskCount; IOController::IOStateList::iterator itAskCount;
UniSetTypes::ObjectId askcount_id; UniSetTypes::ObjectId askcount_id;
IOController::DIOStateList::iterator ditRespond; IOController::IOStateList::iterator itRespond;
UniSetTypes::ObjectId respond_id; UniSetTypes::ObjectId respond_id;
bool respond_invert; bool respond_invert;
......
...@@ -19,15 +19,10 @@ SMViewer::~SMViewer() ...@@ -19,15 +19,10 @@ SMViewer::~SMViewer()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void SMViewer::run() void SMViewer::run()
{ {
IOController_i::DSensorInfoSeq_var dmap = shm->getDigitalSensorsMap(); IOController_i::SensorInfoSeq_var amap = shm->getSensorsMap();
IOController_i::ASensorInfoSeq_var amap = shm->getAnalogSensorsMap();
IONotifyController_i::ThresholdsListSeq_var tlst = shm->getThresholdsList(); IONotifyController_i::ThresholdsListSeq_var tlst = shm->getThresholdsList();
try try
{ updateDSensors(dmap,getSharedMemoryID()); { updateSensors(amap,getSharedMemoryID());
}catch(...){};
try
{ updateASensors(amap,getSharedMemoryID());
}catch(...){} }catch(...){}
try try
......
...@@ -30,7 +30,6 @@ void SharedMemory::help_print( int argc, const char* const* argv ) ...@@ -30,7 +30,6 @@ void SharedMemory::help_print( int argc, const char* const* argv )
cout << "--sm-no-history - отключить ведение истории (аварийного следа)" << endl; cout << "--sm-no-history - отключить ведение истории (аварийного следа)" << endl;
cout << "--pulsar-id - датчик 'мигания'" << endl; cout << "--pulsar-id - датчик 'мигания'" << endl;
cout << "--pulsar-msec - период 'мигания'. По умолчанию: 5000." << endl; cout << "--pulsar-msec - период 'мигания'. По умолчанию: 5000." << endl;
cout << "--pulsar-iotype - [DI|DO]тип датчика для 'мигания'. По умолчанию DI." << endl;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ): SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ):
...@@ -41,7 +40,6 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ) ...@@ -41,7 +40,6 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
activated(false), activated(false),
workready(false), workready(false),
dblogging(false), dblogging(false),
iotypePulsar(UniversalIO::DI),
msecPulsar(0) msecPulsar(0)
{ {
mutex_start.setName(myname + "_mutex_start"); mutex_start.setName(myname + "_mutex_start");
...@@ -120,22 +118,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ) ...@@ -120,22 +118,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
throw SystemError(err.str()); throw SystemError(err.str());
} }
siPulsar.node = conf->getLocalNode(); siPulsar.node = conf->getLocalNode();
msecPulsar = conf->getArgPInt("--pulsar-msec",it.getProp("pulsar_msec"), 5000); msecPulsar = conf->getArgPInt("--pulsar-msec",it.getProp("pulsar_msec"), 5000);
string t = conf->getArgParam("--pulsar-iotype",it.getProp("pulsar_iotype"));
if( !t.empty() )
{
iotypePulsar = UniSetTypes::getIOType(t);
if( iotypePulsar == UniversalIO::UnknownIOType ||
iotypePulsar == UniversalIO::AI || iotypePulsar == UniversalIO::AO )
{
ostringstream err;
err << myname << ": Invalid iotype '" << t << "' for pulsar. Must be 'DI' or 'DO'";
dlog[Debug::CRIT] << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
}
} }
} }
...@@ -237,12 +220,9 @@ void SharedMemory::timerInfo( TimerMessage *tm ) ...@@ -237,12 +220,9 @@ void SharedMemory::timerInfo( TimerMessage *tm )
{ {
if( siPulsar.id != DefaultObjectId ) if( siPulsar.id != DefaultObjectId )
{ {
bool st = localGetState(ditPulsar,siPulsar); bool st = (bool)localGetValue(itPulsar,siPulsar);
st ^= true; st ^= true;
if( iotypePulsar == UniversalIO::DI ) localSetValue(itPulsar,siPulsar, (st ? 1:0), getId() );
localSaveState(ditPulsar,siPulsar,st,getId());
else if( iotypePulsar == UniversalIO::DO )
localSetState(ditPulsar,siPulsar,st,getId());
} }
} }
} }
...@@ -329,28 +309,22 @@ bool SharedMemory::activateObject() ...@@ -329,28 +309,22 @@ bool SharedMemory::activateObject()
uniset_rwmutex_wrlock l(mutex_act); uniset_rwmutex_wrlock l(mutex_act);
activated = false; activated = false;
} }
UniSetTypes::uniset_rwmutex_wrlock l(mutex_start); UniSetTypes::uniset_rwmutex_wrlock l(mutex_start);
res = IONotifyController_LT::activateObject(); res = IONotifyController_LT::activateObject();
// инициализируем указатели // инициализируем указатели
for( HeartBeatList::iterator it=hlist.begin(); it!=hlist.end(); ++it ) for( HeartBeatList::iterator it=hlist.begin(); it!=hlist.end(); ++it )
{ {
it->ait = myioEnd(); it->ioit = myioEnd();
it->dit = mydioEnd();
} }
ditPulsar = mydioEnd(); itPulsar = myioEnd();
// cerr << "history count=" << hist.size() << endl;
for( History::iterator it=hist.begin(); it!=hist.end(); ++it ) for( History::iterator it=hist.begin(); it!=hist.end(); ++it )
{ {
// cerr << "history for id=" << it->id << " count=" << it->hlst.size() << endl;
for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit ) for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit )
{ hit->ioit = myioEnd();
hit->ait = myioEnd();
hit->dit = mydioEnd();
}
} }
{ {
...@@ -395,17 +369,14 @@ void SharedMemory::checkHeartBeat() ...@@ -395,17 +369,14 @@ void SharedMemory::checkHeartBeat()
try try
{ {
si.id = it->a_sid; si.id = it->a_sid;
long val = localGetValue(it->ait,si); long val = localGetValue(it->ioit,si);
val --; val --;
if( val < -1 ) if( val < -1 )
val = -1; val = -1;
localSaveValue(it->ait,si,val,getId()); localSetValue(it->ioit,si,val,getId());
si.id = it->d_sid; si.id = it->d_sid;
if( val >= 0 ) localSetValue(it->ioit,si,( val >= 0 ? true:false),getId());
localSaveState(it->dit,si,true,getId());
else
localSaveState(it->dit,si,false,getId());
// проверяем нужна ли "перезагрузка" по данному датчику // проверяем нужна ли "перезагрузка" по данному датчику
if( wdt && it->ptReboot.getInterval() ) if( wdt && it->ptReboot.getInterval() )
...@@ -750,10 +721,8 @@ void SharedMemory::saveHistory() ...@@ -750,10 +721,8 @@ void SharedMemory::saveHistory()
{ {
for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit ) for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit )
{ {
if( hit->ait != myioEnd() ) if( hit->ioit != myioEnd() )
hit->add( localGetValue( hit->ait, hit->ait->second.si ), it->size ); hit->add( localGetValue( hit->ioit, hit->ioit->second.si ), it->size );
else if( hit->dit != mydioEnd() )
hit->add( localGetState( hit->dit, hit->dit->second.si ), it->size );
else else
{ {
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
...@@ -762,14 +731,7 @@ void SharedMemory::saveHistory() ...@@ -762,14 +731,7 @@ void SharedMemory::saveHistory()
try try
{ {
hit->add( localGetValue( hit->ait, si ), it->size ); hit->add( localGetValue( hit->ioit, si ), it->size );
continue;
}
catch(...){}
try
{
hit->add( localGetState( hit->dit, si ), it->size );
continue; continue;
} }
catch(...){} catch(...){}
...@@ -787,7 +749,6 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm ) ...@@ -787,7 +749,6 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm )
{ {
dlog[Debug::INFO] << myname << "(updateHistory): " dlog[Debug::INFO] << myname << "(updateHistory): "
<< " sid=" << sm->id << " sid=" << sm->id
<< " state=" << sm->state
<< " value=" << sm->value << " value=" << sm->value
<< endl; << endl;
} }
...@@ -799,12 +760,16 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm ) ...@@ -799,12 +760,16 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm )
if( sm->sensor_type == UniversalIO::DI || if( sm->sensor_type == UniversalIO::DI ||
sm->sensor_type == UniversalIO::DO ) sm->sensor_type == UniversalIO::DO )
{ {
bool st = it->fuse_invert ? !sm->state : sm->state; bool st = (bool)sm->value;
if( it->fuse_invert )
st^=true;
if( st ) if( st )
{ {
if( dlog.debugging(Debug::INFO) ) if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(updateHistory): HISTORY EVENT for " << (*it) << endl; dlog[Debug::INFO] << myname << "(updateHistory): HISTORY EVENT for " << (*it) << endl;
it->fuse_sec = sm->sm_tv_sec; it->fuse_sec = sm->sm_tv_sec;
it->fuse_usec = sm->sm_tv_usec; it->fuse_usec = sm->sm_tv_usec;
m_historySignal.emit( &(*it) ); m_historySignal.emit( &(*it) );
...@@ -812,13 +777,16 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm ) ...@@ -812,13 +777,16 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm )
} }
else if( sm->sensor_type == UniversalIO::AI || else if( sm->sensor_type == UniversalIO::AI ||
sm->sensor_type == UniversalIO::AO ) sm->sensor_type == UniversalIO::AO )
>>>>>>> Первый этап переделок в связи с переходом на getValue/setValue
{ {
if( sm->sensor_type == UniversalIO::DigitalInput || if( sm->sensor_type == UniversalIO::DigitalInput ||
sm->sensor_type == UniversalIO::DigitalOutput ) sm->sensor_type == UniversalIO::DigitalOutput )
{ {
bool st = it->fuse_invert ? !sm->state : sm->state; bool st = (bool)sm->value;
if( st )
if( it->fuse_invert )
st^=true;
if( !st )
{ {
if( dlog.debugging(Debug::INFO) ) if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(updateHistory): HISTORY EVENT for " << (*it) << endl; dlog[Debug::INFO] << myname << "(updateHistory): HISTORY EVENT for " << (*it) << endl;
......
...@@ -283,8 +283,7 @@ class SharedMemory: ...@@ -283,8 +283,7 @@ class SharedMemory:
UniSetTypes::ObjectId id; UniSetTypes::ObjectId id;
HBuffer buf; HBuffer buf;
IOStateList::iterator ait; IOStateList::iterator ioit;
DIOStateList::iterator dit;
void add( long val, size_t size ) void add( long val, size_t size )
{ {
...@@ -375,8 +374,7 @@ class SharedMemory: ...@@ -375,8 +374,7 @@ class SharedMemory:
UniSetTypes::ObjectId a_sid; // аналоговый счётчик UniSetTypes::ObjectId a_sid; // аналоговый счётчик
UniSetTypes::ObjectId d_sid; // дискретный датчик состояния процесса UniSetTypes::ObjectId d_sid; // дискретный датчик состояния процесса
IOStateList::iterator ait; IOStateList::iterator ioit;
DIOStateList::iterator dit;
int reboot_msec; /*!< Время в течение которого, процесс обязан подтвердить своё существование, int reboot_msec; /*!< Время в течение которого, процесс обязан подтвердить своё существование,
иначе будет произведена перезагрузка контроллера по WDT (в случае если он включён). иначе будет произведена перезагрузка контроллера по WDT (в случае если он включён).
...@@ -430,9 +428,8 @@ class SharedMemory: ...@@ -430,9 +428,8 @@ class SharedMemory:
bool isActivated(); bool isActivated();
DIOStateList::iterator ditPulsar; IOStateList::iterator itPulsar;
IOController_i::SensorInfo siPulsar; IOController_i::SensorInfo siPulsar;
UniversalIO::IOType iotypePulsar;
int msecPulsar; int msecPulsar;
UniSetTypes::uniset_mutex act_mutex; UniSetTypes::uniset_mutex act_mutex;
......
...@@ -410,7 +410,7 @@ void UNetExchange::step() ...@@ -410,7 +410,7 @@ void UNetExchange::step()
{ {
try try
{ {
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId()); shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch(Exception& ex) catch(Exception& ex)
...@@ -434,7 +434,7 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string& myna ...@@ -434,7 +434,7 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string& myna
if( respondInvert ) if( respondInvert )
resp = !resp; resp = !resp;
shm->localSaveState(ditRespond,sidRespond,resp,shm->ID()); shm->localSetValue(itRespond,sidRespond,resp,shm->ID());
} }
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -452,7 +452,7 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string& myna ...@@ -452,7 +452,7 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string& myna
if( r2 ) if( r2 )
l += r2->getLostPacketsNum(); l += r2->getLostPacketsNum();
shm->localSaveValue(aitLostPackets,sidLostPackets,l,shm->ID()); shm->localSetValue(itLostPackets,sidLostPackets,l,shm->ID());
} }
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -672,7 +672,7 @@ void UNetExchange::sigterm( int signo ) ...@@ -672,7 +672,7 @@ void UNetExchange::sigterm( int signo )
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void UNetExchange::initIterators() void UNetExchange::initIterators()
{ {
shm->initAIterator(aitHeartBeat); shm->initIterator(itHeartBeat);
if( sender ) if( sender )
sender->initIterators(); sender->initIterators();
if( sender2 ) if( sender2 )
......
...@@ -130,7 +130,7 @@ class UNetExchange: ...@@ -130,7 +130,7 @@ class UNetExchange:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::ObjectId test_id; UniSetTypes::ObjectId test_id;
int steptime; /*!< периодичность вызова step, [мсек] */ int steptime; /*!< периодичность вызова step, [мсек] */
...@@ -166,8 +166,8 @@ class UNetExchange: ...@@ -166,8 +166,8 @@ class UNetExchange:
inline void setLostPacketsID( UniSetTypes::ObjectId id ){ sidLostPackets = id; } inline void setLostPacketsID( UniSetTypes::ObjectId id ){ sidLostPackets = id; }
inline void initIterators( SMInterface* shm ) inline void initIterators( SMInterface* shm )
{ {
shm->initAIterator(aitLostPackets); shm->initIterator(itLostPackets);
shm->initDIterator(ditRespond); shm->initIterator(itRespond);
} }
// Сводная информация по двум каналам // Сводная информация по двум каналам
...@@ -175,10 +175,10 @@ class UNetExchange: ...@@ -175,10 +175,10 @@ class UNetExchange:
// хотя бы по одному каналу // хотя бы по одному каналу
// ( реализацию см. ReceiverInfo::step() ) // ( реализацию см. ReceiverInfo::step() )
UniSetTypes::ObjectId sidRespond; UniSetTypes::ObjectId sidRespond;
IOController::DIOStateList::iterator ditRespond; IOController::IOStateList::iterator itRespond;
bool respondInvert; bool respondInvert;
UniSetTypes::ObjectId sidLostPackets; UniSetTypes::ObjectId sidLostPackets;
IOController::IOStateList::iterator aitLostPackets; IOController::IOStateList::iterator itLostPackets;
}; };
typedef std::list<ReceiverInfo> ReceiverList; typedef std::list<ReceiverInfo> ReceiverList;
......
...@@ -132,28 +132,28 @@ void UNetReceiver::setRespondID( UniSetTypes::ObjectId id, bool invert ) ...@@ -132,28 +132,28 @@ void UNetReceiver::setRespondID( UniSetTypes::ObjectId id, bool invert )
{ {
sidRespond = id; sidRespond = id;
respondInvert = invert; respondInvert = invert;
shm->initDIterator(ditRespond); shm->initIterator(itRespond);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetReceiver::setLostPacketsID( UniSetTypes::ObjectId id ) void UNetReceiver::setLostPacketsID( UniSetTypes::ObjectId id )
{ {
sidLostPackets = id; sidLostPackets = id;
shm->initAIterator(aitLostPackets); shm->initIterator(itLostPackets);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetReceiver::setLockUpdate( bool st ) void UNetReceiver::setLockUpdate( bool st )
{ {
uniset_rwmutex_wrlock l(lockMutex); uniset_rwmutex_wrlock l(lockMutex);
lockUpdate = st; lockUpdate = st;
if( !st ) if( !st )
ptPrepare.reset(); ptPrepare.reset();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetReceiver::resetTimeout() void UNetReceiver::resetTimeout()
{ {
uniset_rwmutex_wrlock l(tmMutex); uniset_rwmutex_wrlock l(tmMutex);
ptRecvTimeout.reset(); ptRecvTimeout.reset();
trTimeout.change(false); trTimeout.change(false);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetReceiver::start() void UNetReceiver::start()
...@@ -189,7 +189,7 @@ void UNetReceiver::update() ...@@ -189,7 +189,7 @@ void UNetReceiver::update()
try try
{ {
bool r = respondInvert ? !isRecvOK() : isRecvOK(); bool r = respondInvert ? !isRecvOK() : isRecvOK();
shm->localSaveState(ditRespond,sidRespond,r,shm->ID()); shm->localSetValue(itRespond,sidRespond,( r ? 1:0 ),shm->ID());
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -201,7 +201,7 @@ void UNetReceiver::update() ...@@ -201,7 +201,7 @@ void UNetReceiver::update()
{ {
try try
{ {
shm->localSaveValue(aitLostPackets,sidLostPackets,getLostPacketsNum(),shm->ID()); shm->localSetValue(itLostPackets,sidLostPackets,getLostPacketsNum(),shm->ID());
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -288,8 +288,7 @@ void UNetReceiver::real_update() ...@@ -288,8 +288,7 @@ void UNetReceiver::real_update()
{ {
dlog[Debug::WARN] << myname << "(update): reinit cache for sid=" << id << endl; dlog[Debug::WARN] << myname << "(update): reinit cache for sid=" << id << endl;
ii.id = id; ii.id = id;
shm->initAIterator(ii.ait); shm->initIterator(ii.ioit);
shm->initDIterator(ii.dit);
} }
// обновление данных в SM (блокировано) // обновление данных в SM (блокировано)
...@@ -298,17 +297,8 @@ void UNetReceiver::real_update() ...@@ -298,17 +297,8 @@ void UNetReceiver::real_update()
if( lockUpdate ) if( lockUpdate )
continue; continue;
} }
if( ii.iotype == UniversalIO::DI ) shm->localSetValue(ii.ioit,id,val,shm->ID());
shm->localSaveState(ii.dit,id,val,shm->ID());
else if( ii.iotype == UniversalIO::AI )
shm->localSaveValue(ii.ait,id,val,shm->ID());
else if( ii.iotype == UniversalIO::AO )
shm->localSetValue(ii.ait,id,val,shm->ID());
else if( ii.iotype == UniversalIO::DO )
shm->localSetState(ii.dit,id,val,shm->ID());
else
dlog[Debug::CRIT] << myname << "(update): Unknown iotype for sid=" << id << endl;
} }
catch( UniSetTypes::Exception& ex) catch( UniSetTypes::Exception& ex)
{ {
...@@ -331,8 +321,7 @@ void UNetReceiver::real_update() ...@@ -331,8 +321,7 @@ void UNetReceiver::real_update()
{ {
dlog[Debug::WARN] << myname << "(update): reinit cache for sid=" << d.id << endl; dlog[Debug::WARN] << myname << "(update): reinit cache for sid=" << d.id << endl;
ii.id = d.id; ii.id = d.id;
shm->initAIterator(ii.ait); shm->initIterator(ii.ioit);
shm->initDIterator(ii.dit);
} }
// обновление данных в SM (блокировано) // обновление данных в SM (блокировано)
...@@ -342,16 +331,7 @@ void UNetReceiver::real_update() ...@@ -342,16 +331,7 @@ void UNetReceiver::real_update()
continue; continue;
} }
if( ii.iotype == UniversalIO::DI ) shm->localSetValue(ii.ioit,d.id,d.val,shm->ID());
shm->localSaveState(ii.dit,d.id,d.val,shm->ID());
else if( ii.iotype == UniversalIO::AI )
shm->localSaveValue(ii.ait,d.id,d.val,shm->ID());
else if( ii.iotype == UniversalIO::AO )
shm->localSetValue(ii.ait,d.id,d.val,shm->ID());
else if( ii.iotype == UniversalIO::DO )
shm->localSetState(ii.dit,d.id,d.val,shm->ID());
else
dlog[Debug::CRIT] << myname << "(update): Unknown iotype for sid=" << d.id << endl;
} }
catch( UniSetTypes::Exception& ex) catch( UniSetTypes::Exception& ex)
{ {
...@@ -409,7 +389,7 @@ void UNetReceiver::receive() ...@@ -409,7 +389,7 @@ void UNetReceiver::receive()
{ {
if( dlog.debugging(Debug::WARN) ) if( dlog.debugging(Debug::WARN) )
dlog[Debug::WARN] << myname << "(receive): catch ..." << std::endl; dlog[Debug::WARN] << myname << "(receive): catch ..." << std::endl;
} }
// делаем через промежуточную переменную // делаем через промежуточную переменную
// чтобы поскорее освободить mutex // чтобы поскорее освободить mutex
...@@ -519,15 +499,10 @@ bool UNetReceiver::recv() ...@@ -519,15 +499,10 @@ bool UNetReceiver::recv()
void UNetReceiver::initIterators() void UNetReceiver::initIterators()
{ {
for( ItemVec::iterator it=d_icache.begin(); it!=d_icache.end(); ++it ) for( ItemVec::iterator it=d_icache.begin(); it!=d_icache.end(); ++it )
{ shm->initIterator(it->ioit);
shm->initAIterator(it->ait);
shm->initDIterator(it->dit);
}
for( ItemVec::iterator it=a_icache.begin(); it!=a_icache.end(); ++it ) for( ItemVec::iterator it=a_icache.begin(); it!=a_icache.end(); ++it )
{ shm->initIterator(it->ioit);
shm->initAIterator(it->ait);
shm->initDIterator(it->dit);
}
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force ) void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force )
...@@ -547,8 +522,7 @@ void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force ) ...@@ -547,8 +522,7 @@ void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force )
{ {
d.id = pack.d_id[i]; d.id = pack.d_id[i];
d.iotype = conf->getIOType(d.id); d.iotype = conf->getIOType(d.id);
shm->initAIterator(d.ait); shm->initIterator(d.ioit);
shm->initDIterator(d.dit);
} }
} }
} }
...@@ -569,8 +543,7 @@ void UNetReceiver::initACache( UniSetUDP::UDPMessage& pack, bool force ) ...@@ -569,8 +543,7 @@ void UNetReceiver::initACache( UniSetUDP::UDPMessage& pack, bool force )
{ {
d.id = pack.a_dat[i].id; d.id = pack.a_dat[i].id;
d.iotype = conf->getIOType(d.id); d.iotype = conf->getIOType(d.id);
shm->initAIterator(d.ait); shm->initIterator(d.ioit);
shm->initDIterator(d.dit);
} }
} }
} }
......
...@@ -125,10 +125,10 @@ class UNetReceiver ...@@ -125,10 +125,10 @@ class UNetReceiver
unsigned long lostPackets; /*!< счётчик потерянных пакетов */ unsigned long lostPackets; /*!< счётчик потерянных пакетов */
UniSetTypes::ObjectId sidRespond; UniSetTypes::ObjectId sidRespond;
IOController::DIOStateList::iterator ditRespond; IOController::IOStateList::iterator itRespond;
bool respondInvert; bool respondInvert;
UniSetTypes::ObjectId sidLostPackets; UniSetTypes::ObjectId sidLostPackets;
IOController::IOStateList::iterator aitLostPackets; IOController::IOStateList::iterator itLostPackets;
bool activated; bool activated;
...@@ -171,13 +171,11 @@ class UNetReceiver ...@@ -171,13 +171,11 @@ class UNetReceiver
struct ItemInfo struct ItemInfo
{ {
long id; long id;
IOController::IOStateList::iterator ait; IOController::IOStateList::iterator ioit;
IOController::DIOStateList::iterator dit;
UniversalIO::IOType iotype; UniversalIO::IOType iotype;
ItemInfo(): ItemInfo():
id(UniSetTypes::DefaultObjectId), id(UniSetTypes::DefaultObjectId),iotype(UniversalIO::UnknownIOType){}
iotype(UniversalIO::UnknownIOType){}
}; };
typedef std::vector<ItemInfo> ItemVec; typedef std::vector<ItemInfo> ItemVec;
......
...@@ -88,18 +88,7 @@ void UNetSender::updateFromSM() ...@@ -88,18 +88,7 @@ void UNetSender::updateFromSM()
DMap::iterator it=dlist.begin(); DMap::iterator it=dlist.begin();
for( ; it!=dlist.end(); ++it ) for( ; it!=dlist.end(); ++it )
{ {
long value = 0; long value = shm->localGetValue(it->ioit,it->id);
if( it->iotype == UniversalIO::DI || it->iotype == UniversalIO::DO )
value = shm->localGetState(it->dit,it->id) ? 1 : 0;
else if( it->iotype == UniversalIO::AI || it->iotype == UniversalIO::AO )
value = shm->localGetValue(it->ait,it->id);
else
{
dlog[Debug::CRIT] << myname << "(update): Unknown iotype for sid=" << it->id << endl;
continue;
}
updateItem(it,value); updateItem(it,value);
} }
} }
...@@ -334,10 +323,7 @@ void UNetSender::initIterators() ...@@ -334,10 +323,7 @@ void UNetSender::initIterators()
{ {
DMap::iterator it=dlist.begin(); DMap::iterator it=dlist.begin();
for( ; it!=dlist.end(); it++ ) for( ; it!=dlist.end(); it++ )
{ shm->initIterator(it->ioit);
shm->initDIterator(it->dit);
shm->initAIterator(it->ait);
}
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetSender::askSensors( UniversalIO::UIOCommand cmd ) void UNetSender::askSensors( UniversalIO::UIOCommand cmd )
......
...@@ -33,8 +33,7 @@ class UNetSender ...@@ -33,8 +33,7 @@ class UNetSender
UniversalIO::IOType iotype; UniversalIO::IOType iotype;
UniSetTypes::ObjectId id; UniSetTypes::ObjectId id;
IOController::IOStateList::iterator ait; IOController::IOStateList::iterator ioit;
IOController::DIOStateList::iterator dit;
int pack_ind; int pack_ind;
friend std::ostream& operator<<( std::ostream& os, UItem& p ); friend std::ostream& operator<<( std::ostream& os, UItem& p );
......
...@@ -173,11 +173,12 @@ void UniExchange::execute() ...@@ -173,11 +173,12 @@ void UniExchange::execute()
{ {
try try
{ {
shm->localSaveState(it->conn_dit,it->sidConnection,ok,getId()); shm->localSetValue(it->conn_it,it->sidConnection,ok,getId());
} }
catch(...) catch(...)
{ {
dlog[Debug::CRIT]<< myname << "(execute): sensor not avalible " if( dlog.debugging(Debug::CRIT) )
dlog[Debug::CRIT]<< myname << "(execute): sensor not avalible "
<< conf->oind->getNameById( it->sidConnection) << conf->oind->getNameById( it->sidConnection)
<< endl; << endl;
} }
...@@ -214,8 +215,7 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI ...@@ -214,8 +215,7 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI
IOController_i::ShortMap* m = &(map[i]); IOController_i::ShortMap* m = &(map[i]);
if( reinit ) if( reinit )
{ {
shm->initDIterator(s->dit); shm->initIterator(s->ioit);
shm->initAIterator(s->ait);
s->type = m->type; s->type = m->type;
s->id = m->id; s->id = m->id;
} }
...@@ -224,14 +224,13 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI ...@@ -224,14 +224,13 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI
try try
{ {
if( m->type == UniversalIO::DI ) /*
shm->localSaveState( s->dit, m->id, (m->value ? true : false ), shm->ID() ); if( s->type == UniversalIO::DO || s->type == UniversalIO::DI )
else if( m->type == UniversalIO::DO ) shm->localSetValue( s->ioit, m->id, (m->value ? 1:0), shm->ID() );
shm->localSetState( s->dit, m->id, (m->value ? true : false ), shm->ID() ); else
else if( map[i].type == UniversalIO::AI ) shm->localSetValue( s->ioit, m->id, m->value, shm->ID() );
shm->localSaveValue( s->ait, m->id, m->value, shm->ID() ); */
else if( map[i].type == UniversalIO::AO ) shm->localSetValue( s->ioit, m->id, m->value, shm->ID() );
shm->localSetValue( s->ait, m->id, m->value, shm->ID() );
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
...@@ -275,24 +274,15 @@ void UniExchange::updateLocalData() ...@@ -275,24 +274,15 @@ void UniExchange::updateLocalData()
try try
{ {
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
if( it->type == UniversalIO::DI || it->val = shm->localGetValue( it->ioit, it->id );
it->type == UniversalIO::DO )
{
it->val = shm->localGetState( it->dit, it->id );
}
else if( it->type == UniversalIO::AI ||
it->type == UniversalIO::AO )
{
it->val = shm->localGetValue( it->ait, it->id );
}
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
dlog[Debug::INFO] << "(update): " << ex << endl; dlog[Debug::WARN] << "(update): " << ex << endl;
} }
catch( ... ) catch( ... )
{ {
dlog[Debug::INFO] << "(update): catch ..." << endl; dlog[Debug::WARN] << "(update): catch ..." << endl;
} }
} }
...@@ -302,10 +292,7 @@ void UniExchange::updateLocalData() ...@@ -302,10 +292,7 @@ void UniExchange::updateLocalData()
void UniExchange::initIterators() void UniExchange::initIterators()
{ {
for( SList::iterator it=mymap.begin(); it!=mymap.end(); ++it ) for( SList::iterator it=mymap.begin(); it!=mymap.end(); ++it )
{ shm->initIterator(it->ioit);
shm->initDIterator(it->dit);
shm->initAIterator(it->ait);
}
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void UniExchange::askSensors( UniversalIO::UIOCommand cmd ) void UniExchange::askSensors( UniversalIO::UIOCommand cmd )
......
...@@ -73,8 +73,7 @@ class UniExchange: ...@@ -73,8 +73,7 @@ class UniExchange:
type(UniversalIO::UnknownIOType) type(UniversalIO::UnknownIOType)
{} {}
IOController::DIOStateList::iterator dit; IOController::IOStateList::iterator ioit;
IOController::IOStateList::iterator ait;
long val; long val;
long id; long id;
UniversalIO::IOType type; UniversalIO::IOType type;
...@@ -92,7 +91,7 @@ class UniExchange: ...@@ -92,7 +91,7 @@ class UniExchange:
UniSetTypes::ObjectId id; UniSetTypes::ObjectId id;
UniSetTypes::ObjectId node; UniSetTypes::ObjectId node;
UniSetTypes::ObjectId sidConnection; /*!< датчик связи */ UniSetTypes::ObjectId sidConnection; /*!< датчик связи */
IOController::DIOStateList::iterator conn_dit; IOController::IOStateList::iterator conn_it;
SList smap; SList smap;
void update(IOController_i::ShortMapSeq_var& map, SMInterface* shm ); void update(IOController_i::ShortMapSeq_var& map, SMInterface* shm );
......
...@@ -89,8 +89,7 @@ static const int NoSafety = -1; ...@@ -89,8 +89,7 @@ static const int NoSafety = -1;
// Зависимость (d - depend) // Зависимость (d - depend)
UniSetTypes::ObjectId d_id; /*!< идентификатор датчика, от которого зависит данный */ UniSetTypes::ObjectId d_id; /*!< идентификатор датчика, от которого зависит данный */
IOController::IOStateList::iterator d_ait; /*! итератор на датчик от которого зависит данный */ IOController::IOStateList::iterator d_ioit; /*! итератор на датчик от которого зависит данный */
IOController::DIOStateList::iterator d_dit; /*! итератор на датчик от которого зависит данный */
long d_value; /*!< разрешающее работу значение датчика от которого зависит данный */ long d_value; /*!< разрешающее работу значение датчика от которого зависит данный */
long d_off_value; /*!< блокирующее значение */ long d_off_value; /*!< блокирующее значение */
UniversalIO::IOType d_iotype; UniversalIO::IOType d_iotype;
...@@ -103,8 +102,7 @@ static const int NoSafety = -1; ...@@ -103,8 +102,7 @@ static const int NoSafety = -1;
IONotifyController_i::ThresholdInfo ti; IONotifyController_i::ThresholdInfo ti;
IOController::AIOStateList::iterator t_ait; /*! итератор на датчик по которому формируется порог */ IOController::AIOStateList::iterator t_ait; /*! итератор на датчик по которому формируется порог */
IOController::IOStateList::iterator ait; IOController::IOStateList::iterator ioit;
IOController::DIOStateList::iterator dit;
UniSetTypes::uniset_rwmutex val_lock; /*!< блокировка на время "работы" со значением */ UniSetTypes::uniset_rwmutex val_lock; /*!< блокировка на время "работы" со значением */
friend std::ostream& operator<<(std::ostream& os, IOBase& inf ); friend std::ostream& operator<<(std::ostream& os, IOBase& inf );
......
...@@ -14,44 +14,21 @@ class SMInterface ...@@ -14,44 +14,21 @@ class SMInterface
UniSetTypes::ObjectId myid, IONotifyController* ic=0 ); UniSetTypes::ObjectId myid, IONotifyController* ic=0 );
~SMInterface(); ~SMInterface();
void setState ( UniSetTypes::ObjectId, bool state );
void setValue ( UniSetTypes::ObjectId, long value ); void setValue ( UniSetTypes::ObjectId, long value );
bool saveState ( IOController_i::SensorInfo& si, bool state, UniversalIO::IOType type, UniSetTypes::ObjectId supplier );
bool saveValue ( IOController_i::SensorInfo& si, long value, UniversalIO::IOType type, UniSetTypes::ObjectId supplier );
bool saveLocalState ( UniSetTypes::ObjectId id, bool state, UniversalIO::IOType type=UniversalIO::DI );
bool saveLocalValue ( UniSetTypes::ObjectId id, long value, UniversalIO::IOType type=UniversalIO::AI );
void setUndefinedState( IOController_i::SensorInfo& si, bool undefined, UniSetTypes::ObjectId supplier ); void setUndefinedState( IOController_i::SensorInfo& si, bool undefined, UniSetTypes::ObjectId supplier );
long getValue ( UniSetTypes::ObjectId id ); long getValue ( UniSetTypes::ObjectId id );
bool getState ( UniSetTypes::ObjectId id );
void askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, void askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId ); UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
IOController_i::DSensorInfoSeq* getDigitalSensorsMap(); IOController_i::SensorInfoSeq* getSensorsMap();
IOController_i::ASensorInfoSeq* getAnalogSensorsMap();
IONotifyController_i::ThresholdsListSeq* getThresholdsList(); IONotifyController_i::ThresholdsListSeq* getThresholdsList();
void localSaveValue( IOController::IOStateList::iterator& it, void localSetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid, UniSetTypes::ObjectId sid,
CORBA::Long newvalue, UniSetTypes::ObjectId sup_id ); CORBA::Long newvalue, UniSetTypes::ObjectId sup_id );
void localSaveState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id );
void localSetState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id );
void localSetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Long value, UniSetTypes::ObjectId sup_id );
bool localGetState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid );
long localGetValue( IOController::IOStateList::iterator& it, long localGetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid ); UniSetTypes::ObjectId sid );
...@@ -63,10 +40,8 @@ class SMInterface ...@@ -63,10 +40,8 @@ class SMInterface
bool undefined, UniSetTypes::ObjectId sid ); bool undefined, UniSetTypes::ObjectId sid );
// специальные функции // специальные функции
IOController::DIOStateList::iterator dioEnd();
IOController::IOStateList::iterator ioEnd(); IOController::IOStateList::iterator ioEnd();
void initAIterator( IOController::IOStateList::iterator& it ); void initIterator( IOController::IOStateList::iterator& it );
void initDIterator( IOController::DIOStateList::iterator& it );
bool exist(); bool exist();
bool waitSMready( int msec, int pause=5000 ); bool waitSMready( int msec, int pause=5000 );
......
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/* /*
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE. DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
ALL YOUR CHANGES WILL BE LOST. ALL YOUR CHANGES WILL BE LOST.
НЕ РЕДАКТИРУЙТЕ ЭТОТ ФАЙЛ. ЭТОТ ФАЙЛ СОЗДАН АВТОМАТИЧЕСКИ. НЕ РЕДАКТИРУЙТЕ ЭТОТ ФАЙЛ. ЭТОТ ФАЙЛ СОЗДАН АВТОМАТИЧЕСКИ.
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ. ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// generate timestamp: 2013-12-10+04:00 // generate timestamp: 2013-12-15+04:00
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef UObject_SK_H_ #ifndef UObject_SK_H_
#define UObject_SK_H_ #define UObject_SK_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include <string>
#include "UniSetObject.h" #include "UniSetObject.h"
#include "LT_Object.h" #include "LT_Object.h"
#include "UniXML.h" #include "UniXML.h"
#include "Trigger.h" #include "Trigger.h"
#include "DebugStream.h" #include "SMInterface.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class UObject_SK: class UObject_SK:
public UniSetObject, public UniSetObject,
public LT_Object public LT_Object
{ {
public: public:
UObject_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("UObject"), const std::string& argprefix="" ); UObject_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("UObject"),
UniSetTypes::ObjectId shmID = UniSetTypes::DefaultObjectId );
UObject_SK(); UObject_SK();
virtual ~UObject_SK(); virtual ~UObject_SK();
bool alarm( UniSetTypes::ObjectId sid, bool state ); bool alarm( UniSetTypes::ObjectId sid, bool state );
bool getState( UniSetTypes::ObjectId sid );
long getValue( UniSetTypes::ObjectId sid ); long getValue( UniSetTypes::ObjectId sid );
void setValue( UniSetTypes::ObjectId sid, long value ); void setValue( UniSetTypes::ObjectId sid, long value );
void setState( UniSetTypes::ObjectId sid, bool state ); void askSensor( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void updateValues(); void updateValues();
void setMsg( UniSetTypes::ObjectId code, bool state ); void setMsg( UniSetTypes::ObjectId code, bool state );
DebugStream dlog; DebugStream dlog;
void init_dlog(DebugStream& dlog); void init_dlog(DebugStream& dlog);
void updateValues();
// Используемые идентификаторы void setInfo( UniSetTypes::ObjectId code, bool state );
// Используемые идентификаторы сообщений
// Текущее значение и предыдущее значение
// --- public variables ---
// --- end of public variables ---
protected: protected:
// --- protected variables ---
// ---- end of protected variables ----
virtual void callback(); virtual void callback();
virtual void processingMessage( UniSetTypes::VoidMessage* msg ); virtual void processingMessage( UniSetTypes::VoidMessage* msg );
virtual void sysCommand( UniSetTypes::SystemMessage* sm ); virtual void sysCommand( UniSetTypes::SystemMessage* sm );
virtual void askSensors( UniversalIO::UIOCommand cmd ){} virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){} virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){};
virtual void timerInfo( UniSetTypes::TimerMessage* tm ){} virtual void timerInfo( UniSetTypes::TimerMessage* tm ){};
virtual void sigterm( int signo ); virtual void sigterm( int signo );
virtual bool activateObject(); virtual bool activateObject();
virtual void testMode( bool state ); virtual void testMode( bool state );
void updatePreviousValues(); void updatePreviousValues();
void checkSensors(); void checkSensors();
void updateOutputs( bool force ); void updateOutputs( bool force );
bool checkTestMode();
void preAskSensors( UniversalIO::UIOCommand cmd );
void preSensorInfo( UniSetTypes::SensorMessage* sm ); void preSensorInfo( UniSetTypes::SensorMessage* sm );
void preTimerInfo( UniSetTypes::TimerMessage* tm ); void preTimerInfo( UniSetTypes::TimerMessage* tm );
void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId ); void waitSM( int wait_msec );
void resetMsg(); void resetMsg();
Trigger trResetMsg; Trigger trResetMsg;
...@@ -95,37 +71,24 @@ class UObject_SK: ...@@ -95,37 +71,24 @@ class UObject_SK:
int sleep_msec; /*!< пауза между итерациями */ int sleep_msec; /*!< пауза между итерациями */
bool active; bool active;
bool isTestMode;
UniSetTypes::ObjectId smTestID; /*!< идентификатор датчика для тестирования готовности SM */ Trigger trTestMode;
UniSetTypes::ObjectId idTestMode_S; /*!< идентификатор для флага тестовго режима (для всех) */
// управление датчиком "сердцебиения" UniSetTypes::ObjectId idLocalTestMode_S; /*!< идентификатор для флага тестовго режима (для данного узла) */
PassiveTimer ptHeartBeat; /*! < период "сердцебиения" */ bool in_TestMode_S;
UniSetTypes::ObjectId idHeartBeat; /*! < идентификатор датчика (AI) "сердцебиения" */ bool in_LocalTestMode_S;
int maxHeartBeat; /*! < сохраняемое значение */
xmlNode* confnode; xmlNode* confnode;
/*! получить числовое свойство из конф. файла по привязанной confnode */ SMInterface shm;
int getIntProp(const std::string& name) { return UniSetTypes::conf->getIntProp(confnode, name); }
/*! получить текстовое свойство из конф. файла по привязанной confnode */
inline const std::string getProp(const std::string& name) { return UniSetTypes::conf->getProp(confnode, name); }
int smReadyTimeout; /*!< время ожидания готовности SM */ int smReadyTimeout; /*!< время ожидания готовности SM */
bool activated; bool activated;
int activateTimeout; /*!< время ожидания готовности UniSetObject к работе */ int activateTimeout; /*!< время ожидания готовности UniSetObject к работе */
PassiveTimer ptStartUpTimeout; /*!< время на блокировку обработки WatchDog, если недавно был StartUp */ PassiveTimer ptStartUpTimeout; /*!< время на блокировку обработки WatchDog, если недавно был StartUp */
int askPause; /*!< пауза между неудачными попытками заказать датчики */
IOController_i::SensorInfo si;
private:
// --- private variables --- private:
// --- end of private variables ---
IOController_i::SensorInfo si;
bool end_private; // вспомогательное поле (для внутреннего использования при генерировании кода)
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -97,21 +97,8 @@ bool IOBase::check_depend( SMInterface* shm ) ...@@ -97,21 +97,8 @@ bool IOBase::check_depend( SMInterface* shm )
if( d_id == DefaultObjectId ) if( d_id == DefaultObjectId )
return true; return true;
if( d_iotype == UniversalIO::DI || d_iotype == UniversalIO::DO ) if( shm->localGetValue(d_ioit,d_id) != d_value )
{
if( shm->localGetState(d_dit,d_id) == (bool)d_value )
return true;
return false; return false;
}
if( d_iotype == UniversalIO::AI || d_iotype == UniversalIO::AO )
{
if( shm->localGetValue(d_ait,d_id) == d_value )
return true;
return false;
}
return true; return true;
} }
...@@ -123,7 +110,7 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force ...@@ -123,7 +110,7 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force
{ {
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
it->value = ChannelBreakValue; it->value = ChannelBreakValue;
shm->localSetUndefinedState(it->ait,true,it->si.id); shm->localSetUndefinedState(it->ioit,true,it->si.id);
return; return;
} }
...@@ -172,19 +159,11 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force ...@@ -172,19 +159,11 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force
{ {
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
if( it->value == ChannelBreakValue ) if( it->value == ChannelBreakValue )
shm->localSetUndefinedState(it->ait,false,it->si.id); shm->localSetUndefinedState(it->ioit,false,it->si.id);
if( force || it->value != val ) if( force || it->value != val )
{ {
if( it->stype == UniversalIO::AI ) shm->localSetValue( it->ioit,it->si.id,val,shm->ID() );
shm->localSaveValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::DO )
shm->localSetState( it->dit,it->si.id,(bool)val,shm->ID() );
else if( it->stype == UniversalIO::DI )
shm->localSaveState( it->dit,it->si.id,(bool)val,shm->ID() );
it->value = val; it->value = val;
} }
} }
...@@ -202,7 +181,7 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for ...@@ -202,7 +181,7 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for
{ {
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
it->value = ChannelBreakValue; it->value = ChannelBreakValue;
shm->localSetUndefinedState(it->ait,true,it->si.id); shm->localSetUndefinedState(it->ioit,true,it->si.id);
return; return;
} }
...@@ -230,19 +209,11 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for ...@@ -230,19 +209,11 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for
{ {
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
if( it->value == ChannelBreakValue ) if( it->value == ChannelBreakValue )
shm->localSetUndefinedState(it->ait,false,it->si.id); shm->localSetUndefinedState(it->ioit,false,it->si.id);
if( force || it->value != val ) if( force || it->value != val )
{ {
if( it->stype == UniversalIO::AI ) shm->localSetValue( it->ioit,it->si.id,val,shm->ID() );
shm->localSaveValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::DO )
shm->localSetState( it->dit,it->si.id,(bool)val,shm->ID() );
else if( it->stype == UniversalIO::DI )
shm->localSaveState( it->dit,it->si.id,(bool)val,shm->ID() );
it->value = val; it->value = val;
} }
} }
...@@ -265,15 +236,7 @@ void IOBase::processingAsDI( IOBase* it, bool set, SMInterface* shm, bool force ...@@ -265,15 +236,7 @@ void IOBase::processingAsDI( IOBase* it, bool set, SMInterface* shm, bool force
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
if( force || (bool)it->value!=set ) if( force || (bool)it->value!=set )
{ {
if( it->stype == UniversalIO::DI ) shm->localSetValue( it->ioit,it->si.id,(set ? 1:0),shm->ID() );
shm->localSaveState(it->dit,it->si.id,set,shm->ID());
else if( it->stype == UniversalIO::DO )
shm->localSetState(it->dit,it->si.id,set,shm->ID());
else if( it->stype == UniversalIO::AI )
shm->localSaveValue( it->ait,it->si.id,(set ? 1:0),shm->ID() );
else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,(set ? 1:0),shm->ID() );
it->value = set ? 1 : 0; it->value = set ? 1 : 0;
} }
} }
...@@ -290,11 +253,7 @@ long IOBase::processingAsAO( IOBase* it, SMInterface* shm, bool force ) ...@@ -290,11 +253,7 @@ long IOBase::processingAsAO( IOBase* it, SMInterface* shm, bool force )
if( force ) if( force )
{ {
if( it->stype == UniversalIO::DI || it->stype == UniversalIO::DO ) val = shm->localGetValue(it->ioit,it->si.id);
val = shm->localGetState(it->dit,it->si.id) ? 1 : 0;
else if( it->stype == UniversalIO::AI || it->stype == UniversalIO::AO )
val = shm->localGetValue(it->ait,it->si.id);
it->value = val; it->value = val;
} }
...@@ -342,12 +301,7 @@ bool IOBase::processingAsDO( IOBase* it, SMInterface* shm, bool force ) ...@@ -342,12 +301,7 @@ bool IOBase::processingAsDO( IOBase* it, SMInterface* shm, bool force )
bool set = it->value; bool set = it->value;
if( force ) if( force )
{ set = shm->localGetValue(it->ioit,it->si.id) ? true : false;
if( it->stype == UniversalIO::DI || it->stype == UniversalIO::DO )
set = shm->localGetState(it->dit,it->si.id);
else if( it->stype == UniversalIO::AI || it->stype == UniversalIO::AO )
set = shm->localGetValue(it->ait,it->si.id) ? true : false;
}
set = it->invert ? !set : set; set = it->invert ? !set : set;
return set; return set;
...@@ -364,7 +318,7 @@ float IOBase::processingFasAO( IOBase* it, SMInterface* shm, bool force ) ...@@ -364,7 +318,7 @@ float IOBase::processingFasAO( IOBase* it, SMInterface* shm, bool force )
if( force ) if( force )
{ {
val = shm->localGetValue(it->ait,it->si.id); val = shm->localGetValue(it->ioit,it->si.id);
it->value = val; it->value = val;
} }
...@@ -406,7 +360,7 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force ) ...@@ -406,7 +360,7 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
if( it->t_ai == DefaultObjectId ) if( it->t_ai == DefaultObjectId )
return; return;
long val = shm->localGetValue(it->ait,it->t_ai); long val = shm->localGetValue(it->ioit,it->t_ai);
bool set = it->value ? true : false; bool set = it->value ? true : false;
// cout << "val=" << val << " set=" << set << endl; // cout << "val=" << val << " set=" << set << endl;
...@@ -497,10 +451,8 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm, ...@@ -497,10 +451,8 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->f_ls = false; b->f_ls = false;
b->f_filter_iir = false; b->f_filter_iir = false;
shm->initAIterator(b->ait); shm->initIterator(b->ioit);
shm->initAIterator(b->d_ait); shm->initIterator(b->d_ioit);
shm->initDIterator(b->dit);
shm->initDIterator(b->d_dit);
string d_txt(it.getProp("depend")); string d_txt(it.getProp("depend"));
if( !d_txt.empty() ) if( !d_txt.empty() )
......
...@@ -7,5 +7,3 @@ libUniSetExtensions_la_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/in ...@@ -7,5 +7,3 @@ libUniSetExtensions_la_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/in
libUniSetExtensions_la_LIBADD = $(SIGC_LIBS) $(top_builddir)/lib/libUniSet.la libUniSetExtensions_la_LIBADD = $(SIGC_LIBS) $(top_builddir)/lib/libUniSet.la
libUniSetExtensions_la_SOURCES = Extensions.cc SMInterface.cc Calibration.cc SingleProcess.cc \ libUniSetExtensions_la_SOURCES = Extensions.cc SMInterface.cc Calibration.cc SingleProcess.cc \
IOBase.cc DigitalFilter.cc PID.cc MTR.cc VTypes.cc UObject_SK.cc IOBase.cc DigitalFilter.cc PID.cc MTR.cc VTypes.cc UObject_SK.cc
#UObject_SK.cc
\ No newline at end of file
...@@ -99,26 +99,6 @@ SMInterface::~SMInterface() ...@@ -99,26 +99,6 @@ SMInterface::~SMInterface()
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void SMInterface::setState ( UniSetTypes::ObjectId id, bool state )
{
IOController_i::SensorInfo si;
si.id = id;
si.node = conf->getLocalNode();
if( ic )
{
BEG_FUNC1(SMInterface::setState)
ic->fastSetState(si,state,myid);
return;
END_FUNC(SMInterface::setState)
}
BEG_FUNC1(SMInterface::setState)
ui->fastSetState(si,state,myid);
return;
END_FUNC(SMInterface::setState)
}
// --------------------------------------------------------------------------
void SMInterface::setValue ( UniSetTypes::ObjectId id, long value ) void SMInterface::setValue ( UniSetTypes::ObjectId id, long value )
{ {
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
...@@ -139,40 +119,6 @@ void SMInterface::setValue ( UniSetTypes::ObjectId id, long value ) ...@@ -139,40 +119,6 @@ void SMInterface::setValue ( UniSetTypes::ObjectId id, long value )
END_FUNC(SMInterface::setValue) END_FUNC(SMInterface::setValue)
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool SMInterface::saveState ( IOController_i::SensorInfo& si, bool state,
UniversalIO::IOType type, UniSetTypes::ObjectId sup_id )
{
if( ic )
{
BEG_FUNC1(SMInterface::saveState)
ic->fastSaveState(si,state,type,sup_id);
return true;
END_FUNC(SMInterface::saveState)
}
BEG_FUNC1(SMInterface::saveState)
ui->fastSaveState(si,state,type,sup_id);
return true;
END_FUNC(SMInterface::saveState)
}
// --------------------------------------------------------------------------
bool SMInterface::saveValue ( IOController_i::SensorInfo& si, long value,
UniversalIO::IOType type, UniSetTypes::ObjectId sup_id )
{
if( ic )
{
BEG_FUNC1(SMInterface::saveValue)
ic->fastSaveValue(si,value,type,sup_id);
return true;
END_FUNC(SMInterface::saveValue)
}
BEG_FUNC1(SMInterface::saveValue)
ui->fastSaveValue(si,value,type,sup_id);
return true;
END_FUNC(SMInterface::saveValue)
}
// --------------------------------------------------------------------------
long SMInterface::getValue ( UniSetTypes::ObjectId id ) long SMInterface::getValue ( UniSetTypes::ObjectId id )
{ {
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
...@@ -191,42 +137,6 @@ long SMInterface::getValue ( UniSetTypes::ObjectId id ) ...@@ -191,42 +137,6 @@ long SMInterface::getValue ( UniSetTypes::ObjectId id )
END_FUNC(SMInterface::getValue) END_FUNC(SMInterface::getValue)
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool SMInterface::getState ( UniSetTypes::ObjectId id )
{
IOController_i::SensorInfo si;
si.id = id;
si.node = conf->getLocalNode();
if( ic )
{
BEG_FUNC1(SMInterface::getState)
return ic->getState(si);
END_FUNC(SMInterface::getState)
}
BEG_FUNC1(SMInterface::getState)
return ui->getState(si.id,si.node);
END_FUNC(SMInterface::getState)
}
// --------------------------------------------------------------------------
bool SMInterface::saveLocalState( UniSetTypes::ObjectId id, bool state,
UniversalIO::IOType type )
{
IOController_i::SensorInfo si;
si.id = id;
si.node = conf->getLocalNode();
return saveState(si,state,type,myid);
}
// --------------------------------------------------------------------------
bool SMInterface::saveLocalValue ( UniSetTypes::ObjectId id, long value,
UniversalIO::IOType type )
{
IOController_i::SensorInfo si;
si.id = id;
si.node = conf->getLocalNode();
return saveValue(si,value,type,myid);
}
// --------------------------------------------------------------------------
void SMInterface::askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId backid ) void SMInterface::askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId backid )
{ {
IOController_i::SensorInfo_var si; IOController_i::SensorInfo_var si;
...@@ -250,32 +160,18 @@ void SMInterface::askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand c ...@@ -250,32 +160,18 @@ void SMInterface::askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand c
END_FUNC(SMInterface::askSensor) END_FUNC(SMInterface::askSensor)
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
IOController_i::DSensorInfoSeq* SMInterface::getDigitalSensorsMap() IOController_i::SensorInfoSeq* SMInterface::getSensorsMap()
{ {
if( ic ) if( ic )
{ {
BEG_FUNC1(SMInterface::getDigitalSensorsMap) BEG_FUNC1(SMInterface::getSensorsMap)
return ic->getDigitalSensorsMap(); return ic->getSensorsMap();
END_FUNC(SMInterface::getDigitalSensorsMap) END_FUNC(SMInterface::getSensorsMap)
} }
BEG_FUNC(SMInterface::getDigitalSensorsMap) BEG_FUNC(SMInterface::getSensorsMap)
return shm->getDigitalSensorsMap(); return shm->getSensorsMap();
END_FUNC(SMInterface::getDigitalSensorsMap) END_FUNC(SMInterface::getSensorsMap)
}
// --------------------------------------------------------------------------
IOController_i::ASensorInfoSeq* SMInterface::getAnalogSensorsMap()
{
if( ic )
{
BEG_FUNC1(SMInterface::getAnalogSensorsMap)
return ic->getAnalogSensorsMap();
END_FUNC(SMInterface::getAnalogSensorsMap)
}
BEG_FUNC(SMInterface::getAnalogSensorsMap)
return shm->getAnalogSensorsMap();
END_FUNC(SMInterface::getAnalogSensorsMap)
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
IONotifyController_i::ThresholdsListSeq* SMInterface::getThresholdsList() IONotifyController_i::ThresholdsListSeq* SMInterface::getThresholdsList()
...@@ -319,63 +215,12 @@ bool SMInterface::exist() ...@@ -319,63 +215,12 @@ bool SMInterface::exist()
return ui->isExist(shmID); return ui->isExist(shmID);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
IOController::DIOStateList::iterator SMInterface::dioEnd()
{
CHECK_IC_PTR(dioEnd)
return ic->dioEnd();
}
// --------------------------------------------------------------------------
IOController::IOStateList::iterator SMInterface::ioEnd() IOController::IOStateList::iterator SMInterface::ioEnd()
{ {
CHECK_IC_PTR(ioEnd) CHECK_IC_PTR(ioEnd)
return ic->ioEnd(); return ic->ioEnd();
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void SMInterface::localSaveValue( IOController::IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Long nval, UniSetTypes::ObjectId sup_id )
{
if( !ic )
{
saveLocalValue( sid, nval );
return;
}
IOController_i::SensorInfo si;
si.id = sid;
si.node = conf->getLocalNode();
ic->localSaveValue(it,si,nval,sup_id);
}
// --------------------------------------------------------------------------
void SMInterface::localSaveState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Boolean nstate, UniSetTypes::ObjectId sup_id )
{
if( !ic )
{
saveLocalState( sid, nstate );
return;
}
IOController_i::SensorInfo si;
si.id = sid;
si.node = conf->getLocalNode();
ic->localSaveState(it,si,nstate,sup_id);
}
// --------------------------------------------------------------------------
void SMInterface::localSetState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id )
{
if( !ic )
return setState( sid, newstate );
// CHECK_IC_PTR(localSetState)
IOController_i::SensorInfo si;
si.id = sid;
si.node = conf->getLocalNode();
ic->localSetState(it,si,newstate,sup_id);
}
// --------------------------------------------------------------------------
void SMInterface::localSetValue( IOController::IOStateList::iterator& it, void SMInterface::localSetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid, UniSetTypes::ObjectId sid,
CORBA::Long value, UniSetTypes::ObjectId sup_id ) CORBA::Long value, UniSetTypes::ObjectId sup_id )
...@@ -390,18 +235,6 @@ void SMInterface::localSetValue( IOController::IOStateList::iterator& it, ...@@ -390,18 +235,6 @@ void SMInterface::localSetValue( IOController::IOStateList::iterator& it,
ic->localSetValue(it,si,value,sup_id); ic->localSetValue(it,si,value,sup_id);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool SMInterface::localGetState( IOController::DIOStateList::iterator& it, UniSetTypes::ObjectId sid )
{
// CHECK_IC_PTR(localGetState)
if( !ic )
return getState(sid);
IOController_i::SensorInfo si;
si.id = sid;
si.node = conf->getLocalNode();
return ic->localGetState(it,si);
}
// --------------------------------------------------------------------------
long SMInterface::localGetValue( IOController::IOStateList::iterator& it, UniSetTypes::ObjectId sid ) long SMInterface::localGetValue( IOController::IOStateList::iterator& it, UniSetTypes::ObjectId sid )
{ {
if( !ic ) if( !ic )
...@@ -434,20 +267,10 @@ void SMInterface::localSetUndefinedState( IOController::IOStateList::iterator& i ...@@ -434,20 +267,10 @@ void SMInterface::localSetUndefinedState( IOController::IOStateList::iterator& i
ic->localSetUndefinedState(it,undefined,si); ic->localSetUndefinedState(it,undefined,si);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void SMInterface::initAIterator( IOController::IOStateList::iterator& it ) void SMInterface::initIterator( IOController::IOStateList::iterator& it )
{ {
if( ic ) if( ic )
it = ic->ioEnd(); it = ic->ioEnd();
// else
// cerr << "(SMInterface::initAIterator): ic=NULL" << endl;
}
// --------------------------------------------------------------------------
void SMInterface::initDIterator( IOController::DIOStateList::iterator& it )
{
if( ic )
it = ic->dioEnd();
// else
// cerr << "(SMInterface::initDIterator): ic=NULL" << endl;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool SMInterface::waitSMready( int ready_timeout, int pmsec ) bool SMInterface::waitSMready( int ready_timeout, int pmsec )
...@@ -479,7 +302,7 @@ bool SMInterface::waitSMworking( UniSetTypes::ObjectId sid, int msec, int pmsec ...@@ -479,7 +302,7 @@ bool SMInterface::waitSMworking( UniSetTypes::ObjectId sid, int msec, int pmsec
{ {
try try
{ {
getState(sid); getValue(sid);
sm_ready = true; sm_ready = true;
break; break;
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ. ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// generate timestamp: 2013-12-10+04:00 // generate timestamp: 2013-12-15+04:00
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include "Configuration.h" #include "Configuration.h"
#include "Exceptions.h" #include "Exceptions.h"
...@@ -300,11 +300,6 @@ void UObject_SK::sysCommand( SystemMessage* _sm ) ...@@ -300,11 +300,6 @@ void UObject_SK::sysCommand( SystemMessage* _sm )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UObject_SK::setState( UniSetTypes::ObjectId _sid, bool _state )
{
setValue(_sid, _state ? 1 : 0 );
}
// -----------------------------------------------------------------------------
void UObject_SK::sigterm( int signo ) void UObject_SK::sigterm( int signo )
{ {
...@@ -399,7 +394,7 @@ void UObject_SK::callback() ...@@ -399,7 +394,7 @@ void UObject_SK::callback()
// "сердцебиение" // "сердцебиение"
if( idHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() ) if( idHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
{ {
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AI); ui.setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
...@@ -445,32 +440,24 @@ void UObject_SK::preSensorInfo( UniSetTypes::SensorMessage* _sm ) ...@@ -445,32 +440,24 @@ void UObject_SK::preSensorInfo( UniSetTypes::SensorMessage* _sm )
sensorInfo(_sm); sensorInfo(_sm);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UObject_SK::askState( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node ) void UObject_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{
ui.askRemoteSensor(_sid,_cmd,_node,getId());
}
// -----------------------------------------------------------------------------
void UObject_SK::askValue( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{ {
ui.askRemoteSensor(_sid,_cmd,_node,getId()); ui.askRemoteSensor(_sid,_cmd,_node,getId());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool UObject_SK::getState( UniSetTypes::ObjectId _sid )
{
return (bool)getValue(_sid);
}
// -----------------------------------------------------------------------------
long UObject_SK::getValue( UniSetTypes::ObjectId _sid ) long UObject_SK::getValue( UniSetTypes::ObjectId _sid )
{ {
try try
{ {
unideb[Debug::CRIT] << myname << "(getState): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid=" if( unideb.debugging(Debug::CRIT) )
<< _sid << endl; unideb[Debug::CRIT] << myname << "(getValue): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid="
<< _sid << endl;
} }
catch(Exception& ex) catch(Exception& ex)
{ {
unideb[Debug::CRIT] << myname << "(getState): " << ex << endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(getValue): " << ex << endl;
throw; throw;
} }
......
...@@ -216,9 +216,8 @@ class IONotifyController: ...@@ -216,9 +216,8 @@ class IONotifyController:
typedef std::map<UniSetTypes::KeyType,ThresholdsListInfo> AskThresholdMap; typedef std::map<UniSetTypes::KeyType,ThresholdsListInfo> AskThresholdMap;
virtual void localSetValue( IOController::IOStateList::iterator& it, virtual void localSetValue( IOController::IOStateList::iterator& it,
const IOController_i::SensorInfo& si, const IOController_i::SensorInfo& si,
CORBA::Long value, UniSetTypes::ObjectId sup_id ); CORBA::Long value, UniSetTypes::ObjectId sup_id );
protected: protected:
IONotifyController(); IONotifyController();
virtual bool activateObject(); virtual bool activateObject();
......
...@@ -60,7 +60,7 @@ class ObjectIndex_XML: ...@@ -60,7 +60,7 @@ class ObjectIndex_XML:
unsigned int read_nodes( UniXML& xml, const std::string sec, unsigned int ind ); unsigned int read_nodes( UniXML& xml, const std::string sec, unsigned int ind );
private: private:
typedef std::map<std::string, ObjectId> MapObjectKey; typedef std::map<std::string, ObjectId> MapObjectKey;
MapObjectKey mok; // для обратного писка MapObjectKey mok; // для обратного писка
std::vector<ObjectInfo> omap; // для прямого поиска std::vector<ObjectInfo> omap; // для прямого поиска
......
...@@ -26,16 +26,15 @@ class ObjectIndex_idXML: ...@@ -26,16 +26,15 @@ class ObjectIndex_idXML:
protected: protected:
virtual void build( UniXML& xml ); virtual void build( UniXML& xml );
void read_section( UniXML& xml, const std::string& sec ); void read_section( UniXML& xml, const std::string sec );
void read_nodes( UniXML& xml, const std::string& sec ); void read_nodes( UniXML& xml, const std::string sec );
private: private:
typedef std::map<UniSetTypes::ObjectId, UniSetTypes::ObjectInfo> MapObjects; typedef std::map<UniSetTypes::ObjectId, UniSetTypes::ObjectInfo> MapObjects;
MapObjects omap; MapObjects omap;
// чтобы не хранить дублирующие структуры (ObjectInfo)
typedef std::map<std::string, UniSetTypes::ObjectId> MapObjectKey; typedef std::map<std::string, UniSetTypes::ObjectId> MapObjectKey;
MapObjectKey mok; // для обратного писка MapObjectKey mok; // для обратного писка
}; };
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
#endif #endif
...@@ -66,7 +66,7 @@ long UConnector::getValue( long id, long node )throw(UException) ...@@ -66,7 +66,7 @@ long UConnector::getValue( long id, long node )throw(UException)
if( node == UTypes::DefaultID ) if( node == UTypes::DefaultID )
node = conf->getLocalNode(); node = conf->getLocalNode();
UniversalIO::IOType t = conf->getIOType(id); UniversalIO::IOType t = conf->getIOType(id);
try try
{ {
...@@ -74,9 +74,6 @@ long UConnector::getValue( long id, long node )throw(UException) ...@@ -74,9 +74,6 @@ long UConnector::getValue( long id, long node )throw(UException)
{ {
case UniversalIO::DI: case UniversalIO::DI:
case UniversalIO::DO: case UniversalIO::DO:
return (ui->getState(id,node) ? 1 : 0);
break;
case UniversalIO::AI: case UniversalIO::AI:
case UniversalIO::AO: case UniversalIO::AO:
return ui->getValue(id,node); return ui->getValue(id,node);
...@@ -114,24 +111,15 @@ void UConnector::setValue( long id, long val, long node )throw(UException) ...@@ -114,24 +111,15 @@ void UConnector::setValue( long id, long val, long node )throw(UException)
if( node == UTypes::DefaultID ) if( node == UTypes::DefaultID )
node = conf->getLocalNode(); node = conf->getLocalNode();
UniversalIO::IOType t = conf->getIOType(id); UniversalIO::IOType t = conf->getIOType(id);
try try
{ {
switch(t) switch(t)
{ {
case UniversalIO::DI: case UniversalIO::DI:
ui->saveState(id,val,t,node);
break;
case UniversalIO::DO: case UniversalIO::DO:
ui->setState(id,val,node);
break;
case UniversalIO::AI: case UniversalIO::AI:
ui->saveValue(id,val,t,node);
break;
case UniversalIO::AO: case UniversalIO::AO:
ui->setValue(id,val,node); ui->setValue(id,val,node);
break; break;
......
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org). * This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.8 * Version 2.0.10
* *
* This file is not intended to be easily readable and contains a number of * This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make * coding conventions designed to improve portability and efficiency. Do not make
...@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { ...@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
} }
#else /* no cast-rank mode */ #else /* no cast-rank mode */
# define SWIG_AddCast # define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif #endif
...@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1, ...@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
/* /*
Check type equivalence in a name list like <name1>|<name2>|... Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/ */
SWIGRUNTIME int SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) { SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 0; int equiv = 1;
const char* te = tb + strlen(tb); const char* te = tb + strlen(tb);
const char* ne = nb; const char* ne = nb;
while (!equiv && *ne) { while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) { for (nb = ne; *ne; ++ne) {
if (*ne == '|') break; if (*ne == '|') break;
} }
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne; if (*ne) ++ne;
} }
return equiv; return equiv;
...@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { ...@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
/* /*
Check type equivalence in a name list like <name1>|<name2>|... Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb Return 0 if not equal, 1 if equal
*/ */
SWIGRUNTIME int SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) { SWIG_TypeEquiv(const char *nb, const char *tb) {
int equiv = 0; return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
} }
/* /*
Check the typename Check the typename
*/ */
...@@ -927,6 +916,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) ...@@ -927,6 +916,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
} }
#endif #endif
#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif
#if PY_VERSION_HEX < 0x02040000 #if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op) \ #define Py_VISIT(op) \
do { \ do { \
...@@ -1198,7 +1191,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), ...@@ -1198,7 +1191,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
/* Runtime API */ /* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
...@@ -1821,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) ...@@ -1821,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args)
static PyMethodDef static PyMethodDef
swigobject_methods[] = { swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
...@@ -2637,7 +2630,7 @@ void *SWIG_ReturnGlobalTypeList(void *); ...@@ -2637,7 +2630,7 @@ void *SWIG_ReturnGlobalTypeList(void *);
#endif #endif
SWIGRUNTIME swig_module_info * SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void) { SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
static void *type_pointer = (void *)0; static void *type_pointer = (void *)0;
/* first check if module already created */ /* first check if module already created */
if (!type_pointer) { if (!type_pointer) {
...@@ -2763,7 +2756,7 @@ SWIG_Python_TypeQuery(const char *type) ...@@ -2763,7 +2756,7 @@ SWIG_Python_TypeQuery(const char *type)
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
#endif #endif
} else { } else {
swig_module_info *swig_module = SWIG_Python_GetModule(); swig_module_info *swig_module = SWIG_GetModule(0);
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) { if (descriptor) {
#ifdef SWIGPY_USE_CAPSULE #ifdef SWIGPY_USE_CAPSULE
...@@ -2987,7 +2980,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; ...@@ -2987,7 +2980,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
#endif #endif
#define SWIG_name "_pyUConnector" #define SWIG_name "_pyUConnector"
#define SWIGVERSION 0x020008 #define SWIGVERSION 0x020010
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
...@@ -4158,7 +4151,6 @@ SWIG_InitializeModule(void *clientdata) { ...@@ -4158,7 +4151,6 @@ SWIG_InitializeModule(void *clientdata) {
size_t i; size_t i;
swig_module_info *module_head, *iter; swig_module_info *module_head, *iter;
int found, init; int found, init;
(void *)clientdata;
/* check to see if the circular list has been setup, if not, set it up */ /* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next==0) { if (swig_module.next==0) {
......
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org). * This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.9 * Version 2.0.10
* *
* This file is not intended to be easily readable and contains a number of * This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make * coding conventions designed to improve portability and efficiency. Do not make
...@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { ...@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
} }
#else /* no cast-rank mode */ #else /* no cast-rank mode */
# define SWIG_AddCast # define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif #endif
...@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1, ...@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
/* /*
Check type equivalence in a name list like <name1>|<name2>|... Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/ */
SWIGRUNTIME int SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) { SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 0; int equiv = 1;
const char* te = tb + strlen(tb); const char* te = tb + strlen(tb);
const char* ne = nb; const char* ne = nb;
while (!equiv && *ne) { while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) { for (nb = ne; *ne; ++ne) {
if (*ne == '|') break; if (*ne == '|') break;
} }
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne; if (*ne) ++ne;
} }
return equiv; return equiv;
...@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { ...@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
/* /*
Check type equivalence in a name list like <name1>|<name2>|... Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb Return 0 if not equal, 1 if equal
*/ */
SWIGRUNTIME int SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) { SWIG_TypeEquiv(const char *nb, const char *tb) {
int equiv = 0; return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
} }
/* /*
Check the typename Check the typename
*/ */
...@@ -1825,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) ...@@ -1825,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args)
static PyMethodDef static PyMethodDef
swigobject_methods[] = { swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
...@@ -2991,7 +2980,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; ...@@ -2991,7 +2980,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
#endif #endif
#define SWIG_name "_pyUExceptions" #define SWIG_name "_pyUExceptions"
#define SWIGVERSION 0x020009 #define SWIGVERSION 0x020010
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
......
...@@ -38,7 +38,7 @@ long UInterface::getValue( long id )throw(UException) ...@@ -38,7 +38,7 @@ long UInterface::getValue( long id )throw(UException)
{ {
if( !UniSetTypes::conf || !ui ) if( !UniSetTypes::conf || !ui )
throw USysError(); throw USysError();
UniversalIO::IOType t = UniSetTypes::conf->getIOType(id); UniversalIO::IOType t = UniSetTypes::conf->getIOType(id);
try try
{ {
...@@ -46,9 +46,6 @@ long UInterface::getValue( long id )throw(UException) ...@@ -46,9 +46,6 @@ long UInterface::getValue( long id )throw(UException)
{ {
case UniversalIO::DI: case UniversalIO::DI:
case UniversalIO::DO: case UniversalIO::DO:
return (ui->getState(id) ? 1 : 0);
break;
case UniversalIO::AI: case UniversalIO::AI:
case UniversalIO::AO: case UniversalIO::AO:
return ui->getValue(id); return ui->getValue(id);
...@@ -82,24 +79,15 @@ void UInterface::setValue( long id, long val )throw(UException) ...@@ -82,24 +79,15 @@ void UInterface::setValue( long id, long val )throw(UException)
{ {
if( !UniSetTypes::conf || !ui ) if( !UniSetTypes::conf || !ui )
throw USysError(); throw USysError();
UniversalIO::IOType t = UniSetTypes::conf->getIOType(id); UniversalIO::IOType t = UniSetTypes::conf->getIOType(id);
try try
{ {
switch(t) switch(t)
{ {
case UniversalIO::DI: case UniversalIO::DI:
ui->saveState(id,val,t);
break;
case UniversalIO::DO: case UniversalIO::DO:
ui->setState(id,val);
break;
case UniversalIO::AI: case UniversalIO::AI:
ui->saveValue(id,val,t);
break;
case UniversalIO::AO: case UniversalIO::AO:
ui->setValue(id,val); ui->setValue(id,val);
break; break;
......
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org). * This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.8 * Version 2.0.10
* *
* This file is not intended to be easily readable and contains a number of * This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make * coding conventions designed to improve portability and efficiency. Do not make
...@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { ...@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
} }
#else /* no cast-rank mode */ #else /* no cast-rank mode */
# define SWIG_AddCast # define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif #endif
...@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1, ...@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
/* /*
Check type equivalence in a name list like <name1>|<name2>|... Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/ */
SWIGRUNTIME int SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) { SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 0; int equiv = 1;
const char* te = tb + strlen(tb); const char* te = tb + strlen(tb);
const char* ne = nb; const char* ne = nb;
while (!equiv && *ne) { while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) { for (nb = ne; *ne; ++ne) {
if (*ne == '|') break; if (*ne == '|') break;
} }
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne; if (*ne) ++ne;
} }
return equiv; return equiv;
...@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { ...@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
/* /*
Check type equivalence in a name list like <name1>|<name2>|... Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb Return 0 if not equal, 1 if equal
*/ */
SWIGRUNTIME int SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) { SWIG_TypeEquiv(const char *nb, const char *tb) {
int equiv = 0; return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
} }
/* /*
Check the typename Check the typename
*/ */
...@@ -927,6 +916,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) ...@@ -927,6 +916,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
} }
#endif #endif
#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif
#if PY_VERSION_HEX < 0x02040000 #if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op) \ #define Py_VISIT(op) \
do { \ do { \
...@@ -1198,7 +1191,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), ...@@ -1198,7 +1191,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
/* Runtime API */ /* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
...@@ -1821,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) ...@@ -1821,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args)
static PyMethodDef static PyMethodDef
swigobject_methods[] = { swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
...@@ -2637,7 +2630,7 @@ void *SWIG_ReturnGlobalTypeList(void *); ...@@ -2637,7 +2630,7 @@ void *SWIG_ReturnGlobalTypeList(void *);
#endif #endif
SWIGRUNTIME swig_module_info * SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void) { SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
static void *type_pointer = (void *)0; static void *type_pointer = (void *)0;
/* first check if module already created */ /* first check if module already created */
if (!type_pointer) { if (!type_pointer) {
...@@ -2763,7 +2756,7 @@ SWIG_Python_TypeQuery(const char *type) ...@@ -2763,7 +2756,7 @@ SWIG_Python_TypeQuery(const char *type)
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
#endif #endif
} else { } else {
swig_module_info *swig_module = SWIG_Python_GetModule(); swig_module_info *swig_module = SWIG_GetModule(0);
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) { if (descriptor) {
#ifdef SWIGPY_USE_CAPSULE #ifdef SWIGPY_USE_CAPSULE
...@@ -2989,7 +2982,7 @@ static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0}; ...@@ -2989,7 +2982,7 @@ static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
#endif #endif
#define SWIG_name "_pyUniSet" #define SWIG_name "_pyUniSet"
#define SWIGVERSION 0x020008 #define SWIGVERSION 0x020010
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
...@@ -3832,27 +3825,22 @@ fail: ...@@ -3832,27 +3825,22 @@ fail:
SWIGINTERN PyObject *_wrap_new_UException__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { SWIGINTERN PyObject *_wrap_new_UException__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0; PyObject *resultobj = 0;
std::string arg1 ; std::string *arg1 = 0 ;
void *argp1 ; void *argp1 = 0 ;
int res1 = 0 ; int res1 = 0 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
UException *result = 0 ; UException *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_UException",&obj0)) SWIG_fail; if (!PyArg_ParseTuple(args,(char *)"O:new_UException",&obj0)) SWIG_fail;
{ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0); if (!SWIG_IsOK(res1)) {
if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UException" "', argument " "1"" of type '" "std::string const""'"); }
} if (!argp1) {
if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UException" "', argument " "1"" of type '" "std::string const &""'");
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UException" "', argument " "1"" of type '" "std::string const""'");
} else {
std::string * temp = reinterpret_cast< std::string * >(argp1);
arg1 = *temp;
if (SWIG_IsNewObj(res1)) delete temp;
}
} }
result = (UException *)new UException(arg1); arg1 = reinterpret_cast< std::string * >(argp1);
result = (UException *)new UException((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UException, SWIG_POINTER_NEW | 0 ); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UException, SWIG_POINTER_NEW | 0 );
return resultobj; return resultobj;
fail: fail:
...@@ -3919,7 +3907,7 @@ fail: ...@@ -3919,7 +3907,7 @@ fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UException'.\n" SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UException'.\n"
" Possible C/C++ prototypes are:\n" " Possible C/C++ prototypes are:\n"
" UException::UException()\n" " UException::UException()\n"
" UException::UException(std::string const)\n" " UException::UException(std::string const &)\n"
" UException::UException(char const *)\n"); " UException::UException(char const *)\n");
return 0; return 0;
} }
...@@ -4050,27 +4038,22 @@ fail: ...@@ -4050,27 +4038,22 @@ fail:
SWIGINTERN PyObject *_wrap_new_UTimeOut__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { SWIGINTERN PyObject *_wrap_new_UTimeOut__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0; PyObject *resultobj = 0;
std::string arg1 ; std::string *arg1 = 0 ;
void *argp1 ; void *argp1 = 0 ;
int res1 = 0 ; int res1 = 0 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
UTimeOut *result = 0 ; UTimeOut *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_UTimeOut",&obj0)) SWIG_fail; if (!PyArg_ParseTuple(args,(char *)"O:new_UTimeOut",&obj0)) SWIG_fail;
{ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0); if (!SWIG_IsOK(res1)) {
if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const""'"); }
} if (!argp1) {
if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const &""'");
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_UTimeOut" "', argument " "1"" of type '" "std::string const""'");
} else {
std::string * temp = reinterpret_cast< std::string * >(argp1);
arg1 = *temp;
if (SWIG_IsNewObj(res1)) delete temp;
}
} }
result = (UTimeOut *)new UTimeOut(arg1); arg1 = reinterpret_cast< std::string * >(argp1);
result = (UTimeOut *)new UTimeOut((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UTimeOut, SWIG_POINTER_NEW | 0 ); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UTimeOut, SWIG_POINTER_NEW | 0 );
return resultobj; return resultobj;
fail: fail:
...@@ -4104,7 +4087,7 @@ fail: ...@@ -4104,7 +4087,7 @@ fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UTimeOut'.\n" SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_UTimeOut'.\n"
" Possible C/C++ prototypes are:\n" " Possible C/C++ prototypes are:\n"
" UTimeOut::UTimeOut()\n" " UTimeOut::UTimeOut()\n"
" UTimeOut::UTimeOut(std::string const)\n"); " UTimeOut::UTimeOut(std::string const &)\n");
return 0; return 0;
} }
...@@ -4152,27 +4135,22 @@ fail: ...@@ -4152,27 +4135,22 @@ fail:
SWIGINTERN PyObject *_wrap_new_USysError__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { SWIGINTERN PyObject *_wrap_new_USysError__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0; PyObject *resultobj = 0;
std::string arg1 ; std::string *arg1 = 0 ;
void *argp1 ; void *argp1 = 0 ;
int res1 = 0 ; int res1 = 0 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
USysError *result = 0 ; USysError *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_USysError",&obj0)) SWIG_fail; if (!PyArg_ParseTuple(args,(char *)"O:new_USysError",&obj0)) SWIG_fail;
{ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0);
res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__string, 0 | 0); if (!SWIG_IsOK(res1)) {
if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const""'"); }
} if (!argp1) {
if (!argp1) { SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const &""'");
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_USysError" "', argument " "1"" of type '" "std::string const""'");
} else {
std::string * temp = reinterpret_cast< std::string * >(argp1);
arg1 = *temp;
if (SWIG_IsNewObj(res1)) delete temp;
}
} }
result = (USysError *)new USysError(arg1); arg1 = reinterpret_cast< std::string * >(argp1);
result = (USysError *)new USysError((std::string const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_USysError, SWIG_POINTER_NEW | 0 ); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_USysError, SWIG_POINTER_NEW | 0 );
return resultobj; return resultobj;
fail: fail:
...@@ -4206,7 +4184,7 @@ fail: ...@@ -4206,7 +4184,7 @@ fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_USysError'.\n" SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_USysError'.\n"
" Possible C/C++ prototypes are:\n" " Possible C/C++ prototypes are:\n"
" USysError::USysError()\n" " USysError::USysError()\n"
" USysError::USysError(std::string const)\n"); " USysError::USysError(std::string const &)\n");
return 0; return 0;
} }
...@@ -4386,7 +4364,6 @@ SWIG_InitializeModule(void *clientdata) { ...@@ -4386,7 +4364,6 @@ SWIG_InitializeModule(void *clientdata) {
size_t i; size_t i;
swig_module_info *module_head, *iter; swig_module_info *module_head, *iter;
int found, init; int found, init;
(void *)clientdata;
/* check to see if the circular list has been setup, if not, set it up */ /* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next==0) { if (swig_module.next==0) {
......
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org). * This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.8 * Version 2.0.10
* *
* This file is not intended to be easily readable and contains a number of * This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make * coding conventions designed to improve portability and efficiency. Do not make
...@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { ...@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
} }
#else /* no cast-rank mode */ #else /* no cast-rank mode */
# define SWIG_AddCast # define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif #endif
...@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1, ...@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
/* /*
Check type equivalence in a name list like <name1>|<name2>|... Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/ */
SWIGRUNTIME int SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) { SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 0; int equiv = 1;
const char* te = tb + strlen(tb); const char* te = tb + strlen(tb);
const char* ne = nb; const char* ne = nb;
while (!equiv && *ne) { while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) { for (nb = ne; *ne; ++ne) {
if (*ne == '|') break; if (*ne == '|') break;
} }
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne; if (*ne) ++ne;
} }
return equiv; return equiv;
...@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { ...@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
/* /*
Check type equivalence in a name list like <name1>|<name2>|... Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb Return 0 if not equal, 1 if equal
*/ */
SWIGRUNTIME int SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) { SWIG_TypeEquiv(const char *nb, const char *tb) {
int equiv = 0; return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
} }
/* /*
Check the typename Check the typename
*/ */
...@@ -927,6 +916,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) ...@@ -927,6 +916,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
} }
#endif #endif
#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif
#if PY_VERSION_HEX < 0x02040000 #if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op) \ #define Py_VISIT(op) \
do { \ do { \
...@@ -1198,7 +1191,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), ...@@ -1198,7 +1191,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
/* Runtime API */ /* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
...@@ -1821,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) ...@@ -1821,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args)
static PyMethodDef static PyMethodDef
swigobject_methods[] = { swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
...@@ -2637,7 +2630,7 @@ void *SWIG_ReturnGlobalTypeList(void *); ...@@ -2637,7 +2630,7 @@ void *SWIG_ReturnGlobalTypeList(void *);
#endif #endif
SWIGRUNTIME swig_module_info * SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void) { SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
static void *type_pointer = (void *)0; static void *type_pointer = (void *)0;
/* first check if module already created */ /* first check if module already created */
if (!type_pointer) { if (!type_pointer) {
...@@ -2763,7 +2756,7 @@ SWIG_Python_TypeQuery(const char *type) ...@@ -2763,7 +2756,7 @@ SWIG_Python_TypeQuery(const char *type)
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
#endif #endif
} else { } else {
swig_module_info *swig_module = SWIG_Python_GetModule(); swig_module_info *swig_module = SWIG_GetModule(0);
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) { if (descriptor) {
#ifdef SWIGPY_USE_CAPSULE #ifdef SWIGPY_USE_CAPSULE
...@@ -2988,7 +2981,7 @@ static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0}; ...@@ -2988,7 +2981,7 @@ static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0};
#endif #endif
#define SWIG_name "_pyUModbus" #define SWIG_name "_pyUModbus"
#define SWIGVERSION 0x020008 #define SWIGVERSION 0x020010
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
...@@ -5348,7 +5341,6 @@ SWIG_InitializeModule(void *clientdata) { ...@@ -5348,7 +5341,6 @@ SWIG_InitializeModule(void *clientdata) {
size_t i; size_t i;
swig_module_info *module_head, *iter; swig_module_info *module_head, *iter;
int found, init; int found, init;
(void *)clientdata;
/* check to see if the circular list has been setup, if not, set it up */ /* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next==0) { if (swig_module.next==0) {
......
# This file was automatically generated by SWIG (http://www.swig.org). # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.8 # Version 2.0.10
# #
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
......
# This file was automatically generated by SWIG (http://www.swig.org). # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.9 # Version 2.0.10
# #
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
......
# This file was automatically generated by SWIG (http://www.swig.org). # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.8 # Version 2.0.10
# #
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
......
# This file was automatically generated by SWIG (http://www.swig.org). # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.8 # Version 2.0.10
# #
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
......
...@@ -30,11 +30,11 @@ ObjectIndex_idXML::~ObjectIndex_idXML() ...@@ -30,11 +30,11 @@ ObjectIndex_idXML::~ObjectIndex_idXML()
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
ObjectId ObjectIndex_idXML::getIdByName( const string& name ) ObjectId ObjectIndex_idXML::getIdByName( const string& name )
{ {
MapObjectKey::iterator it = mok.find(name); MapObjectKey::iterator it = mok.find(name);
if( it != mok.end() ) if( it != mok.end() )
return it->second; return it->second;
return DefaultObjectId; return DefaultObjectId;
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
string ObjectIndex_idXML::getMapName( const ObjectId id ) string ObjectIndex_idXML::getMapName( const ObjectId id )
...@@ -86,7 +86,7 @@ void ObjectIndex_idXML::build(UniXML& xml) ...@@ -86,7 +86,7 @@ void ObjectIndex_idXML::build(UniXML& xml)
read_nodes(xml,"nodes"); read_nodes(xml,"nodes");
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec ) void ObjectIndex_idXML::read_section( UniXML& xml, const std::string sec )
{ {
string secRoot = xml.getProp( xml.findNode(xml.getFirstNode(),"RootSection"), "name"); string secRoot = xml.getProp( xml.findNode(xml.getFirstNode(),"RootSection"), "name");
if( secRoot.empty() ) if( secRoot.empty() )
...@@ -148,22 +148,21 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec ) ...@@ -148,22 +148,21 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string& sec )
strcpy( inf.repName, name.c_str() ); strcpy( inf.repName, name.c_str() );
// textname // textname
string textname(it.getProp("textname")); string textname(xml.getProp(it,"textname"));
if( textname.empty() ) if( textname.empty() )
textname = it.getProp("name"); textname = xml.getProp(it,"name");
inf.textName = new char[textname.size()+1]; inf.textName = new char[textname.size()+1];
strcpy( inf.textName, textname.c_str() ); strcpy( inf.textName, textname.c_str() );
inf.data = (void*)(xmlNode*)(it); inf.data = (void*)(xmlNode*)(it);
// omap[inf.id] = inf; omap.insert(MapObjects::value_type(inf.id,inf)); // omap[inf.id] = inf;
omap.insert(MapObjects::value_type(inf.id,inf)); // omap[inf.id] = inf; mok.insert(MapObjectKey::value_type(name,inf.id)); // mok[name] = inf.id;
mok.insert(MapObjectKey::value_type(name,inf.id)); // mok[name] = inf.id;
} }
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec ) void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string sec )
{ {
xmlNode* root( xml.findNode(xml.getFirstNode(),sec) ); xmlNode* root( xml.findNode(xml.getFirstNode(),sec) );
if( !root ) if( !root )
...@@ -216,10 +215,10 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec ) ...@@ -216,10 +215,10 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string& sec )
inf.data = (void*)(xmlNode*)(it); inf.data = (void*)(xmlNode*)(it);
// omap[inf.id] = inf; // omap[inf.id] = inf;
omap.insert(MapObjects::value_type(inf.id,inf)); // omap[inf.id] = inf; // mok[nodename] = inf.id;
mok.insert( MapObjectKey::value_type(nodename,inf.id) ); // mok[name] = inf.id; omap.insert(MapObjects::value_type(inf.id,inf)); // omap[inf.id] = inf;
mok.insert(MapObjectKey::value_type(nodename,inf.id)); // mok[name] = inf.id;
} }
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
...@@ -234,9 +233,12 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const ObjectId id ) ...@@ -234,9 +233,12 @@ const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const ObjectId id )
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const std::string name ) const ObjectInfo* ObjectIndex_idXML::getObjectInfo( const std::string name )
{ {
MapObjectKey::iterator it = mok.find(name); const char* n = name.c_str();
if( it != mok.end() ) for( MapObjects::iterator it=omap.begin(); it!=omap.end(); it++ )
return getObjectInfo(it->second); {
if( !strcmp(it->second.repName,n) )
return &(it->second);
}
return NULL; return NULL;
} }
......
...@@ -22,6 +22,8 @@ int main(int argc, const char **argv) ...@@ -22,6 +22,8 @@ int main(int argc, const char **argv)
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "test.xml" ); string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "test.xml" );
conf = new Configuration(argc, argv, confile); conf = new Configuration(argc, argv, confile);
cout << "getLocalNode()=" << conf->getLocalNode() << endl;
string t(conf->oind->getTextName(1)); string t(conf->oind->getTextName(1));
cout << "**** check getTextName: " << ( t.empty() ? "FAILED" : "OK" ) << endl; cout << "**** check getTextName: " << ( t.empty() ? "FAILED" : "OK" ) << endl;
...@@ -32,6 +34,15 @@ int main(int argc, const char **argv) ...@@ -32,6 +34,15 @@ int main(int argc, const char **argv)
string mn(conf->oind->getMapName(1)); string mn(conf->oind->getMapName(1));
cout << "**** check getMapName: " << ( mn.empty() ? "FAILED" : "OK" ) << endl; cout << "**** check getMapName: " << ( mn.empty() ? "FAILED" : "OK" ) << endl;
cout << "getSensorID(Input1_S): " << conf->getSensorID("Input1_S") << endl;
std::string iname = conf->oind->getNameById(1);
cout << "getNameById(1): " << iname << endl;
ObjectId i_id = conf->oind->getIdByName(mn);
cout << "getIdByName(" << iname << "): " << (i_id == DefaultObjectId ? "FAIL" : "OK" ) << endl;
UniversalIO::IOType t1=conf->getIOType(1); UniversalIO::IOType t1=conf->getIOType(1);
cout << "**** getIOType for " << mn << endl; cout << "**** getIOType for " << mn << endl;
cout << "**** check getIOType(id): (" << t1 << ") " << ( t1 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl; cout << "**** check getIOType(id): (" << t1 << ") " << ( t1 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<DocDir name=""/> <DocDir name=""/>
<LockDir name=""/> <LockDir name=""/>
<testnode name="testnode" id2="-100"/>
<Services> <Services>
<LocalTimeService name="TimeService" MaxCountTimers="100" AskLifeTimeSEC="10"/> <LocalTimeService name="TimeService" MaxCountTimers="100" AskLifeTimeSEC="10"/>
<LocalInfoServer name="InfoServer" dbrepeat="1"> <LocalInfoServer name="InfoServer" dbrepeat="1">
......
...@@ -12,7 +12,6 @@ int main( int argc, const char **argv ) ...@@ -12,7 +12,6 @@ int main( int argc, const char **argv )
uniset_init(argc,argv,"test.xml"); uniset_init(argc,argv,"test.xml");
UniversalInterface ui; UniversalInterface ui;
cout << "** check getSensorID function **" << endl; cout << "** check getSensorID function **" << endl;
ObjectId id1 = conf->getSensorID("Input1_S"); ObjectId id1 = conf->getSensorID("Input1_S");
if( id1 != 1 ) if( id1 != 1 )
...@@ -50,6 +49,12 @@ int main( int argc, const char **argv ) ...@@ -50,6 +49,12 @@ int main( int argc, const char **argv )
cout << "id=" << id cout << "id=" << id
<< " value=" << inf.value << " value=" << inf.value
<< " last changed: " << string(t_str) << endl; << " last changed: " << string(t_str) << endl;
cout << "check getValue: " << ui.getValue(id1) << endl;
cout << "check setValue: id='" << id1 << "' val=2" << endl;
ui.setValue(id1,2,DefaultObjectId);
cout << "OK" << endl;
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
......
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