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
b1ef89fe
Commit
b1ef89fe
authored
Jan 18, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Исправил небольшую ошибку с параметром влючения сборки документации.
- Переход на shared_ptr везде где только можно.. - выпуск версии 2.0-alt11 с текущими изменениями.
parent
2fbcb22d
Show whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
222 additions
and
246 deletions
+222
-246
ctl-cpp-cc-alone-ask.xsl
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
+11
-11
ctl-cpp-cc-alone.xsl
Utilities/codegen/ctl-cpp-cc-alone.xsl
+8
-8
ctl-cpp-cc-ask.xsl
Utilities/codegen/ctl-cpp-cc-ask.xsl
+10
-10
ctl-cpp-cc.xsl
Utilities/codegen/ctl-cpp-cc.xsl
+9
-9
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+11
-11
libuniset2.spec
conf/libuniset2.spec
+14
-9
configure.ac
configure.ac
+3
-3
IOControl.cc
extensions/IOControl/IOControl.cc
+1
-4
IOControl.h
extensions/IOControl/IOControl.h
+2
-2
PassiveLProcessor.cc
extensions/LogicProcessor/PassiveLProcessor.cc
+3
-3
PassiveLProcessor.h
extensions/LogicProcessor/PassiveLProcessor.h
+2
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+1
-3
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+1
-1
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+9
-16
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+4
-3
MBTCPMultiSlave.cc
extensions/ModbusSlave/MBTCPMultiSlave.cc
+3
-3
MBTCPMultiSlave.h
extensions/ModbusSlave/MBTCPMultiSlave.h
+1
-1
RRDServer.cc
extensions/RRDServer/RRDServer.cc
+1
-1
SMViewer.cc
extensions/SMViewer/SMViewer.cc
+1
-2
SMViewer.h
extensions/SMViewer/SMViewer.h
+2
-2
SharedMemory.cc
extensions/SharedMemory/SharedMemory.cc
+2
-2
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+8
-21
UNetExchange.h
extensions/UNetUDP/UNetExchange.h
+7
-7
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+6
-12
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+8
-6
UNetSender.cc
extensions/UNetUDP/UNetSender.cc
+4
-7
UNetSender.h
extensions/UNetUDP/UNetSender.h
+3
-3
UniExchange.cc
extensions/UniNetwork/UniExchange.cc
+3
-7
UniExchange.h
extensions/UniNetwork/UniExchange.h
+3
-2
IOBase.h
extensions/include/IOBase.h
+10
-9
SMInterface.h
extensions/include/SMInterface.h
+3
-2
UObject_SK.h
extensions/include/UObject_SK.h
+1
-1
IOBase.cc
extensions/lib/IOBase.cc
+9
-9
SMInterface.cc
extensions/lib/SMInterface.cc
+1
-1
UObject_SK.cc
extensions/lib/UObject_SK.cc
+6
-6
TestProc.cc
extensions/tests/SMemoryTest/TestProc.cc
+4
-4
test_iobase.cc
extensions/tests/test_iobase.cc
+6
-6
test_iobase_with_sm.cc
extensions/tests/test_iobase_with_sm.cc
+4
-6
tests_with_sm.cc
extensions/tests/tests_with_sm.cc
+2
-2
ProxyManager.h
include/ProxyManager.h
+2
-1
SViewer.h
include/SViewer.h
+3
-1
UniSetObject.h
include/UniSetObject.h
+1
-1
ProxyManager.cc
src/ObjectRepository/ProxyManager.cc
+4
-4
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+13
-11
IOController.cc
src/Processes/IOController.cc
+4
-4
IONotifyController.cc
src/Processes/IONotifyController.cc
+5
-5
SMonitor.cc
src/Various/SMonitor.cc
+1
-1
SViewer.cc
src/Various/SViewer.cc
+2
-2
No files found.
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
View file @
b1ef89fe
...
@@ -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
&&
ptHeartBeat.checkTime() )
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
{
ui
.
setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ui
->
setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset();
ptHeartBeat.reset();
}
}
...
@@ -154,7 +154,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
...
@@ -154,7 +154,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
<xsl:if
test=
"normalize-space(@name)=$OID"
>
<xsl:if
test=
"normalize-space(@name)=$OID"
>
<xsl:if
test=
"normalize-space(@vartype)='in'"
>
<xsl:if
test=
"normalize-space(@vartype)='in'"
>
ui
.
askRemoteSensor(
<xsl:value-of
select=
"../../@name"
/>
,_cmd,node_
<xsl:value-of
select=
"../../@name"
/>
, getId());
ui
->
askRemoteSensor(
<xsl:value-of
select=
"../../@name"
/>
,_cmd,node_
<xsl:value-of
select=
"../../@name"
/>
, getId());
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
...
@@ -178,7 +178,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
...
@@ -178,7 +178,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
{
{
// ui
.
setState(sid,state);
// ui
->
setState(sid,state);
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
<xsl:if
test=
"normalize-space(@name)=$OID"
>
<xsl:if
test=
"normalize-space(@name)=$OID"
>
<xsl:if
test=
"normalize-space(../../@msg)!='1'"
>
<xsl:if
test=
"normalize-space(../../@msg)!='1'"
>
...
@@ -195,12 +195,12 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
...
@@ -195,12 +195,12 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
ui
.
setValue(_sid,_val);
ui
->
setValue(_sid,_val);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::askSensor( 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());
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -213,14 +213,14 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
...
@@ -213,14 +213,14 @@ 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: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:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
return ui
.
getValue(_sid);
return ui
->
getValue(_sid);
}
}
catch(Exception
&
ex)
catch(Exception
&
ex)
{
{
...
@@ -255,7 +255,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
...
@@ -255,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
.
setValue( si,m_
<xsl:value-of
select=
"../../@name"
/>
, 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>
...
@@ -286,7 +286,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -286,7 +286,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: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:if>
</xsl:if>
</xsl:if>
</xsl:if>
}
}
...
@@ -323,7 +323,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -323,7 +323,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
ui
->
setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
}
}
catch(Exception
&
ex)
catch(Exception
&
ex)
{
{
...
@@ -338,7 +338,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -338,7 +338,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
ui
->
setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
}
}
catch(Exception
&
ex)
catch(Exception
&
ex)
{
{
...
...
Utilities/codegen/ctl-cpp-cc-alone.xsl
View file @
b1ef89fe
...
@@ -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
&&
ptHeartBeat.checkTime() )
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
{
ui
.
setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ui
->
setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset();
ptHeartBeat.reset();
}
}
...
@@ -138,7 +138,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _s
...
@@ -138,7 +138,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _s
// что-бы компилятор выбрал
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateIo _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::AI;
_sm.sensor_type = UniversalIO::AI;
sensorInfo(
&
_sm);
sensorInfo(
&
_sm);
...
@@ -147,7 +147,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _s
...
@@ -147,7 +147,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _s
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
{
{
// ui
.
setState(sid,state);
// ui
->
setState(sid,state);
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
<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"
>
...
@@ -163,7 +163,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
...
@@ -163,7 +163,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
ui
.
setValue(_sid,_val);
ui
->
setValue(_sid,_val);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -178,7 +178,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
...
@@ -178,7 +178,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
return ui
.
getValue(_sid);
return ui
->
getValue(_sid);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::updateOutputs( bool _force )
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::updateOutputs( bool _force )
...
@@ -220,7 +220,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -220,7 +220,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: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:if>
</xsl:if>
</xsl:if>
</xsl:if>
}
}
...
@@ -257,7 +257,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -257,7 +257,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
ui
->
setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
}
}
catch( Exception
&
ex )
catch( Exception
&
ex )
{
{
...
@@ -272,7 +272,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -272,7 +272,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
ui
->
setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
}
}
catch( Exception
&
ex )
catch( Exception
&
ex )
{
{
...
...
Utilities/codegen/ctl-cpp-cc-ask.xsl
View file @
b1ef89fe
...
@@ -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
&&
ptHeartBeat.checkTime() )
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
{
ui
.
setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ui
->
setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset();
ptHeartBeat.reset();
}
}
...
@@ -120,7 +120,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
...
@@ -120,7 +120,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
ui
.
setValue(_sid,_val);
ui
->
setValue(_sid,_val);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::updateOutputs( bool _force )
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::updateOutputs( bool _force )
...
@@ -143,7 +143,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
...
@@ -143,7 +143,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
.
setValue( si,m_<xsl:value-of select="@name"/>,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>
...
@@ -173,7 +173,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::S
...
@@ -173,7 +173,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::S
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::askSensor( 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());
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
long
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::getValue( UniSetTypes::ObjectId _sid )
long
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::getValue( UniSetTypes::ObjectId _sid )
...
@@ -183,12 +183,12 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
...
@@ -183,12 +183,12 @@ 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"
/>
&&
<xsl:value-of
select=
"@name"
/>
!= DefaultObjectId )
if( _sid ==
<xsl:value-of
select=
"@name"
/>
&&
<xsl:value-of
select=
"@name"
/>
!= DefaultObjectId )
{
{
<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:for-each>
</xsl:for-each>
return ui
.
getValue(_sid);
return ui
->
getValue(_sid);
}
}
catch(Exception
&
ex)
catch(Exception
&
ex)
{
{
...
@@ -220,7 +220,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
...
@@ -220,7 +220,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
<xsl:for-each
select=
"//smap/item"
>
<xsl:for-each
select=
"//smap/item"
>
<xsl:if
test=
"normalize-space(@vartype)='in'"
>
<xsl:if
test=
"normalize-space(@vartype)='in'"
>
if(
<xsl:value-of
select=
"@name"
/>
!= DefaultObjectId )
if(
<xsl:value-of
select=
"@name"
/>
!= DefaultObjectId )
ui
.
askRemoteSensor(
<xsl:value-of
select=
"@name"
/>
,_cmd,node_
<xsl:value-of
select=
"@name"
/>
,getId());
ui
->
askRemoteSensor(
<xsl:value-of
select=
"@name"
/>
,_cmd,node_
<xsl:value-of
select=
"@name"
/>
,getId());
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
return;
return;
...
@@ -263,7 +263,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -263,7 +263,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
{
{
try
try
{
{
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
= ui
.
getValue(
<xsl:value-of
select=
"@name"
/>
, node_
<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"
/>
);
}
}
catch( UniSetTypes::Exception
&
ex )
catch( UniSetTypes::Exception
&
ex )
{
{
...
@@ -280,7 +280,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -280,7 +280,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
ui
->
setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
}
}
catch( UniSetTypes::Exception
&
ex )
catch( UniSetTypes::Exception
&
ex )
{
{
...
@@ -298,7 +298,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
...
@@ -298,7 +298,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
ui
->
setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
}
}
catch( UniSetTypes::Exception
&
ex )
catch( UniSetTypes::Exception
&
ex )
{
{
...
...
Utilities/codegen/ctl-cpp-cc.xsl
View file @
b1ef89fe
...
@@ -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
&&
ptHeartBeat.checkTime() )
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
{
ui
.
setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ui
->
setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset();
ptHeartBeat.reset();
}
}
...
@@ -123,7 +123,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId sid
...
@@ -123,7 +123,7 @@ 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);
ui
->
setValue(sid,val);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::updateOutputs( bool force )
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::updateOutputs( bool force )
...
@@ -138,7 +138,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool force )
...
@@ -138,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
.
setValue( si,m_<xsl:value-of select="@name"/>,getId() );
ui
->
setValue( si,m_<xsl:value-of select="@name"/>,getId() );
</xsl:for-each>
</xsl:for-each>
-->
-->
}
}
...
@@ -160,7 +160,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId si
...
@@ -160,7 +160,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId si
// что-бы компилятор выбрал
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у 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::AI;
sm.sensor_type = UniversalIO::AI;
sm.node = node;
sm.node = node;
sensorInfo(
&
sm);
sensorInfo(
&
sm);
...
@@ -174,7 +174,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
...
@@ -174,7 +174,7 @@ 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);
return ui
->
getValue(_sid);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::preSensorInfo( const UniSetTypes::SensorMessage* sm )
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::preSensorInfo( const UniSetTypes::SensorMessage* sm )
...
@@ -203,7 +203,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
...
@@ -203,7 +203,7 @@ 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:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
= ui
->
getValue(
<xsl:value-of
select=
"@name"
/>
,node_
<xsl:value-of
select=
"@name"
/>
);
}
}
catch( Exception
&
ex )
catch( Exception
&
ex )
{
{
...
@@ -219,7 +219,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
...
@@ -219,7 +219,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
ui
->
setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
}
}
}
}
catch( Exception
&
ex )
catch( Exception
&
ex )
...
@@ -237,7 +237,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
...
@@ -237,7 +237,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
ui
->
setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
}
}
}
}
catch( Exception
&
ex )
catch( Exception
&
ex )
...
@@ -254,7 +254,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId code,
...
@@ -254,7 +254,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( 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
.
setValue( si,(long)m_
<xsl:value-of
select=
"@name"
/>
, getId() );
ui
->
setValue( si,(long)m_
<xsl:value-of
select=
"@name"
/>
, getId() );
}
}
}
}
catch( Exception
&
ex )
catch( Exception
&
ex )
...
...
Utilities/codegen/ctl-cpp-common.xsl
View file @
b1ef89fe
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
</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
.
setValue( si,( m_
<xsl:value-of
select=
"../../@name"
/>
? 1:0), 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"
/>
)
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
{
{
// сохраняем сразу...
// сохраняем сразу...
si.id = mid_
<xsl:value-of
select=
"../../@name"
/>
;
si.id = mid_
<xsl:value-of
select=
"../../@name"
/>
;
ui
.
setValue( si,(m_
<xsl:value-of
select=
"../../@name"
/>
? 1:0), getId() );
ui
->
setValue( si,(m_
<xsl:value-of
select=
"../../@name"
/>
? 1:0), getId() );
return true;
return true;
}
}
catch(...){}
catch(...){}
...
@@ -126,7 +126,7 @@
...
@@ -126,7 +126,7 @@
try
try
{
{
si.id = mid_
<xsl:value-of
select=
"../../@name"
/>
;
si.id = mid_
<xsl:value-of
select=
"../../@name"
/>
;
ui
.
setValue( si,0,getId() );
ui
->
setValue( si,0,getId() );
}
}
catch( UniSetTypes::Exception
&
ex )
catch( UniSetTypes::Exception
&
ex )
{
{
...
@@ -387,7 +387,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
...
@@ -387,7 +387,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
<<
wait_msec
<<
" msec"
<<
wait_msec
<<
" msec"
<<
" testID="
<<
_testID
<<
endl;
<<
" testID="
<<
_testID
<<
endl;
if( !ui
.
waitReady(_testID,wait_msec) )
if( !ui
->
waitReady(_testID,wait_msec) )
{
{
ostringstream err;
ostringstream err;
err
<<
myname
err
<<
myname
...
@@ -404,7 +404,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
...
@@ -404,7 +404,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
<xsl:if
test=
"normalize-space($TESTMODE)!=''"
>
<xsl:if
test=
"normalize-space($TESTMODE)!=''"
>
if( idTestMode_S != DefaultObjectId )
if( idTestMode_S != DefaultObjectId )
{
{
if( !ui
.
waitWorking(idTestMode_S,wait_msec) )
if( !ui
->
waitWorking(idTestMode_S,wait_msec) )
{
{
ostringstream err;
ostringstream err;
err
<<
myname
err
<<
myname
...
@@ -749,8 +749,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateValues()
...
@@ -749,8 +749,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
.
getValue(idTestMode_S):false;
in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui
->
getValue(idTestMode_S):false;
in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui
.
getValue(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>
...
@@ -806,7 +806,7 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId _code,
...
@@ -806,7 +806,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
.
setValue( si,m_
<xsl:value-of
select=
"@name"
/>
,getId() );
ui
->
setValue( si,m_
<xsl:value-of
select=
"@name"
/>
,getId() );
return true;
return true;
}
}
catch(...){}
catch(...){}
...
@@ -829,7 +829,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::resetMsg()
...
@@ -829,7 +829,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
.
setValue( si, 0, getId() );
ui
->
setValue( si, 0, getId() );
}
}
catch( UniSetTypes::Exception
&
ex )
catch( UniSetTypes::Exception
&
ex )
{
{
...
@@ -998,8 +998,8 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
...
@@ -998,8 +998,8 @@ askPause(uniset_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
.
getValue(idTestMode_S):false;
in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui
->
getValue(idTestMode_S):false;
in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui
.
getValue(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"
>
...
...
conf/libuniset2.spec
View file @
b1ef89fe
%def_enable doc
%def_enable doc
s
%def_enable mysql
%def_enable mysql
%def_enable sqlite
%def_enable sqlite
%def_enable python
%def_enable python
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
Name: libuniset2
Name: libuniset2
Version: 2.0
Version: 2.0
Release: alt1
0
Release: alt1
1
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
...
@@ -54,7 +54,7 @@ BuildRequires(pre): rpm-build-python
...
@@ -54,7 +54,7 @@ BuildRequires(pre): rpm-build-python
# add_findprov_lib_path %python_sitelibdir/%oname
# add_findprov_lib_path %python_sitelibdir/%oname
%endif
%endif
%if_enabled doc
%if_enabled doc
s
BuildRequires: doxygen
BuildRequires: doxygen
%endif
%endif
...
@@ -108,15 +108,15 @@ Obsoletes: %oname-utils
...
@@ -108,15 +108,15 @@ Obsoletes: %oname-utils
%description utils
%description utils
UniSet utilities
UniSet utilities
%if_enabled doc
%if_enabled doc
s
%package doc
%package doc
s
Group: Development/C++
Group: Development/C++
Summary: Documentations for developing with UniSet
Summary: Documentations for developing with UniSet
Requires: %name = %version-%release
Requires: %name = %version-%release
BuildArch: noarch
BuildArch: noarch
%description doc
%description doc
s
Documentations for developing with UniSet
Documentations for developing with UniSet
%endif
%endif
...
@@ -241,7 +241,7 @@ SharedMemoryPlus extension ('all in one') for libuniset
...
@@ -241,7 +241,7 @@ SharedMemoryPlus extension ('all in one') for libuniset
%build
%build
%autoreconf
%autoreconf
%configure %{subst_enable doc} %{subst_enable mysql} %{subst_enable sqlite} %{subst_enable python} %{subst_enable rrd} %{subst_enable io} %{subst_enable logicproc} %{subst_enable tests}
%configure %{subst_enable doc
s
} %{subst_enable mysql} %{subst_enable sqlite} %{subst_enable python} %{subst_enable rrd} %{subst_enable io} %{subst_enable logicproc} %{subst_enable tests}
%make
%make
%install
%install
...
@@ -323,8 +323,8 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
...
@@ -323,8 +323,8 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%endif
%endif
%if_enabled doc
%if_enabled doc
s
%files doc
%files doc
s
%_docdir/%oname
%_docdir/%oname
%endif
%endif
...
@@ -406,6 +406,11 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
...
@@ -406,6 +406,11 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet2.pc
%exclude %_pkgconfigdir/libUniSet2.pc
%changelog
%changelog
* Sat Jan 17 2015 Pavel Vainerman <pv@altlinux.ru> 2.0-alt11
- refactoring "exit process"
- fixed bug in specfile: --enable-doc --> --enable-docs
- transition to use shared_ptr wherever possible
* Mon Nov 24 2014 Pavel Vainerman <pv@altlinux.ru> 2.0-alt10
* Mon Nov 24 2014 Pavel Vainerman <pv@altlinux.ru> 2.0-alt10
- use shared_ptr
- use shared_ptr
...
...
configure.ac
View file @
b1ef89fe
...
@@ -165,13 +165,13 @@ AM_CONDITIONAL(DISABLE_PYTHON, test ${buildpython} = false)
...
@@ -165,13 +165,13 @@ AM_CONDITIONAL(DISABLE_PYTHON, test ${buildpython} = false)
# check Doxygen
# check Doxygen
DOXYGEN=""
DOXYGEN=""
doc=false
doc
s
=false
dox=
dox=
AC_MSG_CHECKING([Generate docs])
AC_MSG_CHECKING([Generate docs])
AC_ARG_ENABLE(docs,AC_HELP_STRING([--enable-docs], [enable build docs]),
AC_ARG_ENABLE(docs,AC_HELP_STRING([--enable-docs], [enable build docs]),
[ if test $enableval = yes; then doc
=true; else doc=false; fi],[ doc
=false; ])
[ if test $enableval = yes; then doc
s=true; else docs=false; fi],[ docs
=false; ])
if test ${doc} = true; then
if test ${doc
s
} = true; then
AC_MSG_RESULT([yes])
AC_MSG_RESULT([yes])
AC_PATH_PROG([DOXYGEN], [doxygen])
AC_PATH_PROG([DOXYGEN], [doxygen])
test "x$DOXYGEN" = "x" && AC_MSG_WARN([*** Doxygen not found])
test "x$DOXYGEN" = "x" && AC_MSG_WARN([*** Doxygen not found])
...
...
extensions/IOControl/IOControl.cc
View file @
b1ef89fe
...
@@ -31,7 +31,6 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -31,7 +31,6 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
iomap
(
100
),
iomap
(
100
),
maxItem
(
0
),
maxItem
(
0
),
filterT
(
0
),
filterT
(
0
),
shm
(
0
),
myid
(
id
),
myid
(
id
),
prefix
(
prefix_
),
prefix
(
prefix_
),
blink_state
(
true
),
blink_state
(
true
),
...
@@ -172,7 +171,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -172,7 +171,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
dinfo
<<
myname
<<
"(init): testMode_as='"
<<
testmode
<<
"'"
<<
endl
;
dinfo
<<
myname
<<
"(init): testMode_as='"
<<
testmode
<<
"'"
<<
endl
;
}
}
shm
=
new
SMInterface
(
icID
,
&
ui
,
myid
,
ic
);
shm
=
make_shared
<
SMInterface
>
(
icID
,
ui
,
myid
,
ic
);
// определяем фильтр
// определяем фильтр
s_field
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-s-filter-field"
);
s_field
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-s-filter-field"
);
...
@@ -247,8 +246,6 @@ IOControl::~IOControl()
...
@@ -247,8 +246,6 @@ IOControl::~IOControl()
//
//
for
(
unsigned
int
i
=
0
;
i
<
cards
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
cards
.
size
();
i
++
)
delete
cards
[
i
];
delete
cards
[
i
];
delete
shm
;
}
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
...
...
extensions/IOControl/IOControl.h
View file @
b1ef89fe
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#define IOControl_H_
#define IOControl_H_
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#include <vector>
#include <vector>
#include <memory>
#include <deque>
#include <deque>
#include <string>
#include <string>
#include "UniXML.h"
#include "UniXML.h"
...
@@ -335,8 +336,7 @@ class IOControl:
...
@@ -335,8 +336,7 @@ class IOControl:
std
::
string
s_field
;
std
::
string
s_field
;
std
::
string
s_fvalue
;
std
::
string
s_fvalue
;
SMInterface
*
shm
;
std
::
shared_ptr
<
SMInterface
>
shm
;
UInterface
ui
;
UniSetTypes
::
ObjectId
myid
;
UniSetTypes
::
ObjectId
myid
;
std
::
string
prefix
;
std
::
string
prefix
;
...
...
extensions/LogicProcessor/PassiveLProcessor.cc
View file @
b1ef89fe
...
@@ -9,12 +9,12 @@ using namespace UniSetExtensions;
...
@@ -9,12 +9,12 @@ using namespace UniSetExtensions;
PassiveLProcessor
::
PassiveLProcessor
(
std
::
string
lfile
,
UniSetTypes
::
ObjectId
objId
,
PassiveLProcessor
::
PassiveLProcessor
(
std
::
string
lfile
,
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
std
::
string
&
prefix
)
:
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
std
::
string
&
prefix
)
:
UniSetObject_LT
(
objId
),
UniSetObject_LT
(
objId
),
shm
(
0
)
shm
(
nullptr
)
{
{
auto
conf
=
uniset_conf
();
auto
conf
=
uniset_conf
();
logname
=
myname
;
logname
=
myname
;
shm
=
new
SMInterface
(
shmID
,
&
(
UniSetObject_LT
::
ui
)
,
objId
,
ic
);
shm
=
make_shared
<
SMInterface
>
(
shmID
,
UniSetObject_LT
::
ui
,
objId
,
ic
);
build
(
lfile
);
build
(
lfile
);
// ********** HEARTBEAT *************
// ********** HEARTBEAT *************
...
@@ -42,7 +42,7 @@ PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId o
...
@@ -42,7 +42,7 @@ PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId o
PassiveLProcessor
::~
PassiveLProcessor
()
PassiveLProcessor
::~
PassiveLProcessor
()
{
{
delete
shm
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
PassiveLProcessor
::
step
()
void
PassiveLProcessor
::
step
()
...
...
extensions/LogicProcessor/PassiveLProcessor.h
View file @
b1ef89fe
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define PassiveLProcessor_H_
#define PassiveLProcessor_H_
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#include <map>
#include <map>
#include <memory>
#include "UniSetTypes.h"
#include "UniSetTypes.h"
#include "UniSetObject_LT.h"
#include "UniSetObject_LT.h"
#include "Extensions.h"
#include "Extensions.h"
...
@@ -44,7 +45,7 @@ class PassiveLProcessor:
...
@@ -44,7 +45,7 @@ class PassiveLProcessor:
void
initIterators
();
void
initIterators
();
virtual
bool
activateObject
()
override
;
virtual
bool
activateObject
()
override
;
SMInterface
*
shm
;
std
::
shared_ptr
<
SMInterface
>
shm
;
private
:
private
:
PassiveTimer
ptHeartBeat
;
PassiveTimer
ptHeartBeat
;
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
b1ef89fe
...
@@ -15,7 +15,6 @@ MBExchange::MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId
...
@@ -15,7 +15,6 @@ MBExchange::MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
std
::
string
&
prefix
)
:
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
std
::
string
&
prefix
)
:
UniSetObject_LT
(
objId
),
UniSetObject_LT
(
objId
),
allInitOK
(
false
),
allInitOK
(
false
),
shm
(
0
),
initPause
(
0
),
initPause
(
0
),
force
(
false
),
force
(
false
),
force_out
(
false
),
force_out
(
false
),
...
@@ -43,7 +42,7 @@ pollActivated(false)
...
@@ -43,7 +42,7 @@ pollActivated(false)
if
(
cnode
==
NULL
)
if
(
cnode
==
NULL
)
throw
UniSetTypes
::
SystemError
(
"(MBExchange): Not found node <"
+
conf_name
+
" ...> for "
+
myname
);
throw
UniSetTypes
::
SystemError
(
"(MBExchange): Not found node <"
+
conf_name
+
" ...> for "
+
myname
);
shm
=
new
SMInterface
(
shmId
,
&
ui
,
objId
,
ic
);
shm
=
make_shared
<
SMInterface
>
(
shmId
,
ui
,
objId
,
ic
);
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
cnode
);
...
@@ -189,7 +188,6 @@ MBExchange::~MBExchange()
...
@@ -189,7 +188,6 @@ MBExchange::~MBExchange()
}
}
mb
.
reset
();
mb
.
reset
();
delete
shm
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
MBExchange
::
waitSMReady
()
void
MBExchange
::
waitSMReady
()
...
...
extensions/ModbusMaster/MBExchange.h
View file @
b1ef89fe
...
@@ -291,7 +291,7 @@ class MBExchange:
...
@@ -291,7 +291,7 @@ class MBExchange:
std
::
string
s_field
;
std
::
string
s_field
;
std
::
string
s_fvalue
;
std
::
string
s_fvalue
;
SMInterface
*
shm
;
std
::
shared_ptr
<
SMInterface
>
shm
;
bool
initPause
;
bool
initPause
;
UniSetTypes
::
uniset_rwmutex
mutex_start
;
UniSetTypes
::
uniset_rwmutex
mutex_start
;
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
b1ef89fe
...
@@ -13,8 +13,6 @@ using namespace ModbusRTU;
...
@@ -13,8 +13,6 @@ using namespace ModbusRTU;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
MBSlave
::
MBSlave
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
string
&
prefix
)
:
MBSlave
::
MBSlave
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
string
&
prefix
)
:
UniSetObject_LT
(
objId
),
UniSetObject_LT
(
objId
),
mbslot
(
0
),
shm
(
0
),
initPause
(
0
),
initPause
(
0
),
test_id
(
DefaultObjectId
),
test_id
(
DefaultObjectId
),
askcount_id
(
DefaultObjectId
),
askcount_id
(
DefaultObjectId
),
...
@@ -40,7 +38,7 @@ prefix(prefix)
...
@@ -40,7 +38,7 @@ prefix(prefix)
if
(
cnode
==
NULL
)
if
(
cnode
==
NULL
)
throw
UniSetTypes
::
SystemError
(
"(MBSlave): Not found conf-node for "
+
myname
);
throw
UniSetTypes
::
SystemError
(
"(MBSlave): Not found conf-node for "
+
myname
);
shm
=
new
SMInterface
(
shmId
,
&
ui
,
objId
,
ic
);
shm
=
make_shared
<
SMInterface
>
(
shmId
,
ui
,
objId
,
ic
);
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
cnode
);
...
@@ -89,15 +87,15 @@ prefix(prefix)
...
@@ -89,15 +87,15 @@ prefix(prefix)
bool
use485F
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-use485F"
,
it
.
getProp
(
"use485F"
));
bool
use485F
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-use485F"
,
it
.
getProp
(
"use485F"
));
bool
transmitCtl
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-transmit-ctl"
,
it
.
getProp
(
"transmitCtl"
));
bool
transmitCtl
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-transmit-ctl"
,
it
.
getProp
(
"transmitCtl"
));
ModbusRTUSlaveSlot
*
rs
=
new
ModbusRTUSlaveSlot
(
dev
,
use485F
,
transmitCtl
);
auto
rs
=
make_shared
<
ModbusRTUSlaveSlot
>
(
dev
,
use485F
,
transmitCtl
);
rs
->
setSpeed
(
speed
);
rs
->
setSpeed
(
speed
);
rs
->
setRecvTimeout
(
2000
);
rs
->
setRecvTimeout
(
2000
);
rs
->
setAfterSendPause
(
aftersend_pause
);
rs
->
setAfterSendPause
(
aftersend_pause
);
rs
->
setReplyTimeout
(
reply_tout
);
rs
->
setReplyTimeout
(
reply_tout
);
rs
->
setLog
(
dlog
);
rs
->
setLog
(
dlog
);
mbslot
=
rs
;
mbslot
=
std
::
static_pointer_cast
<
ModbusServerSlot
>
(
rs
)
;
thr
=
new
ThreadCreator
<
MBSlave
>
(
this
,
&
MBSlave
::
execute_rtu
);
thr
=
make_shared
<
ThreadCreator
<
MBSlave
>
>
(
this
,
&
MBSlave
::
execute_rtu
);
thr
->
setFinalAction
(
this
,
&
MBSlave
::
finalThread
);
thr
->
setFinalAction
(
this
,
&
MBSlave
::
finalThread
);
dinfo
<<
myname
<<
"(init): type=RTU myaddr="
<<
ModbusRTU
::
addr2str
(
addr
)
dinfo
<<
myname
<<
"(init): type=RTU myaddr="
<<
ModbusRTU
::
addr2str
(
addr
)
<<
" dev="
<<
dev
<<
" speed="
<<
speed
<<
endl
;
<<
" dev="
<<
dev
<<
" speed="
<<
speed
<<
endl
;
...
@@ -114,13 +112,13 @@ prefix(prefix)
...
@@ -114,13 +112,13 @@ prefix(prefix)
<<
" inet="
<<
iaddr
<<
" port="
<<
port
<<
endl
;
<<
" inet="
<<
iaddr
<<
" port="
<<
port
<<
endl
;
ost
::
InetAddress
ia
(
iaddr
.
c_str
());
ost
::
InetAddress
ia
(
iaddr
.
c_str
());
ModbusTCPServerSlot
*
mbtcp
=
new
ModbusTCPServerSlot
(
ia
,
port
);
auto
mbtcp
=
make_shared
<
ModbusTCPServerSlot
>
(
ia
,
port
);
mbtcp
->
setAfterSendPause
(
aftersend_pause
);
mbtcp
->
setAfterSendPause
(
aftersend_pause
);
mbtcp
->
setReplyTimeout
(
reply_tout
);
mbtcp
->
setReplyTimeout
(
reply_tout
);
mbslot
=
mb
tcp
;
mbslot
=
mb
slot
=
std
::
static_pointer_cast
<
ModbusServerSlot
>
(
mbtcp
)
;
thr
=
new
ThreadCreator
<
MBSlave
>
(
this
,
&
MBSlave
::
execute_tcp
);
thr
=
make_shared
<
ThreadCreator
<
MBSlave
>
>
(
this
,
&
MBSlave
::
execute_tcp
);
thr
->
setFinalAction
(
this
,
&
MBSlave
::
finalThread
);
thr
->
setFinalAction
(
this
,
&
MBSlave
::
finalThread
);
dinfo
<<
myname
<<
"(init): init TCP connection ok. "
<<
" inet="
<<
iaddr
<<
" port="
<<
port
<<
endl
;
dinfo
<<
myname
<<
"(init): init TCP connection ok. "
<<
" inet="
<<
iaddr
<<
" port="
<<
port
<<
endl
;
...
@@ -364,16 +362,11 @@ prefix(prefix)
...
@@ -364,16 +362,11 @@ prefix(prefix)
MBSlave
::~
MBSlave
()
MBSlave
::~
MBSlave
()
{
{
cancelled
=
true
;
cancelled
=
true
;
if
(
thr
&&
thr
->
isRunning
()
)
if
(
thr
&&
thr
->
isRunning
()
)
{
{
thr
->
stop
();
thr
->
stop
();
// thr->join();
// thr->join();
}
}
delete
thr
;
delete
mbslot
;
delete
shm
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
MBSlave
::
finalThread
()
void
MBSlave
::
finalThread
()
...
@@ -402,7 +395,7 @@ void MBSlave::waitSMReady()
...
@@ -402,7 +395,7 @@ void MBSlave::waitSMReady()
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
MBSlave
::
execute_rtu
()
void
MBSlave
::
execute_rtu
()
{
{
ModbusRTUSlaveSlot
*
rscomm
=
dynamic_cast
<
ModbusRTUSlaveSlot
*
>
(
mbslot
);
auto
rscomm
=
dynamic_pointer_cast
<
ModbusRTUSlaveSlot
>
(
mbslot
);
ModbusRTU
::
mbErrCode
prev
=
erNoError
;
ModbusRTU
::
mbErrCode
prev
=
erNoError
;
...
@@ -483,7 +476,7 @@ void MBSlave::execute_rtu()
...
@@ -483,7 +476,7 @@ void MBSlave::execute_rtu()
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
MBSlave
::
execute_tcp
()
void
MBSlave
::
execute_tcp
()
{
{
ModbusTCPServerSlot
*
sslot
=
dynamic_cast
<
ModbusTCPServerSlot
*
>
(
mbslot
);
auto
sslot
=
dynamic_pointer_cast
<
ModbusTCPServerSlot
>
(
mbslot
);
ModbusRTU
::
mbErrCode
prev
=
erNoError
;
ModbusRTU
::
mbErrCode
prev
=
erNoError
;
...
...
extensions/ModbusSlave/MBSlave.h
View file @
b1ef89fe
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#include <ostream>
#include <ostream>
#include <string>
#include <string>
#include <memory>
#include <map>
#include <map>
#include <vector>
#include <vector>
#include "UniSetObject_LT.h"
#include "UniSetObject_LT.h"
...
@@ -365,14 +366,14 @@ class MBSlave:
...
@@ -365,14 +366,14 @@ class MBSlave:
typedef
std
::
map
<
ModbusRTU
::
ModbusData
,
IOProperty
>
IOMap
;
typedef
std
::
map
<
ModbusRTU
::
ModbusData
,
IOProperty
>
IOMap
;
IOMap
iomap
;
/*!< список входов/выходов */
IOMap
iomap
;
/*!< список входов/выходов */
ModbusServerSlot
*
mbslot
;
std
::
shared_ptr
<
ModbusServerSlot
>
mbslot
;
ModbusRTU
::
ModbusAddr
addr
;
/*!< адрес данного узла */
ModbusRTU
::
ModbusAddr
addr
;
/*!< адрес данного узла */
xmlNode
*
cnode
;
xmlNode
*
cnode
;
std
::
string
s_field
;
std
::
string
s_field
;
std
::
string
s_fvalue
;
std
::
string
s_fvalue
;
SMInterface
*
shm
;
std
::
shared_ptr
<
SMInterface
>
shm
;
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
msg
)
override
;
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
msg
)
override
;
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
;
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
;
...
@@ -407,7 +408,7 @@ class MBSlave:
...
@@ -407,7 +408,7 @@ class MBSlave:
MBSlave
();
MBSlave
();
bool
initPause
;
bool
initPause
;
UniSetTypes
::
uniset_rwmutex
mutex_start
;
UniSetTypes
::
uniset_rwmutex
mutex_start
;
ThreadCreator
<
MBSlave
>*
thr
;
std
::
shared_ptr
<
ThreadCreator
<
MBSlave
>
>
thr
;
PassiveTimer
ptHeartBeat
;
PassiveTimer
ptHeartBeat
;
UniSetTypes
::
ObjectId
sidHeartBeat
;
UniSetTypes
::
ObjectId
sidHeartBeat
;
...
...
extensions/ModbusSlave/MBTCPMultiSlave.cc
View file @
b1ef89fe
...
@@ -136,7 +136,7 @@ std::shared_ptr<MBTCPMultiSlave> MBTCPMultiSlave::init_mbslave( int argc, const
...
@@ -136,7 +136,7 @@ std::shared_ptr<MBTCPMultiSlave> MBTCPMultiSlave::init_mbslave( int argc, const
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
MBTCPMultiSlave
::
execute_tcp
()
void
MBTCPMultiSlave
::
execute_tcp
()
{
{
ModbusTCPServerSlot
*
sslot
=
dynamic_cast
<
ModbusTCPServerSlot
*
>
(
mbslot
);
auto
sslot
=
dynamic_pointer_cast
<
ModbusTCPServerSlot
>
(
mbslot
);
if
(
!
sslot
)
if
(
!
sslot
)
{
{
...
@@ -309,7 +309,7 @@ bool MBTCPMultiSlave::deactivateObject()
...
@@ -309,7 +309,7 @@ bool MBTCPMultiSlave::deactivateObject()
{
{
if
(
mbslot
)
if
(
mbslot
)
{
{
ModbusTCPServerSlot
*
sslot
=
dynamic_cast
<
ModbusTCPServerSlot
*
>
(
mbslot
);
auto
sslot
=
dynamic_pointer_cast
<
ModbusTCPServerSlot
>
(
mbslot
);
if
(
sslot
)
if
(
sslot
)
sslot
->
sigterm
(
SIGTERM
);
sslot
->
sigterm
(
SIGTERM
);
}
}
...
@@ -321,7 +321,7 @@ void MBTCPMultiSlave::sigterm( int signo )
...
@@ -321,7 +321,7 @@ void MBTCPMultiSlave::sigterm( int signo )
{
{
if
(
mbslot
)
if
(
mbslot
)
{
{
ModbusTCPServerSlot
*
sslot
=
dynamic_cast
<
ModbusTCPServerSlot
*
>
(
mbslot
);
auto
sslot
=
dynamic_pointer_cast
<
ModbusTCPServerSlot
>
(
mbslot
);
if
(
sslot
)
if
(
sslot
)
sslot
->
sigterm
(
signo
);
sslot
->
sigterm
(
signo
);
}
}
...
...
extensions/ModbusSlave/MBTCPMultiSlave.h
View file @
b1ef89fe
...
@@ -60,7 +60,7 @@ class MBTCPMultiSlave:
...
@@ -60,7 +60,7 @@ class MBTCPMultiSlave:
UniSetTypes
::
ObjectId
askcount_s
;
UniSetTypes
::
ObjectId
askcount_s
;
IOController
::
IOStateList
::
iterator
askcount_it
;
IOController
::
IOStateList
::
iterator
askcount_it
;
inline
void
initIterators
(
SMInterface
*
shm
)
inline
void
initIterators
(
const
std
::
shared_ptr
<
SMInterface
>&
shm
)
{
{
shm
->
initIterator
(
respond_it
);
shm
->
initIterator
(
respond_it
);
shm
->
initIterator
(
askcount_it
);
shm
->
initIterator
(
askcount_it
);
...
...
extensions/RRDServer/RRDServer.cc
View file @
b1ef89fe
...
@@ -16,7 +16,7 @@ RRDServer::RRDServer( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::
...
@@ -16,7 +16,7 @@ RRDServer::RRDServer( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::
UObject_SK
(
objId
,
cnode
),
UObject_SK
(
objId
,
cnode
),
prefix
(
prefix
)
prefix
(
prefix
)
{
{
shm
=
make_shared
<
SMInterface
>
(
shmId
,
&
ui
,
objId
,
ic
);
shm
=
make_shared
<
SMInterface
>
(
shmId
,
ui
,
objId
,
ic
);
mylog
=
log
;
mylog
=
log
;
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
cnode
);
...
...
extensions/SMViewer/SMViewer.cc
View file @
b1ef89fe
...
@@ -9,12 +9,11 @@ using namespace UniSetExtensions;
...
@@ -9,12 +9,11 @@ using namespace UniSetExtensions;
SMViewer
::
SMViewer
(
UniSetTypes
::
ObjectId
shmID
)
:
SMViewer
::
SMViewer
(
UniSetTypes
::
ObjectId
shmID
)
:
SViewer
(
uniset_conf
()
->
getControllersSection
(),
true
)
SViewer
(
uniset_conf
()
->
getControllersSection
(),
true
)
{
{
shm
=
new
SMInterface
(
shmID
,
&
ui
,
DefaultObjectId
,
0
);
shm
=
make_shared
<
SMInterface
>
(
shmID
,
ui
,
DefaultObjectId
);
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
SMViewer
::~
SMViewer
()
SMViewer
::~
SMViewer
()
{
{
delete
shm
;
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
void
SMViewer
::
run
()
void
SMViewer
::
run
()
...
...
extensions/SMViewer/SMViewer.h
View file @
b1ef89fe
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#define _SMVIEWER_H
#define _SMVIEWER_H
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
#include <string>
#include <string>
#include <memory>
#include "SViewer.h"
#include "SViewer.h"
#include "SMInterface.h"
#include "SMInterface.h"
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
...
@@ -17,9 +18,8 @@ class SMViewer:
...
@@ -17,9 +18,8 @@ class SMViewer:
protected
:
protected
:
std
::
shared_ptr
<
SMInterface
>
shm
;
private
:
private
:
SMInterface
*
shm
;
UInterface
ui
;
};
};
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#endif
#endif
...
...
extensions/SharedMemory/SharedMemory.cc
View file @
b1ef89fe
...
@@ -215,7 +215,7 @@ void SharedMemory::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -215,7 +215,7 @@ void SharedMemory::askSensors( UniversalIO::UIOCommand cmd )
{
{
try
try
{
{
ui
.
askState( SID, cmd);
ui
->
askState( SID, cmd);
}
}
catch(Exception& ex)
catch(Exception& ex)
{
{
...
@@ -490,7 +490,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
...
@@ -490,7 +490,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
{
{
try
try
{
{
ui
.
send
(
it
,
std
::
move
(
sm
.
transport_msg
())
);
ui
->
send
(
it
,
std
::
move
(
sm
.
transport_msg
())
);
ok
=
true
;
ok
=
true
;
break
;
break
;
}
}
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
b1ef89fe
...
@@ -9,12 +9,9 @@ using namespace UniSetExtensions;
...
@@ -9,12 +9,9 @@ using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
UNetExchange
::
UNetExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
std
::
string
&
prefix
)
:
UNetExchange
::
UNetExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
std
::
string
&
prefix
)
:
UniSetObject_LT
(
objId
),
UniSetObject_LT
(
objId
),
shm
(
0
),
initPause
(
0
),
initPause
(
0
),
activated
(
false
),
activated
(
false
),
no_sender
(
false
),
no_sender
(
false
)
sender
(
0
),
sender2
(
0
)
{
{
if
(
objId
==
DefaultObjectId
)
if
(
objId
==
DefaultObjectId
)
throw
UniSetTypes
::
SystemError
(
"(UNetExchange): objId=-1?!! Use --"
+
prefix
+
"-unet-name"
);
throw
UniSetTypes
::
SystemError
(
"(UNetExchange): objId=-1?!! Use --"
+
prefix
+
"-unet-name"
);
...
@@ -25,7 +22,7 @@ sender2(0)
...
@@ -25,7 +22,7 @@ sender2(0)
if
(
cnode
==
NULL
)
if
(
cnode
==
NULL
)
throw
UniSetTypes
::
SystemError
(
"(UNetExchange): Not found conf-node for "
+
myname
);
throw
UniSetTypes
::
SystemError
(
"(UNetExchange): Not found conf-node for "
+
myname
);
shm
=
make_shared
<
SMInterface
>
(
shmId
,
&
ui
,
objId
,
ic
);
shm
=
make_shared
<
SMInterface
>
(
shmId
,
ui
,
objId
,
ic
);
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
cnode
);
...
@@ -122,7 +119,7 @@ sender2(0)
...
@@ -122,7 +119,7 @@ sender2(0)
}
}
dinfo
<<
myname
<<
"(init): init sender.. my node "
<<
n_it
.
getProp
(
"name"
)
<<
endl
;
dinfo
<<
myname
<<
"(init): init sender.. my node "
<<
n_it
.
getProp
(
"name"
)
<<
endl
;
sender
=
new
UNetSender
(
h
,
p
,
shm
,
s_field
,
s_fvalue
);
sender
=
make_shared
<
UNetSender
>
(
h
,
p
,
shm
,
s_field
,
s_fvalue
);
sender
->
setSendPause
(
sendpause
);
sender
->
setSendPause
(
sendpause
);
try
try
...
@@ -131,7 +128,7 @@ sender2(0)
...
@@ -131,7 +128,7 @@ sender2(0)
if
(
!
h2
.
empty
()
)
if
(
!
h2
.
empty
()
)
{
{
dinfo
<<
myname
<<
"(init): init sender2.. my node "
<<
n_it
.
getProp
(
"name"
)
<<
endl
;
dinfo
<<
myname
<<
"(init): init sender2.. my node "
<<
n_it
.
getProp
(
"name"
)
<<
endl
;
sender2
=
new
UNetSender
(
h2
,
p2
,
shm
,
s_field
,
s_fvalue
);
sender2
=
make_shared
<
UNetSender
>
(
h2
,
p2
,
shm
,
s_field
,
s_fvalue
);
sender2
->
setSendPause
(
sendpause
);
sender2
->
setSendPause
(
sendpause
);
}
}
}
}
...
@@ -242,7 +239,7 @@ sender2(0)
...
@@ -242,7 +239,7 @@ sender2(0)
dinfo
<<
myname
<<
"(init): (node='"
<<
n
<<
"') add receiver "
dinfo
<<
myname
<<
"(init): (node='"
<<
n
<<
"') add receiver "
<<
h2
<<
":"
<<
p2
<<
endl
;
<<
h2
<<
":"
<<
p2
<<
endl
;
UNetReceiver
*
r
=
new
UNetReceiver
(
h
,
p
,
shm
);
auto
r
=
make_shared
<
UNetReceiver
>
(
h
,
p
,
shm
);
// на всякий принудительно разблокируем,
// на всякий принудительно разблокируем,
// чтобы не зависеть от значения по умолчанию
// чтобы не зависеть от значения по умолчанию
...
@@ -259,7 +256,7 @@ sender2(0)
...
@@ -259,7 +256,7 @@ sender2(0)
r
->
setLostPacketsID
(
lp_id
);
r
->
setLostPacketsID
(
lp_id
);
r
->
connectEvent
(
sigc
::
mem_fun
(
this
,
&
UNetExchange
::
receiverEvent
)
);
r
->
connectEvent
(
sigc
::
mem_fun
(
this
,
&
UNetExchange
::
receiverEvent
)
);
UNetReceiver
*
r2
=
0
;
shared_ptr
<
UNetReceiver
>
r2
(
nullptr
)
;
try
try
{
{
if
(
!
h2
.
empty
()
)
// создаём читателя впо второму каналу
if
(
!
h2
.
empty
()
)
// создаём читателя впо второму каналу
...
@@ -267,7 +264,7 @@ sender2(0)
...
@@ -267,7 +264,7 @@ sender2(0)
dinfo
<<
myname
<<
"(init): (node='"
<<
n
<<
"') add reserv receiver "
dinfo
<<
myname
<<
"(init): (node='"
<<
n
<<
"') add reserv receiver "
<<
h2
<<
":"
<<
p2
<<
endl
;
<<
h2
<<
":"
<<
p2
<<
endl
;
r2
=
new
UNetReceiver
(
h2
,
p2
,
shm
);
r2
=
make_shared
<
UNetReceiver
>
(
h2
,
p2
,
shm
);
// т.к. это резервный канал (по началу блокируем его)
// т.к. это резервный канал (по началу блокируем его)
r2
->
setLockUpdate
(
true
);
r2
->
setLockUpdate
(
true
);
...
@@ -339,16 +336,6 @@ sender2(0)
...
@@ -339,16 +336,6 @@ sender2(0)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
UNetExchange
::~
UNetExchange
()
UNetExchange
::~
UNetExchange
()
{
{
for
(
auto
&
it
:
recvlist
)
{
if
(
it
.
r1
)
delete
it
.
r1
;
if
(
it
.
r2
)
delete
it
.
r2
;
}
delete
sender
;
delete
sender2
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
bool
UNetExchange
::
checkExistUNetHost
(
const
std
::
string
&
addr
,
ost
::
tpport_t
port
)
bool
UNetExchange
::
checkExistUNetHost
(
const
std
::
string
&
addr
,
ost
::
tpport_t
port
)
...
@@ -680,7 +667,7 @@ std::shared_ptr<UNetExchange> UNetExchange::init_unetexchange( int argc, const c
...
@@ -680,7 +667,7 @@ std::shared_ptr<UNetExchange> UNetExchange::init_unetexchange( int argc, const c
return
make_shared
<
UNetExchange
>
(
ID
,
icID
,
ic
,
prefix
);
return
make_shared
<
UNetExchange
>
(
ID
,
icID
,
ic
,
prefix
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UNetExchange
::
receiverEvent
(
UNetReceiver
*
r
,
UNetReceiver
::
Event
ev
)
void
UNetExchange
::
receiverEvent
(
const
shared_ptr
<
UNetReceiver
>&
r
,
UNetReceiver
::
Event
ev
)
{
{
// пока, что другие события нас не интересуют
// пока, что другие события нас не интересуют
if
(
ev
!=
UNetReceiver
::
evTimeout
)
if
(
ev
!=
UNetReceiver
::
evTimeout
)
...
...
extensions/UNetUDP/UNetExchange.h
View file @
b1ef89fe
...
@@ -106,7 +106,7 @@ class UNetExchange:
...
@@ -106,7 +106,7 @@ class UNetExchange:
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
;
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
;
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
);
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
);
void
waitSMReady
();
void
waitSMReady
();
void
receiverEvent
(
UNetReceiver
*
r
,
UNetReceiver
::
Event
ev
);
void
receiverEvent
(
const
std
::
shared_ptr
<
UNetReceiver
>&
r
,
UNetReceiver
::
Event
ev
);
virtual
bool
activateObject
();
virtual
bool
activateObject
();
...
@@ -139,21 +139,21 @@ class UNetExchange:
...
@@ -139,21 +139,21 @@ class UNetExchange:
struct
ReceiverInfo
struct
ReceiverInfo
{
{
ReceiverInfo
()
:
r1
(
0
),
r2
(
0
),
ReceiverInfo
()
:
r1
(
nullptr
),
r2
(
nullptr
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
respondInvert
(
false
),
respondInvert
(
false
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
)
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
)
{}
{}
ReceiverInfo
(
UNetReceiver
*
_r1
,
UNetReceiver
*
_r2
)
:
ReceiverInfo
(
const
std
::
shared_ptr
<
UNetReceiver
>&
_r1
,
const
std
::
shared_ptr
<
UNetReceiver
>&
_r2
)
:
r1
(
_r1
),
r2
(
_r2
),
r1
(
_r1
),
r2
(
_r2
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
respondInvert
(
false
),
respondInvert
(
false
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
)
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
)
{}
{}
UNetReceiver
*
r1
;
/*!< приём по первому каналу */
std
::
shared_ptr
<
UNetReceiver
>
r1
;
/*!< приём по первому каналу */
UNetReceiver
*
r2
;
/*!< приём по второму каналу */
std
::
shared_ptr
<
UNetReceiver
>
r2
;
/*!< приём по второму каналу */
void
step
(
const
std
::
shared_ptr
<
SMInterface
>
shm
,
const
std
::
string
&
myname
);
void
step
(
const
std
::
shared_ptr
<
SMInterface
>
shm
,
const
std
::
string
&
myname
);
...
@@ -184,8 +184,8 @@ class UNetExchange:
...
@@ -184,8 +184,8 @@ class UNetExchange:
ReceiverList
recvlist
;
ReceiverList
recvlist
;
bool
no_sender
;
/*!< флаг отключения посылки сообщений (создания потока для посылки)*/
bool
no_sender
;
/*!< флаг отключения посылки сообщений (создания потока для посылки)*/
UNetSender
*
sender
;
std
::
shared_ptr
<
UNetSender
>
sender
;
UNetSender
*
sender2
;
std
::
shared_ptr
<
UNetSender
>
sender2
;
};
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#endif // UNetExchange_H_
#endif // UNetExchange_H_
...
...
extensions/UNetUDP/UNetReceiver.cc
View file @
b1ef89fe
...
@@ -19,11 +19,10 @@ bool UNetReceiver::PacketCompare::operator()(const UniSetUDP::UDPMessage& lhs,
...
@@ -19,11 +19,10 @@ bool UNetReceiver::PacketCompare::operator()(const UniSetUDP::UDPMessage& lhs,
}
}
*/
*/
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
UNetReceiver
::
UNetReceiver
(
const
std
::
string
&
s_host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>
smi
)
:
UNetReceiver
::
UNetReceiver
(
const
std
::
string
&
s_host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>
&
smi
)
:
shm
(
smi
),
shm
(
smi
),
recvpause
(
10
),
recvpause
(
10
),
updatepause
(
100
),
updatepause
(
100
),
udp
(
0
),
recvTimeout
(
5000
),
recvTimeout
(
5000
),
prepareTime
(
2000
),
prepareTime
(
2000
),
lostTimeout
(
5000
),
lostTimeout
(
5000
),
...
@@ -32,8 +31,6 @@ sidRespond(UniSetTypes::DefaultObjectId),
...
@@ -32,8 +31,6 @@ sidRespond(UniSetTypes::DefaultObjectId),
respondInvert
(
false
),
respondInvert
(
false
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
),
activated
(
false
),
activated
(
false
),
r_thr
(
0
),
u_thr
(
0
),
pnum
(
0
),
pnum
(
0
),
maxDifferens
(
1000
),
maxDifferens
(
1000
),
waitClean
(
false
),
waitClean
(
false
),
...
@@ -58,7 +55,7 @@ a_cache_init_ok(false)
...
@@ -58,7 +55,7 @@ a_cache_init_ok(false)
// addr = ci.getBroadcast();
// addr = ci.getBroadcast();
// cerr << "****************** addr: " << addr << endl;
// cerr << "****************** addr: " << addr << endl;
addr
=
s_host
.
c_str
();
addr
=
s_host
.
c_str
();
udp
=
new
ost
::
UDPDuplex
(
addr
,
port
);
udp
=
make_shared
<
ost
::
UDPDuplex
>
(
addr
,
port
);
}
}
catch
(
std
::
exception
&
e
)
catch
(
std
::
exception
&
e
)
{
{
...
@@ -75,8 +72,8 @@ a_cache_init_ok(false)
...
@@ -75,8 +72,8 @@ a_cache_init_ok(false)
throw
SystemError
(
s
.
str
());
throw
SystemError
(
s
.
str
());
}
}
r_thr
=
new
ThreadCreator
<
UNetReceiver
>
(
this
,
&
UNetReceiver
::
receive
);
r_thr
=
make_shared
<
ThreadCreator
<
UNetReceiver
>
>
(
this
,
&
UNetReceiver
::
receive
);
u_thr
=
new
ThreadCreator
<
UNetReceiver
>
(
this
,
&
UNetReceiver
::
update
);
u_thr
=
make_shared
<
ThreadCreator
<
UNetReceiver
>
>
(
this
,
&
UNetReceiver
::
update
);
ptRecvTimeout
.
setTiming
(
recvTimeout
);
ptRecvTimeout
.
setTiming
(
recvTimeout
);
ptPrepare
.
setTiming
(
prepareTime
);
ptPrepare
.
setTiming
(
prepareTime
);
...
@@ -84,9 +81,6 @@ a_cache_init_ok(false)
...
@@ -84,9 +81,6 @@ a_cache_init_ok(false)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
UNetReceiver
::~
UNetReceiver
()
UNetReceiver
::~
UNetReceiver
()
{
{
delete
r_thr
;
delete
u_thr
;
delete
udp
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UNetReceiver
::
setReceiveTimeout
(
timeout_t
msec
)
void
UNetReceiver
::
setReceiveTimeout
(
timeout_t
msec
)
...
@@ -405,9 +399,9 @@ void UNetReceiver::receive()
...
@@ -405,9 +399,9 @@ void UNetReceiver::receive()
if
(
ptPrepare
.
checkTime
()
&&
trTimeout
.
change
(
tout
)
)
if
(
ptPrepare
.
checkTime
()
&&
trTimeout
.
change
(
tout
)
)
{
{
if
(
tout
)
if
(
tout
)
slEvent
(
this
,
evTimeout
);
slEvent
(
shared_from_this
()
,
evTimeout
);
else
else
slEvent
(
this
,
evOK
);
slEvent
(
shared_from_this
()
,
evOK
);
}
}
msleep
(
recvpause
);
msleep
(
recvpause
);
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
b1ef89fe
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define UNetReceiver_H_
#define UNetReceiver_H_
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#include <ostream>
#include <ostream>
#include <memory>
#include <string>
#include <string>
#include <queue>
#include <queue>
#include <cc++/socket.h>
#include <cc++/socket.h>
...
@@ -49,10 +50,11 @@
...
@@ -49,10 +50,11 @@
* ОПТИМИЗАЦИЯ N1: см. UNetSender.h. Если номер последнего принятого пакета не менялся.. не обрабатываем..
* ОПТИМИЗАЦИЯ N1: см. UNetSender.h. Если номер последнего принятого пакета не менялся.. не обрабатываем..
*/
*/
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
class
UNetReceiver
class
UNetReceiver
:
public
std
::
enable_shared_from_this
<
UNetReceiver
>
{
{
public
:
public
:
UNetReceiver
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>
smi
);
UNetReceiver
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>
&
smi
);
~
UNetReceiver
();
~
UNetReceiver
();
void
start
();
void
start
();
...
@@ -95,7 +97,7 @@ class UNetReceiver
...
@@ -95,7 +97,7 @@ class UNetReceiver
evTimeout
/*!< потеря связи */
evTimeout
/*!< потеря связи */
};
};
typedef
sigc
::
slot
<
void
,
UNetReceiver
*
,
Event
>
EventSlot
;
typedef
sigc
::
slot
<
void
,
const
std
::
shared_ptr
<
UNetReceiver
>&
,
Event
>
EventSlot
;
void
connectEvent
(
EventSlot
sl
);
void
connectEvent
(
EventSlot
sl
);
protected
:
protected
:
...
@@ -114,7 +116,7 @@ class UNetReceiver
...
@@ -114,7 +116,7 @@ class UNetReceiver
int
recvpause
;
/*!< пауза меджду приёмами пакетов, [мсек] */
int
recvpause
;
/*!< пауза меджду приёмами пакетов, [мсек] */
int
updatepause
;
/*!< переодичность обновления данных в SM, [мсек] */
int
updatepause
;
/*!< переодичность обновления данных в SM, [мсек] */
ost
::
UDPReceive
*
udp
;
std
::
shared_ptr
<
ost
::
UDPReceive
>
udp
;
ost
::
IPV4Address
addr
;
ost
::
IPV4Address
addr
;
ost
::
tpport_t
port
;
ost
::
tpport_t
port
;
std
::
string
myname
;
std
::
string
myname
;
...
@@ -136,8 +138,8 @@ class UNetReceiver
...
@@ -136,8 +138,8 @@ class UNetReceiver
std
::
atomic_bool
activated
;
std
::
atomic_bool
activated
;
ThreadCreator
<
UNetReceiver
>*
r_thr
;
// receive thread
std
::
shared_ptr
<
ThreadCreator
<
UNetReceiver
>
>
r_thr
;
// receive thread
ThreadCreator
<
UNetReceiver
>*
u_thr
;
// update thread
std
::
shared_ptr
<
ThreadCreator
<
UNetReceiver
>
>
u_thr
;
// update thread
// функция определения приоритетного сообщения для обработки
// функция определения приоритетного сообщения для обработки
struct
PacketCompare
:
struct
PacketCompare
:
...
...
extensions/UNetUDP/UNetSender.cc
View file @
b1ef89fe
...
@@ -8,7 +8,7 @@ using namespace std;
...
@@ -8,7 +8,7 @@ using namespace std;
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
using
namespace
UniSetExtensions
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
UNetSender
::
UNetSender
(
const
std
::
string
&
s_host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>
smi
,
UNetSender
::
UNetSender
(
const
std
::
string
&
s_host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>
&
smi
,
const
std
::
string
&
s_f
,
const
std
::
string
&
s_val
)
:
const
std
::
string
&
s_f
,
const
std
::
string
&
s_val
)
:
s_field
(
s_f
),
s_field
(
s_f
),
s_fvalue
(
s_val
),
s_fvalue
(
s_val
),
...
@@ -19,8 +19,7 @@ activated(false),
...
@@ -19,8 +19,7 @@ activated(false),
dlist
(
100
),
dlist
(
100
),
maxItem
(
0
),
maxItem
(
0
),
packetnum
(
1
),
packetnum
(
1
),
lastcrc
(
0
),
lastcrc
(
0
)
s_thr
(
0
)
{
{
{
{
...
@@ -41,7 +40,7 @@ s_thr(0)
...
@@ -41,7 +40,7 @@ s_thr(0)
try
try
{
{
addr
=
s_host
.
c_str
();
addr
=
s_host
.
c_str
();
udp
=
new
ost
::
UDPBroadcast
(
addr
,
port
);
udp
=
make_shared
<
ost
::
UDPBroadcast
>
(
addr
,
port
);
}
}
catch
(
std
::
exception
&
e
)
catch
(
std
::
exception
&
e
)
{
{
...
@@ -58,7 +57,7 @@ s_thr(0)
...
@@ -58,7 +57,7 @@ s_thr(0)
throw
SystemError
(
s
.
str
());
throw
SystemError
(
s
.
str
());
}
}
s_thr
=
new
ThreadCreator
<
UNetSender
>
(
this
,
&
UNetSender
::
send
);
s_thr
=
make_shared
<
ThreadCreator
<
UNetSender
>
>
(
this
,
&
UNetSender
::
send
);
// -------------------------------
// -------------------------------
if
(
shm
->
isLocalwork
()
)
if
(
shm
->
isLocalwork
()
)
...
@@ -89,8 +88,6 @@ s_thr(0)
...
@@ -89,8 +88,6 @@ s_thr(0)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
UNetSender
::~
UNetSender
()
UNetSender
::~
UNetSender
()
{
{
delete
s_thr
;
delete
udp
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UNetSender
::
updateFromSM
()
void
UNetSender
::
updateFromSM
()
...
...
extensions/UNetUDP/UNetSender.h
View file @
b1ef89fe
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
class
UNetSender
class
UNetSender
{
{
public
:
public
:
UNetSender
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>
smi
,
UNetSender
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>
&
smi
,
const
std
::
string
&
s_field
=
""
,
const
std
::
string
&
s_fvalue
=
""
);
const
std
::
string
&
s_field
=
""
,
const
std
::
string
&
s_fvalue
=
""
);
~
UNetSender
();
~
UNetSender
();
...
@@ -81,7 +81,7 @@ class UNetSender
...
@@ -81,7 +81,7 @@ class UNetSender
private
:
private
:
UNetSender
();
UNetSender
();
ost
::
UDPBroadcast
*
udp
;
std
::
shared_ptr
<
ost
::
UDPBroadcast
>
udp
;
ost
::
IPV4Address
addr
;
ost
::
IPV4Address
addr
;
ost
::
tpport_t
port
;
ost
::
tpport_t
port
;
std
::
string
s_host
;
std
::
string
s_host
;
...
@@ -98,7 +98,7 @@ class UNetSender
...
@@ -98,7 +98,7 @@ class UNetSender
unsigned
short
lastcrc
;
unsigned
short
lastcrc
;
UniSetUDP
::
UDPPacket
s_msg
;
UniSetUDP
::
UDPPacket
s_msg
;
ThreadCreator
<
UNetSender
>*
s_thr
;
// send thread
std
::
shared_ptr
<
ThreadCreator
<
UNetSender
>
>
s_thr
;
// send thread
};
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#endif // UNetSender_H_
#endif // UNetSender_H_
...
...
extensions/UniNetwork/UniExchange.cc
View file @
b1ef89fe
...
@@ -20,7 +20,6 @@ UniExchange::NetNodeInfo::NetNodeInfo():
...
@@ -20,7 +20,6 @@ UniExchange::NetNodeInfo::NetNodeInfo():
UniExchange
::
UniExchange
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
shmID
,
UniExchange
::
UniExchange
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
std
::
string
&
prefix
)
:
const
std
::
shared_ptr
<
SharedMemory
>
ic
,
const
std
::
string
&
prefix
)
:
IOController
(
id
),
IOController
(
id
),
shm
(
0
),
polltime
(
200
),
polltime
(
200
),
mymap
(
1
),
mymap
(
1
),
maxIndex
(
0
),
maxIndex
(
0
),
...
@@ -32,7 +31,7 @@ smReadyTimeout(15000)
...
@@ -32,7 +31,7 @@ smReadyTimeout(15000)
if
(
cnode
==
NULL
)
if
(
cnode
==
NULL
)
throw
UniSetTypes
::
SystemError
(
"(UniExchange): Not found conf-node for "
+
myname
);
throw
UniSetTypes
::
SystemError
(
"(UniExchange): Not found conf-node for "
+
myname
);
shm
=
new
SMInterface
(
shmID
,
&
ui
,
id
,
ic
);
shm
=
make_shared
<
SMInterface
>
(
shmID
,
ui
,
id
,
ic
);
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
cnode
);
...
@@ -114,12 +113,9 @@ smReadyTimeout(15000)
...
@@ -114,12 +113,9 @@ smReadyTimeout(15000)
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
UniExchange
::~
UniExchange
()
UniExchange
::~
UniExchange
()
{
{
delete
shm
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UniExchange
::
execute
()
void
UniExchange
::
execute
()
{
{
...
@@ -154,7 +150,7 @@ void UniExchange::execute()
...
@@ -154,7 +150,7 @@ void UniExchange::execute()
{
{
dinfo
<<
myname
<<
": connect to id="
<<
it
.
id
<<
" node="
<<
it
.
node
<<
endl
;
dinfo
<<
myname
<<
": connect to id="
<<
it
.
id
<<
" node="
<<
it
.
node
<<
endl
;
IOController_i
::
ShortMapSeq_var
sseq
=
ui
.
getSensors
(
it
.
id
,
it
.
node
);
IOController_i
::
ShortMapSeq_var
sseq
=
ui
->
getSensors
(
it
.
id
,
it
.
node
);
ok
=
true
;
ok
=
true
;
dinfo
<<
myname
<<
" update sensors from id="
<<
it
.
id
<<
" node="
<<
it
.
node
<<
endl
;
dinfo
<<
myname
<<
" update sensors from id="
<<
it
.
id
<<
" node="
<<
it
.
node
<<
endl
;
...
@@ -197,7 +193,7 @@ void UniExchange::execute()
...
@@ -197,7 +193,7 @@ void UniExchange::execute()
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UniExchange
::
NetNodeInfo
::
update
(
IOController_i
::
ShortMapSeq_var
&
map
,
SMInterface
*
shm
)
void
UniExchange
::
NetNodeInfo
::
update
(
IOController_i
::
ShortMapSeq_var
&
map
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
)
{
{
bool
reinit
=
false
;
bool
reinit
=
false
;
if
(
smap
.
size
()
!=
map
->
length
()
)
if
(
smap
.
size
()
!=
map
->
length
()
)
...
...
extensions/UniNetwork/UniExchange.h
View file @
b1ef89fe
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#define UniExchange_H_
#define UniExchange_H_
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#include <list>
#include <list>
#include <memory>
#include "UniXML.h"
#include "UniXML.h"
#include "IOController.h"
#include "IOController.h"
#include "SMInterface.h"
#include "SMInterface.h"
...
@@ -60,7 +61,7 @@ class UniExchange:
...
@@ -60,7 +61,7 @@ class UniExchange:
xmlNode
*
cnode
;
xmlNode
*
cnode
;
std
::
string
s_field
;
std
::
string
s_field
;
std
::
string
s_fvalue
;
std
::
string
s_fvalue
;
SMInterface
*
shm
;
std
::
shared_ptr
<
SMInterface
>
shm
;
struct
SInfo
struct
SInfo
{
{
...
@@ -105,7 +106,7 @@ class UniExchange:
...
@@ -105,7 +106,7 @@ class UniExchange:
IOController
::
IOStateList
::
iterator
conn_it
;
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
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
);
};
};
typedef
std
::
list
<
NetNodeInfo
>
NetNodeList
;
typedef
std
::
list
<
NetNodeInfo
>
NetNodeList
;
...
...
extensions/include/IOBase.h
View file @
b1ef89fe
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#define IOBase_H_
#define IOBase_H_
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#include <string>
#include <string>
#include <memory>
#include "PassiveTimer.h"
#include "PassiveTimer.h"
#include "Trigger.h"
#include "Trigger.h"
#include "Mutex.h"
#include "Mutex.h"
...
@@ -70,7 +71,7 @@ struct IOBase
...
@@ -70,7 +71,7 @@ struct IOBase
bool
check_on_delay
(
bool
val
);
/*!< реализация задержки на включение */
bool
check_on_delay
(
bool
val
);
/*!< реализация задержки на включение */
bool
check_off_delay
(
bool
val
);
/*!< реализация задержки на отключение */
bool
check_off_delay
(
bool
val
);
/*!< реализация задержки на отключение */
bool
check_front
(
bool
val
);
/*!< реализация срабатывания по фронту сигнала */
bool
check_front
(
bool
val
);
/*!< реализация срабатывания по фронту сигнала */
bool
check_depend
(
SMInterface
*
shm
);
/*!< проверка разрешения(зависимости) от другого датчика */
bool
check_depend
(
const
std
::
shared_ptr
<
SMInterface
>&
shm
);
/*!< проверка разрешения(зависимости) от другого датчика */
IOController_i
::
SensorInfo
si
;
IOController_i
::
SensorInfo
si
;
UniversalIO
::
IOType
stype
;
/*!< тип канала (DI,DO,AI,AO) */
UniversalIO
::
IOType
stype
;
/*!< тип канала (DI,DO,AI,AO) */
...
@@ -143,18 +144,18 @@ struct IOBase
...
@@ -143,18 +144,18 @@ struct IOBase
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
IOBase
&
inf
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
IOBase
&
inf
);
static
void
processingFasAI
(
IOBase
*
it
,
float
new_val
,
SMInterface
*
shm
,
bool
force
);
static
void
processingFasAI
(
IOBase
*
it
,
float
new_val
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
void
processingAsAI
(
IOBase
*
it
,
long
new_val
,
SMInterface
*
shm
,
bool
force
);
static
void
processingAsAI
(
IOBase
*
it
,
long
new_val
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
void
processingAsDI
(
IOBase
*
it
,
bool
new_set
,
SMInterface
*
shm
,
bool
force
);
static
void
processingAsDI
(
IOBase
*
it
,
bool
new_set
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
long
processingAsAO
(
IOBase
*
it
,
SMInterface
*
shm
,
bool
force
);
static
long
processingAsAO
(
IOBase
*
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
float
processingFasAO
(
IOBase
*
it
,
SMInterface
*
shm
,
bool
force
);
static
float
processingFasAO
(
IOBase
*
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
bool
processingAsDO
(
IOBase
*
it
,
SMInterface
*
shm
,
bool
force
);
static
bool
processingAsDO
(
IOBase
*
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
void
processingThreshold
(
IOBase
*
it
,
SMInterface
*
shm
,
bool
force
);
static
void
processingThreshold
(
IOBase
*
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
/*! \param initPrefixOnly - TRUE - инициализировать только свойста с prefix (или брать значения по умолчанию).
/*! \param initPrefixOnly - TRUE - инициализировать только свойста с prefix (или брать значения по умолчанию).
FALSE - сперва искать свойство с prefix, если не найдено брать без prefix.
FALSE - сперва искать свойство с prefix, если не найдено брать без prefix.
*/
*/
static
bool
initItem
(
IOBase
*
b
,
UniXML
::
iterator
&
it
,
SMInterface
*
shm
,
static
bool
initItem
(
IOBase
*
b
,
UniXML
::
iterator
&
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
const
std
::
string
&
prefix
,
bool
init_prefix_only
,
const
std
::
string
&
prefix
,
bool
init_prefix_only
,
DebugStream
*
dlog
=
0
,
std
::
string
myname
=
""
,
DebugStream
*
dlog
=
0
,
std
::
string
myname
=
""
,
int
def_filtersize
=
0
,
float
def_filterT
=
0
.
0
,
int
def_filtersize
=
0
,
float
def_filterT
=
0
.
0
,
...
...
extensions/include/SMInterface.h
View file @
b1ef89fe
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define SMInterface_H_
#define SMInterface_H_
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
#include <string>
#include <string>
#include <memory>
#include "UniSetTypes.h"
#include "UniSetTypes.h"
#include "Mutex.h"
#include "Mutex.h"
#include "IONotifyController.h"
#include "IONotifyController.h"
...
@@ -10,7 +11,7 @@ class SMInterface
...
@@ -10,7 +11,7 @@ class SMInterface
{
{
public
:
public
:
SMInterface
(
UniSetTypes
::
ObjectId
_shmID
,
UInterface
*
ui
,
SMInterface
(
UniSetTypes
::
ObjectId
_shmID
,
const
std
::
shared_ptr
<
UInterface
>&
ui
,
UniSetTypes
::
ObjectId
myid
,
const
std
::
shared_ptr
<
IONotifyController
>
ic
=
nullptr
);
UniSetTypes
::
ObjectId
myid
,
const
std
::
shared_ptr
<
IONotifyController
>
ic
=
nullptr
);
~
SMInterface
();
~
SMInterface
();
...
@@ -54,7 +55,7 @@ class SMInterface
...
@@ -54,7 +55,7 @@ class SMInterface
protected
:
protected
:
const
std
::
shared_ptr
<
IONotifyController
>
ic
;
const
std
::
shared_ptr
<
IONotifyController
>
ic
;
UInterface
*
ui
;
const
std
::
shared_ptr
<
UInterface
>
ui
;
CORBA
::
Object_var
oref
;
CORBA
::
Object_var
oref
;
UniSetTypes
::
ObjectId
shmID
;
UniSetTypes
::
ObjectId
shmID
;
UniSetTypes
::
ObjectId
myid
;
UniSetTypes
::
ObjectId
myid
;
...
...
extensions/include/UObject_SK.h
View file @
b1ef89fe
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
*/
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// generate timestamp: 2015-01-1
2
+03:00
// generate timestamp: 2015-01-1
7
+03:00
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#ifndef UObject_SK_H_
#define UObject_SK_H_
#define UObject_SK_H_
...
...
extensions/lib/IOBase.cc
View file @
b1ef89fe
...
@@ -26,7 +26,7 @@ bool IOBase::check_channel_break( long val )
...
@@ -26,7 +26,7 @@ bool IOBase::check_channel_break( long val )
return
(
val
<
breaklim
);
return
(
val
<
breaklim
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
bool
IOBase
::
check_depend
(
SMInterface
*
shm
)
bool
IOBase
::
check_depend
(
const
std
::
shared_ptr
<
SMInterface
>&
shm
)
{
{
if
(
d_id
==
DefaultObjectId
)
if
(
d_id
==
DefaultObjectId
)
return
true
;
return
true
;
...
@@ -142,7 +142,7 @@ bool IOBase::check_front( bool val )
...
@@ -142,7 +142,7 @@ bool IOBase::check_front( bool val )
return
front_state
;
return
front_state
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
IOBase
::
processingAsAI
(
IOBase
*
it
,
long
val
,
SMInterface
*
shm
,
bool
force
)
void
IOBase
::
processingAsAI
(
IOBase
*
it
,
long
val
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
)
{
{
// проверка на обрыв
// проверка на обрыв
if
(
it
->
check_channel_break
(
val
)
)
if
(
it
->
check_channel_break
(
val
)
)
...
@@ -210,7 +210,7 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force
...
@@ -210,7 +210,7 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
IOBase
::
processingFasAI
(
IOBase
*
it
,
float
fval
,
SMInterface
*
shm
,
bool
force
)
void
IOBase
::
processingFasAI
(
IOBase
*
it
,
float
fval
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
)
{
{
long
val
=
lroundf
(
fval
);
long
val
=
lroundf
(
fval
);
...
@@ -268,7 +268,7 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for
...
@@ -268,7 +268,7 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
IOBase
::
processingAsDI
(
IOBase
*
it
,
bool
set
,
SMInterface
*
shm
,
bool
force
)
void
IOBase
::
processingAsDI
(
IOBase
*
it
,
bool
set
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
)
{
{
// проверка зависимости
// проверка зависимости
if
(
!
it
->
check_depend
(
shm
)
)
if
(
!
it
->
check_depend
(
shm
)
)
...
@@ -292,7 +292,7 @@ void IOBase::processingAsDI( IOBase* it, bool set, SMInterface* shm, bool force
...
@@ -292,7 +292,7 @@ void IOBase::processingAsDI( IOBase* it, bool set, SMInterface* shm, bool force
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
long
IOBase
::
processingAsAO
(
IOBase
*
it
,
SMInterface
*
shm
,
bool
force
)
long
IOBase
::
processingAsAO
(
IOBase
*
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
)
{
{
// проверка зависимости
// проверка зависимости
if
(
!
it
->
check_depend
(
shm
)
)
if
(
!
it
->
check_depend
(
shm
)
)
...
@@ -344,7 +344,7 @@ long IOBase::processingAsAO( IOBase* it, SMInterface* shm, bool force )
...
@@ -344,7 +344,7 @@ long IOBase::processingAsAO( IOBase* it, SMInterface* shm, bool force )
return
val
;
return
val
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
bool
IOBase
::
processingAsDO
(
IOBase
*
it
,
SMInterface
*
shm
,
bool
force
)
bool
IOBase
::
processingAsDO
(
IOBase
*
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
)
{
{
// проверка зависимости
// проверка зависимости
if
(
!
it
->
check_depend
(
shm
)
)
if
(
!
it
->
check_depend
(
shm
)
)
...
@@ -360,7 +360,7 @@ bool IOBase::processingAsDO( IOBase* it, SMInterface* shm, bool force )
...
@@ -360,7 +360,7 @@ bool IOBase::processingAsDO( IOBase* it, SMInterface* shm, bool force )
return
set
;
return
set
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
float
IOBase
::
processingFasAO
(
IOBase
*
it
,
SMInterface
*
shm
,
bool
force
)
float
IOBase
::
processingFasAO
(
IOBase
*
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
)
{
{
// проверка зависимости
// проверка зависимости
if
(
!
it
->
check_depend
(
shm
)
)
if
(
!
it
->
check_depend
(
shm
)
)
...
@@ -415,7 +415,7 @@ float IOBase::processingFasAO( IOBase* it, SMInterface* shm, bool force )
...
@@ -415,7 +415,7 @@ float IOBase::processingFasAO( IOBase* it, SMInterface* shm, bool force )
return
val
;
return
val
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
IOBase
::
processingThreshold
(
IOBase
*
it
,
SMInterface
*
shm
,
bool
force
)
void
IOBase
::
processingThreshold
(
IOBase
*
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
)
{
{
if
(
it
->
t_ai
==
DefaultObjectId
)
if
(
it
->
t_ai
==
DefaultObjectId
)
return
;
return
;
...
@@ -475,7 +475,7 @@ int IOBase::initIntProp( UniXML::iterator& it, const std::string& prop, const st
...
@@ -475,7 +475,7 @@ int IOBase::initIntProp( UniXML::iterator& it, const std::string& prop, const st
return
defval
;
return
defval
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
bool
IOBase
::
initItem
(
IOBase
*
b
,
UniXML
::
iterator
&
it
,
SMInterface
*
shm
,
const
std
::
string
&
prefix
,
bool
IOBase
::
initItem
(
IOBase
*
b
,
UniXML
::
iterator
&
it
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
const
std
::
string
&
prefix
,
bool
init_prefix_only
,
bool
init_prefix_only
,
DebugStream
*
dlog
,
std
::
string
myname
,
DebugStream
*
dlog
,
std
::
string
myname
,
int
def_filtersize
,
float
def_filterT
,
float
def_lsparam
,
int
def_filtersize
,
float
def_filterT
,
float
def_lsparam
,
...
...
extensions/lib/SMInterface.cc
View file @
b1ef89fe
...
@@ -84,7 +84,7 @@ using namespace UniSetTypes;
...
@@ -84,7 +84,7 @@ using namespace UniSetTypes;
} \
} \
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
SMInterface
::
SMInterface
(
UniSetTypes
::
ObjectId
_shmID
,
UInterface
*
_ui
,
SMInterface
::
SMInterface
(
UniSetTypes
::
ObjectId
_shmID
,
const
std
::
shared_ptr
<
UInterface
>&
_ui
,
UniSetTypes
::
ObjectId
_myid
,
const
std
::
shared_ptr
<
IONotifyController
>
ic
)
:
UniSetTypes
::
ObjectId
_myid
,
const
std
::
shared_ptr
<
IONotifyController
>
ic
)
:
ic
(
ic
),
ic
(
ic
),
ui
(
_ui
),
ui
(
_ui
),
...
...
extensions/lib/UObject_SK.cc
View file @
b1ef89fe
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
*/
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// generate timestamp: 2015-01-1
2
+03:00
// generate timestamp: 2015-01-1
7
+03:00
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#include "Configuration.h"
#include "Configuration.h"
#include "Exceptions.h"
#include "Exceptions.h"
...
@@ -334,7 +334,7 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
...
@@ -334,7 +334,7 @@ void UObject_SK::waitSM( int wait_msec, ObjectId _testID )
<<
wait_msec
<<
" msec"
<<
wait_msec
<<
" msec"
<<
" testID="
<<
_testID
<<
endl
;
<<
" testID="
<<
_testID
<<
endl
;
if
(
!
ui
.
waitReady
(
_testID
,
wait_msec
)
)
if
(
!
ui
->
waitReady
(
_testID
,
wait_msec
)
)
{
{
ostringstream
err
;
ostringstream
err
;
err
<<
myname
err
<<
myname
...
@@ -385,7 +385,7 @@ void UObject_SK::callback()
...
@@ -385,7 +385,7 @@ void UObject_SK::callback()
// "сердцебиение"
// "сердцебиение"
if
(
idHeartBeat
!=
DefaultObjectId
&&
ptHeartBeat
.
checkTime
()
)
if
(
idHeartBeat
!=
DefaultObjectId
&&
ptHeartBeat
.
checkTime
()
)
{
{
ui
.
setValue
(
idHeartBeat
,
maxHeartBeat
,
UniversalIO
::
AI
);
ui
->
setValue
(
idHeartBeat
,
maxHeartBeat
,
UniversalIO
::
AI
);
ptHeartBeat
.
reset
();
ptHeartBeat
.
reset
();
}
}
...
@@ -417,7 +417,7 @@ void UObject_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
...
@@ -417,7 +417,7 @@ void UObject_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
{
{
ui
.
setValue
(
_sid
,
_val
);
ui
->
setValue
(
_sid
,
_val
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UObject_SK
::
updateOutputs
(
bool
_force
)
void
UObject_SK
::
updateOutputs
(
bool
_force
)
...
@@ -434,7 +434,7 @@ void UObject_SK::preSensorInfo( const UniSetTypes::SensorMessage* _sm )
...
@@ -434,7 +434,7 @@ void UObject_SK::preSensorInfo( const UniSetTypes::SensorMessage* _sm )
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UObject_SK
::
askSensor
(
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
());
ui
->
askRemoteSensor
(
_sid
,
_cmd
,
_node
,
getId
());
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
long
UObject_SK
::
getValue
(
UniSetTypes
::
ObjectId
_sid
)
long
UObject_SK
::
getValue
(
UniSetTypes
::
ObjectId
_sid
)
...
@@ -443,7 +443,7 @@ long UObject_SK::getValue( UniSetTypes::ObjectId _sid )
...
@@ -443,7 +443,7 @@ long UObject_SK::getValue( UniSetTypes::ObjectId _sid )
{
{
return
ui
.
getValue
(
_sid
);
return
ui
->
getValue
(
_sid
);
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
...
...
extensions/tests/SMemoryTest/TestProc.cc
View file @
b1ef89fe
...
@@ -138,7 +138,7 @@ void TestProc::test_undefined_state()
...
@@ -138,7 +138,7 @@ void TestProc::test_undefined_state()
si
.
id
=
undef_c
;
si
.
id
=
undef_c
;
si
.
node
=
conf
->
getLocalNode
();
si
.
node
=
conf
->
getLocalNode
();
cerr
<<
myname
<<
": set undefined="
<<
undef
<<
endl
;
cerr
<<
myname
<<
": set undefined="
<<
undef
<<
endl
;
ui
.
setUndefinedState
(
si
,
undef
,
getId
()
);
ui
->
setUndefinedState
(
si
,
undef
,
getId
()
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
TestProc
::
test_thresholds
()
void
TestProc
::
test_thresholds
()
...
@@ -158,12 +158,12 @@ void TestProc::test_thresholds()
...
@@ -158,12 +158,12 @@ void TestProc::test_thresholds()
{
{
setValue
(
t_set_c
,
0
);
setValue
(
t_set_c
,
0
);
UniSetTypes
::
ThresholdId
tid
=
100
;
UniSetTypes
::
ThresholdId
tid
=
100
;
ui
.
askThreshold
(
t_set_c
,
tid
,
UniversalIO
::
UIONotify
,
10
,
20
);
ui
->
askThreshold
(
t_set_c
,
tid
,
UniversalIO
::
UIONotify
,
10
,
20
);
IONotifyController_i
::
ThresholdInfo
ti
=
ui
.
getThresholdInfo
(
t_set_c
,
tid
);
IONotifyController_i
::
ThresholdInfo
ti
=
ui
->
getThresholdInfo
(
t_set_c
,
tid
);
cerr
<<
myname
<<
": ask OFF threshold: "
<<
(
ti
.
state
==
IONotifyController_i
::
NormalThreshold
?
"ok"
:
"FAIL"
)
<<
endl
;
cerr
<<
myname
<<
": ask OFF threshold: "
<<
(
ti
.
state
==
IONotifyController_i
::
NormalThreshold
?
"ok"
:
"FAIL"
)
<<
endl
;
setValue
(
t_set_c
,
25
);
setValue
(
t_set_c
,
25
);
ti
=
ui
.
getThresholdInfo
(
t_set_c
,
tid
);
ti
=
ui
->
getThresholdInfo
(
t_set_c
,
tid
);
cerr
<<
myname
<<
": ask ON threshold: "
<<
(
ti
.
state
==
IONotifyController_i
::
HiThreshold
?
"ok"
:
"FAIL"
)
<<
endl
;
cerr
<<
myname
<<
": ask ON threshold: "
<<
(
ti
.
state
==
IONotifyController_i
::
HiThreshold
?
"ok"
:
"FAIL"
)
<<
endl
;
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
...
...
extensions/tests/test_iobase.cc
View file @
b1ef89fe
...
@@ -71,13 +71,13 @@ TEST_CASE("[IOBase]: Init from xml","[iobase][init][extensions]")
...
@@ -71,13 +71,13 @@ TEST_CASE("[IOBase]: Init from xml","[iobase][init][extensions]")
xmlNode
*
cnode
=
conf
->
getNode
(
"iobasetest"
);
xmlNode
*
cnode
=
conf
->
getNode
(
"iobasetest"
);
CHECK
(
cnode
!=
NULL
);
CHECK
(
cnode
!=
NULL
);
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
cnode
);
UInterface
ui
;
auto
ui
=
make_shared
<
UInterface
>
()
;
ObjectId
shmID
=
conf
->
getControllerID
(
"SharedMemory"
);
ObjectId
shmID
=
conf
->
getControllerID
(
"SharedMemory"
);
CHECK
(
shmID
!=
DefaultObjectId
);
CHECK
(
shmID
!=
DefaultObjectId
);
SMInterface
shm
(
shmID
,
&
ui
,
DefaultObjectId
);
auto
shm
=
make_shared
<
SMInterface
>
(
shmID
,
ui
,
DefaultObjectId
);
IOBase
ib
;
IOBase
ib
;
IOBase
::
initItem
(
&
ib
,
it
,
&
shm
,
""
,
false
);
IOBase
::
initItem
(
&
ib
,
it
,
shm
,
""
,
false
);
CHECK
(
ib
.
si
.
id
==
1
);
CHECK
(
ib
.
si
.
id
==
1
);
CHECK
(
ib
.
si
.
node
==
conf
->
getLocalNode
()
);
CHECK
(
ib
.
si
.
node
==
conf
->
getLocalNode
()
);
CHECK
(
ib
.
defval
==
-
10
);
CHECK
(
ib
.
defval
==
-
10
);
...
@@ -95,13 +95,13 @@ TEST_CASE("[IOBase]: Init from xml","[iobase][init][extensions]")
...
@@ -95,13 +95,13 @@ TEST_CASE("[IOBase]: Init from xml","[iobase][init][extensions]")
xmlNode
*
cnode
=
conf
->
getNode
(
"iobasetest3"
);
xmlNode
*
cnode
=
conf
->
getNode
(
"iobasetest3"
);
CHECK
(
cnode
!=
NULL
);
CHECK
(
cnode
!=
NULL
);
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
cnode
);
UInterface
ui
;
auto
ui
=
make_shared
<
UInterface
>
()
;
ObjectId
shmID
=
conf
->
getControllerID
(
"SharedMemory"
);
ObjectId
shmID
=
conf
->
getControllerID
(
"SharedMemory"
);
CHECK
(
shmID
!=
DefaultObjectId
);
CHECK
(
shmID
!=
DefaultObjectId
);
SMInterface
shm
(
shmID
,
&
ui
,
DefaultObjectId
);
auto
shm
=
make_shared
<
SMInterface
>
(
shmID
,
ui
,
DefaultObjectId
);
IOBase
ib
;
IOBase
ib
;
IOBase
::
initItem
(
&
ib
,
it
,
&
shm
,
"myprefix_"
,
false
);
IOBase
::
initItem
(
&
ib
,
it
,
shm
,
"myprefix_"
,
false
);
CHECK
(
ib
.
si
.
id
==
10
);
CHECK
(
ib
.
si
.
id
==
10
);
CHECK
(
ib
.
si
.
node
==
conf
->
getLocalNode
()
);
CHECK
(
ib
.
si
.
node
==
conf
->
getLocalNode
()
);
CHECK
(
ib
.
defval
==
5
);
CHECK
(
ib
.
defval
==
5
);
...
...
extensions/tests/test_iobase_with_sm.cc
View file @
b1ef89fe
...
@@ -10,15 +10,13 @@ using namespace std;
...
@@ -10,15 +10,13 @@ using namespace std;
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
using
namespace
UniSetExtensions
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
static
std
::
shared_ptr
<
SMInterface
>
shared_shm
;
static
std
::
shared_ptr
<
SMInterface
>
shm
;
static
SMInterface
*
shm
;
static
void
init_test
()
static
void
init_test
()
{
{
shared_shm
=
smiInstance
();
shm
=
smiInstance
();
CHECK
(
shared_shm
!=
nullptr
);
CHECK
(
shm
!=
nullptr
);
shm
=
shared_shm
.
get
();
}
}
// -----------------------------------------------------------------------------
static
bool
init_iobase
(
IOBase
*
ib
,
const
std
::
string
&
sensor
)
static
bool
init_iobase
(
IOBase
*
ib
,
const
std
::
string
&
sensor
)
{
{
init_test
();
init_test
();
...
...
extensions/tests/tests_with_sm.cc
View file @
b1ef89fe
...
@@ -16,7 +16,7 @@ using namespace UniSetExtensions;
...
@@ -16,7 +16,7 @@ using namespace UniSetExtensions;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
static
shared_ptr
<
SMInterface
>
smi
;
static
shared_ptr
<
SMInterface
>
smi
;
static
shared_ptr
<
SharedMemory
>
shm
;
static
shared_ptr
<
SharedMemory
>
shm
;
static
UInterface
*
ui
=
nullptr
;
static
shared_ptr
<
UInterface
>
ui
;
static
ObjectId
myID
=
6000
;
static
ObjectId
myID
=
6000
;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
shared_ptr
<
SharedMemory
>
shmInstance
()
shared_ptr
<
SharedMemory
>
shmInstance
()
...
@@ -35,7 +35,7 @@ shared_ptr<SMInterface> smiInstance()
...
@@ -35,7 +35,7 @@ shared_ptr<SMInterface> smiInstance()
throw
SystemError
(
"SharedMemory don`t initialize.."
);
throw
SystemError
(
"SharedMemory don`t initialize.."
);
if
(
ui
==
nullptr
)
if
(
ui
==
nullptr
)
ui
=
new
UInterface
();
ui
=
make_shared
<
UInterface
>
();
smi
=
make_shared
<
SMInterface
>
(
shm
->
getId
(),
ui
,
myID
,
shm
);
smi
=
make_shared
<
SMInterface
>
(
shm
->
getId
(),
ui
,
myID
,
shm
);
}
}
...
...
include/ProxyManager.h
View file @
b1ef89fe
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#define ProxyManager_H_
#define ProxyManager_H_
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <map>
#include <map>
#include <memory>
#include "UniSetObject.h"
#include "UniSetObject.h"
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
...
@@ -45,7 +46,7 @@ class ProxyManager:
...
@@ -45,7 +46,7 @@ class ProxyManager:
void
attachObject
(
PassiveObject
*
po
,
UniSetTypes
::
ObjectId
id
);
void
attachObject
(
PassiveObject
*
po
,
UniSetTypes
::
ObjectId
id
);
void
detachObject
(
UniSetTypes
::
ObjectId
id
);
void
detachObject
(
UniSetTypes
::
ObjectId
id
);
UInterface
*
uin
;
std
::
shared_ptr
<
UInterface
>
uin
;
protected
:
protected
:
ProxyManager
();
ProxyManager
();
...
...
include/SViewer.h
View file @
b1ef89fe
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#define _SVIEWER_H
#define _SVIEWER_H
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
#include <string>
#include <string>
#include <memory>
#include "IOController_i.hh"
#include "IOController_i.hh"
#include "ObjectRepository.h"
#include "ObjectRepository.h"
#include "UInterface.h"
#include "UInterface.h"
...
@@ -55,10 +56,11 @@ class SViewer
...
@@ -55,10 +56,11 @@ class SViewer
void
printInfo
(
UniSetTypes
::
ObjectId
id
,
const
std
::
string
&
sname
,
long
value
,
const
std
::
string
&
owner
,
void
printInfo
(
UniSetTypes
::
ObjectId
id
,
const
std
::
string
&
sname
,
long
value
,
const
std
::
string
&
owner
,
const
std
::
string
&
txtname
,
const
std
::
string
&
iotype
);
const
std
::
string
&
txtname
,
const
std
::
string
&
iotype
);
std
::
shared_ptr
<
UInterface
>
ui
;
private
:
private
:
ObjectRepository
rep
;
ObjectRepository
rep
;
UInterface
::
CacheOfResolve
cache
;
UInterface
::
CacheOfResolve
cache
;
UInterface
ui
;
bool
isShort
;
bool
isShort
;
};
};
...
...
include/UniSetObject.h
View file @
b1ef89fe
...
@@ -111,7 +111,7 @@ class UniSetObject:
...
@@ -111,7 +111,7 @@ class UniSetObject:
/*! прервать ожидание сообщений */
/*! прервать ожидание сообщений */
void
termWaiting
();
void
termWaiting
();
UInterface
ui
;
/*!< универсальный интерфейс для работы с другими процессами */
std
::
shared_ptr
<
UInterface
>
ui
;
/*!< универсальный интерфейс для работы с другими процессами */
std
::
string
myname
;
std
::
string
myname
;
std
::
string
section
;
std
::
string
section
;
...
...
src/ObjectRepository/ProxyManager.cc
View file @
b1ef89fe
...
@@ -39,7 +39,7 @@ ProxyManager::~ProxyManager()
...
@@ -39,7 +39,7 @@ ProxyManager::~ProxyManager()
ProxyManager
::
ProxyManager
(
UniSetTypes
::
ObjectId
id
)
:
ProxyManager
::
ProxyManager
(
UniSetTypes
::
ObjectId
id
)
:
UniSetObject
(
id
)
UniSetObject
(
id
)
{
{
uin
=
&
ui
;
uin
=
ui
;
}
}
...
@@ -86,7 +86,7 @@ bool ProxyManager::activateObject()
...
@@ -86,7 +86,7 @@ bool ProxyManager::activateObject()
<<
" (pname="
<<
it
.
second
->
getName
()
<<
") "
<<
" (pname="
<<
it
.
second
->
getName
()
<<
") "
<<
uniset_conf
()
->
oind
->
getNameById
(
it
.
first
)
<<
endl
;
<<
uniset_conf
()
->
oind
->
getNameById
(
it
.
first
)
<<
endl
;
ui
.
registered
(
it
.
first
,
getRef
(),
true
);
ui
->
registered
(
it
.
first
,
getRef
(),
true
);
break
;
break
;
}
}
catch
(
UniSetTypes
::
ObjectNameAlready
&
ex
)
catch
(
UniSetTypes
::
ObjectNameAlready
&
ex
)
...
@@ -94,7 +94,7 @@ bool ProxyManager::activateObject()
...
@@ -94,7 +94,7 @@ bool ProxyManager::activateObject()
ucrit
<<
myname
<<
"(registered): СПЕРВА РАЗРЕГИСТРИРУЮ (ObjectNameAlready)"
<<
endl
;
ucrit
<<
myname
<<
"(registered): СПЕРВА РАЗРЕГИСТРИРУЮ (ObjectNameAlready)"
<<
endl
;
try
try
{
{
ui
.
unregister
(
it
.
first
);
ui
->
unregister
(
it
.
first
);
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
...
@@ -118,7 +118,7 @@ bool ProxyManager::deactivateObject()
...
@@ -118,7 +118,7 @@ bool ProxyManager::deactivateObject()
{
{
try
try
{
{
ui
.
unregister
(
it
->
first
);
ui
->
unregister
(
it
->
first
);
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
...
...
src/ObjectRepository/UniSetObject.cc
View file @
b1ef89fe
...
@@ -45,7 +45,6 @@ using namespace UniSetTypes;
...
@@ -45,7 +45,6 @@ using namespace UniSetTypes;
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
UniSetObject
::
UniSetObject
()
:
UniSetObject
::
UniSetObject
()
:
ui
(
UniSetTypes
::
DefaultObjectId
),
msgpid
(
0
),
msgpid
(
0
),
reg
(
false
),
reg
(
false
),
active
(
0
),
active
(
0
),
...
@@ -57,6 +56,8 @@ MaxCountRemoveOfMessage(10),
...
@@ -57,6 +56,8 @@ MaxCountRemoveOfMessage(10),
stMaxQueueMessages
(
0
),
stMaxQueueMessages
(
0
),
stCountOfQueueFull
(
0
)
stCountOfQueueFull
(
0
)
{
{
ui
=
make_shared
<
UInterface
>
(
UniSetTypes
::
DefaultObjectId
);
tmr
=
CREATE_TIMER
;
tmr
=
CREATE_TIMER
;
myname
=
"noname"
;
myname
=
"noname"
;
section
=
"nonameSection"
;
section
=
"nonameSection"
;
...
@@ -64,7 +65,6 @@ stCountOfQueueFull(0)
...
@@ -64,7 +65,6 @@ stCountOfQueueFull(0)
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
UniSetObject
::
UniSetObject
(
ObjectId
id
)
:
UniSetObject
::
UniSetObject
(
ObjectId
id
)
:
ui
(
id
),
msgpid
(
0
),
msgpid
(
0
),
reg
(
false
),
reg
(
false
),
active
(
0
),
active
(
0
),
...
@@ -76,10 +76,11 @@ MaxCountRemoveOfMessage(10),
...
@@ -76,10 +76,11 @@ MaxCountRemoveOfMessage(10),
stMaxQueueMessages
(
0
),
stMaxQueueMessages
(
0
),
stCountOfQueueFull
(
0
)
stCountOfQueueFull
(
0
)
{
{
ui
=
make_shared
<
UInterface
>
(
id
);
tmr
=
CREATE_TIMER
;
tmr
=
CREATE_TIMER
;
if
(
myid
>=
0
)
if
(
myid
>=
0
)
{
{
string
myfullname
=
ui
.
getNameById
(
id
);
string
myfullname
=
ui
->
getNameById
(
id
);
myname
=
ORepHelpers
::
getShortName
(
myfullname
.
c_str
());
myname
=
ORepHelpers
::
getShortName
(
myfullname
.
c_str
());
section
=
ORepHelpers
::
getSectionName
(
myfullname
.
c_str
());
section
=
ORepHelpers
::
getSectionName
(
myfullname
.
c_str
());
}
}
...
@@ -95,8 +96,7 @@ stCountOfQueueFull(0)
...
@@ -95,8 +96,7 @@ stCountOfQueueFull(0)
}
}
UniSetObject
::
UniSetObject
(
const
string
&
name
,
const
string
&
section
)
:
UniSetObject
::
UniSetObject
(
const
string
&
name
,
const
string
&
section
)
:
ui
(
UniSetTypes
::
DefaultObjectId
),
msgpid
(
0
),
msgpid
(
0
),
reg
(
false
),
reg
(
false
),
active
(
0
),
active
(
0
),
...
@@ -108,10 +108,12 @@ MaxCountRemoveOfMessage(10),
...
@@ -108,10 +108,12 @@ MaxCountRemoveOfMessage(10),
stMaxQueueMessages
(
0
),
stMaxQueueMessages
(
0
),
stCountOfQueueFull
(
0
)
stCountOfQueueFull
(
0
)
{
{
ui
=
make_shared
<
UInterface
>
(
UniSetTypes
::
DefaultObjectId
);
/*! \warning UniverslalInterface не инициализируется идентификатором объекта */
/*! \warning UniverslalInterface не инициализируется идентификатором объекта */
tmr
=
CREATE_TIMER
;
tmr
=
CREATE_TIMER
;
myname
=
section
+
"/"
+
name
;
myname
=
section
+
"/"
+
name
;
myid
=
ui
.
getIdByName
(
myname
);
myid
=
ui
->
getIdByName
(
myname
);
if
(
myid
==
DefaultObjectId
)
if
(
myid
==
DefaultObjectId
)
{
{
uwarn
<<
"name: my ID not found!"
<<
endl
;
uwarn
<<
"name: my ID not found!"
<<
endl
;
...
@@ -119,7 +121,7 @@ stCountOfQueueFull(0)
...
@@ -119,7 +121,7 @@ stCountOfQueueFull(0)
}
}
init_object
();
init_object
();
ui
.
initBackId
(
myid
);
ui
->
initBackId
(
myid
);
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
@@ -187,11 +189,11 @@ void UniSetObject::setID( UniSetTypes::ObjectId id )
...
@@ -187,11 +189,11 @@ void UniSetObject::setID( UniSetTypes::ObjectId id )
if
(
myid
!=
UniSetTypes
::
DefaultObjectId
)
if
(
myid
!=
UniSetTypes
::
DefaultObjectId
)
throw
ObjectNameAlready
(
"ObjectId already set(setID)"
);
throw
ObjectNameAlready
(
"ObjectId already set(setID)"
);
string
myfullname
=
ui
.
getNameById
(
id
);
string
myfullname
=
ui
->
getNameById
(
id
);
myname
=
ORepHelpers
::
getShortName
(
myfullname
.
c_str
());
myname
=
ORepHelpers
::
getShortName
(
myfullname
.
c_str
());
section
=
ORepHelpers
::
getSectionName
(
myfullname
.
c_str
());
section
=
ORepHelpers
::
getSectionName
(
myfullname
.
c_str
());
myid
=
id
;
myid
=
id
;
ui
.
initBackId
(
myid
);
ui
->
initBackId
(
myid
);
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
...
@@ -354,7 +356,7 @@ void UniSetObject::registered()
...
@@ -354,7 +356,7 @@ void UniSetObject::registered()
{
{
try
try
{
{
ui
.
registered
(
myid
,
getRef
(),
true
);
ui
->
registered
(
myid
,
getRef
(),
true
);
break
;
break
;
}
}
catch
(
ObjectNameAlready
&
al
)
catch
(
ObjectNameAlready
&
al
)
...
@@ -415,7 +417,7 @@ void UniSetObject::unregister()
...
@@ -415,7 +417,7 @@ void UniSetObject::unregister()
try
try
{
{
uinfo
<<
myname
<<
": unregister "
<<
endl
;
uinfo
<<
myname
<<
": unregister "
<<
endl
;
ui
.
unregister
(
myid
);
ui
->
unregister
(
myid
);
uinfo
<<
myname
<<
": unregister ok. "
<<
endl
;
uinfo
<<
myname
<<
": unregister ok. "
<<
endl
;
}
}
catch
(...)
catch
(...)
...
...
src/Processes/IOController.cc
View file @
b1ef89fe
...
@@ -382,13 +382,13 @@ void IOController::ioRegistration( USensorInfo&& ainf, bool force )
...
@@ -382,13 +382,13 @@ void IOController::ioRegistration( USensorInfo&& ainf, bool force )
<<
"(ioRegistration): регистрирую "
<<
"(ioRegistration): регистрирую "
<<
uniset_conf
()
->
oind
->
getNameById
(
ainf
.
si
.
id
)
<<
endl
;
<<
uniset_conf
()
->
oind
->
getNameById
(
ainf
.
si
.
id
)
<<
endl
;
ui
.
registered
(
ainf
.
si
.
id
,
getRef
(),
true
);
ui
->
registered
(
ainf
.
si
.
id
,
getRef
(),
true
);
return
;
return
;
}
}
catch
(
ObjectNameAlready
&
ex
)
catch
(
ObjectNameAlready
&
ex
)
{
{
uwarn
<<
myname
<<
"(asRegistration): ЗАМЕНЯЮ СУЩЕСТВУЮЩИЙ ОБЪЕКТ (ObjectNameAlready)"
<<
endl
;
uwarn
<<
myname
<<
"(asRegistration): ЗАМЕНЯЮ СУЩЕСТВУЮЩИЙ ОБЪЕКТ (ObjectNameAlready)"
<<
endl
;
ui
.
unregister
(
ainf
.
si
.
id
);
ui
->
unregister
(
ainf
.
si
.
id
);
}
}
}
}
}
}
...
@@ -404,7 +404,7 @@ void IOController::ioRegistration( USensorInfo&& ainf, bool force )
...
@@ -404,7 +404,7 @@ void IOController::ioRegistration( USensorInfo&& ainf, bool force )
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
void
IOController
::
ioUnRegistration
(
const
UniSetTypes
::
ObjectId
sid
)
void
IOController
::
ioUnRegistration
(
const
UniSetTypes
::
ObjectId
sid
)
{
{
ui
.
unregister
(
sid
);
ui
->
unregister
(
sid
);
}
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
void
IOController
::
logging
(
UniSetTypes
::
SensorMessage
&
sm
)
void
IOController
::
logging
(
UniSetTypes
::
SensorMessage
&
sm
)
...
@@ -421,7 +421,7 @@ void IOController::logging( UniSetTypes::SensorMessage& sm )
...
@@ -421,7 +421,7 @@ void IOController::logging( UniSetTypes::SensorMessage& sm )
sm
.
consumer
=
dbID
;
sm
.
consumer
=
dbID
;
TransportMessage
tm
(
sm
.
transport_msg
());
TransportMessage
tm
(
sm
.
transport_msg
());
ui
.
send
(
sm
.
consumer
,
std
::
move
(
tm
)
);
ui
->
send
(
sm
.
consumer
,
std
::
move
(
tm
)
);
isPingDBServer
=
true
;
isPingDBServer
=
true
;
}
}
catch
(...)
catch
(...)
...
...
src/Processes/IONotifyController.cc
View file @
b1ef89fe
...
@@ -98,7 +98,7 @@ bool IONotifyController::addConsumer( ConsumerListInfo& lst, const ConsumerInfo&
...
@@ -98,7 +98,7 @@ bool IONotifyController::addConsumer( ConsumerListInfo& lst, const ConsumerInfo&
// получаем ссылку
// получаем ссылку
try
try
{
{
UniSetTypes
::
ObjectVar
op
=
ui
.
resolve
(
ci
.
id
,
ci
.
node
);
UniSetTypes
::
ObjectVar
op
=
ui
->
resolve
(
ci
.
id
,
ci
.
node
);
cinf
.
ref
=
UniSetObject_i
::
_narrow
(
op
);
cinf
.
ref
=
UniSetObject_i
::
_narrow
(
op
);
}
}
catch
(...){}
catch
(...){}
...
@@ -176,7 +176,7 @@ void IONotifyController::askSensor(const UniSetTypes::ObjectId sid,
...
@@ -176,7 +176,7 @@ void IONotifyController::askSensor(const UniSetTypes::ObjectId sid,
try
try
{
{
ui
.
send
(
ci
.
id
,
std
::
move
(
smsg
.
transport_msg
()),
ci
.
node
);
ui
->
send
(
ci
.
id
,
std
::
move
(
smsg
.
transport_msg
()),
ci
.
node
);
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
...
@@ -390,7 +390,7 @@ void IONotifyController::send( ConsumerListInfo& lst, UniSetTypes::SensorMessage
...
@@ -390,7 +390,7 @@ void IONotifyController::send( ConsumerListInfo& lst, UniSetTypes::SensorMessage
{
{
if
(
CORBA
::
is_nil
(
li
->
ref
)
)
if
(
CORBA
::
is_nil
(
li
->
ref
)
)
{
{
CORBA
::
Object_var
op
=
ui
.
resolve
(
li
->
id
,
li
->
node
);
CORBA
::
Object_var
op
=
ui
->
resolve
(
li
->
id
,
li
->
node
);
li
->
ref
=
UniSetObject_i
::
_narrow
(
op
);
li
->
ref
=
UniSetObject_i
::
_narrow
(
op
);
}
}
...
@@ -610,7 +610,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
...
@@ -610,7 +610,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
if
(
val
<=
lowLimit
)
if
(
val
<=
lowLimit
)
{
{
sm
.
threshold
=
false
;
sm
.
threshold
=
false
;
CORBA
::
Object_var
op
=
ui
.
resolve
(
ci
.
id
,
ci
.
node
);
CORBA
::
Object_var
op
=
ui
->
resolve
(
ci
.
id
,
ci
.
node
);
UniSetObject_i_var
ref
=
UniSetObject_i
::
_narrow
(
op
);
UniSetObject_i_var
ref
=
UniSetObject_i
::
_narrow
(
op
);
if
(
!
CORBA
::
is_nil
(
ref
))
if
(
!
CORBA
::
is_nil
(
ref
))
ref
->
push
(
std
::
move
(
sm
.
transport_msg
())
);
ref
->
push
(
std
::
move
(
sm
.
transport_msg
())
);
...
@@ -619,7 +619,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
...
@@ -619,7 +619,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
else
if
(
val
>=
hiLimit
)
else
if
(
val
>=
hiLimit
)
{
{
sm
.
threshold
=
true
;
sm
.
threshold
=
true
;
CORBA
::
Object_var
op
=
ui
.
resolve
(
ci
.
id
,
ci
.
node
);
CORBA
::
Object_var
op
=
ui
->
resolve
(
ci
.
id
,
ci
.
node
);
UniSetObject_i_var
ref
=
UniSetObject_i
::
_narrow
(
op
);
UniSetObject_i_var
ref
=
UniSetObject_i
::
_narrow
(
op
);
if
(
!
CORBA
::
is_nil
(
ref
))
if
(
!
CORBA
::
is_nil
(
ref
))
ref
->
push
(
std
::
move
(
sm
.
transport_msg
())
);
ref
->
push
(
std
::
move
(
sm
.
transport_msg
())
);
...
...
src/Various/SMonitor.cc
View file @
b1ef89fe
...
@@ -54,7 +54,7 @@ void SMonitor::sysCommand( const SystemMessage *sm )
...
@@ -54,7 +54,7 @@ void SMonitor::sysCommand( const SystemMessage *sm )
try
try
{
{
if
(
it
.
si
.
id
!=
DefaultObjectId
)
if
(
it
.
si
.
id
!=
DefaultObjectId
)
ui
.
askRemoteSensor
(
it
.
si
.
id
,
UniversalIO
::
UIONotify
,
it
.
si
.
node
);
ui
->
askRemoteSensor
(
it
.
si
.
id
,
UniversalIO
::
UIONotify
,
it
.
si
.
node
);
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
...
...
src/Various/SViewer.cc
View file @
b1ef89fe
...
@@ -39,9 +39,9 @@ SViewer::SViewer(const string& csec, bool sn):
...
@@ -39,9 +39,9 @@ SViewer::SViewer(const string& csec, bool sn):
csec
(
csec
),
csec
(
csec
),
rep
(
UniSetTypes
::
uniset_conf
()),
rep
(
UniSetTypes
::
uniset_conf
()),
cache
(
500
,
15
),
cache
(
500
,
15
),
ui
(
UniSetTypes
::
uniset_conf
()),
isShort
(
sn
)
isShort
(
sn
)
{
{
ui
=
make_shared
<
UInterface
>
(
UniSetTypes
::
uniset_conf
());
}
}
SViewer
::~
SViewer
()
SViewer
::~
SViewer
()
...
@@ -171,7 +171,7 @@ void SViewer::getInfo( ObjectId id )
...
@@ -171,7 +171,7 @@ void SViewer::getInfo( ObjectId id )
if
(
CORBA
::
is_nil
(
oref
)
)
if
(
CORBA
::
is_nil
(
oref
)
)
{
{
oref
=
ui
.
resolve
(
id
);
oref
=
ui
->
resolve
(
id
);
cache
.
cache
(
id
,
uniset_conf
()
->
getLocalNode
(),
oref
);
cache
.
cache
(
id
,
uniset_conf
()
->
getLocalNode
(),
oref
);
}
}
...
...
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