Commit b348783b authored by Pavel Vainerman's avatar Pavel Vainerman

new codegen: use "node"

parent e4527c9f
......@@ -141,10 +141,10 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensors( UniversalIO::UIOCommand
<xsl:for-each select="//sensors/item/consumers/consumer">
<xsl:if test="normalize-space(@name)=$OID">
<xsl:if test="normalize-space(@vartype)='in'">
ui.askSensor(<xsl:value-of select="../../@name"/>,cmd, getId());
ui.askRemoteSensor(<xsl:value-of select="../../@name"/>,cmd,node_<xsl:value-of select="../../@name"/>, getId());
</xsl:if>
<xsl:if test="normalize-space(@vartype)='io'">
ui.askSensor(<xsl:value-of select="../../@name"/>,cmd, getId());
ui.askRemoteSensor(<xsl:value-of select="../../@name"/>,cmd,node_<xsl:value-of select="../../@name"/>, getId());
</xsl:if>
</xsl:if>
</xsl:for-each>
......@@ -196,14 +196,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId sid
</xsl:for-each>
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd )
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
ui.askSensor(sid,cmd, getId());
ui.askRemoteSensor(sid,cmd,node,getId());
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd )
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
ui.askSensor(sid,cmd, getId());
ui.askRemoteSensor(sid,cmd, node,getId());
}
// -----------------------------------------------------------------------------
bool <xsl:value-of select="$CLASSNAME"/>_SK::getState( UniSetTypes::ObjectId sid )
......@@ -347,19 +347,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setInfo( UniSetTypes::ObjectId code
<xsl:template name="gensetdata">
<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"/> );
ui.setState( <xsl:value-of select="../../@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, <xsl:value-of select="../../@node"/>, );
</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"/> );
ui.setValue( <xsl:value-of select="../../@name"/>, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, <xsl:value-of select="../../@node"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DI'">
si.id = <xsl:value-of select="../../@name"/>;
si.node = conf->getLocalNode();
si.node = <xsl:value-of select="../../@node"/>;
ui.saveState( si, <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>,UniversalIO::DigitalInput, getId() );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
si.id = <xsl:value-of select="../../@name"/>;
si.node = conf->getLocalNode();
si.node = <xsl:value-of select="../../@node"/>;
ui.saveValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
</xsl:choose>
......@@ -369,19 +369,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setInfo( UniSetTypes::ObjectId code
<xsl:param name="setval"></xsl:param>
<xsl:choose>
<xsl:when test="normalize-space(../../@iotype)='DO'">
ui.setState( <xsl:value-of select="../../@name"/>,<xsl:value-of select="$setval"/> );
ui.setState( <xsl:value-of select="../../@name"/>,<xsl:value-of select="$setval"/>,<xsl:value-of select="../../@node"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AO'">
ui.setValue( <xsl:value-of select="../../@name"/>,<xsl:value-of select="$setval"/> );
ui.setValue( <xsl:value-of select="../../@name"/>,<xsl:value-of select="$setval"/>,<xsl:value-of select="../../@node"/> );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='DI'">
si.id = <xsl:value-of select="../../@name"/>;
si.node = conf->getLocalNode();
si.node = <xsl:value-of select="../../@node"/>
ui.saveState( si,<xsl:value-of select="$setval"/>, UniversalIO::DigitalInput, getId() );
</xsl:when>
<xsl:when test="normalize-space(../../@iotype)='AI'">
si.id = <xsl:value-of select="../../@name"/>;
si.node = conf->getLocalNode();
si.node = <xsl:value-of select="../../@node"/>
ui.saveValue( si,<xsl:value-of select="$setval"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
</xsl:choose>
......
......@@ -118,23 +118,25 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorM
sensorInfo(sm);
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd )
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
// #warning ...
if( cmd == UniversalIO::UIONotify )
{
SensorMessage sm( sid, (bool)ui.getState(sid) );
SensorMessage sm( sid, (bool)ui.getState(sid,node) );
sm.node = node;
// push( sm.transport_msg() );
sensorInfo(&amp;sm);
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd )
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
// #warning ..
if( cmd == UniversalIO::UIONotify )
{
SensorMessage sm( sid, (long)ui.getValue(sid) );
SensorMessage sm( sid, (long)ui.getValue(sid,node) );
sm.node = node;
// push( sm.transport_msg() );
sensorInfo(&amp;sm);
}
......
......@@ -165,14 +165,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorM
sensorInfo(sm);
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd )
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
ui.askSensor(sid,cmd,getId());
ui.askRemoteSensor(sid,cmd,node,getId());
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd )
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
ui.askSensor(sid,cmd,getId());
ui.askRemoteSensor(sid,cmd,node,getId());
}
// -----------------------------------------------------------------------------
bool <xsl:value-of select="$CLASSNAME"/>_SK::getState( UniSetTypes::ObjectId sid )
......@@ -182,19 +182,19 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::getState( UniSetTypes::ObjectId sid
{
<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: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)='DI'">
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui.getState(<xsl:value-of select="@name"/>);
<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: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"/>, 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: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"/>, node_<xsl:value-of select="@name"/>);
return <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:when>
</xsl:choose>
......@@ -229,11 +229,11 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensors( UniversalIO::UIOCommand
<xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@vartype)='in'">
if( <xsl:value-of select="@name"/> != DefaultObjectId )
ui.askSensor(<xsl:value-of select="@name"/>,cmd,getId());
ui.askRemoteSensor(<xsl:value-of select="@name"/>,cmd,node_<xsl:value-of select="@name"/>,getId());
</xsl:if>
<xsl:if test="normalize-space(@vartype)='io'">
if( <xsl:value-of select="@name"/> != DefaultObjectId )
ui.askSensor(<xsl:value-of select="@name"/>,cmd,getId());
ui.askRemoteSensor(<xsl:value-of select="@name"/>,cmd,node_<xsl:value-of select="@name"/>,getId());
</xsl:if>
</xsl:for-each>
return;
......@@ -277,18 +277,18 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setInfo( UniSetTypes::ObjectId code
{
<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: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"/>);
<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"/>);
<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"/>);
<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>
}
......@@ -300,19 +300,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setInfo( UniSetTypes::ObjectId code
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
si.id = <xsl:value-of select="@name"/>;
// si.node = conf->getLocalNode();
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"/> );
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 = conf->getLocalNode();
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"/> );
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>
}
......@@ -325,17 +325,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setInfo( UniSetTypes::ObjectId code
<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"/>);
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.node = node_<xsl:value-of select="@name"/>;
ui.saveValue( si,<xsl:value-of select="$setval"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
ui.setValue( <xsl:value-of select="@name"/>,<xsl:value-of select="$setval"/> );
ui.setValue( <xsl:value-of select="@name"/>,<xsl:value-of select="$setval"/>, node_<xsl:value-of select="@name"/> );
</xsl:when>
</xsl:choose>
}
......
......@@ -151,23 +151,25 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensors( UniversalIO::UIOCommand
</xsl:for-each>
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd )
void <xsl:value-of select="$CLASSNAME"/>_SK::askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
// #warning ...
if( cmd == UniversalIO::UIONotify )
{
SensorMessage sm( sid, (bool)ui.getState(sid) );
SensorMessage sm( sid, (bool)ui.getState(sid,node) );
sm.node = node;
// push( sm.transport_msg() );
sensorInfo(&amp;sm);
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd )
void <xsl:value-of select="$CLASSNAME"/>_SK::askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
{
// #warning ..
if( cmd == UniversalIO::UIONotify )
{
SensorMessage sm( sid, (long)ui.getValue(sid) );
SensorMessage sm( sid, (long)ui.getValue(sid,node) );
sm.node = node;
// push( sm.transport_msg() );
sensorInfo(&amp;sm);
}
......@@ -235,19 +237,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setInfo( UniSetTypes::ObjectId code
<xsl:choose>
<xsl:when test="normalize-space(@iotype)='DI'">
si.id = <xsl:value-of select="@name"/>;
// si.node = conf->getLocalNode();
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"/> );
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 = conf->getLocalNode();
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"/> );
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>
}
......@@ -260,17 +262,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setInfo( UniSetTypes::ObjectId code
<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"/>);
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.node = node_<xsl:value-of select="@name"/>;
ui.saveValue( si,<xsl:value-of select="$setval"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
ui.setValue( <xsl:value-of select="@name"/>,<xsl:value-of select="$setval"/> );
ui.setValue( <xsl:value-of select="@name"/>,<xsl:value-of select="$setval"/>,node_<xsl:value-of select="@name"/> );
</xsl:when>
</xsl:choose>
}
......@@ -282,17 +286,19 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setInfo( UniSetTypes::ObjectId code
<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"/>);
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.node = node_<xsl:value-of select="@name"/>;
ui.saveValue( si,(long)m_<xsl:value-of select="@name"/>,UniversalIO::AnalogInput, getId() );
</xsl:when>
<xsl:when test="normalize-space(@iotype)='AO'">
ui.setValue( <xsl:value-of select="@name"/>, (long)m_<xsl:value-of select="@name"/> );
ui.setValue( <xsl:value-of select="@name"/>, (long)m_<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/> );
</xsl:when>
</xsl:choose>
}
......
......@@ -23,6 +23,13 @@
</xsl:choose>
</xsl:template>
<xsl:template name="setnode">
<xsl:choose>
<xsl:when test="normalize-space(@node)=''">conf->getLocalNode()</xsl:when>
<xsl:when test="normalize-space(@node)!=''">conf->getNodeID(<xsl:value-of select="@node"/> )</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="preinclude">
<xsl:if test="normalize-space($LOCALINC)!=''">
<xsl:text>&quot;</xsl:text>
......@@ -48,6 +55,7 @@
<xsl:choose>
<xsl:when test="$GENTYPE='H'">
const UniSetTypes::ObjectId <xsl:value-of select="../../@name"/>; /*!&lt; <xsl:value-of select="../../@textname"/> */
const 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; */
<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; */
</xsl:when>
......@@ -141,10 +149,11 @@
bool alarm( UniSetTypes::ObjectId sid, bool state );
bool getState( UniSetTypes::ObjectId sid );
bool getValue( UniSetTypes::ObjectId sid );
void setValue( UniSetTypes::ObjectId sid, long value );
void setState( UniSetTypes::ObjectId sid, bool state );
void askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand );
void askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand );
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 askThreshold ( UniSetTypes::ObjectId sensorId, UniSetTypes::ThresholdId tid,
UniversalIO::UIOCommand cmd,
CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Long sensibility,
......@@ -198,7 +207,6 @@
<xsl:template name="COMMON-HEAD-PRIVATE">
IOController_i::SensorInfo si;
// UniSetTypes::SensorMessage sm;
</xsl:template>
<xsl:template name="COMMON-CC-FILE">
......@@ -347,6 +355,13 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId tes
if( testID == DefaultObjectId )
return;
if( unideb.debugging(Debug::INFO) )
{
unideb[Debug::INFO] &lt;&lt; myname &lt;&lt; "(waitSM): waiting SM ready "
&lt;&lt; wait_msec &lt;&lt; " msec"
&lt;&lt; " testID=" &lt;&lt; testID &lt;&lt; endl;
}
if( !ui.waitReady(testID,wait_msec) )
{
ostringstream err;
......@@ -355,7 +370,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId tes
&lt;&lt; wait_msec &lt;&lt; " ";
unideb[Debug::CRIT] &lt;&lt; err.str() &lt;&lt; endl;
kill(SIGTERM,getpid()); // () ...
terminate();
abort();
// kill(SIGTERM,getpid()); // () ...
throw SystemError(err.str());
}
......@@ -369,7 +386,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId tes
&lt;&lt; wait_msec &lt;&lt; " ";
unideb[Debug::CRIT] &lt;&lt; err.str() &lt;&lt; endl;
kill(SIGTERM,getpid()); // () ...
terminate();
abort();
// kill(SIGTERM,getpid()); // () ...
throw SystemError(err.str());
}
}
......@@ -405,9 +424,11 @@ using namespace UniSetTypes;
// ( . )
<xsl:for-each select="//smap/item">
<xsl:value-of select="@name"/>(DefaultObjectId),
node_<xsl:value-of select="@name"/>(DefaultObjectId),
</xsl:for-each>
// ( . )
<xsl:for-each select="//msgmap/item"><xsl:value-of select="@name"/>(DefaultObjectId),
node_<xsl:value-of select="@name"/>(DefaultObjectId),
</xsl:for-each>
active(false),
isTestMode(false),
......@@ -427,9 +448,11 @@ activated(false)
// ( . )
<xsl:for-each select="//smap/item">
<xsl:value-of select="normalize-space(@name)"/>(conf->getSensorID(conf->getProp(cnode,"<xsl:value-of select="normalize-space(@name)"/>"))),
node_<xsl:value-of select="normalize-space(@name)"/>(<xsl:call-template name="setnode"/>),
</xsl:for-each>
// ( . )
<xsl:for-each select="//msgmap/item"><xsl:value-of select="normalize-space(@name)"/>(conf->getSensorID(conf->getProp(cnode,"<xsl:value-of select="normalize-space(@name)"/>"))),
node_<xsl:value-of select="normalize-space(@name)"/>(<xsl:call-template name="setnode"/>),
</xsl:for-each>
sleep_msec(<xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>),
active(true),
......@@ -446,12 +469,22 @@ activated(false)
<xsl:if test="normalize-space(@no_check_id)!='1'">
if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
throw Exception( myname + ": NotFound ID for (<xsl:value-of select="@name"/>) " + conf->getProp(cnode,"<xsl:value-of select="@name"/>") );
<xsl:if test="normalize-space(@node)!=''">
if( node_<xsl:value-of select="normalize-space(@node)"/> == UniSetTypes::DefaultObjectId )
throw Exception( myname + ": NotFound NodeID for (node=<xsl:value-of select="@node"/>) " + conf->getProp(cnode,"<xsl:value-of select="@node"/>") );
</xsl:if>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="//msgmap/item">
if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
unideb[Debug::WARN] &lt;&lt; myname &lt;&lt; ": NotFound (Message)OID for " &lt;&lt; conf->getProp(cnode,"<xsl:value-of select="normalize-space(@name)"/>") &lt;&lt; endl;
if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
{
unideb[Debug::WARN] &lt;&lt; myname &lt;&lt; ": NotFound (Message)NodeD for node=" &lt;&lt; conf->getProp(cnode,"<xsl:value-of select="normalize-space(@node)"/>")
&lt;&lt; ". Use localNode=" &lt;&lt; conf->getLocalNode()
&lt;&lt; endl;
}
</xsl:for-each>
//
......@@ -473,8 +506,6 @@ activated(false)
</xsl:if>
</xsl:for-each>
si.node = conf->getLocalNode();
sleep_msec = atoi(conf->getArgParam("--sleep-msec","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>").c_str());
if( sleep_msec &lt;=0 )
sleep_msec = <xsl:call-template name="settings"><xsl:with-param name="varname" select="'sleep-msec'"/></xsl:call-template>;
......@@ -563,15 +594,18 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId code,
else
unideb(Debug::LEVEL1) &lt;&lt; "RESET ";
unideb(Debug::LEVEL1) &lt;&lt; endl;
<xsl:for-each select="//msgmap/item">
if( code == <xsl:value-of select="@name"/> )
{
unideb(Debug::LEVEL1) &lt;&lt; "<xsl:value-of select="@name"/>" &lt;&lt; endl;
unideb[Debug::LEVEL1] &lt;&lt; "<xsl:value-of select="@name"/>" &lt;&lt; endl;
try
{
m_<xsl:value-of select="@name"/> = state;
// ...
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() );
return true;
}
......@@ -580,7 +614,7 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId code,
}
</xsl:for-each>
unideb(Debug::LEVEL8) &lt;&lt; " not found MessgeOID?!!" &lt;&lt; endl;
unideb[Debug::LEVEL1] &lt;&lt; " not found MessgeOID?!!" &lt;&lt; endl;
return false;
}
// -----------------------------------------------------------------------------
......@@ -590,6 +624,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::resetMsg()
<xsl:for-each select="//msgmap/item">
m_<xsl:value-of select="@name"/> = 0;
si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si,false,UniversalIO::DigitalInput,getId() );
</xsl:for-each>
}
......
......@@ -56,11 +56,13 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
//
<xsl:for-each select="//smap/item">const UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const UniSetTypes::ObjectId node_<xsl:value-of select="@name"/>;
</xsl:for-each>
//
<xsl:for-each select="//msgmap/item">
const UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const UniSetTypes::ObjectId node_<xsl:value-of select="@name"/>;
bool m_<xsl:value-of select="@name"/>; /*!&lt; /> */
bool prev_m_<xsl:value-of select="@name"/>; /*!&lt; /> */
</xsl:for-each>
......
......@@ -43,7 +43,7 @@ int main( int argc, char* argv[] )
if( argc>1 &amp;&amp; strcmp(argv[1],"--help")==0 )
{
cout &lt;&lt; "--name name - ID . <xsl:value-of select="$CLASSNAME"/>." &lt;&lt; endl;
cout &lt;&lt; "--vonfile fname - . . configure.xml" &lt;&lt; endl;
cout &lt;&lt; "--confile fname - . . configure.xml" &lt;&lt; endl;
cout &lt;&lt; "--logfile fname - fname. <xsl:value-of select="$CLASSNAME"/>.log" &lt;&lt; endl;
return 0;
}
......@@ -85,7 +85,7 @@ int main( int argc, char* argv[] )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
act.run(false);
pause(); // ,
pause(); // ,
}
catch(Exception&amp; ex)
{
......
// $Id$
#include <uniset/Exceptions.h>
#include "TestGen.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
// -----------------------------------------------------------------------------
TestGen::TestGen( UniSetTypes::ObjectId id, xmlNode* confnode ):
TestGen_SK( id, confnode )
{
}
// -----------------------------------------------------------------------------
TestGen::~TestGen()
{
}
// -----------------------------------------------------------------------------
TestGen::TestGen()
{
cerr << ": init failed!!!!!!!!!!!!!!!"<< endl;
throw Exception();
}
// -----------------------------------------------------------------------------
void TestGen::step()
{
cout << "input2 state=" << in_input2_s << endl;
}
// -----------------------------------------------------------------------------
void TestGen::sensorInfo( SensorMessage *sm )
{
if( sm->id == input1_s )
out_output1_c = in_input1_s; // sm->state
}
// -----------------------------------------------------------------------------
void TestGen::timerInfo( TimerMessage *tm )
{
}
// -----------------------------------------------------------------------------
void TestGen::sigterm( int signo )
{
TestGen_SK::sigterm(signo);
}
// -----------------------------------------------------------------------------
// $Id$
// -----------------------------------------------------------------------------
#ifndef TestGen_H_
#define TestGen_H_
// -----------------------------------------------------------------------------
#include "TestGen_SK.h"
// -----------------------------------------------------------------------------
class TestGen:
public TestGen_SK
{
public:
TestGen( UniSetTypes::ObjectId id, xmlNode* confnode = UniSetTypes::conf->getNode("TestGen") );
virtual ~TestGen();
protected:
TestGen();
virtual void step();
void sensorInfo( UniSetTypes::SensorMessage *sm );
void timerInfo( UniSetTypes::TimerMessage *tm );
virtual void sigterm( int signo );
private:
};
// -----------------------------------------------------------------------------
#endif // TestGen_H_
// -----------------------------------------------------------------------------
#!/bin/sh
ln -s -f /usr/bin/uniset-stop.sh stop.sh
ln -s -f ../../../conf/test.xml test.xml
#!/bin/sh
ulimit -Sc 1000000
uniset-start.sh -f ./test --name TestProc --confile test.xml --unideb-add-levels info,crit,warn,level1,level8 \
--sm-ready-timeout 5000
#info,warn,crit,system,level9 > 1.log
#--c-filter-field cfilter --c-filter-value test1 --s-filter-field io --s-filter-value 1
......@@ -129,6 +129,7 @@ class UniSetObject:
*/
virtual void sigterm( int signo ){};
inline void terminate(){ disactivate(); }
/*! timeMS */
virtual bool waitMessage(UniSetTypes::VoidMessage& msg, int timeMS=UniSetTimer::WaitUpTime);
......
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