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
ebd3c841
Commit
ebd3c841
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
a5e8affc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
9 deletions
+29
-9
main.cc
Utilities/SViewer-text/main.cc
+3
-1
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.
Utilities/SViewer-text/main.cc
View file @
ebd3c841
...
...
@@ -35,7 +35,9 @@ int main(int argc, const char **argv)
for(int i=0; i<size; i++)
cout << "id=" << seq[i].si.id << " val=" << seq[i].value << endl;
*/
bool
fullname
=
conf
->
getArgInt
(
"--fullname"
);
bool
fullname
=
false
;
if
(
findArgParam
(
"--fullname"
,
conf
->
getArgc
(),
conf
->
getArgv
())
!=
-
1
)
fullname
=
true
;
SViewer
sv
(
conf
->
getControllersSection
(),
!
fullname
);
timeout_t
timeMS
=
conf
->
getArgInt
(
"--polltime"
);
...
...
conf/libuniset.spec
View file @
ebd3c841
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 1.3
Release: alt1
3
Release: alt1
4
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -213,6 +213,9 @@ rm -f %buildroot%_libdir/*.la
%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
- minor fixes in uniset-codegen (add "preAskSensors")
...
...
extensions/UNet2/UNetExchange.cc
View file @
ebd3c841
...
...
@@ -151,6 +151,8 @@ sender2(0)
continue
;
}
bool
resp_invert
=
n_it
.
getIntProp
(
"unet_respond_invert"
);
string
s_resp_id
(
n_it
.
getProp
(
"unet_respond1_id"
));
UniSetTypes
::
ObjectId
resp_id
=
UniSetTypes
::
DefaultObjectId
;
if
(
!
s_resp_id
.
empty
()
)
...
...
@@ -250,7 +252,7 @@ sender2(0)
r
->
setUpdatePause
(
updatepause
);
r
->
setMaxDifferens
(
maxDiff
);
r
->
setMaxProcessingCount
(
maxProcessingCount
);
r
->
setRespondID
(
resp_id
);
r
->
setRespondID
(
resp_id
,
resp_invert
);
r
->
setLostPacketsID
(
lp_id
);
r
->
connectEvent
(
sigc
::
mem_fun
(
this
,
&
UNetExchange
::
receiverEvent
)
);
...
...
@@ -273,7 +275,7 @@ sender2(0)
r2
->
setUpdatePause
(
updatepause
);
r2
->
setMaxDifferens
(
maxDiff
);
r2
->
setMaxProcessingCount
(
maxProcessingCount
);
r2
->
setRespondID
(
resp2_id
);
r2
->
setRespondID
(
resp2_id
,
resp_invert
);
r2
->
setLostPacketsID
(
lp2_id
);
r2
->
connectEvent
(
sigc
::
mem_fun
(
this
,
&
UNetExchange
::
receiverEvent
)
);
}
...
...
@@ -287,7 +289,7 @@ sender2(0)
}
ReceiverInfo
ri
(
r
,
r2
);
ri
.
setRespondID
(
resp_comm_id
);
ri
.
setRespondID
(
resp_comm_id
,
resp_invert
);
ri
.
setLostPacketsID
(
lp_comm_id
);
recvlist
.
push_back
(
ri
);
}
...
...
@@ -427,6 +429,9 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string mynam
if
(
sidRespond
!=
DefaultObjectId
)
{
bool
resp
=
(
(
r1
&&
r1
->
isRecvOK
())
||
(
r2
&&
r2
->
isRecvOK
())
);
if
(
respondInvert
)
resp
=
!
resp
;
shm
->
localSaveState
(
ditRespond
,
sidRespond
,
resp
,
shm
->
ID
());
}
}
...
...
extensions/UNet2/UNetExchange.h
View file @
ebd3c841
...
...
@@ -148,6 +148,7 @@ class UNetExchange:
ReceiverInfo
(
UNetReceiver
*
_r1
,
UNetReceiver
*
_r2
)
:
r1
(
_r1
),
r2
(
_r2
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
respondInvert
(
false
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
)
{}
...
...
@@ -156,7 +157,11 @@ class UNetExchange:
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
initIterators
(
SMInterface
*
shm
)
{
...
...
@@ -170,6 +175,7 @@ class UNetExchange:
// ( реализацию см. ReceiverInfo::step() )
UniSetTypes
::
ObjectId
sidRespond
;
IOController
::
DIOStateList
::
iterator
ditRespond
;
bool
respondInvert
;
UniSetTypes
::
ObjectId
sidLostPackets
;
IOController
::
AIOStateList
::
iterator
aitLostPackets
;
};
...
...
extensions/UNet2/UNetReceiver.cc
View file @
ebd3c841
...
...
@@ -28,6 +28,7 @@ recvTimeout(5000),
lostTimeout
(
5000
),
lostPackets
(
0
),
sidRespond
(
UniSetTypes
::
DefaultObjectId
),
respondInvert
(
false
),
sidLostPackets
(
UniSetTypes
::
DefaultObjectId
),
activated
(
false
),
r_thr
(
0
),
...
...
@@ -118,9 +119,10 @@ void UNetReceiver::setMaxDifferens( unsigned long set )
maxDifferens
=
set
;
}
// -----------------------------------------------------------------------------
void
UNetReceiver
::
setRespondID
(
UniSetTypes
::
ObjectId
id
)
void
UNetReceiver
::
setRespondID
(
UniSetTypes
::
ObjectId
id
,
bool
invert
)
{
sidRespond
=
id
;
respondInvert
=
invert
;
shm
->
initDIterator
(
ditRespond
);
}
// -----------------------------------------------------------------------------
...
...
@@ -175,7 +177,8 @@ void UNetReceiver::update()
{
try
{
shm
->
localSaveState
(
ditRespond
,
sidRespond
,
isRecvOK
(),
shm
->
ID
());
bool
r
=
respondInvert
?
!
isRecvOK
()
:
isRecvOK
();
shm
->
localSaveState
(
ditRespond
,
sidRespond
,
r
,
shm
->
ID
());
}
catch
(
Exception
&
ex
)
{
...
...
extensions/UNet2/UNetReceiver.h
View file @
ebd3c841
...
...
@@ -75,7 +75,7 @@ class UNetReceiver
void
setLostTimeout
(
timeout_t
msec
);
void
setMaxDifferens
(
unsigned
long
set
);
void
setRespondID
(
UniSetTypes
::
ObjectId
id
);
void
setRespondID
(
UniSetTypes
::
ObjectId
id
,
bool
invert
=
false
);
void
setLostPacketsID
(
UniSetTypes
::
ObjectId
id
);
void
setMaxProcessingCount
(
int
set
);
...
...
@@ -123,6 +123,7 @@ class UNetReceiver
UniSetTypes
::
ObjectId
sidRespond
;
IOController
::
DIOStateList
::
iterator
ditRespond
;
bool
respondInvert
;
UniSetTypes
::
ObjectId
sidLostPackets
;
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