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
2d26f84d
Commit
2d26f84d
authored
Oct 10, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправления по результатам проверки статическим анализатором
parent
3556ba44
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
115 additions
and
100 deletions
+115
-100
admin.cc
Utilities/Admin/admin.cc
+2
-1
DBServer_MySQL.cc
extensions/DBServer-MySQL/DBServer_MySQL.cc
+3
-1
DBServer_PostgreSQL.cc
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
+5
-4
DBServer_SQLite.cc
extensions/DBServer-SQLite/DBServer_SQLite.cc
+3
-1
IOControl.cc
extensions/IOControl/IOControl.cc
+11
-11
IOControl.h
extensions/IOControl/IOControl.h
+1
-1
iocalibr.cc
extensions/IOControl/iocalibr.cc
+0
-1
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+0
-2
smemory-plus.cc
extensions/SharedMemoryPlus/smemory-plus.cc
+0
-3
MTR.h
extensions/include/MTR.h
+4
-4
VTypes.h
extensions/include/VTypes.h
+3
-3
IOBase.cc
extensions/lib/IOBase.cc
+4
-2
SMInterface.cc
extensions/lib/SMInterface.cc
+1
-1
LogServer.h
include/LogServer.h
+7
-6
NCRestorer.h
include/NCRestorer.h
+0
-2
ModbusClient.h
include/modbus/ModbusClient.h
+4
-6
PyUInterface.cc
python/lib/pyUniSet/PyUInterface.cc
+6
-6
ModbusClient.cc
src/Communications/Modbus/ModbusClient.cc
+24
-24
ModbusTCPCore.cc
src/Communications/Modbus/ModbusTCPCore.cc
+16
-6
UInterface.cc
src/Interfaces/UInterface.cc
+2
-2
Debug.cc
src/Log/Debug.cc
+12
-2
LogServer.cc
src/Log/LogServer.cc
+7
-7
NCRestorer_XML.cc
src/Processes/NCRestorer_XML.cc
+0
-4
No files found.
Utilities/Admin/admin.cc
View file @
2d26f84d
...
...
@@ -955,7 +955,8 @@ int configure( const string& arg, UInterface& ui )
UniSetTypes
::
ObjectId
id
=
conf
->
getObjectID
(
arg
);
if
(
id
==
DefaultObjectId
)
id
=
conf
->
getControllerID
(
arg
);
else
if
(
id
==
DefaultObjectId
)
if
(
id
==
DefaultObjectId
)
id
=
conf
->
getServiceID
(
arg
);
if
(
id
==
DefaultObjectId
)
...
...
extensions/DBServer-MySQL/DBServer_MySQL.cc
View file @
2d26f84d
...
...
@@ -384,10 +384,12 @@ void DBServer_MySQL::timerInfo( const UniSetTypes::TimerMessage* tm )
askTimer
(
DBServer_MySQL
::
ReconnectTimer
,
0
);
askTimer
(
DBServer_MySQL
::
PingTimer
,
PingTime
);
}
else
{
connect_ok
=
false
;
dbwarn
<<
myname
<<
"(timerInfo): DB no connection.."
<<
endl
;
}
}
else
initDBServer
();
}
...
...
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
View file @
2d26f84d
...
...
@@ -220,10 +220,9 @@ void DBServer_PostgreSQL::flushInsertBuffer()
}
ibuf
.
erase
(
beg
,
end
);
ibufSize
-=
delnum
;
if
(
ibufSize
<
0
)
ibufSize
=
0
;
// ibufSize - беззнаковое, так что надо аккуратно
ibufSize
=
(
delnum
<
ibufSize
)
?
(
ibufSize
-
delnum
)
:
0
;
dbwarn
<<
myname
<<
"(flushInsertBuffer): overflow: clear data "
<<
delnum
<<
" records."
<<
endl
;
return
;
...
...
@@ -438,10 +437,12 @@ void DBServer_PostgreSQL::timerInfo( const UniSetTypes::TimerMessage* tm )
askTimer
(
DBServer_PostgreSQL
::
ReconnectTimer
,
0
);
askTimer
(
DBServer_PostgreSQL
::
PingTimer
,
PingTime
);
}
else
{
connect_ok
=
false
;
dbwarn
<<
myname
<<
"(timerInfo): DB no connection.."
<<
endl
;
}
}
else
initDBServer
();
}
...
...
extensions/DBServer-SQLite/DBServer_SQLite.cc
View file @
2d26f84d
...
...
@@ -359,10 +359,12 @@ void DBServer_SQLite::timerInfo( const UniSetTypes::TimerMessage* tm )
askTimer
(
DBServer_SQLite
::
ReconnectTimer
,
0
);
askTimer
(
DBServer_SQLite
::
PingTimer
,
PingTime
);
}
else
{
connect_ok
=
false
;
dbwarn
<<
myname
<<
"(timerInfo): DB no connection.."
<<
endl
;
}
}
else
initDBServer
();
}
...
...
extensions/IOControl/IOControl.cc
View file @
2d26f84d
...
...
@@ -69,9 +69,9 @@ IOControl::IOControl(UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
auto
conf
=
uniset_conf
();
string
cname
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-confnode"
,
myname
);
cnode
=
conf
->
getNode
(
cname
);
c
onf
node
=
conf
->
getNode
(
cname
);
if
(
cnode
==
NULL
)
if
(
c
onf
node
==
NULL
)
throw
SystemError
(
"Not found conf-node "
+
cname
+
" for "
+
myname
);
iolog
=
make_shared
<
DebugStream
>
();
...
...
@@ -89,10 +89,10 @@ IOControl::IOControl(UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
ioinfo
<<
myname
<<
"(init): numcards="
<<
numcards
<<
endl
;
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
c
onf
node
);
logserv
=
make_shared
<
LogServer
>
(
loga
);
logserv
->
init
(
prefix
+
"-logserver"
,
cnode
);
logserv
->
init
(
prefix
+
"-logserver"
,
c
onf
node
);
if
(
findArgParam
(
"--"
+
prefix
+
"-run-logserver"
,
conf
->
getArgc
(),
conf
->
getArgv
())
!=
-
1
)
{
...
...
@@ -306,7 +306,7 @@ IOControl::~IOControl()
void
IOControl
::
execute
()
{
// set_signals(true);
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
c
onf
node
);
waitSM
();
// необходимо дождаться, чтобы нормально инициализировать итераторы
...
...
@@ -1055,7 +1055,9 @@ void IOControl::check_testmode()
// если режим "выключено всё"
// то гасим все выходы
if
(
testmode
==
tmOffPoll
)
if
(
testmode
==
tmOffPoll
||
testmode
==
tmConfigEnable
||
testmode
==
tmConfigDisable
)
{
// выставляем безопасные состояния
for
(
auto
&
it
:
iomap
)
...
...
@@ -1602,17 +1604,15 @@ void IOControl::buildCardsList()
return
;
}
//xmlNode* cnode = xml->findNode(mynode,"iocards","");
//xmlNode* extFindNode(xmlNode* node, int depth, int width, const std::string searchnode, const std::string name = "", bool top=true );
xmlNode
*
cnode
=
xml
->
extFindNode
(
mynode
,
1
,
1
,
"iocards"
,
""
);
xmlNode
*
cardsnode
=
xml
->
extFindNode
(
mynode
,
1
,
1
,
"iocards"
,
""
);
if
(
!
cnode
)
if
(
!
c
ards
node
)
{
iowarn
<<
myname
<<
"(buildCardsList): Not found <iocards> for node="
<<
conf
->
getLocalNodeName
()
<<
"("
<<
conf
->
getLocalNode
()
<<
")"
<<
endl
;
return
;
}
UniXML
::
iterator
it
(
cnode
);
UniXML
::
iterator
it
(
c
ards
node
);
if
(
!
it
.
goChildren
()
)
{
...
...
extensions/IOControl/IOControl.h
View file @
2d26f84d
...
...
@@ -335,7 +335,7 @@ class IOControl:
void
waitSM
();
xmlNode
*
cnode
=
{
0
};
/*!< xml-узел в настроечном файле */
xmlNode
*
c
onf
node
=
{
0
};
/*!< xml-узел в настроечном файле */
int
polltime
=
{
150
};
/*!< переодичность обновления данных (опроса карт в/в), [мсек] */
CardList
cards
;
/*!< список карт - массив созданных ComediInterface */
...
...
extensions/IOControl/iocalibr.cc
View file @
2d26f84d
...
...
@@ -72,7 +72,6 @@ int subdev = 0;
int
chan
=
0
;
int
range
=
0
;
int
aref
=
AREF_GROUND
;
bool
go
=
true
;
static
struct
option
longopts
[]
=
{
...
...
extensions/ModbusSlave/MBSlave.h
View file @
2d26f84d
...
...
@@ -337,7 +337,6 @@ class MBSlave:
VTypes
::
VType
vtype
;
/*!< type of value */
size_t
wnum
;
/*!< номер слова (для типов с размеров больше 2х байт */
size_t
nbyte
;
/*!< номер байта, который надо "сохранить" из "пришедщего в запросе" слова. [1-2] */
bool
rawdata
;
/*!< флаг, что в SM просто сохраняются 4-байта (актуально для типа F4)*/
std
::
shared_ptr
<
BitRegProperty
>
bitreg
;
/*!< указатель, как признак является ли данный регистр "сборным" из битовых */
ModbusRTU
::
RegID
regID
;
...
...
@@ -347,7 +346,6 @@ class MBSlave:
vtype
(
VTypes
::
vtUnknown
),
wnum
(
0
),
nbyte
(
0
),
rawdata
(
false
),
regID
(
0
)
{}
...
...
extensions/SharedMemoryPlus/smemory-plus.cc
View file @
2d26f84d
...
...
@@ -99,9 +99,6 @@ int main( int argc, const char** argv )
ThreadCreator
<
IOControl
>*
io_thr
=
new
ThreadCreator
<
IOControl
>
(
ic
.
get
(),
&
IOControl
::
execute
);
if
(
io_thr
==
NULL
)
return
1
;
act
->
add
(
ic
);
lst_iothr
.
push_back
(
io_thr
);
}
...
...
extensions/include/MTR.h
View file @
2d26f84d
...
...
@@ -717,8 +717,8 @@ namespace MTR
return
val
;
}
unsigned
short
val
;
float
fval
;
unsigned
short
val
=
{
0
}
;
float
fval
=
{
0
.
0
}
;
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
T16
&
t
);
// --------------------------------------------------------------------------
...
...
@@ -765,8 +765,8 @@ namespace MTR
return
val
;
}
signed
short
val
;
float
fval
;
signed
short
val
=
{
0
}
;
float
fval
=
{
0
}
;
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
T17
&
t
);
// --------------------------------------------------------------------------
...
...
extensions/include/VTypes.h
View file @
2d26f84d
...
...
@@ -114,7 +114,7 @@ namespace VTypes
// ------------------------------------------
// конструкторы на разные случаи...
F2r
()
noexcept
{}
F2r
()
noexcept
{
raw_backorder
.
val
=
0
;
}
F2r
(
const
float
&
f
)
noexcept
:
F2
(
f
)
{
...
...
@@ -383,7 +383,7 @@ namespace VTypes
public
I2
{
public
:
I2r
()
noexcept
{}
I2r
()
noexcept
{
raw_backorder
.
val
=
0
;
}
I2r
(
const
int
v
)
noexcept
:
I2
(
v
)
{
...
...
@@ -457,7 +457,7 @@ namespace VTypes
public
U2
{
public
:
U2r
()
noexcept
{}
U2r
()
noexcept
{
raw_backorder
.
val
=
0
;
}
U2r
(
int
v
)
noexcept
:
U2
(
v
)
{
...
...
extensions/lib/IOBase.cc
View file @
2d26f84d
...
...
@@ -192,7 +192,9 @@ bool IOBase::check_front( bool val )
void
IOBase
::
processingAsAI
(
IOBase
*
it
,
long
val
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
)
{
if
(
it
->
stype
==
UniversalIO
::
DI
||
it
->
stype
==
UniversalIO
::
DO
)
val
=
(
val
?
1.0
:
0.0
);
{
val
=
(
val
?
1
:
0
);
}
else
{
// проверка на обрыв
...
...
@@ -270,7 +272,7 @@ void IOBase::processingFasAI( IOBase* it, float fval, const std::shared_ptr<SMIn
long
val
=
lroundf
(
fval
);
if
(
it
->
stype
==
UniversalIO
::
DI
||
it
->
stype
==
UniversalIO
::
DO
)
val
=
(
fval
!=
0
?
1
.0
:
0.
0
);
val
=
(
fval
!=
0
?
1
:
0
);
else
{
if
(
it
->
rawdata
)
...
...
extensions/lib/SMInterface.cc
View file @
2d26f84d
...
...
@@ -74,7 +74,7 @@ using namespace UniSetTypes;
{ \
uwarn << "(" << __STRING(fname) << "): " << ex.err << endl; \
} \
catch( const Exception& ex ) \
catch( const
UniSetTypes::
Exception& ex ) \
{ \
uwarn << "(" << __STRING(fname) << "): " << ex << endl; \
} \
...
...
include/LogServer.h
View file @
2d26f84d
...
...
@@ -87,8 +87,8 @@ class LogServer:
{
public
:
LogServer
(
std
::
shared_ptr
<
DebugStream
>
log
)
noexcept
;
LogServer
(
std
::
shared_ptr
<
LogAgregator
>
log
)
noexcept
;
LogServer
(
std
::
shared_ptr
<
DebugStream
>
log
);
LogServer
(
std
::
shared_ptr
<
LogAgregator
>
log
);
virtual
~
LogServer
()
noexcept
;
inline
void
setCmdTimeout
(
timeout_t
msec
)
noexcept
...
...
@@ -122,7 +122,7 @@ class LogServer:
std
::
string
getShortInfo
();
protected
:
LogServer
()
noexcept
;
LogServer
();
virtual
void
evprepare
(
const
ev
::
loop_ref
&
loop
)
override
;
virtual
void
evfinish
(
const
ev
::
loop_ref
&
loop
)
override
;
...
...
@@ -138,15 +138,16 @@ class LogServer:
std
::
string
onCommand
(
LogSession
*
s
,
LogServerTypes
::
Command
cmd
,
const
std
::
string
&
logname
);
private
:
typedef
std
::
vector
<
std
::
shared_ptr
<
LogSession
>
>
SessionList
;
SessionList
slist
;
UniSetTypes
::
uniset_rwmutex
mutSList
;
timeout_t
timeout
=
{
UniSetTimer
::
WaitUpTime
};
timeout_t
cmdTimeout
=
{
2000
};
Debug
::
type
sessLogLevel
=
{
Debug
::
NONE
};
size_t
sessMaxCount
=
{
10
};
typedef
std
::
vector
<
std
::
shared_ptr
<
LogSession
>
>
SessionList
;
SessionList
slist
;
UniSetTypes
::
uniset_rwmutex
mutSList
;
DebugStream
mylog
;
ev
::
io
io
;
...
...
include/NCRestorer.h
View file @
2d26f84d
...
...
@@ -180,8 +180,6 @@ class NCRestorer_XML:
std
::
string
s_filterField
;
std
::
string
s_filterValue
;
std
::
string
c_filterField
;
std
::
string
c_filterValue
;
std
::
string
t_filterField
;
std
::
string
t_filterValue
;
...
...
include/modbus/ModbusClient.h
View file @
2d26f84d
...
...
@@ -178,7 +178,7 @@ class ModbusClient
/*! функция запрос-ответ */
virtual
ModbusRTU
::
mbErrCode
query
(
ModbusRTU
::
ModbusAddr
addr
,
ModbusRTU
::
ModbusMessage
&
msg
,
ModbusRTU
::
ModbusMessage
&
reply
,
timeout_t
timeout
)
=
0
;
ModbusRTU
::
ModbusMessage
&
q
reply
,
timeout_t
timeout
)
=
0
;
// -------------------------------------
/*! посылка запроса */
...
...
@@ -191,11 +191,6 @@ class ModbusClient
virtual
ModbusRTU
::
mbErrCode
recv_pdu
(
ModbusRTU
::
ModbusByte
qfunc
,
ModbusRTU
::
ModbusMessage
&
rbuf
,
timeout_t
timeout
);
ModbusRTU
::
ModbusMessage
reply
;
/*!< буфер для приёма сообщений */
ModbusRTU
::
ModbusMessage
qbuf
;
/*!< буфер для посылки сообщений */
timeout_t
replyTimeOut_ms
;
/*!< таймаут на ожидание ответа */
timeout_t
aftersend_msec
;
/*!< пауза после посылки запроса */
timeout_t
sleepPause_usec
;
/*!< пауза между попытками чтения символа из канала */
...
...
@@ -209,6 +204,9 @@ class ModbusClient
PassiveTimer
tmProcessing
;
private
:
ModbusRTU
::
ModbusMessage
qreply
;
/*!< буфер для приёма сообщений */
ModbusRTU
::
ModbusMessage
qbuf
;
/*!< буфер для посылки сообщений */
};
// -------------------------------------------------------------------------
#endif // ModbusClient_H_
...
...
python/lib/pyUniSet/PyUInterface.cc
View file @
2d26f84d
...
...
@@ -24,7 +24,7 @@
//---------------------------------------------------------------------------
using
namespace
std
;
//---------------------------------------------------------------------------
static
UInterface
*
u
i
=
0
;
static
UInterface
*
u
Interface
=
0
;
//---------------------------------------------------------------------------
void
pyUInterface
::
uniset_init_params
(
UTypes
::
Params
*
p
,
const
std
::
string
&
xmlfile
)
throw
(
UException
)
{
...
...
@@ -37,7 +37,7 @@ void pyUInterface::uniset_init( int argc, char* argv[], const std::string& xmlfi
try
{
UniSetTypes
::
uniset_init
(
argc
,
argv
,
xmlfile
);
u
i
=
new
UInterface
();
u
Interface
=
new
UInterface
();
return
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
...
...
@@ -54,7 +54,7 @@ long pyUInterface::getValue( long id )throw(UException)
{
auto
conf
=
UniSetTypes
::
uniset_conf
();
if
(
!
conf
||
!
u
i
)
if
(
!
conf
||
!
u
Interface
)
throw
USysError
();
UniversalIO
::
IOType
t
=
conf
->
getIOType
(
id
);
...
...
@@ -67,7 +67,7 @@ long pyUInterface::getValue( long id )throw(UException)
case
UniversalIO
:
:
DO
:
case
UniversalIO
:
:
AI
:
case
UniversalIO
:
:
AO
:
return
u
i
->
getValue
(
id
);
return
u
Interface
->
getValue
(
id
);
break
;
default
:
...
...
@@ -96,7 +96,7 @@ void pyUInterface::setValue( long id, long val, long supplier )throw(UException)
{
auto
conf
=
UniSetTypes
::
uniset_conf
();
if
(
!
conf
||
!
u
i
)
if
(
!
conf
||
!
u
Interface
)
throw
USysError
();
UniversalIO
::
IOType
t
=
conf
->
getIOType
(
id
);
...
...
@@ -109,7 +109,7 @@ void pyUInterface::setValue( long id, long val, long supplier )throw(UException)
case
UniversalIO
:
:
DO
:
case
UniversalIO
:
:
AI
:
case
UniversalIO
:
:
AO
:
u
i
->
setValue
(
id
,
val
,
supplier
);
u
Interface
->
setValue
(
id
,
val
,
supplier
);
break
;
default
:
...
...
src/Communications/Modbus/ModbusClient.cc
View file @
2d26f84d
...
...
@@ -60,10 +60,10 @@ throw(ModbusRTU::mbException)
{
ReadCoilMessage
msg
(
addr
,
start
,
count
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
ReadCoilRetMessage
(
reply
);
return
ReadCoilRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -74,10 +74,10 @@ throw(ModbusRTU::mbException)
{
ReadInputStatusMessage
msg
(
addr
,
start
,
count
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
ReadInputStatusRetMessage
(
reply
);
return
ReadInputStatusRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -90,10 +90,10 @@ throw(ModbusRTU::mbException)
ReadOutputMessage
msg
(
addr
,
start
,
count
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
ReadOutputRetMessage
(
reply
);
return
ReadOutputRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -104,10 +104,10 @@ throw(ModbusRTU::mbException)
{
ReadInputMessage
msg
(
addr
,
start
,
count
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
ReadInputRetMessage
(
reply
);
return
ReadInputRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -119,10 +119,10 @@ throw(ModbusRTU::mbException)
ForceSingleCoilMessage
msg
(
addr
,
start
,
cmd
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
ForceSingleCoilRetMessage
(
reply
);
return
ForceSingleCoilRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -135,10 +135,10 @@ throw(ModbusRTU::mbException)
WriteSingleOutputMessage
msg
(
addr
,
start
,
data
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
WriteSingleOutputRetMessage
(
reply
);
return
WriteSingleOutputRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -147,10 +147,10 @@ ForceCoilsRetMessage ModbusClient::write0F( ForceCoilsMessage& msg )
throw
(
ModbusRTU
::
mbException
)
{
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
msg
.
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
msg
.
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
ForceCoilsRetMessage
(
reply
);
return
ForceCoilsRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -160,10 +160,10 @@ WriteOutputRetMessage ModbusClient::write10( WriteOutputMessage& msg )
throw
(
ModbusRTU
::
mbException
)
{
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
msg
.
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
msg
.
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
WriteOutputRetMessage
(
reply
);
return
WriteOutputRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -175,10 +175,10 @@ throw(ModbusRTU::mbException)
{
DiagnosticMessage
msg
(
addr
,
subfunc
,
dat
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
msg
.
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
msg
.
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
DiagnosticRetMessage
(
reply
);
return
DiagnosticRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -190,10 +190,10 @@ throw(ModbusRTU::mbException)
{
MEIMessageRDI
msg
(
addr
,
devID
,
objID
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
msg
.
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
msg
.
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
MEIMessageRetRDI
(
reply
);
return
MEIMessageRetRDI
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -213,10 +213,10 @@ throw(ModbusRTU::mbException)
msg
.
century
=
century
;
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
addr
,
qbuf
,
reply
,
replyTimeOut_ms
);
mbErrCode
res
=
query
(
addr
,
qbuf
,
q
reply
,
replyTimeOut_ms
);
if
(
res
==
erNoError
)
return
SetDateTimeRetMessage
(
reply
);
return
SetDateTimeRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
@@ -320,10 +320,10 @@ throw(ModbusRTU::mbException)
FileTransferMessage
msg
(
addr
,
idFile
,
numpack
);
qbuf
=
msg
.
transport_msg
();
mbErrCode
res
=
query
(
addr
,
qbuf
,
reply
,
part_timeout_msec
);
mbErrCode
res
=
query
(
addr
,
qbuf
,
q
reply
,
part_timeout_msec
);
if
(
res
==
erNoError
)
return
FileTransferRetMessage
(
reply
);
return
FileTransferRetMessage
(
q
reply
);
throw
mbException
(
res
);
}
...
...
src/Communications/Modbus/ModbusTCPCore.cc
View file @
2d26f84d
...
...
@@ -39,9 +39,6 @@ size_t ModbusTCPCore::readNextData(UTCPStream* tcp,
char
*
buf
=
new
char
[
max
];
if
(
buf
==
0
)
return
0
;
try
{
ssize_t
l
=
tcp
->
receiveBytes
(
buf
,
max
);
...
...
@@ -114,11 +111,19 @@ size_t ModbusTCPCore::getNextData(UTCPStream* tcp,
if
(
len
<=
0
)
len
=
7
;
try
{
size_t
ret
=
ModbusTCPCore
::
readNextData
(
tcp
,
qrecv
,
len
);
if
(
ret
==
0
)
return
0
;
}
catch
(
UniSetTypes
::
CommFailed
&
ex
)
{
if
(
qrecv
.
empty
()
)
return
0
;
}
}
size_t
i
=
0
;
...
...
@@ -141,9 +146,6 @@ size_t ModbusTCPCore::readDataFD( int fd, std::queue<unsigned char>& qrecv, size
char
*
buf
=
new
char
[
max
];
if
(
buf
==
0
)
return
0
;
ssize_t
l
=
0
;
size_t
cnt
=
0
;
...
...
@@ -209,11 +211,19 @@ size_t ModbusTCPCore::getDataFD( int fd, std::queue<unsigned char>& qrecv,
if
(
len
==
0
)
len
=
7
;
try
{
size_t
ret
=
ModbusTCPCore
::
readDataFD
(
fd
,
qrecv
,
len
,
attempts
);
if
(
ret
==
0
&&
qrecv
.
empty
()
)
return
0
;
}
catch
(
UniSetTypes
::
CommFailed
&
ex
)
{
if
(
qrecv
.
empty
()
)
return
0
;
}
}
size_t
i
=
0
;
...
...
src/Interfaces/UInterface.cc
View file @
2d26f84d
...
...
@@ -920,8 +920,8 @@ throw(ResolveNameError, UniSetTypes::TimeOut )
catch
(
const
CosNaming
::
NamingContext
::
NotFound
&
nf
)
{}
catch
(
const
CosNaming
::
NamingContext
::
InvalidName
&
nf
)
{}
catch
(
const
CosNaming
::
NamingContext
::
CannotProceed
&
cp
)
{}
catch
(
const
Exception
)
{}
catch
(
const
CORBA
::
OBJECT_NOT_EXIST
)
catch
(
const
UniSetTypes
::
Exception
&
ex
)
{}
catch
(
const
CORBA
::
OBJECT_NOT_EXIST
&
ex
)
{
throw
UniSetTypes
::
ResolveNameError
(
"ObjectNOTExist"
);
}
...
...
src/Log/Debug.cc
View file @
2d26f84d
...
...
@@ -59,8 +59,8 @@ static const int numErrorTags = sizeof(errorTags) / sizeof(error_item);
Debug
::
type
const
Debug
::
ANY
=
Debug
::
type
(
Debug
::
INFO
|
Debug
::
INIT
|
Debug
::
WARN
|
Debug
::
CRIT
|
Debug
::
LEVEL1
|
Debug
::
LEVEL2
|
Debug
::
LEVEL3
|
Debug
::
LEVEL4
|
Debug
::
LEVEL5
|
Debug
::
LEVEL
5
|
Debug
::
LEVEL6
|
Debug
::
LEVEL7
|
Debug
::
LEVEL
8
|
Debug
::
LEVEL
9
|
Debug
::
REPOSITORY
|
Debug
::
SYSTEM
|
Debug
::
LEVEL5
|
Debug
::
LEVEL
6
|
Debug
::
LEVEL7
|
Debug
::
LEVEL8
|
Debug
::
LEVEL9
|
Debug
::
REPOSITORY
|
Debug
::
SYSTEM
|
Debug
::
EXCEPTION
);
...
...
@@ -124,7 +124,11 @@ void Debug::showTags(ostream& os) noexcept
<<
setw
(
10
)
<<
errorTags
[
i
].
name
<<
" "
<<
errorTags
[
i
].
desc
<<
'\n'
;
try
{
os
.
flush
();
}
catch
(...){}
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Debug
::
type
level
)
noexcept
...
...
@@ -166,7 +170,13 @@ std::string Debug::str( Debug::type level ) noexcept
}
}
try
{
return
s
.
str
();
}
catch
(...){}
return
""
;
}
...
...
src/Log/LogServer.cc
View file @
2d26f84d
...
...
@@ -39,28 +39,28 @@ LogServer::~LogServer() noexcept
catch
(...){}
}
// -------------------------------------------------------------------------
LogServer
::
LogServer
(
std
::
shared_ptr
<
LogAgregator
>
log
)
noexcept
:
LogServer
(
static_pointer_cast
<
DebugStream
>
(
log
)
)
LogServer
::
LogServer
(
std
::
shared_ptr
<
LogAgregator
>
log
)
:
LogServer
()
{
elog
=
static_pointer_cast
<
DebugStream
>
(
log
);
}
// -------------------------------------------------------------------------
LogServer
::
LogServer
(
std
::
shared_ptr
<
DebugStream
>
log
)
noexcept
:
slist
(
sessMaxCount
),
LogServer
::
LogServer
(
std
::
shared_ptr
<
DebugStream
>
log
)
:
timeout
(
UniSetTimer
::
WaitUpTime
),
cmdTimeout
(
2000
),
sessLogLevel
(
Debug
::
NONE
),
slist
(
sessMaxCount
),
sock
(
0
),
elog
(
log
)
{
}
// -------------------------------------------------------------------------
LogServer
::
LogServer
()
noexcept
:
slist
(
sessMaxCount
),
LogServer
::
LogServer
()
:
timeout
(
UniSetTimer
::
WaitUpTime
),
cmdTimeout
(
2000
),
sessLogLevel
(
Debug
::
NONE
),
slist
(
sessMaxCount
),
sock
(
0
),
elog
(
nullptr
)
{
...
...
src/Processes/NCRestorer_XML.cc
View file @
2d26f84d
...
...
@@ -32,8 +32,6 @@ using namespace UniSetTypes;
NCRestorer_XML
::
NCRestorer_XML
(
const
string
&
fname
)
:
s_filterField
(
""
),
s_filterValue
(
""
),
c_filterField
(
""
),
c_filterValue
(
""
),
t_filterField
(
""
),
t_filterValue
(
""
),
fname
(
fname
),
...
...
@@ -47,8 +45,6 @@ NCRestorer_XML::NCRestorer_XML(const string& fname,
const
std
::
string
&
f_value
)
:
s_filterField
(
f_field
),
s_filterValue
(
f_value
),
c_filterField
(
""
),
c_filterValue
(
""
),
t_filterField
(
""
),
t_filterValue
(
""
),
fname
(
fname
),
...
...
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