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
d5bdd661
Commit
d5bdd661
authored
Apr 04, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make style
parent
969fac56
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
31 additions
and
21 deletions
+31
-21
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+1
-0
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+2
-2
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+5
-2
test_sm.cc
extensions/SharedMemory/tests/test_sm.cc
+8
-8
TestProc.cc
extensions/tests/MBSlaveTest/TestProc.cc
+1
-0
DelayTimer.h
include/DelayTimer.h
+2
-2
IOController.h
include/IOController.h
+0
-0
IONotifyController.h
include/IONotifyController.h
+1
-1
ModbusTCPSession.h
include/modbus/ModbusTCPSession.h
+0
-0
ModbusTCPServer.cc
src/Communications/Modbus/ModbusTCPServer.cc
+1
-0
ModbusTCPSession.cc
src/Communications/Modbus/ModbusTCPSession.cc
+3
-0
IOController.cc
src/Processes/IOController.cc
+0
-0
IONotifyController.cc
src/Processes/IONotifyController.cc
+1
-1
develop.cc
tests/develop.cc
+4
-4
test_delaytimer.cc
tests/test_delaytimer.cc
+2
-1
No files found.
extensions/ModbusMaster/MBExchange.cc
View file @
d5bdd661
...
@@ -3300,6 +3300,7 @@ UniSetTypes::SimpleInfo* MBExchange::getInfo( CORBA::Long userparam )
...
@@ -3300,6 +3300,7 @@ UniSetTypes::SimpleInfo* MBExchange::getInfo( CORBA::Long userparam )
inf
<<
"Statistics: "
<<
statInfo
<<
endl
;
inf
<<
"Statistics: "
<<
statInfo
<<
endl
;
inf
<<
"Devices: "
<<
endl
;
inf
<<
"Devices: "
<<
endl
;
for
(
const
auto
&
it
:
devices
)
for
(
const
auto
&
it
:
devices
)
inf
<<
" "
<<
it
.
second
->
getShortInfo
()
<<
endl
;
inf
<<
" "
<<
it
.
second
->
getShortInfo
()
<<
endl
;
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
d5bdd661
...
@@ -51,7 +51,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
...
@@ -51,7 +51,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
// Т.к. при "многоканальном" доступе к slave, смена канала должна происходит сразу после
// Т.к. при "многоканальном" доступе к slave, смена канала должна происходит сразу после
// неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на channel-timeout..
// неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на channel-timeout..
int
channelTimeout
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-default-channel-timeout"
,
it
.
getProp
(
"channelTimeout"
),
default_timeout
);
int
channelTimeout
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-default-channel-timeout"
,
it
.
getProp
(
"channelTimeout"
),
default_timeout
);
ptReopen
.
setTiming
(
channelTimeout
);
ptReopen
.
setTiming
(
channelTimeout
);
UniXML
::
iterator
it1
(
it
);
UniXML
::
iterator
it1
(
it
);
...
@@ -174,7 +174,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
...
@@ -174,7 +174,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
// Т.к. при "многоканальном" доступе к slave, смена канала должна происходит сразу после
// Т.к. при "многоканальном" доступе к slave, смена канала должна происходит сразу после
// неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на channel-timeout..
// неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на channel-timeout..
int
tout
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-default-channel-timeout"
,
it
.
getProp
(
"channelTimeout"
),
default_timeout
);
int
tout
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-default-channel-timeout"
,
it
.
getProp
(
"channelTimeout"
),
default_timeout
);
ptReopen
.
setTiming
(
tout
);
ptReopen
.
setTiming
(
tout
);
if
(
mblog
->
is_info
()
)
if
(
mblog
->
is_info
()
)
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
d5bdd661
...
@@ -614,7 +614,7 @@ void MBSlave::execute_tcp()
...
@@ -614,7 +614,7 @@ void MBSlave::execute_tcp()
mbinfo
<<
myname
<<
"(execute_tcp): run tcpserver ("
mbinfo
<<
myname
<<
"(execute_tcp): run tcpserver ("
<<
tcpserver
->
getInetAddress
()
<<
":"
<<
tcpserver
->
getInetPort
()
<<
tcpserver
->
getInetAddress
()
<<
":"
<<
tcpserver
->
getInetPort
()
<<
")"
<<
endl
;
<<
")"
<<
endl
;
tcpCancelled
=
false
;
tcpCancelled
=
false
;
...
@@ -2564,8 +2564,10 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam )
...
@@ -2564,8 +2564,10 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam )
inf
<<
"LogServer: "
<<
logserv_host
<<
":"
<<
logserv_port
<<
endl
;
inf
<<
"LogServer: "
<<
logserv_host
<<
":"
<<
logserv_port
<<
endl
;
inf
<<
"iomap["
<<
iomap
.
size
()
<<
"]: "
<<
endl
;
inf
<<
"iomap["
<<
iomap
.
size
()
<<
"]: "
<<
endl
;
for
(
const
auto
&
m
:
iomap
)
for
(
const
auto
&
m
:
iomap
)
inf
<<
" "
<<
ModbusRTU
::
addr2str
(
m
.
first
)
<<
": iomap="
<<
m
.
second
.
size
()
<<
endl
;
inf
<<
" "
<<
ModbusRTU
::
addr2str
(
m
.
first
)
<<
": iomap="
<<
m
.
second
.
size
()
<<
endl
;
inf
<<
" myaddr: "
<<
ModbusServer
::
vaddr2str
(
vaddr
)
<<
endl
;
inf
<<
" myaddr: "
<<
ModbusServer
::
vaddr2str
(
vaddr
)
<<
endl
;
inf
<<
"Statistic: askCount="
<<
askCount
<<
" pingOK="
<<
pingOK
<<
endl
;
inf
<<
"Statistic: askCount="
<<
askCount
<<
" pingOK="
<<
pingOK
<<
endl
;
...
@@ -2592,6 +2594,7 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam )
...
@@ -2592,6 +2594,7 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam )
{
{
uniset_mutex_lock
l
(
sessMutex
);
uniset_mutex_lock
l
(
sessMutex
);
inf
<<
"TCP sessions["
<<
sess
.
size
()
<<
"]: max="
<<
sessMaxNum
<<
" updateStatTime="
<<
updateStatTime
<<
endl
;
inf
<<
"TCP sessions["
<<
sess
.
size
()
<<
"]: max="
<<
sessMaxNum
<<
" updateStatTime="
<<
updateStatTime
<<
endl
;
for
(
const
auto
&
m
:
sess
)
for
(
const
auto
&
m
:
sess
)
inf
<<
" "
<<
m
.
iaddr
<<
" askCount="
<<
m
.
askCount
<<
endl
;
inf
<<
" "
<<
m
.
iaddr
<<
" askCount="
<<
m
.
askCount
<<
endl
;
}
}
...
...
extensions/SharedMemory/tests/test_sm.cc
View file @
d5bdd661
...
@@ -186,30 +186,30 @@ TEST_CASE("[SM]: depend test", "[sm][depend]")
...
@@ -186,30 +186,30 @@ TEST_CASE("[SM]: depend test", "[sm][depend]")
REQUIRE
(
ui
->
getValue
(
513
)
==
0
);
REQUIRE
(
ui
->
getValue
(
513
)
==
0
);
// проверяем что датчик DI работает
// проверяем что датчик DI работает
ui
->
setValue
(
513
,
1
);
ui
->
setValue
(
513
,
1
);
msleep
(
300
);
msleep
(
300
);
REQUIRE
(
obj
->
in_dependDI_s
==
1
);
REQUIRE
(
obj
->
in_dependDI_s
==
1
);
ui
->
setValue
(
513
,
0
);
ui
->
setValue
(
513
,
0
);
msleep
(
300
);
msleep
(
300
);
REQUIRE
(
obj
->
in_dependDI_s
==
0
);
REQUIRE
(
obj
->
in_dependDI_s
==
0
);
// проверяем что датчик AI не работает, т.к. забклоирован
// проверяем что датчик AI не работает, т.к. забклоирован
ui
->
setValue
(
512
,
100
);
ui
->
setValue
(
512
,
100
);
REQUIRE
(
ui
->
getValue
(
512
)
==
1000
);
REQUIRE
(
ui
->
getValue
(
512
)
==
1000
);
msleep
(
300
);
msleep
(
300
);
REQUIRE
(
obj
->
in_dependAI_s
==
1000
);
REQUIRE
(
obj
->
in_dependAI_s
==
1000
);
ui
->
setValue
(
512
,
50
);
ui
->
setValue
(
512
,
50
);
REQUIRE
(
ui
->
getValue
(
512
)
==
1000
);
REQUIRE
(
ui
->
getValue
(
512
)
==
1000
);
msleep
(
300
);
msleep
(
300
);
REQUIRE
(
obj
->
in_dependAI_s
==
1000
);
REQUIRE
(
obj
->
in_dependAI_s
==
1000
);
// проверяем что после разблолокирования датчик принимает текущее значение
// проверяем что после разблолокирования датчик принимает текущее значение
// и процесс приходит sensorInfo
// и процесс приходит sensorInfo
ui
->
setValue
(
512
,
40
);
// выставляем значение (находясь под блокировкой)
ui
->
setValue
(
512
,
40
);
// выставляем значение (находясь под блокировкой)
REQUIRE
(
obj
->
in_dependAI_s
==
1000
);
// у процесса пока блокированное значение
REQUIRE
(
obj
->
in_dependAI_s
==
1000
);
// у процесса пока блокированное значение
// ----- разблокируем
// ----- разблокируем
ui
->
setValue
(
514
,
1
);
ui
->
setValue
(
514
,
1
);
msleep
(
300
);
msleep
(
300
);
REQUIRE
(
ui
->
getValue
(
514
)
==
1
);
REQUIRE
(
ui
->
getValue
(
514
)
==
1
);
...
@@ -220,14 +220,14 @@ TEST_CASE("[SM]: depend test", "[sm][depend]")
...
@@ -220,14 +220,14 @@ TEST_CASE("[SM]: depend test", "[sm][depend]")
// dependDI наоборот заблокировался
// dependDI наоборот заблокировался
REQUIRE
(
ui
->
getValue
(
513
)
==
0
);
REQUIRE
(
ui
->
getValue
(
513
)
==
0
);
ui
->
setValue
(
513
,
1
);
ui
->
setValue
(
513
,
1
);
msleep
(
300
);
msleep
(
300
);
REQUIRE
(
ui
->
getValue
(
513
)
==
0
);
REQUIRE
(
ui
->
getValue
(
513
)
==
0
);
REQUIRE
(
obj
->
in_dependDI_s
==
0
);
REQUIRE
(
obj
->
in_dependDI_s
==
0
);
// ----- блокируем
// ----- блокируем
ui
->
setValue
(
514
,
0
);
ui
->
setValue
(
514
,
0
);
msleep
(
300
);
msleep
(
300
);
REQUIRE
(
ui
->
getValue
(
514
)
==
0
);
REQUIRE
(
ui
->
getValue
(
514
)
==
0
);
...
...
extensions/tests/MBSlaveTest/TestProc.cc
View file @
d5bdd661
...
@@ -74,6 +74,7 @@ void TestProc::sysCommand( const UniSetTypes::SystemMessage* sm )
...
@@ -74,6 +74,7 @@ void TestProc::sysCommand( const UniSetTypes::SystemMessage* sm )
askTimer
(
tmCheck
,
checkTime
);
askTimer
(
tmCheck
,
checkTime
);
askTimer
(
tmCheckWorking
,
checkWorkingTime
);
askTimer
(
tmCheckWorking
,
checkWorkingTime
);
askTimer
(
tmLogControl
,
checkLogTime
);
askTimer
(
tmLogControl
,
checkLogTime
);
if
(
mbthr
)
if
(
mbthr
)
mbthr
->
start
();
mbthr
->
start
();
...
...
include/DelayTimer.h
View file @
d5bdd661
...
@@ -100,7 +100,7 @@ class DelayTimer
...
@@ -100,7 +100,7 @@ class DelayTimer
if
(
st
)
if
(
st
)
{
{
if
(
onDelay
<=
0
)
if
(
onDelay
<=
0
)
{
{
pt
.
setTiming
(
0
);
pt
.
setTiming
(
0
);
state
=
st
;
state
=
st
;
...
@@ -112,7 +112,7 @@ class DelayTimer
...
@@ -112,7 +112,7 @@ class DelayTimer
}
}
else
else
{
{
if
(
offDelay
<=
0
)
if
(
offDelay
<=
0
)
{
{
pt
.
setTiming
(
0
);
pt
.
setTiming
(
0
);
state
=
st
;
state
=
st
;
...
...
include/IOController.h
View file @
d5bdd661
include/IONotifyController.h
View file @
d5bdd661
...
@@ -283,7 +283,7 @@ class IONotifyController:
...
@@ -283,7 +283,7 @@ class IONotifyController:
//! проверка срабатывания пороговых датчиков
//! проверка срабатывания пороговых датчиков
virtual
void
checkThreshold
(
std
::
shared_ptr
<
USensorInfo
>&
usi
,
const
UniSetTypes
::
ObjectId
sid
,
bool
send
=
true
);
virtual
void
checkThreshold
(
std
::
shared_ptr
<
USensorInfo
>&
usi
,
const
UniSetTypes
::
ObjectId
sid
,
bool
send
=
true
);
virtual
void
checkThreshold
(
IOController
::
IOStateList
::
iterator
&
li
,
const
UniSetTypes
::
ObjectId
sid
,
bool
send_msg
=
true
);
virtual
void
checkThreshold
(
IOController
::
IOStateList
::
iterator
&
li
,
const
UniSetTypes
::
ObjectId
sid
,
bool
send_msg
=
true
);
//! поиск информации о пороговом датчике
//! поиск информации о пороговом датчике
ThresholdExtList
::
iterator
findThreshold
(
const
UniSetTypes
::
ObjectId
sid
,
const
UniSetTypes
::
ThresholdId
tid
);
ThresholdExtList
::
iterator
findThreshold
(
const
UniSetTypes
::
ObjectId
sid
,
const
UniSetTypes
::
ThresholdId
tid
);
...
...
include/modbus/ModbusTCPSession.h
View file @
d5bdd661
src/Communications/Modbus/ModbusTCPServer.cc
View file @
d5bdd661
...
@@ -199,6 +199,7 @@ void ModbusTCPServer::setTimer( timeout_t msec )
...
@@ -199,6 +199,7 @@ void ModbusTCPServer::setTimer( timeout_t msec )
void
ModbusTCPServer
::
iowait
(
timeout_t
msec
)
void
ModbusTCPServer
::
iowait
(
timeout_t
msec
)
{
{
ptWait
.
setTiming
(
msec
);
ptWait
.
setTiming
(
msec
);
while
(
!
ptWait
.
checkTime
()
)
while
(
!
ptWait
.
checkTime
()
)
io
.
loop
.
iteration
();
io
.
loop
.
iteration
();
}
}
...
...
src/Communications/Modbus/ModbusTCPSession.cc
View file @
d5bdd661
...
@@ -92,6 +92,7 @@ void ModbusTCPSession::setSessionTimeout( double t )
...
@@ -92,6 +92,7 @@ void ModbusTCPSession::setSessionTimeout( double t )
void
ModbusTCPSession
::
iowait
(
timeout_t
msec
)
void
ModbusTCPSession
::
iowait
(
timeout_t
msec
)
{
{
ptWait
.
setTiming
(
msec
);
ptWait
.
setTiming
(
msec
);
while
(
!
ptWait
.
checkTime
()
)
while
(
!
ptWait
.
checkTime
()
)
io
.
loop
.
iteration
();
io
.
loop
.
iteration
();
}
}
...
@@ -329,9 +330,11 @@ mbErrCode ModbusTCPSession::tcp_processing( ModbusTCP::MBAPHeader& mhead )
...
@@ -329,9 +330,11 @@ mbErrCode ModbusTCPSession::tcp_processing( ModbusTCP::MBAPHeader& mhead )
}
}
pt
.
setTiming
(
10
);
pt
.
setTiming
(
10
);
do
do
{
{
len
=
ModbusTCPCore
::
readDataFD
(
sock
->
getSocket
(),
qrecv
,
mhead
.
len
);
len
=
ModbusTCPCore
::
readDataFD
(
sock
->
getSocket
(),
qrecv
,
mhead
.
len
);
if
(
len
==
0
)
if
(
len
==
0
)
io
.
loop
.
iteration
();
io
.
loop
.
iteration
();
}
}
...
...
src/Processes/IOController.cc
View file @
d5bdd661
src/Processes/IONotifyController.cc
View file @
d5bdd661
...
@@ -681,7 +681,7 @@ void IONotifyController::checkThreshold( IOController::IOStateList::iterator& li
...
@@ -681,7 +681,7 @@ void IONotifyController::checkThreshold( IOController::IOStateList::iterator& li
if
(
li
==
myioEnd
()
)
if
(
li
==
myioEnd
()
)
return
;
// ???
return
;
// ???
checkThreshold
(
li
->
second
,
sid
,
send_msg
);
checkThreshold
(
li
->
second
,
sid
,
send_msg
);
}
}
// --------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------
void
IONotifyController
::
checkThreshold
(
std
::
shared_ptr
<
IOController
::
USensorInfo
>&
s
,
void
IONotifyController
::
checkThreshold
(
std
::
shared_ptr
<
IOController
::
USensorInfo
>&
s
,
...
...
tests/develop.cc
View file @
d5bdd661
...
@@ -20,13 +20,13 @@ using namespace std;
...
@@ -20,13 +20,13 @@ using namespace std;
int
main
(
int
argc
,
const
char
**
argv
)
int
main
(
int
argc
,
const
char
**
argv
)
{
{
unsigned
char
dat
[]
=
{
'1'
,
'2'
,
'3'
,
'4'
};
unsigned
char
dat
[]
=
{
'1'
,
'2'
,
'3'
,
'4'
};
// UTCPCore::Buffer* buf = new UTCPCore::Buffer( dat, 0 );
// UTCPCore::Buffer* buf = new UTCPCore::Buffer( dat, 0 );
UTCPCore
::
Buffer
*
buf
=
new
UTCPCore
::
Buffer
(
dat
,
3
);
UTCPCore
::
Buffer
*
buf
=
new
UTCPCore
::
Buffer
(
dat
,
3
);
// if( buf->nbytes() == 0 )
// if( buf->nbytes() == 0 )
// delete buf;
// delete buf;
cout
<<
"buf: "
<<
buf
->
dpos
()
<<
endl
;
cout
<<
"buf: "
<<
buf
->
dpos
()
<<
endl
;
...
...
tests/test_delaytimer.cc
View file @
d5bdd661
...
@@ -190,9 +190,10 @@ TEST_CASE("[DelayTimer]: zero time", "[DelayTimer]" )
...
@@ -190,9 +190,10 @@ TEST_CASE("[DelayTimer]: zero time", "[DelayTimer]" )
SECTION
(
"off delay"
)
SECTION
(
"off delay"
)
{
{
DelayTimer
dt
(
0
,
2000
);
DelayTimer
dt
(
0
,
2000
);
PassiveTimer
pt
;
PassiveTimer
pt
;
dt
.
check
(
true
);
dt
.
check
(
true
);
while
(
dt
.
check
(
false
)
)
while
(
dt
.
check
(
false
)
)
msleep
(
100
);
msleep
(
100
);
...
...
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