Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
f30f6903
Commit
f30f6903
authored
Sep 26, 2009
by
Pavel Vaynerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add heartbeat logic to uniset-codegen
parent
13e883c4
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
230 additions
and
9 deletions
+230
-9
ctl-cpp-cc-alone-ask.xsl
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
+8
-1
ctl-cpp-cc-alone.xsl
Utilities/codegen/ctl-cpp-cc-alone.xsl
+7
-0
ctl-cpp-cc-ask.xsl
Utilities/codegen/ctl-cpp-cc-ask.xsl
+7
-0
ctl-cpp-cc.xsl
Utilities/codegen/ctl-cpp-cc.xsl
+8
-2
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+57
-0
Makefile.am
Utilities/codegen/tests/Makefile.am
+13
-3
TestGenAlone.cc
Utilities/codegen/tests/TestGenAlone.cc
+43
-0
TestGenAlone.h
Utilities/codegen/tests/TestGenAlone.h
+28
-0
testgen-alone.src.xml
Utilities/codegen/tests/testgen-alone.src.xml
+53
-0
testgen.src.xml
Utilities/codegen/tests/testgen.src.xml
+2
-2
libuniset.spec
conf/libuniset.spec
+4
-1
No files found.
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
View file @
f30f6903
...
...
@@ -71,9 +71,16 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
//
step();
// ""
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput);
ptHeartBeat.reset();
}
//
updateOutputs(false);
updatePreviousValues();
updatePreviousValues();
}
catch( Exception
&
ex )
{
...
...
Utilities/codegen/ctl-cpp-cc-alone.xsl
View file @
f30f6903
...
...
@@ -73,6 +73,13 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
//
step();
// ""
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput);
ptHeartBeat.reset();
}
//
updateOutputs(false);
...
...
Utilities/codegen/ctl-cpp-cc-ask.xsl
View file @
f30f6903
...
...
@@ -70,6 +70,13 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
//
step();
// ""
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput);
ptHeartBeat.reset();
}
//
updateOutputs(false);
updatePreviousValues();
...
...
Utilities/codegen/ctl-cpp-cc.xsl
View file @
f30f6903
...
...
@@ -57,7 +57,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
//
checkTimers(this);
if( resetMsgTime
>
0
&&
trResetMsg.hi(ptResetMsg.checkTime()) )
{
// cout
<<
myname
<<
": ********* reset messages *********"
<<
endl;
...
...
@@ -74,7 +73,14 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
//
step();
// ""
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput);
ptHeartBeat.reset();
}
//
updateOutputs(false);
...
...
Utilities/codegen/ctl-cpp-common.xsl
View file @
f30f6903
...
...
@@ -203,6 +203,11 @@
UniSetTypes::ObjectId idLocalTestMode_S; /*!
<
( ) */
bool in_TestMode_S;
bool in_LocalTestMode_S;
// ""
PassiveTimer ptHeartBeat; /*!
<
"" */
UniSetTypes::ObjectId idHeartBeat; /*!
<
(AI) "" */
int maxHeartBeat; /*!
<
*/
xmlNode* confnode;
/*! . confnode */
...
...
@@ -445,6 +450,8 @@ active(false),
isTestMode(false),
idTestMode_S(DefaultObjectId),
idLocalTestMode_S(DefaultObjectId),
idHeartBeat(DefaultObjectId),
maxHeartBeat(10),
confnode(0),
smReadyTimeout(0),
activated(false)
...
...
@@ -472,6 +479,8 @@ idTestMode_S(conf->getSensorID("TestMode_S")),
idLocalTestMode_S(conf->getSensorID(conf->getProp(cnode,"LocalTestMode_S"))),
in_TestMode_S(false),
in_LocalTestMode_S(false),
idHeartBeat(DefaultObjectId),
maxHeartBeat(10),
confnode(cnode),
smReadyTimeout(0),
activated(false)
...
...
@@ -498,6 +507,27 @@ activated(false)
}
</xsl:for-each>
UniXML_iterator it(cnode);
string heart = conf->getArgParam("--heartbeat-id",it.getProp("heartbeat_id"));
if( !heart.empty() )
{
idHeartBeat = conf->getSensorID(heart);
if( idHeartBeat == DefaultObjectId )
{
ostringstream err;
err
<<
myname
<<
": 'HeartBeat' "
<<
heart;
throw SystemError(err.str());
}
int heartbeatTime = conf->getArgPInt("--heartbeat-time",it.getProp("heartbeatTime"), 5000);
if( heartbeatTime>0 )
ptHeartBeat.setTiming(heartbeatTime);
else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgPInt("--heartbeat-max",it.getProp("heartbeat_max"), 10);
}
//
<xsl:for-each
select=
"//smap/item"
>
<xsl:if
test=
"normalize-space(@default)=''"
>
...
...
@@ -666,6 +696,8 @@ active(false),
isTestMode(false),
idTestMode_S(DefaultObjectId),
idLocalTestMode_S(DefaultObjectId),
idHeartBeat(DefaultObjectId),
maxHeartBeat(10),
confnode(0),
activated(false)
{
...
...
@@ -695,6 +727,8 @@ idTestMode_S(conf->getSensorID("TestMode_S")),
idLocalTestMode_S(conf->getSensorID(conf->getProp(cnode,"LocalTestMode_S"))),
in_TestMode_S(false),
in_LocalTestMode_S(false),
idHeartBeat(DefaultObjectId),
maxHeartBeat(10),
confnode(cnode),
activated(false)
{
...
...
@@ -706,6 +740,29 @@ activated(false)
</xsl:call-template>
</xsl:for-each>
UniXML_iterator it(cnode);
string heart = conf->getArgParam("--heartbeat-id",it.getProp("heartbeat_id"));
if( !heart.empty() )
{
idHeartBeat = conf->getSensorID(heart);
if( idHeartBeat == DefaultObjectId )
{
ostringstream err;
err
<<
myname
<<
": 'HeartBeat' "
<<
heart;
throw SystemError(err.str());
}
int heartbeatTime = conf->getArgPInt("--heartbeat-time",it.getProp("heartbeatTime"), 5000);
if( heartbeatTime>0 )
ptHeartBeat.setTiming(heartbeatTime);
else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgPInt("--heartbeat-max",it.getProp("heartbeat_max"), 10);
}
sleep_msec = conf->getArgPInt("--sleep-msec","
<xsl:call-template
name=
"settings-alone"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
",
<xsl:call-template
name=
"settings-alone"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
);
resetMsgTime = conf->getPIntProp(cnode,"resetMsgTime", 0);
...
...
Utilities/codegen/tests/Makefile.am
View file @
f30f6903
noinst_PROGRAMS
=
test
noinst_PROGRAMS
=
test
#test2
test_LDADD
=
$(top_builddir)
/lib/libUniSet.la
test_CXXFLAGS
=
-I
$(top_builddir)
/include
test_SOURCES
=
TestGen_SK.cc TestGen.cc TestGen-main.cc
GENERATED
=
TestGen_SK.h TestGen_SK.cc TestGen-main.cc
test2_LDADD
=
$(top_builddir)
/lib/libUniSet.la
test2_CXXFLAGS
=
-I
$(top_builddir)
/include
test2_SOURCES
=
TestGenAlone_SK.cc TestGenAlone.cc TestGenAlone-main.cc
GENERATED
=
TestGen_SK.h TestGen_SK.cc TestGen-main.cc
GENERATED2
=
TestGenAlone_SK.h TestGenAlone_SK.cc TestGenAlone-main.cc
$(GENERATED)
:
../@PACKAGE@-codegen testgen.src.xml ../*.xsl
@
UNISET_CODEGEN@
--local-include
-l
--ask
-n
TestGen testgen.src.xml
$(GENERATED2)
:
../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
@
UNISET_CODEGEN@
--local-include
-l
--ask
--alone
-n
TestGenAlone testgen-alone.src.xml
clean-local
:
rm
-rf
$(GENERATED)
rm
-rf
$(GENERATED)
$(GENERATED2)
#all-local: $(GENERATED)
#
Utilities/codegen/tests/TestGenAlone.cc
0 → 100644
View file @
f30f6903
// $Id$
#include "Exceptions.h"
#include "TestGenAlone.h"
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
// -----------------------------------------------------------------------------
TestGenAlone
::
TestGenAlone
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
confnode
)
:
TestGenAlone_SK
(
id
,
confnode
)
{
}
// -----------------------------------------------------------------------------
TestGenAlone
::~
TestGenAlone
()
{
}
// -----------------------------------------------------------------------------
TestGenAlone
::
TestGenAlone
()
{
cerr
<<
": init failed!!!!!!!!!!!!!!!"
<<
endl
;
throw
Exception
();
}
// -----------------------------------------------------------------------------
void
TestGenAlone
::
step
()
{
cout
<<
"input2 state="
<<
in_input2_s
<<
endl
;
}
// -----------------------------------------------------------------------------
void
TestGenAlone
::
sensorInfo
(
SensorMessage
*
sm
)
{
if
(
sm
->
id
==
input1_s
)
out_output1_c
=
in_input1_s
;
// sm->state
}
// -----------------------------------------------------------------------------
void
TestGenAlone
::
timerInfo
(
TimerMessage
*
tm
)
{
}
// -----------------------------------------------------------------------------
void
TestGenAlone
::
sigterm
(
int
signo
)
{
TestGenAlone_SK
::
sigterm
(
signo
);
}
// -----------------------------------------------------------------------------
Utilities/codegen/tests/TestGenAlone.h
0 → 100644
View file @
f30f6903
// $Id$
// -----------------------------------------------------------------------------
#ifndef TestGenAlone_H_
#define TestGenAlone_H_
// -----------------------------------------------------------------------------
#include "TestGenAlone_SK.h"
// -----------------------------------------------------------------------------
class
TestGenAlone
:
public
TestGenAlone_SK
{
public
:
TestGenAlone
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
confnode
=
UniSetTypes
::
conf
->
getNode
(
"TestGenAlone"
)
);
virtual
~
TestGenAlone
();
protected
:
TestGenAlone
();
virtual
void
step
();
void
sensorInfo
(
UniSetTypes
::
SensorMessage
*
sm
);
void
timerInfo
(
UniSetTypes
::
TimerMessage
*
tm
);
virtual
void
sigterm
(
int
signo
);
private
:
};
// -----------------------------------------------------------------------------
#endif // TestGenAlone_H_
// -----------------------------------------------------------------------------
Utilities/codegen/tests/testgen-alone.src.xml
0 → 100644
View file @
f30f6903
<?xml version="1.0" encoding="koi8-r"?>
<!--
name -
msgcount -
sleep_msec -
type
====
in - ( )
out - ()
io -
-->
<GlobalConfigure>
<settings>
<TestGenAlone>
<set
name=
"ID"
val=
"TestGenAlone"
/>
<set
name=
"class-name"
val=
"TestGenAlone"
/>
<set
name=
"msg-count"
val=
"20"
/>
<set
name=
"sleep-msec"
val=
"150"
/>
</TestGenAlone>
</settings>
<ObjectsMap
idfromfile=
"1"
no_dep=
"0"
>
<sensors>
<item
id=
"1"
name=
"input1_s"
iotype=
"DI"
textname=
"xxx"
>
<consumers>
<consumer
name=
"TestGenAlone"
vartype=
"in"
type=
"objects"
/>
</consumers>
</item>
<item
id=
"23"
name=
"input2_s"
iotype=
"DI"
textname=
"xxx"
>
<consumers>
<consumer
name=
"TestGenAlone"
vartype=
"in"
type=
"objects"
/>
</consumers>
</item>
<item
id=
"31"
name=
"output1_c"
iotype=
"DO"
textname=
"xxx"
>
<consumers>
<consumer
name=
"TestGenAlone"
vartype=
"out"
type=
"objects"
/>
</consumers>
</item>
</sensors>
<messages>
</messages>
<objects>
<item
id=
"2000"
name=
"TestGenAlone"
/>
</objects>
</ObjectsMap>
</GlobalConfigure>
\ No newline at end of file
Utilities/codegen/tests/testgen.src.xml
View file @
f30f6903
...
...
@@ -10,7 +10,7 @@
out - ()
io -
-->
<
QG
>
<
Test
>
<settings>
<set
name=
"class-name"
val=
"TestGen"
/>
<set
name=
"msg-count"
val=
"20"
/>
...
...
@@ -27,4 +27,4 @@
<!-- name - . -->
<item
name=
"mid_Message1"
comment=
"comment for Message 1"
/>
</msgmap>
</
QG
>
</
Test
>
conf/libuniset.spec
View file @
f30f6903
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.97
Release: eter1
2
Release: eter1
3
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -178,6 +178,9 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Sat Sep 26 2009 Pavel Vainerman <pv@etersoft.ru> 0.97-eter12
- minor fixes in IONotifyController
* Fri Sep 25 2009 Pavel Vainerman <pv@altlinux.ru> 0.97-eter11
- return old mutex
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment