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
e6fabab1
Commit
e6fabab1
authored
Dec 11, 2010
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Сделал более информативным вывод лога о неудачном опросе регистра
(
http://bugs.etersoft.ru/show_bug.cgi?id=5180
)
parent
208b2d17
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
12 deletions
+49
-12
MBTCPMaster.cc
extensions/MBTCPMaster/MBTCPMaster.cc
+23
-6
MBTCPMaster.h
extensions/MBTCPMaster/MBTCPMaster.h
+1
-0
start_fg.sh
extensions/MBTCPMaster/start_fg.sh
+1
-1
RTUExchange.cc
extensions/RTUExchange/RTUExchange.cc
+22
-4
RTUExchange.h
extensions/RTUExchange/RTUExchange.h
+1
-0
start_fg.sh
extensions/RTUExchange/start_fg.sh
+1
-1
No files found.
extensions/MBTCPMaster/MBTCPMaster.cc
View file @
e6fabab1
...
...
@@ -279,26 +279,31 @@ void MBTCPMaster::poll()
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(poll): ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
<<
" regs="
<<
d
->
regmap
.
size
()
<<
endl
;
d
->
resp_real
=
tru
e
;
d
->
resp_real
=
fals
e
;
for
(
MBTCPMaster
::
RegMap
::
iterator
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
{
try
{
if
(
d
->
dtype
==
MBTCPMaster
::
dtRTU
||
d
->
dtype
==
MBTCPMaster
::
dtMTR
)
{
pollRTU
(
d
,
it
);
if
(
pollRTU
(
d
,
it
)
)
d
->
resp_real
=
true
;
}
}
catch
(
ModbusRTU
::
mbException
&
ex
)
{
if
(
d
->
resp_real
)
// if( d->resp_real )
// {
if
(
dlog
.
debugging
(
Debug
::
LEVEL3
)
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(poll): FAILED ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
dlog
[
Debug
::
LEVEL3
]
<<
myname
<<
"(poll): FAILED ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
<<
" reg="
<<
ModbusRTU
::
dat2str
(
it
->
second
->
mbreg
)
<<
" -> "
<<
ex
<<
endl
;
<<
" for sensors: "
;
print_plist
(
dlog
(
Debug
::
LEVEL3
),
it
->
second
->
slst
);
dlog
(
Debug
::
LEVEL3
)
<<
" err: "
<<
ex
<<
endl
;
}
// }
d
->
resp_real
=
false
;
//
d->resp_real = false;
if
(
!
d
->
ask_every_reg
)
break
;
}
...
...
@@ -2212,3 +2217,14 @@ void MBTCPMaster::execute()
}
}
// -----------------------------------------------------------------------------
//std::ostream& operator<<( std::ostream& os, MBTCPMaster::PList& lst )
std
::
ostream
&
MBTCPMaster
::
print_plist
(
std
::
ostream
&
os
,
MBTCPMaster
::
PList
&
lst
)
{
os
<<
"[ "
;
for
(
MBTCPMaster
::
PList
::
const_iterator
it
=
lst
.
begin
();
it
!=
lst
.
end
();
++
it
)
os
<<
"("
<<
it
->
si
.
id
<<
")"
<<
conf
->
oind
->
getBaseName
(
conf
->
oind
->
getMapName
(
it
->
si
.
id
))
<<
" "
;
os
<<
"]"
;
return
os
;
}
// -----------------------------------------------------------------------------
\ No newline at end of file
extensions/MBTCPMaster/MBTCPMaster.h
View file @
e6fabab1
...
...
@@ -212,6 +212,7 @@ class MBTCPMaster:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
RSProperty
&
p
);
typedef
std
::
list
<
RSProperty
>
PList
;
static
std
::
ostream
&
print_plist
(
std
::
ostream
&
os
,
PList
&
p
);
typedef
std
::
map
<
ModbusRTU
::
ModbusData
,
RegInfo
*>
RegMap
;
struct
RegInfo
...
...
extensions/MBTCPMaster/start_fg.sh
View file @
e6fabab1
...
...
@@ -4,7 +4,7 @@ uniset-start.sh -f ./uniset-mbtcpmaster \
--confile
test.xml
\
--mbtcp-name
MBMaster1
\
--smemory-id
SharedMemory
\
--dlog-add-levels
info,crit,warn,level4
\
--dlog-add-levels
info,crit,warn,level4
,level3
\
--mbtcp-filter-field
mbtcp
\
--mbtcp-filter-value
1
\
--mbtcp-gateway-iaddr
127.0.0.1
\
...
...
extensions/RTUExchange/RTUExchange.cc
View file @
e6fabab1
...
...
@@ -305,8 +305,11 @@ void RTUExchange::poll()
{
if
(
d
->
resp_real
)
{
if
(
dlog
.
debugging
(
Debug
::
LEVEL3
)
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(poll): FAILED ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
<<
" -> "
<<
ex
<<
endl
;
}
d
->
resp_real
=
false
;
}
}
...
...
@@ -328,13 +331,17 @@ void RTUExchange::poll()
}
catch
(
ModbusRTU
::
mbException
&
ex
)
{
if
(
d
->
resp_real
)
// if( d->resp_real )
// {
if
(
dlog
.
debugging
(
Debug
::
LEVEL3
)
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(poll): FAILED ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
dlog
[
Debug
::
LEVEL3
]
<<
myname
<<
"(poll): FAILED ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
<<
" reg="
<<
ModbusRTU
::
dat2str
(
it
->
second
->
mbreg
)
<<
" -> "
<<
ex
<<
endl
;
// d->resp_real = false
;
<<
" for sensors: "
;
print_plist
(
dlog
(
Debug
::
LEVEL3
),
it
->
second
->
slst
)
;
dlog
(
Debug
::
LEVEL3
)
<<
" err: "
<<
ex
<<
endl
;
}
// d->resp_real = false;
// }
}
if
(
it
==
d
->
regmap
.
end
()
)
...
...
@@ -2262,3 +2269,14 @@ void RTUExchange::updateRTU188( RegMap::iterator& it )
}
}
// -----------------------------------------------------------------------------
//std::ostream& operator<<( std::ostream& os, MBTCPMaster::PList& lst )
std
::
ostream
&
RTUExchange
::
print_plist
(
std
::
ostream
&
os
,
RTUExchange
::
PList
&
lst
)
{
os
<<
"[ "
;
for
(
RTUExchange
::
PList
::
const_iterator
it
=
lst
.
begin
();
it
!=
lst
.
end
();
++
it
)
os
<<
"("
<<
it
->
si
.
id
<<
")"
<<
conf
->
oind
->
getBaseName
(
conf
->
oind
->
getMapName
(
it
->
si
.
id
))
<<
" "
;
os
<<
"]"
;
return
os
;
}
// -----------------------------------------------------------------------------
extensions/RTUExchange/RTUExchange.h
View file @
e6fabab1
...
...
@@ -77,6 +77,7 @@ class RTUExchange:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
RSProperty
&
p
);
typedef
std
::
list
<
RSProperty
>
PList
;
static
std
::
ostream
&
print_plist
(
std
::
ostream
&
os
,
PList
&
p
);
typedef
std
::
map
<
ModbusRTU
::
ModbusData
,
RegInfo
*>
RegMap
;
struct
RegInfo
...
...
extensions/RTUExchange/start_fg.sh
View file @
e6fabab1
...
...
@@ -7,7 +7,7 @@ uniset-start.sh -f ./uniset-rtuexchange --confile test.xml \
--rs-speed
38400
\
--rs-filter-field
rs
\
--rs-filter-value
1
\
--dlog-add-levels
info,crit,warn
\
--dlog-add-levels
info,crit,warn
,level4,level3
\
--rs-force
0
\
--rs-force-out
0
\
#,level3
...
...
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