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
05fa7898
Commit
05fa7898
authored
Sep 05, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ModbusSlave): добавил логов побольше
parent
2a9f1eb1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
libuniset2.spec
conf/libuniset2.spec
+4
-1
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+10
-5
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+2
-2
No files found.
conf/libuniset2.spec
View file @
05fa7898
...
...
@@ -13,7 +13,7 @@
Name: libuniset2
Version: 2.1
Release: alt2
0
Release: alt2
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
* Sat Sep 05 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt21
- (modbus slave): add more logs..
* Sat Aug 29 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt20
- (ModbusSession): add setKeepAliveParams()
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
05fa7898
...
...
@@ -1906,36 +1906,39 @@ ModbusRTU::mbErrCode MBSlave::real_read_prop( IOProperty* p, ModbusRTU::ModbusDa
else
return
ModbusRTU
::
erBadDataAddress
;
mbinfo
<<
myname
<<
"(real_read_prop): read OK. sid="
<<
p
->
si
.
id
<<
" val="
<<
val
<<
endl
;
pingOK
=
true
;
return
ModbusRTU
::
erNoError
;
}
catch
(
UniSetTypes
::
NameNotFound
&
ex
)
{
mbwarn
<<
myname
<<
"(real_read_
it
): "
<<
ex
<<
endl
;
mbwarn
<<
myname
<<
"(real_read_
prop
): "
<<
ex
<<
endl
;
return
ModbusRTU
::
erBadDataAddress
;
}
catch
(
UniSetTypes
::
OutOfRange
&
ex
)
{
mbwarn
<<
myname
<<
"(real_read_
it
): "
<<
ex
<<
endl
;
mbwarn
<<
myname
<<
"(real_read_
prop
): "
<<
ex
<<
endl
;
return
ModbusRTU
::
erBadDataValue
;
}
catch
(
const
Exception
&
ex
)
{
if
(
pingOK
)
mbcrit
<<
myname
<<
"(real_read_
it
): "
<<
ex
<<
endl
;
mbcrit
<<
myname
<<
"(real_read_
prop
): "
<<
ex
<<
endl
;
}
catch
(
const
CORBA
::
SystemException
&
ex
)
{
if
(
pingOK
)
mbcrit
<<
myname
<<
"(real_read_
it
): CORBA::SystemException: "
mbcrit
<<
myname
<<
"(real_read_
prop
): CORBA::SystemException: "
<<
ex
.
NP_minorString
()
<<
endl
;
}
catch
(...)
{
if
(
pingOK
)
mbcrit
<<
myname
<<
"(real_read_
it
) catch ..."
<<
endl
;
mbcrit
<<
myname
<<
"(real_read_
prop
) catch ..."
<<
endl
;
}
mbwarn
<<
myname
<<
"(real_read_prop): read sid="
<<
p
->
si
.
id
<<
" FAILED!!"
<<
endl
;
pingOK
=
false
;
return
ModbusRTU
::
erTimeOut
;
}
...
...
@@ -2249,6 +2252,8 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo()
inf
<<
i
->
info
<<
endl
;
inf
<<
vmon
.
pretty_str
()
<<
endl
;
inf
<<
"LogServer: "
<<
logserv_host
<<
":"
<<
logserv_port
<<
endl
;
inf
<<
" iomap="
<<
iomap
.
size
()
<<
endl
;
inf
<<
"Statistic: askCount="
<<
askCount
<<
" pingOK="
<<
pingOK
<<
endl
;
i
->
info
=
inf
.
str
().
c_str
();
return
i
.
_retn
();
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
05fa7898
...
...
@@ -499,7 +499,7 @@ int UniSetTypes::uni_atoi( const char* str )
// чтобы корректно обрабатывать большие числа типа std::numeric_limits<unsigned int>::max()
// \warning есть сомнения, что на 64bit-тах это будет корректно работать..
int
n
=
0
;
unsigned
int
n
=
0
;
if
(
strlen
(
str
)
>
2
)
{
...
...
@@ -511,7 +511,7 @@ int UniSetTypes::uni_atoi( const char* str )
}
n
=
std
::
atoll
(
str
);
// универсальнее получать unsigned..чтобы не потерять "большие числа"..
return
n
;
return
n
;
// а возвращаем int..
}
//--------------------------------------------------------------------------------------------
char
*
UniSetTypes
::
uni_strdup
(
const
string
&
src
)
...
...
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