Commit 0696bb76 authored by Pavel Vainerman's avatar Pavel Vainerman

(2.0): небольшая оптимизация по выводу логов

parent 360848e3
...@@ -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);
} }
......
...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment