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
2b468646
Commit
2b468646
authored
Aug 20, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ModbusTCP): добавил больше параметров в выводе информации о состоянии связи
parent
dd5e3175
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
17 deletions
+43
-17
libuniset2.spec
conf/libuniset2.spec
+4
-1
test.xml
conf/test.xml
+2
-2
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+20
-1
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+2
-2
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+5
-1
start_fg_mbtcpmulti.sh
extensions/ModbusMaster/start_fg_mbtcpmulti.sh
+2
-2
DelayTimer.h
include/DelayTimer.h
+3
-3
PassiveTimer.h
include/PassiveTimer.h
+4
-4
PassiveTimer.cc
src/Timers/PassiveTimer.cc
+1
-1
No files found.
conf/libuniset2.spec
View file @
2b468646
...
...
@@ -13,7 +13,7 @@
Name: libuniset2
Version: 2.1
Release: alt16
Release: alt16
.1
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -456,6 +456,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Thu Aug 20 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt16.1
- (ModbusTCP): add more vmonit parameters
* Thu Aug 20 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt16
- (modbustcptest): add 'check' for connection
...
...
conf/test.xml
View file @
2b468646
...
...
@@ -78,9 +78,9 @@
<item
addr=
"0x01"
invert=
"0"
respondSensor=
"RespondRTU_S"
timeout=
"5000"
modeSensor=
"MB1_Mode_AS"
/>
</DeviceList>
</MBMaster1>
<MBMultiMaster1
levels=
"info,warn,crit"
name=
"MBMaster1"
poll
_time=
"200"
reply_timeout=
"6
0"
>
<MBMultiMaster1
levels=
"info,warn,crit"
name=
"MBMaster1"
poll
time=
"20
0"
>
<DeviceList>
<item
addr=
"0x01"
invert=
"0"
respondSensor=
"RespondRTU_S"
timeout=
"5
000"
modeSensor=
"MB1_Mode_AS"
/>
<item
addr=
"0x01"
invert=
"0"
force=
"0"
respondSensor=
"RespondRTU_S"
timeout=
"1
000"
modeSensor=
"MB1_Mode_AS"
/>
</DeviceList>
<GateList>
<item
ip=
"localhost"
port=
"2048"
recv_timeout=
"800"
invert=
"1"
respondSensor=
"MM1_Not_Respond_S"
/>
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
2b468646
...
...
@@ -3231,8 +3231,27 @@ UniSetTypes::SimpleInfo* MBExchange::getInfo()
inf
<<
i
->
info
<<
endl
;
inf
<<
vmon
.
pretty_str
()
<<
endl
;
inf
<<
"LogServer: "
<<
logserv_host
<<
":"
<<
logserv_port
<<
endl
;
inf
<<
"Devices:"
<<
endl
;
for
(
const
auto
&
it
:
rmap
)
inf
<<
" "
<<
it
.
second
->
getShortInfo
()
<<
endl
;
i
->
info
=
inf
.
str
().
c_str
();
return
i
.
_retn
();
}
// ----------------------------------------------------------------------------
std
::
string
MBExchange
::
RTUDevice
::
getShortInfo
()
const
{
ostringstream
s
;
s
<<
"mbaddr="
<<
ModbusRTU
::
addr2str
(
mbaddr
)
<<
":"
<<
" resp_state="
<<
resp_state
<<
" (resp_id="
<<
resp_id
<<
" resp_force="
<<
resp_force
<<
" resp_invert="
<<
resp_invert
<<
" numreply="
<<
numreply
<<
" timeout="
<<
resp_Delay
.
getOnDelay
()
<<
" type="
<<
dtype
<<
")"
<<
endl
;
return
std
::
move
(
s
.
str
()
);
}
// ----------------------------------------------------------------------------
extensions/ModbusMaster/MBExchange.h
View file @
2b468646
...
...
@@ -164,7 +164,6 @@ class MBExchange:
struct
RTUDevice
{
RTUDevice
()
:
respnond
(
false
),
mbaddr
(
0
),
dtype
(
dtUnknown
),
resp_id
(
UniSetTypes
::
DefaultObjectId
),
...
...
@@ -180,7 +179,6 @@ class MBExchange:
{
}
bool
respnond
;
ModbusRTU
::
ModbusAddr
mbaddr
;
/*!< адрес устройства */
RegMap
regmap
;
...
...
@@ -211,6 +209,8 @@ class MBExchange:
// специфические поля для RS
ComPort
::
Speed
speed
;
RTUStorage
*
rtu
;
std
::
string
getShortInfo
()
const
;
};
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
RTUDevice
&
d
);
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
2b468646
...
...
@@ -497,7 +497,11 @@ std::shared_ptr<MBTCPMultiMaster> MBTCPMultiMaster::init_mbmaster( int argc, con
const
std
::
string
MBTCPMultiMaster
::
MBSlaveInfo
::
getShortInfo
()
const
{
ostringstream
s
;
s
<<
myname
<<
" respond="
<<
respond
;
s
<<
myname
<<
" respond="
<<
respond
<<
" (respond_id="
<<
respond_id
<<
" respond_invert="
<<
respond_invert
<<
" recv_timeout="
<<
recv_timeout
<<
" use="
<<
use
<<
" ignore="
<<
ignore
<<
" priority="
<<
priority
<<
")"
;
return
std
::
move
(
s
.
str
());
}
// -----------------------------------------------------------------------------
...
...
extensions/ModbusMaster/start_fg_mbtcpmulti.sh
View file @
2b468646
...
...
@@ -8,9 +8,9 @@
--mbtcp-set-prop-prefix
\
--mbtcp-filter-field
rs
\
--mbtcp-filter-value
5
\
--mbtcp-recv-timeout
1
000
\
--mbtcp-recv-timeout
7
000
\
--mbtcp-timeout
2000
\
--mbtcp-polltime
1
000
\
--mbtcp-polltime
5
000
\
--mbtcp-force-out
1
\
--mbtcp-log-add-levels
any
\
$*
...
...
include/DelayTimer.h
View file @
2b468646
...
...
@@ -125,16 +125,16 @@ class DelayTimer
return
check
(
prevState
);
}
inline
timeout_t
getOnDelay
()
inline
timeout_t
getOnDelay
()
const
{
return
onDelay
;
}
inline
timeout_t
getOffDelay
()
inline
timeout_t
getOffDelay
()
const
{
return
offDelay
;
}
inline
timeout_t
getCurrent
()
inline
timeout_t
getCurrent
()
const
{
return
pt
.
getCurrent
();
}
...
...
include/PassiveTimer.h
View file @
2b468646
...
...
@@ -46,8 +46,8 @@ class UniSetTimer
virtual
timeout_t
setTiming
(
timeout_t
msec
)
=
0
;
/*!< установить таймер и запустить */
virtual
void
reset
()
=
0
;
/*!< перезапустить таймер */
virtual
timeout_t
getCurrent
()
=
0
;
/*!< получить текущее значение таймера */
virtual
timeout_t
getInterval
()
=
0
;
/*!< получить интервал, на который установлен таймер, в мс */
virtual
timeout_t
getCurrent
()
const
=
0
;
/*!< получить текущее значение таймера */
virtual
timeout_t
getInterval
()
const
=
0
;
/*!< получить интервал, на который установлен таймер, в мс */
timeout_t
getLeft
(
timeout_t
timeout
)
/*!< получить время, которое остается от timeout после прошествия времени getCurrent() */
{
timeout_t
ct
=
getCurrent
();
...
...
@@ -104,8 +104,8 @@ class PassiveTimer:
virtual
timeout_t
setTiming
(
timeout_t
msec
);
/*!< установить таймер и запустить. timeMS = 0 вызовет немедленное срабатывание */
virtual
void
reset
();
/*!< перезапустить таймер */
virtual
timeout_t
getCurrent
();
/*!< получить текущее значение таймера, в мс */
virtual
timeout_t
getInterval
()
/*!< получить интервал, на который установлен таймер, в мс */
virtual
timeout_t
getCurrent
()
const
override
;
/*!< получить текущее значение таймера, в мс */
virtual
timeout_t
getInterval
()
const
override
/*!< получить интервал, на который установлен таймер, в мс */
{
return
(
t_msec
!=
UniSetTimer
::
WaitUpTime
?
t_msec
:
0
);
}
...
...
src/Timers/PassiveTimer.cc
View file @
2b468646
...
...
@@ -72,7 +72,7 @@ void PassiveTimer::reset(void)
}
//------------------------------------------------------------------------------
// получить текущее значение таймера
timeout_t
PassiveTimer
::
getCurrent
()
timeout_t
PassiveTimer
::
getCurrent
()
const
{
return
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
t_start
).
count
();
}
...
...
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