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
2399602e
Commit
2399602e
authored
Mar 15, 2012
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Unet2): добавил параметр unet_respond_invert для возможности инвертирования…
(Unet2): добавил параметр unet_respond_invert для возможности инвертирования логики выставления датчиков связи.
parent
2fb545d3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
8 deletions
+26
-8
libuniset.spec
conf/libuniset.spec
+4
-1
UNetExchange.cc
extensions/UNet2/UNetExchange.cc
+8
-3
UNetExchange.h
extensions/UNet2/UNetExchange.h
+7
-1
UNetReceiver.cc
extensions/UNet2/UNetReceiver.cc
+5
-2
UNetReceiver.h
extensions/UNet2/UNetReceiver.h
+2
-1
No files found.
conf/libuniset.spec
View file @
2399602e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Name: libuniset
Name: libuniset
Version: 1.3
Version: 1.3
Release: alt1
3
Release: alt1
4
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
License: GPL
License: GPL
Group: Development/C++
Group: Development/C++
...
@@ -213,6 +213,9 @@ rm -f %buildroot%_libdir/*.la
...
@@ -213,6 +213,9 @@ rm -f %buildroot%_libdir/*.la
%changelog
%changelog
* Thu Mar 15 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt14
- (unet2): add 'unet_respond_invert' parameter
* Sun Mar 11 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt13
* Sun Mar 11 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt13
- minor fixes in uniset-codegen (add "preAskSensors")
- minor fixes in uniset-codegen (add "preAskSensors")
...
...
extensions/UNet2/UNetExchange.cc
View file @
2399602e
...
@@ -151,6 +151,8 @@ sender2(0)
...
@@ -151,6 +151,8 @@ sender2(0)
continue
;
continue
;
}
}
bool
resp_invert
=
n_it
.
getIntProp
(
"unet_respond_invert"
);
string
s_resp_id
(
n_it
.
getProp
(
"unet_respond1_id"
));
string
s_resp_id
(
n_it
.
getProp
(
"unet_respond1_id"
));
UniSetTypes
::
ObjectId
resp_id
=
UniSetTypes
::
DefaultObjectId
;
UniSetTypes
::
ObjectId
resp_id
=
UniSetTypes
::
DefaultObjectId
;
if
(
!
s_resp_id
.
empty
()
)
if
(
!
s_resp_id
.
empty
()
)
...
@@ -250,7 +252,7 @@ sender2(0)
...
@@ -250,7 +252,7 @@ sender2(0)
r
->
setUpdatePause
(
updatepause
);
r
->
setUpdatePause
(
updatepause
);
r
->
setMaxDifferens
(
maxDiff
);
r
->
setMaxDifferens
(
maxDiff
);
r
->
setMaxProcessingCount
(
maxProcessingCount
);
r
->
setMaxProcessingCount
(
maxProcessingCount
);
r
->
setRespondID
(
resp_id
);
r
->
setRespondID
(
resp_id
,
resp_invert
);
r
->
setLostPacketsID
(
lp_id
);
r
->
setLostPacketsID
(
lp_id
);
r
->
connectEvent
(
sigc
::
mem_fun
(
this
,
&
UNetExchange
::
receiverEvent
)
);
r
->
connectEvent
(
sigc
::
mem_fun
(
this
,
&
UNetExchange
::
receiverEvent
)
);
...
@@ -273,7 +275,7 @@ sender2(0)
...
@@ -273,7 +275,7 @@ sender2(0)
r2
->
setUpdatePause
(
updatepause
);
r2
->
setUpdatePause
(
updatepause
);
r2
->
setMaxDifferens
(
maxDiff
);
r2
->
setMaxDifferens
(
maxDiff
);
r2
->
setMaxProcessingCount
(
maxProcessingCount
);
r2
->
setMaxProcessingCount
(
maxProcessingCount
);
r2
->
setRespondID
(
resp2_id
);
r2
->
setRespondID
(
resp2_id
,
resp_invert
);
r2
->
setLostPacketsID
(
lp2_id
);
r2
->
setLostPacketsID
(
lp2_id
);
r2
->
connectEvent
(
sigc
::
mem_fun
(
this
,
&
UNetExchange
::
receiverEvent
)
);
r2
->
connectEvent
(
sigc
::
mem_fun
(
this
,
&
UNetExchange
::
receiverEvent
)
);
}
}
...
@@ -287,7 +289,7 @@ sender2(0)
...
@@ -287,7 +289,7 @@ sender2(0)
}
}
ReceiverInfo
ri
(
r
,
r2
);
ReceiverInfo
ri
(
r
,
r2
);
ri
.
setRespondID
(
resp_comm_id
);
ri
.
setRespondID
(
resp_comm_id
,
resp_invert
);
ri
.
setLostPacketsID
(
lp_comm_id
);
ri
.
setLostPacketsID
(
lp_comm_id
);
recvlist
.
push_back
(
ri
);
recvlist
.
push_back
(
ri
);
}
}
...
@@ -427,6 +429,9 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string mynam
...
@@ -427,6 +429,9 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string mynam
if
(
sidRespond
!=
DefaultObjectId
)
if
(
sidRespond
!=
DefaultObjectId
)
{
{
bool
resp
=
(
(
r1
&&
r1
->
isRecvOK
())
||
(
r2
&&
r2
->
isRecvOK
())
);
bool
resp
=
(
(
r1
&&
r1
->
isRecvOK
())
||
(
r2
&&
r2
->
isRecvOK
())
);
if
(
respondInvert
)
resp
=
!
resp
;
shm
->
localSaveState
(
ditRespond
,
sidRespond
,
resp
,
shm
->
ID
());
shm
->
localSaveState
(
ditRespond
,
sidRespond
,
resp
,
shm
->
ID
());
}
}
}
}
...
...
extensions/UNet2/UNetExchange.h
View file @
2399602e
...
@@ -148,6 +148,7 @@ class UNetExchange:
...
@@ -148,6 +148,7 @@ class UNetExchange:
ReceiverInfo
(
UNetReceiver
*
_r1
,
UNetReceiver
*
_r2
)
:
ReceiverInfo
(
UNetReceiver
*
_r1
,
UNetReceiver
*
_r2
)
:
r1
(
_r1
),
r2
(
_r2
),
r1
(
_r1
),
r2
(
_r2
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
respondInvert
(
false
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
)
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
)
{}
{}
...
@@ -156,7 +157,11 @@ class UNetExchange:
...
@@ -156,7 +157,11 @@ class UNetExchange:
void
step
(
SMInterface
*
shm
,
const
std
::
string
myname
);
void
step
(
SMInterface
*
shm
,
const
std
::
string
myname
);
inline
void
setRespondID
(
UniSetTypes
::
ObjectId
id
){
sidRespond
=
id
;
}
inline
void
setRespondID
(
UniSetTypes
::
ObjectId
id
,
bool
invert
=
false
)
{
sidRespond
=
id
;
respondInvert
=
invert
;
}
inline
void
setLostPacketsID
(
UniSetTypes
::
ObjectId
id
){
sidLostPackets
=
id
;
}
inline
void
setLostPacketsID
(
UniSetTypes
::
ObjectId
id
){
sidLostPackets
=
id
;
}
inline
void
initIterators
(
SMInterface
*
shm
)
inline
void
initIterators
(
SMInterface
*
shm
)
{
{
...
@@ -170,6 +175,7 @@ class UNetExchange:
...
@@ -170,6 +175,7 @@ class UNetExchange:
// ( реализацию см. ReceiverInfo::step() )
// ( реализацию см. ReceiverInfo::step() )
UniSetTypes
::
ObjectId
sidRespond
;
UniSetTypes
::
ObjectId
sidRespond
;
IOController
::
DIOStateList
::
iterator
ditRespond
;
IOController
::
DIOStateList
::
iterator
ditRespond
;
bool
respondInvert
;
UniSetTypes
::
ObjectId
sidLostPackets
;
UniSetTypes
::
ObjectId
sidLostPackets
;
IOController
::
AIOStateList
::
iterator
aitLostPackets
;
IOController
::
AIOStateList
::
iterator
aitLostPackets
;
};
};
...
...
extensions/UNet2/UNetReceiver.cc
View file @
2399602e
...
@@ -28,6 +28,7 @@ recvTimeout(5000),
...
@@ -28,6 +28,7 @@ recvTimeout(5000),
lostTimeout
(
5000
),
lostTimeout
(
5000
),
lostPackets
(
0
),
lostPackets
(
0
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
respondInvert
(
false
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
),
activated
(
false
),
activated
(
false
),
r_thr
(
0
),
r_thr
(
0
),
...
@@ -118,9 +119,10 @@ void UNetReceiver::setMaxDifferens( unsigned long set )
...
@@ -118,9 +119,10 @@ void UNetReceiver::setMaxDifferens( unsigned long set )
maxDifferens
=
set
;
maxDifferens
=
set
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UNetReceiver
::
setRespondID
(
UniSetTypes
::
ObjectId
id
)
void
UNetReceiver
::
setRespondID
(
UniSetTypes
::
ObjectId
id
,
bool
invert
)
{
{
sidRespond
=
id
;
sidRespond
=
id
;
respondInvert
=
invert
;
shm
->
initDIterator
(
ditRespond
);
shm
->
initDIterator
(
ditRespond
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -175,7 +177,8 @@ void UNetReceiver::update()
...
@@ -175,7 +177,8 @@ void UNetReceiver::update()
{
{
try
try
{
{
shm
->
localSaveState
(
ditRespond
,
sidRespond
,
isRecvOK
(),
shm
->
ID
());
bool
r
=
respondInvert
?
!
isRecvOK
()
:
isRecvOK
();
shm
->
localSaveState
(
ditRespond
,
sidRespond
,
r
,
shm
->
ID
());
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
...
...
extensions/UNet2/UNetReceiver.h
View file @
2399602e
...
@@ -75,7 +75,7 @@ class UNetReceiver
...
@@ -75,7 +75,7 @@ class UNetReceiver
void
setLostTimeout
(
timeout_t
msec
);
void
setLostTimeout
(
timeout_t
msec
);
void
setMaxDifferens
(
unsigned
long
set
);
void
setMaxDifferens
(
unsigned
long
set
);
void
setRespondID
(
UniSetTypes
::
ObjectId
id
);
void
setRespondID
(
UniSetTypes
::
ObjectId
id
,
bool
invert
=
false
);
void
setLostPacketsID
(
UniSetTypes
::
ObjectId
id
);
void
setLostPacketsID
(
UniSetTypes
::
ObjectId
id
);
void
setMaxProcessingCount
(
int
set
);
void
setMaxProcessingCount
(
int
set
);
...
@@ -123,6 +123,7 @@ class UNetReceiver
...
@@ -123,6 +123,7 @@ class UNetReceiver
UniSetTypes
::
ObjectId
sidRespond
;
UniSetTypes
::
ObjectId
sidRespond
;
IOController
::
DIOStateList
::
iterator
ditRespond
;
IOController
::
DIOStateList
::
iterator
ditRespond
;
bool
respondInvert
;
UniSetTypes
::
ObjectId
sidLostPackets
;
UniSetTypes
::
ObjectId
sidLostPackets
;
IOController
::
AIOStateList
::
iterator
aitLostPackets
;
IOController
::
AIOStateList
::
iterator
aitLostPackets
;
...
...
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