Commit 281f3ef6 authored by Pavel Vainerman's avatar Pavel Vainerman

(uniset-codegen): Добавил возможность указать в src.xml параметр loglevel="1",

для указания датчика задающего уровень выводимых логов. (для управления логами "на ходу").
parent d8fc671f
......@@ -110,9 +110,18 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorM
<xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID">
<xsl:if test="normalize-space(@vartype)='in'">
<xsl:if test="normalize-space(@loglevel)=''">
if( _sm->id == <xsl:value-of select="../../@name"/> )
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = _sm->value;
</xsl:if>
<xsl:if test="normalize-space(@loglevel)!=''">
if( _sm->id == <xsl:value-of select="../../@name"/> )
{
<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/> = _sm->value;
dlog.level( Debug::type(_sm->value) );
}
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
......
......@@ -148,9 +148,18 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( UniSetTypes::SensorM
{
<xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@vartype)='in'">
<xsl:if test="normalize-space(@loglevel)=''">
if( _sm->id == <xsl:value-of select="@name"/> )
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = _sm->value;
</xsl:if>
<xsl:if test="normalize-space(@loglevel)!=''">
if( _sm->id == <xsl:value-of select="@name"/> )
{
<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = _sm->value;
dlog.level( Debug::type(_sm->value) );
}
</xsl:if>
</xsl:if>
</xsl:for-each>
sensorInfo(_sm);
......
......@@ -185,6 +185,10 @@
void askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void updateValues();
void setMsg( UniSetTypes::ObjectId code, bool state );
static DebugStream dlog;
static void init_dlog(DebugStream&amp; dlog);
</xsl:template>
<xsl:template name="COMMON-HEAD-PROTECTED">
......@@ -253,6 +257,18 @@
</xsl:template>
<xsl:template name="COMMON-CC-FILE">
// ------------------------------------------------------------------------------------------
DebugStream <xsl:value-of select="$CLASSNAME"/>_SK::dlog;
static bool init_dlog_ok = false;
void <xsl:value-of select="$CLASSNAME"/>_SK::init_dlog( DebugStream&amp; d )
{
if( !init_dlog_ok )
{
<xsl:value-of select="$CLASSNAME"/>_SK::dlog = d;
init_dlog_ok = true;
}
}
// ------------------------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::processingMessage( UniSetTypes::VoidMessage* _msg )
{
try
......
......@@ -39,6 +39,7 @@
#include <xsl:call-template name="preinclude"/>LT_Object.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>UniXML.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>Trigger.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>DebugStream.h<xsl:call-template name="postinclude"/>
// -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK:
<xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/>,</xsl:if>
......
......@@ -39,6 +39,11 @@
<consumer name="TestGenAlone" vartype="out" type="objects"/>
</consumers>
</item>
<item id="32" name="loglevel_s" iotype="AI" textname="loglevel" node="Test1Node">
<consumers>
<consumer name="TestGenAlone" vartype="in" loglevel="1" type="objects"/>
</consumers>
</item>
</sensors>
<messages>
</messages>
......
......@@ -41,6 +41,7 @@
<item name="input1_s" vartype="in" iotype="DI" comment="comment for input1" smTestID="1"/>
<item name="input2_s" vartype="in" iotype="DI" comment="comment for input2" />
<item name="output1_c" vartype="out" iotype="DO" omment="comment for output1" no_check_id="1"/>
<item name="loglevel_s" vartype="in" iotype="AI" omment="log level control" loglevel="1"/>
</smap>
<msgmap>
......
......@@ -7,7 +7,7 @@
Name: libuniset
Version: 1.6
Release: alt15
Release: alt16
Summary: UniSet - library for building distributed industrial control systems
......@@ -319,6 +319,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Tue Nov 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt16
- (uniset-codegen): add 'loglevel' parameters for src.xml
* Mon Oct 28 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt15
- (python): fixed bug in UInterface
......
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