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
0696bb76
Commit
0696bb76
authored
Dec 16, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(2.0): небольшая оптимизация по выводу логов
parent
360848e3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
94 deletions
+54
-94
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+0
-0
MBTCPMaster.cc
extensions/ModbusMaster/MBTCPMaster.cc
+5
-0
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+48
-26
IONotifyController.cc
src/Processes/IONotifyController.cc
+1
-68
No files found.
extensions/ModbusMaster/MBExchange.cc
View file @
0696bb76
This diff is collapsed.
Click to expand it.
extensions/ModbusMaster/MBTCPMaster.cc
View file @
0696bb76
...
@@ -106,6 +106,7 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
...
@@ -106,6 +106,7 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
mbtcp
->
setAfterSendPause
(
aftersend_pause
);
mbtcp
->
setAfterSendPause
(
aftersend_pause
);
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): ipaddr="
<<
iaddr
<<
" port="
<<
port
<<
endl
;
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): ipaddr="
<<
iaddr
<<
" port="
<<
port
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
LEVEL9
)
)
if
(
dlog
.
debugging
(
Debug
::
LEVEL9
)
)
...
@@ -113,6 +114,7 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
...
@@ -113,6 +114,7 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
}
}
catch
(
ModbusRTU
::
mbException
&
ex
)
catch
(
ModbusRTU
::
mbException
&
ex
)
{
{
if
(
dlog
.
debugging
(
Debug
::
WARN
)
)
dlog
[
Debug
::
WARN
]
<<
"(init): "
<<
ex
<<
endl
;
dlog
[
Debug
::
WARN
]
<<
"(init): "
<<
ex
<<
endl
;
}
}
catch
(...)
catch
(...)
...
@@ -180,6 +182,7 @@ MBTCPMaster* MBTCPMaster::init_mbmaster( int argc, const char* const* argv,
...
@@ -180,6 +182,7 @@ MBTCPMaster* MBTCPMaster::init_mbmaster( int argc, const char* const* argv,
string
name
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-name"
,
"MBTCPMaster1"
);
string
name
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-name"
,
"MBTCPMaster1"
);
if
(
name
.
empty
()
)
if
(
name
.
empty
()
)
{
{
if
(
dlog
.
debugging
(
Debug
::
CRIT
)
)
dlog
[
Debug
::
CRIT
]
<<
"(MBTCPMaster): Не задан name'"
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(MBTCPMaster): Не задан name'"
<<
endl
;
return
0
;
return
0
;
}
}
...
@@ -187,12 +190,14 @@ MBTCPMaster* MBTCPMaster::init_mbmaster( int argc, const char* const* argv,
...
@@ -187,12 +190,14 @@ MBTCPMaster* MBTCPMaster::init_mbmaster( int argc, const char* const* argv,
ObjectId
ID
=
conf
->
getObjectID
(
name
);
ObjectId
ID
=
conf
->
getObjectID
(
name
);
if
(
ID
==
UniSetTypes
::
DefaultObjectId
)
if
(
ID
==
UniSetTypes
::
DefaultObjectId
)
{
{
if
(
dlog
.
debugging
(
Debug
::
CRIT
)
)
dlog
[
Debug
::
CRIT
]
<<
"(MBTCPMaster): идентификатор '"
<<
name
dlog
[
Debug
::
CRIT
]
<<
"(MBTCPMaster): идентификатор '"
<<
name
<<
"' не найден в конф. файле!"
<<
"' не найден в конф. файле!"
<<
" в секции "
<<
conf
->
getObjectsSection
()
<<
endl
;
<<
" в секции "
<<
conf
->
getObjectsSection
()
<<
endl
;
return
0
;
return
0
;
}
}
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
"(MBTCPMaster): name = "
<<
name
<<
"("
<<
ID
<<
")"
<<
endl
;
dlog
[
Debug
::
INFO
]
<<
"(MBTCPMaster): name = "
<<
name
<<
"("
<<
ID
<<
")"
<<
endl
;
return
new
MBTCPMaster
(
ID
,
icID
,
ic
,
prefix
);
return
new
MBTCPMaster
(
ID
,
icID
,
ic
,
prefix
);
}
}
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
0696bb76
This diff is collapsed.
Click to expand it.
src/Processes/IONotifyController.cc
View file @
0696bb76
...
@@ -851,73 +851,6 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
...
@@ -851,73 +851,6 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
}
}
// --------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------
#if 0
void IONotifyController::localSetValue( IOController::IOStateList::iterator& li,
const IOController_i::SensorInfo& si,
CORBA::Long value, UniSetTypes::ObjectId sup_id )
{
// Если датчик не найден сдесь сработает исключение NameNotFound
long prevValue = IOController::localGetValue( li,si );
if( unideb.debugging(Debug::INFO) )
{
unideb[Debug::INFO] << myname << "(IONotifyController::setValue): value=" << value
<< " для выхода " << conf->oind->getNameById(si.id,si.node) << endl;
}
// сохраняем новое состояние
IOController::localSetValue( li, si, value, sup_id );
// Рассылаем уведомления только если значение изменилось...
SensorMessage sm;
{ // lock
uniset_rwmutex_rlock lock(li->second.val_lock);
if( prevValue == li->second.value )
return;
sm.id = si.id;
sm.node = si.node;
sm.value = li->second.value;
sm.state = sm.value!=0 ? true:false;
sm.undefined = li->second.undefined;
sm.sm_tv_sec = li->second.tv_sec;
sm.sm_tv_usec = li->second.tv_usec;
sm.priority = (Message::Priority)li->second.priority;
sm.sensor_type = li->second.type;
sm.ci = li->second.ci;
sm.supplier = sup_id;
} // unlock
try
{
uniset_rwmutex_rlock l(sig_mutex);
changeSignal.emit(&sm);
}
catch(...){}
try
{
if( !li->second.db_ignore )
loggingInfo(sm);
}
catch(...){}
AskMap::iterator dit = askAOList.find( UniSetTypes::key(si.id,si.node) );
if( dit!=askAOList.end() )
{ // lock
uniset_rwmutex_rlock lock(askIOMutex);
send(dit->second, sm);
}
// // проверка порогов
// try
// {
// checkThreshold(li,si, value);
// }
// catch(...){}
}
#endif
// --------------------------------------------------------------------------------------------------------------
IONotifyController
::
ThresholdExtList
::
iterator
IONotifyController
::
findThreshold
(
UniSetTypes
::
KeyType
key
,
UniSetTypes
::
ThresholdId
tid
)
IONotifyController
::
ThresholdExtList
::
iterator
IONotifyController
::
findThreshold
(
UniSetTypes
::
KeyType
key
,
UniSetTypes
::
ThresholdId
tid
)
{
{
{
// lock
{
// lock
...
@@ -1030,7 +963,7 @@ IDSeq* IONotifyController::askSensorsSeq( const UniSetTypes::IDSeq& lst,
...
@@ -1030,7 +963,7 @@ IDSeq* IONotifyController::askSensorsSeq( const UniSetTypes::IDSeq& lst,
const
UniSetTypes
::
ConsumerInfo
&
ci
,
const
UniSetTypes
::
ConsumerInfo
&
ci
,
UniversalIO
::
UIOCommand
cmd
)
UniversalIO
::
UIOCommand
cmd
)
{
{
UniSetTypes
::
IDList
badlist
;
// писок не найденных идентификаторов
UniSetTypes
::
IDList
badlist
;
//
c
писок не найденных идентификаторов
IOController_i
::
SensorInfo
si
;
IOController_i
::
SensorInfo
si
;
...
...
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