Commit 6886264f authored by Pavel Vainerman's avatar Pavel Vainerman

(2.0): Убрал устаревшее поле "sensibility", а также разобрался с начальной…

(2.0): Убрал устаревшее поле "sensibility", а также разобрался с начальной инициализацией порогов (eterbug #9454)
parent 72f3dddf
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/*! \file /*! \file
* \author Pavel Vainerman * \author Pavel Vainerman
* \date $Date: 2008/11/29 21:24:24 $
* \version $Id: IOController_i.idl,v 1.16 2008/11/29 21:24:24 vpashka Exp $
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef BaseIOController_i_IDL_ #ifndef BaseIOController_i_IDL_
...@@ -89,7 +87,6 @@ interface IOController_i : UniSetManager_i ...@@ -89,7 +87,6 @@ interface IOController_i : UniSetManager_i
long maxRaw; /*!< максимальное "сырое" значение */ long maxRaw; /*!< максимальное "сырое" значение */
long minCal; /*!< минимальное калиброванное значение */ long minCal; /*!< минимальное калиброванное значение */
long maxCal; /*!< максимальное калиброванное значение */ long maxCal; /*!< максимальное калиброванное значение */
long sensibility; /*!< чуствительность (для первичного фильтрования) */
short precision; /*!< точность */ short precision; /*!< точность */
}; };
...@@ -193,13 +190,11 @@ interface IONotifyController_i : IOController_i ...@@ -193,13 +190,11 @@ interface IONotifyController_i : IOController_i
* \param tid - идентификатор порога * \param tid - идентификатор порога
* \param lowLimit - нижний порог срабатыания * \param lowLimit - нижний порог срабатыания
* \param hiLimit - верхний порог срабатывания * \param hiLimit - верхний порог срабатывания
* \param sensibility - чуствительность
* *
* Датчик срабатывает при условии, что значение меньше (lowLimit-sensibility) или * Датчик срабатывает при условии, что значение <= lowLimit или >= hiLimit
* больше (hiLimit+sensibility)
*/ */
void askThreshold(in SensorInfo si, in UniSetTypes::ConsumerInfo ci, in UniSetTypes::ThresholdId tid, void askThreshold(in SensorInfo si, in UniSetTypes::ConsumerInfo ci, in UniSetTypes::ThresholdId tid,
in long lowLimit, in long hiLimit, in long sensibility, in long lowLimit, in long hiLimit,
in UniversalIO::UIOCommand cmd ) raises(NameNotFound, IOBadParam, BadRange); in UniversalIO::UIOCommand cmd ) raises(NameNotFound, IOBadParam, BadRange);
/*! /*!
...@@ -225,7 +220,6 @@ interface IONotifyController_i : IOController_i ...@@ -225,7 +220,6 @@ interface IONotifyController_i : IOController_i
UniSetTypes::ThresholdId id; UniSetTypes::ThresholdId id;
long hilimit; /*!< верхняя граница срабатывания */ long hilimit; /*!< верхняя граница срабатывания */
long lowlimit; /*!< нижняя гранийа срабатывания */ long lowlimit; /*!< нижняя гранийа срабатывания */
long sensibility; /*!< точность определения границ (?) */
ThresholdState state; ThresholdState state;
long tv_sec; /*!< время последнего изменения датчика, секунды (gettimeofday) */ long tv_sec; /*!< время последнего изменения датчика, секунды (gettimeofday) */
long tv_usec; /*!< время последнего изменения датчика, мксек (gettimeofday) */ long tv_usec; /*!< время последнего изменения датчика, мксек (gettimeofday) */
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/*! \file /*! \file
* \author Pavel Vainerman * \author Pavel Vainerman
* \date $Date: 2007/12/18 20:24:11 $
* \version $Id: UniSetManager_i.idl,v 1.2 2007/12/18 20:24:11 vpashka Exp $
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef UniSetManager_i_IDL_ #ifndef UniSetManager_i_IDL_
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/*! \file /*! \file
* \author Pavel Vainerman * \author Pavel Vainerman
* \date $Date: 2007/12/17 22:50:59 $
* \version $Id: UniSetObject_i.idl,v 1.4 2007/12/17 22:50:59 vpashka Exp $
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef UniSetObject_i_IDL_ #ifndef UniSetObject_i_IDL_
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/*! \file /*! \file
* \author Pavel Vainerman * \author Pavel Vainerman
* \date $Date: 2009/01/23 23:56:54 $
* \version $Id: UniSetTypes_i.idl,v 1.9 2009/01/23 23:56:54 vpashka Exp $
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef UniSetTypes_i_IDL_ #ifndef UniSetTypes_i_IDL_
......
...@@ -358,7 +358,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -358,7 +358,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
- UniversalInterface --> UInterface - UniversalInterface --> UInterface
- ObjectsManager --> UniSetManager - ObjectsManager --> UniSetManager
- ObjectsActitvator --> UniSetActivator - ObjectsActitvator --> UniSetActivator
- remove deprecated property: "sensebility"
* Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3 * Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3
- add RRDServer - add RRDServer
......
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
set_d2_check_s="AI11_AS" set_d2_check_s="AI11_AS"
undef_c="AI54_S" undef_c="AI54_S"
check_undef_s="AI54_S" check_undef_s="AI54_S"
t_set_c="AI_AS"
t_check_s="Threshold1_S"
/> />
<IOControl name="IOControl"/> <IOControl name="IOControl"/>
......
...@@ -98,7 +98,6 @@ ...@@ -98,7 +98,6 @@
<br>\b rmax - максимальное "сырое" значение <br>\b rmax - максимальное "сырое" значение
<br>\b cmin - минимальное "калиброванное" значение <br>\b cmin - минимальное "калиброванное" значение
<br>\b cmax - максимальное "калиброванное" значение <br>\b cmax - максимальное "калиброванное" значение
<br>\b sensibility - чуствительность. (deprecated)
<br>\b precision - Точность. Задаёт количство знаков после запятой. <br>\b precision - Точность. Задаёт количство знаков после запятой.
<br>Т.е. при считывании из канала, значение домножается <br>Т.е. при считывании из канала, значение домножается
<br>на 10^precision и уже таким сохраняется. <br>на 10^precision и уже таким сохраняется.
...@@ -114,7 +113,6 @@ ...@@ -114,7 +113,6 @@
Используется для DI. Используется для DI.
<br>\b lowlimit - нижний порого срабатывания. <br>\b lowlimit - нижний порого срабатывания.
<br>\b hilimit - верхний порого срабатывания. <br>\b hilimit - верхний порого срабатывания.
<br>\b sensibility - чувствительность (deprecated)
<br>\b card - номер карты <br>\b card - номер карты
<br>\b subdev - номер подустройства <br>\b subdev - номер подустройства
......
...@@ -72,9 +72,9 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ) ...@@ -72,9 +72,9 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
string t_fvalue = conf->getArgParam("--t-filter-value"); string t_fvalue = conf->getArgParam("--t-filter-value");
heartbeat_node = conf->getArgParam("--heartbeat-node"); heartbeat_node = conf->getArgParam("--heartbeat-node");
if( heartbeat_node.empty() ) if( heartbeat_node.empty() && dlog.is_warn() )
dlog.warn() << myname << "(init): --heartbeat-node NULL ===> heartbeat NOT USED..." << endl; dlog.warn() << myname << "(init): --heartbeat-node NULL ===> heartbeat NOT USED..." << endl;
else else if( dlog.is_info() )
dlog.info() << myname << "(init): heartbeat-node: " << heartbeat_node << endl; dlog.info() << myname << "(init): heartbeat-node: " << heartbeat_node << endl;
heartbeatCheckTime = conf->getArgInt("--heartbeat-check-time","1000"); heartbeatCheckTime = conf->getArgInt("--heartbeat-check-time","1000");
...@@ -89,7 +89,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ) ...@@ -89,7 +89,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
string wdt_dev = conf->getArgParam("--wdt-device"); string wdt_dev = conf->getArgParam("--wdt-device");
if( !wdt_dev.empty() ) if( !wdt_dev.empty() )
wdt = new WDTInterface(wdt_dev); wdt = new WDTInterface(wdt_dev);
else else if( dlog.is_warn() )
dlog.warn() << myname << "(init): watchdog timer NOT USED (--wdt-device NULL)" << endl; dlog.warn() << myname << "(init): watchdog timer NOT USED (--wdt-device NULL)" << endl;
...@@ -112,7 +112,8 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ) ...@@ -112,7 +112,8 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
{ {
ostringstream err; ostringstream err;
err << myname << ": ID not found ('pulsar') for " << p; err << myname << ": ID not found ('pulsar') for " << p;
dlog.crit() << myname << "(init): " << err.str() << endl; if( dlog.is_crit() )
dlog.crit() << myname << "(init): " << err.str() << endl;
throw SystemError(err.str()); throw SystemError(err.str());
} }
siPulsar.node = conf->getLocalNode(); siPulsar.node = conf->getLocalNode();
...@@ -169,26 +170,33 @@ void SharedMemory::processingMessage( UniSetTypes::VoidMessage *msg ) ...@@ -169,26 +170,33 @@ void SharedMemory::processingMessage( UniSetTypes::VoidMessage *msg )
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
dlog.crit() << myname << "(processingMessage): " << ex << endl; if( dlog.is_crit() )
dlog.crit() << myname << "(processingMessage): " << ex << endl;
} }
catch(CORBA::SystemException& ex) catch(CORBA::SystemException& ex)
{ {
dlog.warn() << myname << "(processingMessage): CORBA::SystemException: " << ex.NP_minorString() << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(processingMessage): CORBA::SystemException: " << ex.NP_minorString() << endl;
} }
catch(CORBA::Exception& ex) catch(CORBA::Exception& ex)
{ {
dlog.warn() << myname << "(processingMessage): CORBA::Exception: " << ex._name() << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(processingMessage): CORBA::Exception: " << ex._name() << endl;
} }
catch( omniORB::fatalException& fe ) catch( omniORB::fatalException& fe )
{ {
dlog.crit() << myname << "(processingMessage): Caught omniORB::fatalException:" << endl; if( dlog.is_crit() )
dlog.crit() << myname << "(processingMessage): file: " << fe.file() {
<< " line: " << fe.line() dlog.crit() << myname << "(processingMessage): Caught omniORB::fatalException:" << endl;
<< " mesg: " << fe.errmsg() << endl; dlog.crit() << myname << "(processingMessage): file: " << fe.file()
<< " line: " << fe.line()
<< " mesg: " << fe.errmsg() << endl;
}
} }
catch(...) catch(...)
{ {
dlog.crit() << myname << "(processingMessage): catch..." << endl; if( dlog.is_crit() )
dlog.crit() << myname << "(processingMessage): catch..." << endl;
} }
} }
...@@ -240,7 +248,7 @@ void SharedMemory::sysCommand( SystemMessage *sm ) ...@@ -240,7 +248,7 @@ void SharedMemory::sysCommand( SystemMessage *sm )
msleep(100); msleep(100);
} }
if( !isActivated() ) if( !isActivated() && dlog.is_crit() )
dlog.crit() << myname << "(sysCommand): ************* don`t activate?! ************" << endl; dlog.crit() << myname << "(sysCommand): ************* don`t activate?! ************" << endl;
// подождать пока пройдёт инициализация // подождать пока пройдёт инициализация
...@@ -395,11 +403,13 @@ void SharedMemory::checkHeartBeat() ...@@ -395,11 +403,13 @@ void SharedMemory::checkHeartBeat()
} }
catch(Exception& ex) catch(Exception& ex)
{ {
dlog.crit() << myname << "(checkHeartBeat): " << ex << endl; if( dlog.is_crit() )
dlog.crit() << myname << "(checkHeartBeat): " << ex << endl;
} }
catch(...) catch(...)
{ {
dlog.crit() << myname << "(checkHeartBeat): ..." << endl; if( dlog.is_crit() )
dlog.crit() << myname << "(checkHeartBeat): ..." << endl;
} }
} }
...@@ -439,7 +449,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) ...@@ -439,7 +449,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
<< ") указан неверно (" << ") указан неверно ("
<< it.getProp("iotype") << ") должен быть 'AI'"; << it.getProp("iotype") << ") должен быть 'AI'";
dlog.crit() << msg.str() << endl; if( dlog.is_crit() )
dlog.crit() << msg.str() << endl;
kill(getpid(),SIGTERM); kill(getpid(),SIGTERM);
// throw NameNotFound(msg.str()); // throw NameNotFound(msg.str());
}; };
...@@ -453,7 +464,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) ...@@ -453,7 +464,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{ {
ostringstream msg; ostringstream msg;
msg << "(SharedMemory::readItem): дискретный датчик (heartbeat_ds_name) связанный с " << it.getProp("name"); msg << "(SharedMemory::readItem): дискретный датчик (heartbeat_ds_name) связанный с " << it.getProp("name");
dlog.warn() << msg.str() << endl; if( dlog.is_warn() )
dlog.warn() << msg.str() << endl;
} }
} }
else else
...@@ -466,7 +478,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) ...@@ -466,7 +478,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
// Если уж задали имя для датчика, то он должен существовать.. // Если уж задали имя для датчика, то он должен существовать..
// поэтому завершаем процесс, если не нашли.. // поэтому завершаем процесс, если не нашли..
dlog.crit() << msg.str() << endl; if( dlog.is_crit() )
dlog.crit() << msg.str() << endl;
kill(getpid(),SIGTERM); kill(getpid(),SIGTERM);
// throw NameNotFound(msg.str()); // throw NameNotFound(msg.str());
} }
...@@ -481,7 +494,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ) ...@@ -481,7 +494,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
msg << "(SharedMemory::readItem): НЕ УКАЗАН id для " msg << "(SharedMemory::readItem): НЕ УКАЗАН id для "
<< it.getProp("name") << " секция " << sec; << it.getProp("name") << " секция " << sec;
dlog.crit() << msg.str() << endl; if( dlog.is_crit() )
dlog.crit() << msg.str() << endl;
kill(getpid(),SIGTERM); kill(getpid(),SIGTERM);
// throw NameNotFound(msg.str()); // throw NameNotFound(msg.str());
}; };
...@@ -499,7 +513,8 @@ SharedMemory* SharedMemory::init_smemory( int argc, const char* const* argv ) ...@@ -499,7 +513,8 @@ SharedMemory* SharedMemory::init_smemory( int argc, const char* const* argv )
if( dfile[0]!='.' && dfile[0]!='/' ) if( dfile[0]!='.' && dfile[0]!='/' )
dfile = conf->getConfDir() + dfile; dfile = conf->getConfDir() + dfile;
dlog.info() << "(smemory): datfile = " << dfile << endl; if( dlog.is_info() )
dlog.info() << "(smemory): datfile = " << dfile << endl;
UniSetTypes::ObjectId ID = conf->getControllerID(conf->getArgParam("--smemory-id","SharedMemory")); UniSetTypes::ObjectId ID = conf->getControllerID(conf->getArgParam("--smemory-id","SharedMemory"));
if( ID == UniSetTypes::DefaultObjectId ) if( ID == UniSetTypes::DefaultObjectId )
...@@ -527,14 +542,16 @@ void SharedMemory::readEventList( std::string oname ) ...@@ -527,14 +542,16 @@ void SharedMemory::readEventList( std::string oname )
xmlNode* enode = conf->getNode(oname); xmlNode* enode = conf->getNode(oname);
if( enode == NULL ) if( enode == NULL )
{ {
dlog.warn() << myname << "(readEventList): " << oname << " не найден..." << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(readEventList): " << oname << " не найден..." << endl;
return; return;
} }
UniXML_iterator it(enode); UniXML_iterator it(enode);
if( !it.goChildren() ) if( !it.goChildren() )
{ {
dlog.warn() << myname << "(readEventList): <eventlist> пустой..." << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(readEventList): <eventlist> пустой..." << endl;
return; return;
} }
...@@ -550,7 +567,7 @@ void SharedMemory::readEventList( std::string oname ) ...@@ -550,7 +567,7 @@ void SharedMemory::readEventList( std::string oname )
dlog.info() << myname << "(readEventList): add " << it.getProp("name") << endl; dlog.info() << myname << "(readEventList): add " << it.getProp("name") << endl;
elst.push_back(oid); elst.push_back(oid);
} }
else else if( dlog.is_crit() )
dlog.crit() << myname << "(readEventList): Не найден ID для " dlog.crit() << myname << "(readEventList): Не найден ID для "
<< it.getProp("name") << endl; << it.getProp("name") << endl;
} }
...@@ -574,7 +591,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm ) ...@@ -574,7 +591,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
catch(...){}; catch(...){};
} }
if(!ok) if(!ok && dlog.is_crit() )
dlog.crit() << myname << "(sendEvent): Объект " << (*it) << " НЕДОСТУПЕН" << endl; dlog.crit() << myname << "(sendEvent): Объект " << (*it) << " НЕДОСТУПЕН" << endl;
} }
} }
...@@ -598,14 +615,16 @@ void SharedMemory::buildHistoryList( xmlNode* cnode ) ...@@ -598,14 +615,16 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
UniXML* xml = conf->getConfXML(); UniXML* xml = conf->getConfXML();
if( !xml ) if( !xml )
{ {
dlog.warn() << myname << "(buildHistoryList): xml=NULL?!" << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistoryList): xml=NULL?!" << endl;
return; return;
} }
xmlNode* n = xml->extFindNode(cnode,1,1,"History",""); xmlNode* n = xml->extFindNode(cnode,1,1,"History","");
if( !n ) if( !n )
{ {
dlog.warn() << myname << "(buildHistoryList): <History> not found. ignore..." << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistoryList): <History> not found. ignore..." << endl;
hist.clear(); hist.clear();
return; return;
} }
...@@ -615,7 +634,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode ) ...@@ -615,7 +634,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
bool no_history = conf->getArgInt("--sm-no-history",it.getProp("no_history")); bool no_history = conf->getArgInt("--sm-no-history",it.getProp("no_history"));
if( no_history ) if( no_history )
{ {
dlog.warn() << myname << "(buildHistoryList): no_history='1'.. history skipped..." << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistoryList): no_history='1'.. history skipped..." << endl;
hist.clear(); hist.clear();
return; return;
} }
...@@ -626,7 +646,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode ) ...@@ -626,7 +646,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
if( !it.goChildren() ) if( !it.goChildren() )
{ {
dlog.warn() << myname << "(buildHistoryList): <History> empty. ignore..." << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistoryList): <History> empty. ignore..." << endl;
return; return;
} }
...@@ -645,10 +666,11 @@ void SharedMemory::buildHistoryList( xmlNode* cnode ) ...@@ -645,10 +666,11 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
hi.fuse_id = conf->getSensorID(it.getProp("fuse_id")); hi.fuse_id = conf->getSensorID(it.getProp("fuse_id"));
if( hi.fuse_id == DefaultObjectId ) if( hi.fuse_id == DefaultObjectId )
{ {
dlog.warn() << myname << "(buildHistory): not found sensor ID for " if( dlog.is_warn() )
<< it.getProp("fuse_id") dlog.warn() << myname << "(buildHistory): not found sensor ID for "
<< " history item id=" << it.getProp("id") << it.getProp("fuse_id")
<< " ..ignore.." << endl; << " history item id=" << it.getProp("id")
<< " ..ignore.." << endl;
continue; continue;
} }
...@@ -661,7 +683,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode ) ...@@ -661,7 +683,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
hi.fuse_val = it.getIntProp("fuse_value"); hi.fuse_val = it.getIntProp("fuse_value");
} }
dlog.info() << myname << "(buildHistory): add fuse_id=" << hi.fuse_id if( dlog.is_info() )
dlog.info() << myname << "(buildHistory): add fuse_id=" << hi.fuse_id
<< " fuse_val=" << hi.fuse_val << " fuse_val=" << hi.fuse_val
<< " fuse_use_val=" << hi.fuse_use_val << " fuse_use_val=" << hi.fuse_use_val
<< " fuse_invert=" << hi.fuse_invert << " fuse_invert=" << hi.fuse_invert
...@@ -695,7 +718,8 @@ void SharedMemory::checkHistoryFilter( UniXML_iterator& xit ) ...@@ -695,7 +718,8 @@ void SharedMemory::checkHistoryFilter( UniXML_iterator& xit )
ai.id = conf->getSensorID(xit.getProp("name")); ai.id = conf->getSensorID(xit.getProp("name"));
if( ai.id == DefaultObjectId ) if( ai.id == DefaultObjectId )
{ {
dlog.warn() << myname << "(checkHistoryFilter): not found sensor ID for " << xit.getProp("name") << endl; if( dlog.is_warn() )
dlog.warn() << myname << "(checkHistoryFilter): not found sensor ID for " << xit.getProp("name") << endl;
continue; continue;
} }
......
...@@ -355,16 +355,16 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force ) ...@@ -355,16 +355,16 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
// значение должно быть меньше lowLimit-чуствительность // значение должно быть меньше lowLimit-чуствительность
if (it->ti.inverse) if (it->ti.inverse)
{ {
if( val <= (it->ti.lowlimit-it->ti.sensibility) ) if( val <= it->ti.lowlimit )
set = true; set = true;
else if( val >= (it->ti.hilimit+it->ti.sensibility) ) else if( val >= it->ti.hilimit )
set = false; set = false;
} }
else else
{ {
if( val <= (it->ti.lowlimit-it->ti.sensibility) ) if( val <= it->ti.lowlimit )
set = false; set = false;
else if( val >= (it->ti.hilimit+it->ti.sensibility) ) else if( val >= it->ti.hilimit )
set = true; set = true;
} }
...@@ -457,7 +457,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm, ...@@ -457,7 +457,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->cal.maxRaw = 0; b->cal.maxRaw = 0;
b->cal.minCal = 0; b->cal.minCal = 0;
b->cal.maxCal = 0; b->cal.maxCal = 0;
b->cal.sensibility = 0;
b->cal.precision = 0; b->cal.precision = 0;
b->cdiagram = 0; b->cdiagram = 0;
b->f_median = false; b->f_median = false;
...@@ -472,7 +471,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm, ...@@ -472,7 +471,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->cal.maxRaw = it.getIntProp("rmax"); b->cal.maxRaw = it.getIntProp("rmax");
b->cal.minCal = it.getIntProp("cmin"); b->cal.minCal = it.getIntProp("cmin");
b->cal.maxCal = it.getIntProp("cmax"); b->cal.maxCal = it.getIntProp("cmax");
b->cal.sensibility = it.getIntProp("sensibility");
b->cal.precision = it.getIntProp("precision"); b->cal.precision = it.getIntProp("precision");
int f_size = def_filtersize; int f_size = def_filtersize;
...@@ -542,7 +540,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm, ...@@ -542,7 +540,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->ti.lowlimit = it.getIntProp("lowlimit"); b->ti.lowlimit = it.getIntProp("lowlimit");
b->ti.hilimit = it.getIntProp("hilimit"); b->ti.hilimit = it.getIntProp("hilimit");
b->ti.sensibility = it.getIntProp("sensibility");
b->ti.inverse = it.getIntProp("inverse"); b->ti.inverse = it.getIntProp("inverse");
} }
} }
......
...@@ -31,15 +31,18 @@ void TestProc::sysCommand( UniSetTypes::SystemMessage* sm ) ...@@ -31,15 +31,18 @@ void TestProc::sysCommand( UniSetTypes::SystemMessage* sm )
TestProc_SK::sysCommand(sm); TestProc_SK::sysCommand(sm);
if( sm->command == SystemMessage::StartUp || sm->command == SystemMessage::WatchDog ) if( sm->command == SystemMessage::StartUp || sm->command == SystemMessage::WatchDog )
{ {
askTimer(tmCheckDepend,checkDependTime); askTimer(tmCheck,checkTime);
askTimer(tmCheckUndefState,checkUndefTime); askTimer(tmCheckWorking,checkWorkingTime);
// В начальный момент времени блокирующий датчик =0, поэтому d2_check_s должен быть равен depend_off_value (-50).
dlog.level1() << myname << "(startup): check init depend: " << ( getValue(d2_check_s) == -50 ? "OK" : "FAIL" ) << endl;
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void TestProc::sensorInfo( SensorMessage *sm ) void TestProc::sensorInfo( SensorMessage *sm )
{ {
dlog[Debug::LEVEL1] << myname << "(sensorInfo): id=" << sm->id << " val=" << sm->value dlog.level2() << myname << "(sensorInfo): id=" << sm->id << " val=" << sm->value
<< " " << UInterface::timeToString(sm->sm_tv_sec,":") << " " << timeToString(sm->sm_tv_sec,":")
<< "(" << setw(6) << sm->sm_tv_usec << "): " << "(" << setw(6) << sm->sm_tv_usec << "): "
<< endl; << endl;
...@@ -47,18 +50,18 @@ void TestProc::sensorInfo( SensorMessage *sm ) ...@@ -47,18 +50,18 @@ void TestProc::sensorInfo( SensorMessage *sm )
{ {
if( sm->value ) if( sm->value )
{ {
dlog[Debug::LEVEL1] << myname << "(sensorInfo): START WORKING.." << endl; dlog.level1() << myname << "(sensorInfo): START WORKING.." << endl;
askTimer(tmChange,changeTime); askTimer(tmChange,changeTime);
} }
else else
{ {
askTimer(tmChange,0); askTimer(tmChange,0);
dlog[Debug::LEVEL1] << myname << "(sensorInfo): STOP WORKING.." << endl; dlog.level1() << myname << "(sensorInfo): STOP WORKING.." << endl;
} }
} }
else if( sm->id == check_undef_s ) else if( sm->id == check_undef_s )
{ {
dlog[Debug::LEVEL1] << myname << "(sensorInfo): CHECK UNDEFINED STATE ==> " << (sm->undefined==undef ? "OK" : "FAIL") << endl; dlog.level1() << myname << "(sensorInfo): CHECK UNDEFINED STATE ==> " << (sm->undefined==undef ? "OK" : "FAIL") << endl;
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -68,38 +71,60 @@ void TestProc::timerInfo( TimerMessage *tm ) ...@@ -68,38 +71,60 @@ void TestProc::timerInfo( TimerMessage *tm )
{ {
state^=true; state^=true;
out_lamp_c = ( state ? lmpBLINK : lmpOFF ); out_lamp_c = ( state ? lmpBLINK : lmpOFF );
dlog[Debug::LEVEL1] << myname << "(timerInfo): state=" << state << " lmp=" << out_lamp_c << endl; dlog.level2() << myname << ": state=" << state << " lmp=" << out_lamp_c << endl;
askTimer(tmCheckWorking,checkTime); // reset timer askTimer(tmCheckWorking,checkTime); // reset timer
} }
else if( tm->id == tmCheckWorking ) else if( tm->id == tmCheckWorking )
dlog[Debug::LEVEL1] << myname << "(timerInfo): WORKING FAIL!" << endl; dlog.level1() << myname << ": WORKING FAIL!" << endl;
else if( tm->id == tmCheckDepend ) else if( tm->id == tmCheck )
{ {
dlog[Debug::LEVEL1] << myname << "(timerInfo): Check depend..." << endl; dlog.level1() << endl << endl << "--------" << endl;
test_depend();
test_undefined_state();
test_thresholds();
}
}
// -----------------------------------------------------------------------------
void TestProc::test_depend()
{
dlog.level1() << myname << ": Check depend..." << endl;
long test_val = 100; long test_val = 100;
// set depend 0... // set depend 0...
setValue(depend_c,0); setValue(depend_c,0);
setValue(set_d1_check_s,test_val); setValue(set_d1_check_s,test_val);
setValue(set_d2_check_s,test_val); setValue(set_d2_check_s,test_val);
dlog[Debug::LEVEL1] << myname << "(timerInfo): check depend OFF: d1: " << ( getValue(d1_check_s) == 0 ? "OK" : "FAIL" ) << endl; dlog.level1() << myname << ": check depend OFF: d1: " << ( getValue(d1_check_s) == 0 ? "OK" : "FAIL" ) << endl;
dlog[Debug::LEVEL1] << myname << "(timerInfo): check depend OFF: d2: " << ( getValue(d2_check_s) == -50 ? "OK" : "FAIL" ) << endl; dlog.level1() << myname << ": check depend OFF: d2: " << ( getValue(d2_check_s) == -50 ? "OK" : "FAIL" ) << endl;
// set depend 1 // set depend 1
setValue(depend_c,1); setValue(depend_c,1);
dlog[Debug::LEVEL1] << myname << "(timerInfo): check depend ON: d1: " << ( getValue(d1_check_s) == test_val ? "OK" : "FAIL" ) << endl; dlog.level1() << myname << ": check depend ON: d1: " << ( getValue(d1_check_s) == test_val ? "OK" : "FAIL" ) << endl;
dlog[Debug::LEVEL1] << myname << "(timerInfo): check depend ON: d2: " << ( getValue(d2_check_s) == test_val ? "OK" : "FAIL" ) << endl; dlog.level1() << myname << ": check depend ON: d2: " << ( getValue(d2_check_s) == test_val ? "OK" : "FAIL" ) << endl;
} }
else if( tm->id == tmCheckUndefState ) // -----------------------------------------------------------------------------
{ void TestProc::test_undefined_state()
dlog[Debug::LEVEL1] << myname << "(timerInfo): Check undef state..." << endl; {
undef ^= true; // ---------------- Проверка выставления неопределённого состояния ---------------------
dlog.level1() << myname << ": Check undef state..." << endl;
undef ^= true;
si.id = undef_c; si.id = undef_c;
si.node = conf->getLocalNode(); si.node = conf->getLocalNode();
dlog[Debug::LEVEL1] << myname << "(timerInfo): set undefined=" << undef << endl; dlog.level1() << myname << ": set undefined=" << undef << endl;
ui.setUndefinedState( si, undef, getId() ); ui.setUndefinedState( si, undef, getId() );
} }
// -----------------------------------------------------------------------------
void TestProc::test_thresholds()
{
// ---------------- Проверка работы порогов ---------------------
dlog.level1() << myname << ": Check thresholds..." << endl;
setValue(t_set_c,0);
dlog.level1() << myname << ": check threshold OFF value: " << ( getValue(t_check_s) == 0 ? "OK" : "FAIL" ) << endl;
setValue(t_set_c,378);
dlog.level1() << myname << ": check threshold ON value: " << ( getValue(t_check_s) == 1 ? "OK" : "FAIL" ) << endl;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -18,8 +18,7 @@ class TestProc: ...@@ -18,8 +18,7 @@ class TestProc:
{ {
tmChange, tmChange,
tmCheckWorking, tmCheckWorking,
tmCheckDepend, tmCheck
tmCheckUndefState
}; };
virtual void step(); virtual void step();
...@@ -27,6 +26,10 @@ class TestProc: ...@@ -27,6 +26,10 @@ class TestProc:
virtual void timerInfo( UniSetTypes::TimerMessage *tm ); virtual void timerInfo( UniSetTypes::TimerMessage *tm );
virtual void sysCommand( UniSetTypes::SystemMessage* sm ); virtual void sysCommand( UniSetTypes::SystemMessage* sm );
void test_depend();
void test_undefined_state();
void test_thresholds();
private: private:
bool state; bool state;
bool undef; bool undef;
......
...@@ -17,9 +17,8 @@ ...@@ -17,9 +17,8 @@
</settings> </settings>
<variables> <variables>
<item name="changeTime" type="int" default="2000" min="0" comment="change state time" const="1" public="1" /> <item name="changeTime" type="int" default="2000" min="0" comment="change state time" const="1" public="1" />
<item name="checkWorkingTime" type="int" default="3000" min="0" comment="check working time" const="1" public="1" />
<item name="checkTime" type="int" default="3000" min="0" comment="check Working time" const="1" public="1" /> <item name="checkTime" type="int" default="3000" min="0" comment="check Working time" const="1" public="1" />
<item name="checkDependTime" type="int" default="5000" min="0" comment="check depend time" const="1" public="1" />
<item name="checkUndefTime" type="int" default="3000" min="0" comment="check undef time" const="1" public="1" />
</variables> </variables>
<smap> <smap>
<!-- name - название переменной в конф. файле --> <!-- name - название переменной в конф. файле -->
...@@ -36,6 +35,11 @@ ...@@ -36,6 +35,11 @@
<!-- проверка работы undefined state --> <!-- проверка работы undefined state -->
<item name="undef_c" vartype="out" comment="аналоговый датчик (для проверки undef-состояния)"/> <item name="undef_c" vartype="out" comment="аналоговый датчик (для проверки undef-состояния)"/>
<item name="check_undef_s" vartype="in" comment="датчик для выставления undef-состояния"/> <item name="check_undef_s" vartype="in" comment="датчик для выставления undef-состояния"/>
<!-- проверка работы threshold-ов -->
<item name="t_set_c" vartype="out" comment="аналоговый датчик (для выставления порога)"/>
<item name="t_check_s" vartype="in" comment="датчик для проверки срабатывания"/>
</smap> </smap>
<msgmap> <msgmap>
......
...@@ -102,7 +102,6 @@ class IOController: ...@@ -102,7 +102,6 @@ class IOController:
struct USensorInfo; struct USensorInfo;
typedef std::map<UniSetTypes::KeyType, USensorInfo> IOStateList; typedef std::map<UniSetTypes::KeyType, USensorInfo> IOStateList;
// ================== Достпуные сигналы ================= // ================== Достпуные сигналы =================
/*! /*!
// \warning В сигнале напрямую передаётся итератор (т.е. по сути указатель на внутреннюю структуру!) // \warning В сигнале напрямую передаётся итератор (т.е. по сути указатель на внутреннюю структуру!)
...@@ -151,10 +150,10 @@ class IOController: ...@@ -151,10 +150,10 @@ class IOController:
// Дополнительные (вспомогательные поля) // Дополнительные (вспомогательные поля)
UniSetTypes::uniset_rwmutex val_lock; /*!< флаг блокирующий работу со значением */ UniSetTypes::uniset_rwmutex val_lock; /*!< флаг блокирующий работу со значением */
IOStateList::iterator it; IOStateList::iterator it;
void* any; /*!< расширение для возможности хранения своей информации */ void* any; /*!< расширение для возможности хранения своей информации */
// сигнал для реализации механизма зависимостией.. // сигнал для реализации механизма зависимостией..
// (все зависимые датчики подключаются к нему (см. NCRestorer::init_depends_signals) // (все зависимые датчики подключаются к нему (см. NCRestorer::init_depends_signals)
...@@ -193,11 +192,18 @@ class IOController: ...@@ -193,11 +192,18 @@ class IOController:
virtual bool disactivateObject(); virtual bool disactivateObject();
virtual bool activateObject(); virtual bool activateObject();
/*! Начальная инициализация (выставление значений) */
virtual void activateInit();
/*! регистрация датчиков, за информацию о которых отвечает данный IOController */ /*! регистрация датчиков, за информацию о которых отвечает данный IOController */
virtual void sensorsRegistration(){}; virtual void sensorsRegistration(){};
/*! удаление из репозитория датчиков за информацию о которых отвечает данный IOController */ /*! удаление из репозитория датчиков за информацию о которых отвечает данный IOController */
virtual void sensorsUnregistration(); virtual void sensorsUnregistration();
typedef sigc::signal<void, IOStateList::iterator&, IOController*> InitSignal;
// signal по изменению определённого датчика
inline InitSignal signal_init(){ return sigInit; }
/*! регистрация датчика /*! регистрация датчика
force=true - не проверять на дублирование (оптимизация) force=true - не проверять на дублирование (оптимизация)
*/ */
...@@ -230,7 +236,6 @@ class IOController: ...@@ -230,7 +236,6 @@ class IOController:
ai.ci.maxRaw = 0; ai.ci.maxRaw = 0;
ai.ci.minCal = 0; ai.ci.minCal = 0;
ai.ci.maxCal = 0; ai.ci.maxCal = 0;
ai.ci.sensibility = 0;
ai.ci.precision = 0; ai.ci.precision = 0;
} }
return ai; return ai;
...@@ -275,6 +280,7 @@ class IOController: ...@@ -275,6 +280,7 @@ class IOController:
friend class NCRestorer; friend class NCRestorer;
ChangeSignal sigAnyChange; ChangeSignal sigAnyChange;
ChangeSignal sigAnyUndefChange; ChangeSignal sigAnyUndefChange;
InitSignal sigInit;
IOStateList ioList; /*!< список с текущим состоянием аналоговых входов/выходов */ IOStateList ioList; /*!< список с текущим состоянием аналоговых входов/выходов */
UniSetTypes::uniset_rwmutex ioMutex; /*!< замок для блокирования совместного доступа к ioList */ UniSetTypes::uniset_rwmutex ioMutex; /*!< замок для блокирования совместного доступа к ioList */
......
...@@ -63,7 +63,6 @@ class NCRestorer; ...@@ -63,7 +63,6 @@ class NCRestorer;
и оставлены для совместимости со старыми интерфейсами. и оставлены для совместимости со старыми интерфейсами.
... продолжение следует... ... продолжение следует...
\section sec_NC_Consumers Заказчики \section sec_NC_Consumers Заказчики
В качестве "заказчиков" могут выступать любые UniSet-объекты (UniSetObject), В качестве "заказчиков" могут выступать любые UniSet-объекты (UniSetObject),
обладающие "обратным адресом" (идентификатором), по которому присылается обладающие "обратным адресом" (идентификатором), по которому присылается
...@@ -143,8 +142,7 @@ class IONotifyController: ...@@ -143,8 +142,7 @@ class IONotifyController:
virtual void askThreshold(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci, virtual void askThreshold(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci,
UniSetTypes::ThresholdId tid, UniSetTypes::ThresholdId tid,
CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Long sensibility, CORBA::Long lowLimit, CORBA::Long hiLimit, UniversalIO::UIOCommand cmd );
UniversalIO::UIOCommand cmd );
virtual UniSetTypes::IDSeq* askSensorsSeq(const UniSetTypes::IDSeq& lst, virtual UniSetTypes::IDSeq* askSensorsSeq(const UniSetTypes::IDSeq& lst,
const UniSetTypes::ConsumerInfo& ci, UniversalIO::UIOCommand cmd); const UniSetTypes::ConsumerInfo& ci, UniversalIO::UIOCommand cmd);
...@@ -175,7 +173,7 @@ class IONotifyController: ...@@ -175,7 +173,7 @@ class IONotifyController:
struct ThresholdInfoExt: struct ThresholdInfoExt:
public IONotifyController_i::ThresholdInfo public IONotifyController_i::ThresholdInfo
{ {
ThresholdInfoExt( UniSetTypes::ThresholdId tid, CORBA::Long low, CORBA::Long hi, CORBA::Long sb, ThresholdInfoExt( UniSetTypes::ThresholdId tid, CORBA::Long low, CORBA::Long hi,
UniSetTypes::ObjectId _sid=UniSetTypes::DefaultObjectId, UniSetTypes::ObjectId _sid=UniSetTypes::DefaultObjectId,
bool inv = false ): bool inv = false ):
sid(_sid), sid(_sid),
...@@ -184,21 +182,16 @@ class IONotifyController: ...@@ -184,21 +182,16 @@ class IONotifyController:
id = tid; id = tid;
hilimit = hi; hilimit = hi;
lowlimit = low; lowlimit = low;
sensibility = sb;
state = IONotifyController_i::NormalThreshold; state = IONotifyController_i::NormalThreshold;
} }
ConsumerList clst; ConsumerList clst;
/*! идентификатор дискретного датчика /*! идентификатор дискретного датчика связанного с данным порогом */
связанного с данным порогом
*/
UniSetTypes::ObjectId sid; UniSetTypes::ObjectId sid;
/*! итератор в списке датчиков /*! итератор в списке датчиков (для оптимально-быстрого доступа) */
(для оптимально-быстрого доступа) IOController::IOStateList::iterator sit;
*/
IOController::IOStateList::iterator itSID;
/*! инверсная логика */ /*! инверсная логика */
bool inverse; bool inverse;
...@@ -207,12 +200,10 @@ class IONotifyController: ...@@ -207,12 +200,10 @@ class IONotifyController:
{ {
return ((id == r.id) && return ((id == r.id) &&
(hilimit == r.hilimit) && (hilimit == r.hilimit) &&
(lowlimit == r.lowlimit) && (lowlimit == r.lowlimit) );
(sensibility == r.sensibility) );
} }
}; };
typedef std::list<ThresholdInfoExt> ThresholdExtList; typedef std::list<ThresholdInfoExt> ThresholdExtList;
/*! массив пар датчик->список потребителей */ /*! массив пар датчик->список потребителей */
...@@ -237,6 +228,7 @@ class IONotifyController: ...@@ -237,6 +228,7 @@ class IONotifyController:
protected: protected:
IONotifyController(); IONotifyController();
virtual bool activateObject(); virtual bool activateObject();
virtual void initItem( IOStateList::iterator& it, IOController* ic );
// ФИЛЬТРЫ // ФИЛЬТРЫ
bool myIOFilter(const USensorInfo& ai, CORBA::Long newvalue, UniSetTypes::ObjectId sup_id); bool myIOFilter(const USensorInfo& ai, CORBA::Long newvalue, UniSetTypes::ObjectId sup_id);
...@@ -251,7 +243,6 @@ class IONotifyController: ...@@ -251,7 +243,6 @@ class IONotifyController:
//! поиск информации о пороговом датчике //! поиск информации о пороговом датчике
ThresholdExtList::iterator findThreshold( UniSetTypes::KeyType k, UniSetTypes::ThresholdId tid ); ThresholdExtList::iterator findThreshold( UniSetTypes::KeyType k, UniSetTypes::ThresholdId tid );
//! сохранение информации об изменении состояния датчика в базу //! сохранение информации об изменении состояния датчика в базу
virtual void loggingInfo(UniSetTypes::SensorMessage& sm); virtual void loggingInfo(UniSetTypes::SensorMessage& sm);
......
...@@ -124,12 +124,12 @@ class UInterface ...@@ -124,12 +124,12 @@ class UInterface
//! Заказ информации об изменении дискретного датчика //! Заказ информации об изменении дискретного датчика
void askThreshold( UniSetTypes::ObjectId sensorId, UniSetTypes::ThresholdId tid, void askThreshold( UniSetTypes::ObjectId sensorId, UniSetTypes::ThresholdId tid,
UniversalIO::UIOCommand cmd, UniversalIO::UIOCommand cmd,
CORBA::Long lowLimit=0, CORBA::Long hiLimit=0, CORBA::Long sensibility=0, CORBA::Long lowLimit=0, CORBA::Long hiLimit=0,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId ); UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
void askRemoteThreshold( UniSetTypes::ObjectId sensorId, UniSetTypes::ObjectId node, void askRemoteThreshold( UniSetTypes::ObjectId sensorId, UniSetTypes::ObjectId node,
UniSetTypes::ThresholdId thresholdId, UniversalIO::UIOCommand cmd, UniSetTypes::ThresholdId thresholdId, UniversalIO::UIOCommand cmd,
CORBA::Long lowLimit=0, CORBA::Long hiLimit=0, CORBA::Long sensibility=0, CORBA::Long lowLimit=0, CORBA::Long hiLimit=0,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId ); UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
// --------------------------------------------------------------- // ---------------------------------------------------------------
......
...@@ -62,7 +62,6 @@ class UniSetManager: ...@@ -62,7 +62,6 @@ class UniSetManager:
UniSetManager( const std::string& name, const std::string& section ); UniSetManager( const std::string& name, const std::string& section );
virtual ~UniSetManager(); virtual ~UniSetManager();
virtual UniSetTypes::ObjectType getType(){ return UniSetTypes::getObjectType("UniSetManager"); } virtual UniSetTypes::ObjectType getType(){ return UniSetTypes::getObjectType("UniSetManager"); }
// ------ функции объявленные в интерфейсе(IDL) ------ // ------ функции объявленные в интерфейсе(IDL) ------
...@@ -114,7 +113,6 @@ class UniSetManager: ...@@ -114,7 +113,6 @@ class UniSetManager:
int objectsCount(); // количество подчиненных объектов int objectsCount(); // количество подчиненных объектов
PortableServer::POA_ptr getPOA(){ return PortableServer::POA::_duplicate(poa); } PortableServer::POA_ptr getPOA(){ return PortableServer::POA::_duplicate(poa); }
PortableServer::POAManager_ptr getPOAManager(){ return PortableServer::POAManager::_duplicate(pman); } PortableServer::POAManager_ptr getPOAManager(){ return PortableServer::POAManager::_duplicate(pman); }
...@@ -136,7 +134,6 @@ class UniSetManager: ...@@ -136,7 +134,6 @@ class UniSetManager:
//! \note Переопределяя не забывайте вызвать базовую //! \note Переопределяя не забывайте вызвать базовую
virtual bool disactivateObject(); virtual bool disactivateObject();
typedef UniSetManagerList::iterator MListIterator; typedef UniSetManagerList::iterator MListIterator;
int getObjectsInfo( UniSetManager* mngr, UniSetTypes::SimpleInfoSeq* seq, int getObjectsInfo( UniSetManager* mngr, UniSetTypes::SimpleInfoSeq* seq,
......
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \brief Базовый класс для реализации шаблона "наблюдатель"
* \author Pavel Vainerman
*/
//---------------------------------------------------------------------------
#ifndef UniSetObserver_H_
#define UniSetObserver_H_
//---------------------------------------------------------------------------
#include <list>
#include "UniSetObject.h"
#include "MessageType.h"
// --------------------------------------------------------------------------
class UniSetSubject
{
public:
UniSetSubject(UniSetTypes::ObjectId id);
~UniSetSubject();
virtual void attach( UniSetObject* o );
virtual void detach( UniSetObject* o );
virtual void attach( UniSetObject* o, int MessageType );
virtual void detach( UniSetObject* o, int MessageType );
protected:
UniSetSubject();
virtual void notify(int notify, int data,
UniSetTypes::Message::Priority priority=UniSetTypes::Message::Low);
virtual void notify( UniSetTypes::TransportMessage& msg );
private:
typedef std::list<UniSetObject*> ObserverList;
ObserverList lst;
UniSetTypes::ObjectId id;
};
//---------------------------------------------------------------------------
#endif
...@@ -60,14 +60,21 @@ namespace UniSetTypes ...@@ -60,14 +60,21 @@ namespace UniSetTypes
/*! генератор уникального положительного ключа /*! генератор уникального положительного ключа
* Уникальность гарантируется только для пары значений * Уникальность гарантируется только для пары значений
* id и node. * id и node.
* \warning что тут у нас с переполнением..
* \warning Уникальность генерируемого ключа еще не проверялась, * \warning Уникальность генерируемого ключа еще не проверялась,
но нареканий по использованию тоже не было :) но нареканий по использованию тоже не было :)
* \todo Желательно продумать что-нибудь с использованием хэш.
*/ */
inline static KeyType key( UniSetTypes::ObjectId id, UniSetTypes::ObjectId node ) inline static KeyType key( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node )
{ {
return KeyType((id*node)+(id+2*node)); return KeyType((id*node)+(id+2*node));
} }
inline static KeyType key( const IOController_i::SensorInfo& si )
{
return key(si.id,si.node);
}
typedef std::list<std::string> ListObjectName; /*!< Список объектов типа ObjectName */ typedef std::list<std::string> ListObjectName; /*!< Список объектов типа ObjectName */
typedef ObjectId SysId; typedef ObjectId SysId;
......
...@@ -1219,15 +1219,15 @@ string UInterface::set_err(const string& pre, UniSetTypes::ObjectId id, UniSetTy ...@@ -1219,15 +1219,15 @@ string UInterface::set_err(const string& pre, UniSetTypes::ObjectId id, UniSetTy
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
void UInterface::askThreshold( UniSetTypes::ObjectId sid, UniSetTypes::ThresholdId tid, void UInterface::askThreshold( UniSetTypes::ObjectId sid, UniSetTypes::ThresholdId tid,
UniversalIO::UIOCommand cmd, UniversalIO::UIOCommand cmd,
CORBA::Long low, CORBA::Long hi, CORBA::Long sb, CORBA::Long low, CORBA::Long hi,
UniSetTypes::ObjectId backid) UniSetTypes::ObjectId backid)
{ {
askRemoteThreshold(sid, uconf->getLocalNode(), tid, cmd, low,hi,sb, backid); askRemoteThreshold(sid, uconf->getLocalNode(), tid, cmd, low,hi, backid);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
void UInterface::askRemoteThreshold( UniSetTypes::ObjectId sid, UniSetTypes::ObjectId node, void UInterface::askRemoteThreshold( UniSetTypes::ObjectId sid, UniSetTypes::ObjectId node,
UniSetTypes::ThresholdId tid, UniversalIO::UIOCommand cmd, UniSetTypes::ThresholdId tid, UniversalIO::UIOCommand cmd,
CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Long sensibility, CORBA::Long lowLimit, CORBA::Long hiLimit,
UniSetTypes::ObjectId backid ) UniSetTypes::ObjectId backid )
{ {
if( backid==UniSetTypes::DefaultObjectId ) if( backid==UniSetTypes::DefaultObjectId )
...@@ -1264,7 +1264,7 @@ void UInterface::askRemoteThreshold( UniSetTypes::ObjectId sid, UniSetTypes::Obj ...@@ -1264,7 +1264,7 @@ void UInterface::askRemoteThreshold( UniSetTypes::ObjectId sid, UniSetTypes::Obj
ci->id = backid; ci->id = backid;
ci->node = uconf->getLocalNode(); ci->node = uconf->getLocalNode();
inc->askThreshold(si,ci,tid,lowLimit,hiLimit,sensibility,cmd); inc->askThreshold(si,ci,tid,lowLimit,hiLimit,cmd);
return; return;
} }
catch(CORBA::TRANSIENT){} catch(CORBA::TRANSIENT){}
......
...@@ -248,14 +248,15 @@ void UniSetActivator::stop() ...@@ -248,14 +248,15 @@ void UniSetActivator::stop()
if( ulog.is_system() ) if( ulog.is_system() )
ulog.system() << myname << "(stop): discard request ok."<< endl; ulog.system() << myname << "(stop): discard request ok."<< endl;
/*
try try
{ {
ulog.system() << myname << "(stop):: shutdown orb... "<<endl; if( ulog.is_system() )
ulog.system() << myname << "(stop):: shutdown orb... "<<endl;
orb->shutdown(false); orb->shutdown(false);
} }
catch(...){} catch(...){}
*/
if( ulog.is_system() ) if( ulog.is_system() )
ulog.system() << myname << "(stop): shutdown ok."<< endl; ulog.system() << myname << "(stop): shutdown ok."<< endl;
} }
......
...@@ -333,8 +333,7 @@ using namespace UniSetTypes; ...@@ -333,8 +333,7 @@ using namespace UniSetTypes;
{ {
return os << " rmin=" << c.minRaw << " rmax=" << c.maxRaw return os << " rmin=" << c.minRaw << " rmax=" << c.maxRaw
<< " cmin=" << c.minCal << " cmax=" << c.maxCal << " cmin=" << c.minCal << " cmax=" << c.maxCal
<< " precision=" << c.precision << " precision=" << c.precision;
<< " sensibility=" << c.sensibility;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool UniSetTypes::check_filter( UniXML_iterator& it, const std::string f_prop, const std::string f_val ) bool UniSetTypes::check_filter( UniXML_iterator& it, const std::string f_prop, const std::string f_val )
......
...@@ -64,6 +64,10 @@ bool IOController::activateObject() ...@@ -64,6 +64,10 @@ bool IOController::activateObject()
{ {
bool res = UniSetManager::activateObject(); bool res = UniSetManager::activateObject();
sensorsRegistration(); sensorsRegistration();
// Начальная инициализация
activateInit();
return res; return res;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
...@@ -85,11 +89,39 @@ void IOController::sensorsUnregistration() ...@@ -85,11 +89,39 @@ void IOController::sensorsUnregistration()
} }
catch(Exception& ex) catch(Exception& ex)
{ {
ulog.crit() << myname << "(sensorsUnregistration): "<< ex << endl; if( ulog.is_crit() )
ulog.crit() << myname << "(sensorsUnregistration): "<< ex << endl;
} }
catch(...){} catch(...){}
} }
}
// ------------------------------------------------------------------------------------------
void IOController::activateInit()
{
// Разрегистрируем аналоговые датчики
for( IOStateList::iterator li = ioList.begin(); li != ioList.end(); ++li )
{
try
{
USensorInfo& s(li->second);
// Проверка зависимостей
if( s.d_si.id != DefaultObjectId )
{
IOStateList::iterator d_it = myiofind( UniSetTypes::key(s.d_si) );
if( d_it != ioEnd() )
s.checkDepend(d_it, this);
}
sigInit.emit(li,this);
}
catch( Exception& ex )
{
if( ulog.is_crit() )
ulog.crit() << myname << "(activateInit): "<< ex << endl;
}
catch(...){}
}
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
CORBA::Long IOController::getValue( const IOController_i::SensorInfo& si ) CORBA::Long IOController::getValue( const IOController_i::SensorInfo& si )
......
...@@ -66,6 +66,7 @@ IONotifyController::IONotifyController( ObjectId id, NCRestorer* d ): ...@@ -66,6 +66,7 @@ IONotifyController::IONotifyController( ObjectId id, NCRestorer* d ):
maxAttemtps(conf->getPIntField("ConsumerMaxAttempts", 5)) maxAttemtps(conf->getPIntField("ConsumerMaxAttempts", 5))
{ {
signal_change_undefined_state().connect(sigc::mem_fun(*this, &IONotifyController::onChangeUndefinedState)); signal_change_undefined_state().connect(sigc::mem_fun(*this, &IONotifyController::onChangeUndefinedState));
signal_init().connect(sigc::mem_fun(*this, &IONotifyController::initItem));
// добавляем фильтры // добавляем фильтры
addIOFilter( sigc::mem_fun(this,&IONotifyController::myIOFilter) ); addIOFilter( sigc::mem_fun(this,&IONotifyController::myIOFilter) );
...@@ -309,18 +310,12 @@ void IONotifyController::ask(AskMap& askLst, const IOController_i::SensorInfo& s ...@@ -309,18 +310,12 @@ void IONotifyController::ask(AskMap& askLst, const IOController_i::SensorInfo& s
} }
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool IONotifyController::myIOFilter(const USensorInfo& ai, bool IONotifyController::myIOFilter( const USensorInfo& ai,
CORBA::Long newvalue, UniSetTypes::ObjectId sup_id) CORBA::Long newvalue, UniSetTypes::ObjectId sup_id )
{ {
if( ai.value == newvalue ) if( ai.value == newvalue )
return false; return false;
if( ai.ci.sensibility <= 0 )
return true;
if( abs(ai.value - newvalue) < ai.ci.sensibility )
return false;
return true; return true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
...@@ -453,8 +448,11 @@ void IONotifyController::loggingInfo(UniSetTypes::SensorMessage& sm) ...@@ -453,8 +448,11 @@ void IONotifyController::loggingInfo(UniSetTypes::SensorMessage& sm)
// -------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------
bool IONotifyController::activateObject() bool IONotifyController::activateObject()
{ {
IOController::activateObject(); // сперва вычитаем датчиков и заказчиков..
readDump(); readDump();
// а потом уже собственно активация..
IOController::activateObject();
return true; return true;
} }
// -------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------
...@@ -472,6 +470,14 @@ void IONotifyController::readDump() ...@@ -472,6 +470,14 @@ void IONotifyController::readDump()
} }
} }
// -------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------
void IONotifyController::initItem( IOStateList::iterator& li, IOController* ic )
{
USensorInfo& s(li->second);
if( s.type == UniversalIO::AI || s.type == UniversalIO::AO )
checkThreshold( li, s.si, false );
}
// ------------------------------------------------------------------------------------------
void IONotifyController::dumpOrdersList(const IOController_i::SensorInfo& si, void IONotifyController::dumpOrdersList(const IOController_i::SensorInfo& si,
const IONotifyController::ConsumerList& lst) const IONotifyController::ConsumerList& lst)
{ {
...@@ -515,8 +521,7 @@ void IONotifyController::dumpThresholdList(const IOController_i::SensorInfo& si, ...@@ -515,8 +521,7 @@ void IONotifyController::dumpThresholdList(const IOController_i::SensorInfo& si,
void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci, void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci,
UniSetTypes::ThresholdId tid, UniSetTypes::ThresholdId tid,
CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Long sb, CORBA::Long lowLimit, CORBA::Long hiLimit, UniversalIO::UIOCommand cmd )
UniversalIO::UIOCommand cmd )
{ {
if( lowLimit > hiLimit ) if( lowLimit > hiLimit )
throw IONotifyController_i::BadRange(); throw IONotifyController_i::BadRange();
...@@ -531,8 +536,8 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons ...@@ -531,8 +536,8 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons
// поиск датчика в списке // поиск датчика в списке
UniSetTypes::KeyType skey( key(si.id,si.node) ); UniSetTypes::KeyType skey( key(si.id,si.node) );
AskThresholdMap::iterator it = askTMap.find(skey); AskThresholdMap::iterator it = askTMap.find(skey);
ThresholdInfoExt ti(tid,lowLimit, hiLimit,sb); ThresholdInfoExt ti(tid,lowLimit,hiLimit);
ti.itSID = myioEnd(); ti.sit = myioEnd();
switch( cmd ) switch( cmd )
{ {
...@@ -604,17 +609,17 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons ...@@ -604,17 +609,17 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons
sm.sm_tv_usec = ti.tv_usec; sm.sm_tv_usec = ti.tv_usec;
sm.ci = li->second.ci; sm.ci = li->second.ci;
// Проверка нижнего предела // Проверка нижнего предела
if( val <= (lowLimit-sb) ) if( val <= lowLimit )
{ {
sm.threshold = false; sm.threshold = false;
CORBA::Object_var op = ui.resolve(ci.id, ci.node); CORBA::Object_var op = ui.resolve(ci.id, ci.node);
UniSetObject_i_var ref = UniSetObject_i::_narrow(op); UniSetObject_i_var ref = UniSetObject_i::_narrow(op);
if(!CORBA::is_nil(ref)) if(!CORBA::is_nil(ref))
ref->push(sm.transport_msg()); ref->push(sm.transport_msg());
} }
// Проверка верхнего предела // Проверка верхнего предела
else if( val >= (hiLimit+sb) ) else if( val >= hiLimit )
{ {
sm.threshold = true; sm.threshold = true;
CORBA::Object_var op = ui.resolve(ci.id, ci.node); CORBA::Object_var op = ui.resolve(ci.id, ci.node);
...@@ -691,7 +696,6 @@ bool IONotifyController::addThreshold(ThresholdExtList& lst, ThresholdInfoExt& t ...@@ -691,7 +696,6 @@ bool IONotifyController::addThreshold(ThresholdExtList& lst, ThresholdInfoExt& t
addConsumer(ti.clst, ci); addConsumer(ti.clst, ci);
// запоминаем начальное время // запоминаем начальное время
struct timeval tm; struct timeval tm;
struct timezone tz; struct timezone tz;
...@@ -766,9 +770,11 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li, ...@@ -766,9 +770,11 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
for( ThresholdExtList::iterator it=lst->second.list.begin(); it!=lst->second.list.end(); ++it) for( ThresholdExtList::iterator it=lst->second.list.begin(); it!=lst->second.list.end(); ++it)
{ {
// Используем здесь sm.value чтобы не делать ещё раз lock на li->second.value
// Проверка нижнего предела // Проверка нижнего предела
// значение должно быть меньше lowLimit-чуствительность // значение должно быть меньше lowLimit-чуствительность
if( li->second.value <= (it->lowlimit-it->sensibility) ) if( sm.value <= it->lowlimit )
{ {
if( it->state == IONotifyController_i::LowThreshold ) if( it->state == IONotifyController_i::LowThreshold )
continue; continue;
...@@ -793,7 +799,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li, ...@@ -793,7 +799,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
if( it->inverse ) if( it->inverse )
state^=1; state^=1;
localSetValue(it->itSID,SensorInfo(it->sid),(state ? 1:0),getId()); localSetValue(it->sit,SensorInfo(it->sid),(state ? 1:0),getId());
} }
catch( UniSetTypes::Exception& ex ) catch( UniSetTypes::Exception& ex )
{ {
...@@ -808,7 +814,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li, ...@@ -808,7 +814,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
} }
// Проверка верхнего предела // Проверка верхнего предела
// значение должно быть больше hiLimit+чуствительность // значение должно быть больше hiLimit+чуствительность
else if( li->second.value >= (it->hilimit+it->sensibility) ) else if( sm.value >= it->hilimit )
{ {
if( it->state == IONotifyController_i::HiThreshold ) if( it->state == IONotifyController_i::HiThreshold )
continue; continue;
...@@ -832,7 +838,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li, ...@@ -832,7 +838,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
if( it->inverse ) if( it->inverse )
state^=1; state^=1;
localSetValue(it->itSID,SensorInfo(it->sid),(state?1:0),getId()); localSetValue(it->sit,SensorInfo(it->sid),(state?1:0),getId());
} }
catch( UniSetTypes::Exception& ex ) catch( UniSetTypes::Exception& ex )
{ {
...@@ -849,7 +855,6 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li, ...@@ -849,7 +855,6 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
it->state = IONotifyController_i::NormalThreshold; it->state = IONotifyController_i::NormalThreshold;
} }
} // unlock } // unlock
} }
// -------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------
IONotifyController::ThresholdExtList::iterator IONotifyController::findThreshold( UniSetTypes::KeyType key, UniSetTypes::ThresholdId tid ) IONotifyController::ThresholdExtList::iterator IONotifyController::findThreshold( UniSetTypes::KeyType key, UniSetTypes::ThresholdId tid )
...@@ -910,7 +915,6 @@ IONotifyController_i::ThresholdsListSeq* IONotifyController::getThresholdsList() ...@@ -910,7 +915,6 @@ IONotifyController_i::ThresholdsListSeq* IONotifyController::getThresholdsList()
(*res)[i].tlist[k].id = it2->id; (*res)[i].tlist[k].id = it2->id;
(*res)[i].tlist[k].hilimit = it2->hilimit; (*res)[i].tlist[k].hilimit = it2->hilimit;
(*res)[i].tlist[k].lowlimit = it2->lowlimit; (*res)[i].tlist[k].lowlimit = it2->lowlimit;
(*res)[i].tlist[k].sensibility = it2->sensibility;
(*res)[i].tlist[k].state = it2->state; (*res)[i].tlist[k].state = it2->state;
(*res)[i].tlist[k].tv_sec = it2->tv_sec; (*res)[i].tlist[k].tv_sec = it2->tv_sec;
(*res)[i].tlist[k].tv_usec = it2->tv_usec; (*res)[i].tlist[k].tv_usec = it2->tv_usec;
......
...@@ -65,7 +65,8 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController ...@@ -65,7 +65,8 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController
break; break;
default: default:
ulog.crit() << ic->getName() << "(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА! -> " if( ulog.is_crit() )
ulog.crit() << ic->getName() << "(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА! -> "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << endl; << conf->oind->getNameById(inf.si.id,inf.si.node) << endl;
return; return;
break; break;
...@@ -84,8 +85,9 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController ...@@ -84,8 +85,9 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController
break; break;
default: default:
ulog.crit() << ic->getName() << "(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА!-> " if( ulog.is_crit() )
<< conf->oind->getNameById(inf.si.id,inf.si.node) << endl; ulog.crit() << ic->getName() << "(NCRestorer::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА!-> "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << endl;
break; break;
} }
} }
...@@ -120,7 +122,7 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC ...@@ -120,7 +122,7 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
// default init iterators // default init iterators
for( IONotifyController::ThresholdExtList::iterator it=lst.begin(); it!=lst.end(); ++it ) for( IONotifyController::ThresholdExtList::iterator it=lst.begin(); it!=lst.end(); ++it )
it->itSID = ic->myioEnd(); it->sit = ic->myioEnd();
UniSetTypes::KeyType k( key(inf.si.id,inf.si.node) ); UniSetTypes::KeyType k( key(inf.si.id,inf.si.node) );
ic->askTMap[k].si = inf.si; ic->askTMap[k].si = inf.si;
...@@ -128,6 +130,8 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC ...@@ -128,6 +130,8 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
ic->askTMap[k].list = lst; ic->askTMap[k].list = lst;
ic->askTMap[k].ait = ic->myioEnd(); ic->askTMap[k].ait = ic->myioEnd();
// Начальная инициализация делается в IOController (IONotifyContoller) в момент "активации". см. IOController::activateInit()
#if 0
try try
{ {
switch( inf.type ) switch( inf.type )
...@@ -148,22 +152,25 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC ...@@ -148,22 +152,25 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
break; break;
} }
} }
catch(Exception& ex) catch( Exception& ex )
{ {
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): " << ex if( ulog.is_warn() )
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): " << ex
<< " для " << conf->oind->getNameById(inf.si.id, inf.si.node) << endl; << " для " << conf->oind->getNameById(inf.si.id, inf.si.node) << endl;
throw; throw;
} }
catch( CORBA::SystemException& ex ) catch( CORBA::SystemException& ex )
{ {
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): " if( ulog.is_warn() )
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << " недоступен!!(CORBA::SystemException): " << conf->oind->getNameById(inf.si.id,inf.si.node) << " недоступен!!(CORBA::SystemException): "
<< ex.NP_minorString() << endl; << ex.NP_minorString() << endl;
throw; throw;
} }
#endif
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
NCRestorer::SInfo& NCRestorer::SInfo::operator=(IOController_i::SensorIOInfo& inf) NCRestorer::SInfo& NCRestorer::SInfo::operator=( IOController_i::SensorIOInfo& inf )
{ {
this->si = inf.si; this->si = inf.si;
this->type = inf.type; this->type = inf.type;
...@@ -199,6 +206,6 @@ void NCRestorer::init_depends_signals( IONotifyController* ic ) ...@@ -199,6 +206,6 @@ void NCRestorer::init_depends_signals( IONotifyController* ic )
IOController::ChangeSignal s = ic->signal_change_value(it->second.d_si); IOController::ChangeSignal s = ic->signal_change_value(it->second.d_si);
s.connect( sigc::mem_fun( &it->second, &IOController::USensorInfo::checkDepend) ); s.connect( sigc::mem_fun( &it->second, &IOController::USensorInfo::checkDepend) );
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -115,7 +115,8 @@ void NCRestorer_XML::read_list( UniXML& xml, xmlNode* node, IONotifyController* ...@@ -115,7 +115,8 @@ void NCRestorer_XML::read_list( UniXML& xml, xmlNode* node, IONotifyController*
if( !getSensorInfo(xml,it,inf) ) if( !getSensorInfo(xml,it,inf) )
{ {
ulog.warn() << ic->getName() << "(read_list): не смог получить информацию по датчику " << endl; if( ulog.is_warn() )
ulog.warn() << ic->getName() << "(read_list): не смог получить информацию по датчику " << endl;
continue; continue;
} }
...@@ -265,14 +266,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf ) ...@@ -265,14 +266,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
else if( prior == "Super" ) else if( prior == "Super" )
inf.priority = Message::Super; inf.priority = Message::Super;
else else
{
inf.priority = Message::Medium; inf.priority = Message::Medium;
if( ulog.is_info() )
{
ulog.info() << "(NCRestorer_XML:getSensorInfo): не указан приоритет для "
<< xml.getProp(it,"name") << endl;
}
}
inf.type = UniSetTypes::getIOType(xml.getProp(it,"iotype")); inf.type = UniSetTypes::getIOType(xml.getProp(it,"iotype"));
if( inf.type == UniversalIO::UnknownIOType ) if( inf.type == UniversalIO::UnknownIOType )
...@@ -289,7 +283,6 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf ) ...@@ -289,7 +283,6 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
inf.ci.maxRaw = xml.getIntProp(it,"rmax"); inf.ci.maxRaw = xml.getIntProp(it,"rmax");
inf.ci.minCal = xml.getIntProp(it,"cmin"); inf.ci.minCal = xml.getIntProp(it,"cmin");
inf.ci.maxCal = xml.getIntProp(it,"cmax"); inf.ci.maxCal = xml.getIntProp(it,"cmax");
inf.ci.sensibility = xml.getIntProp(it,"sensibility");
inf.ci.precision = xml.getIntProp(it,"precision"); inf.ci.precision = xml.getIntProp(it,"precision");
} }
else else
...@@ -298,13 +291,12 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf ) ...@@ -298,13 +291,12 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
inf.ci.maxRaw = 0; inf.ci.maxRaw = 0;
inf.ci.minCal = 0; inf.ci.minCal = 0;
inf.ci.maxCal = 0; inf.ci.maxCal = 0;
inf.ci.sensibility = 0;
inf.ci.precision = 0; inf.ci.precision = 0;
} }
inf.default_val = xml.getIntProp(it,"default"); inf.default_val = xml.getIntProp(it,"default");
inf.dbignore = xml.getIntProp(it,"dbignore"); inf.dbignore = xml.getIntProp(it,"dbignore");
inf.value = inf.default_val; inf.value = inf.default_val;
inf.undefined = false; inf.undefined = false;
inf.real_value = inf.value; inf.real_value = inf.value;
...@@ -379,7 +371,6 @@ void NCRestorer_XML::read_thresholds(UniXML& xml, xmlNode* node, IONotifyControl ...@@ -379,7 +371,6 @@ void NCRestorer_XML::read_thresholds(UniXML& xml, xmlNode* node, IONotifyControl
{ {
ulog.info() << "(read_thresholds): \tthreshold low=" ulog.info() << "(read_thresholds): \tthreshold low="
<< ti.lowlimit << " \thi=" << ti.hilimit << ti.lowlimit << " \thi=" << ti.hilimit
<< " \t sb=" << ti.sensibility
<< " \t sid=" << ti.sid << " \t sid=" << ti.sid
<< " \t inverse=" << ti.inverse << " \t inverse=" << ti.inverse
<< endl << flush; << endl << flush;
...@@ -482,7 +473,6 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node, ...@@ -482,7 +473,6 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node,
ti.id = uit.getIntProp("id"); ti.id = uit.getIntProp("id");
ti.lowlimit = uit.getIntProp("lowlimit"); ti.lowlimit = uit.getIntProp("lowlimit");
ti.hilimit = uit.getIntProp("hilimit"); ti.hilimit = uit.getIntProp("hilimit");
ti.sensibility = uit.getIntProp("sensibility");
ti.inverse = uit.getIntProp("inverse"); ti.inverse = uit.getIntProp("inverse");
ti.state = IONotifyController_i::NormalThreshold; ti.state = IONotifyController_i::NormalThreshold;
return true; return true;
......
...@@ -85,7 +85,6 @@ tid(UniSetTypes::DefaultThresholdId) ...@@ -85,7 +85,6 @@ tid(UniSetTypes::DefaultThresholdId)
ci.maxRaw = 0; ci.maxRaw = 0;
ci.minCal = 0; ci.minCal = 0;
ci.maxCal = 0; ci.maxCal = 0;
ci.sensibility = 0;
ci.precision = 0; ci.precision = 0;
} }
......
...@@ -286,7 +286,7 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls ...@@ -286,7 +286,7 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls
IONotifyController_i::ThresholdInfo* ti = &tlst[i].tlist[k]; IONotifyController_i::ThresholdInfo* ti = &tlst[i].tlist[k];
cout << "\t(" << setw(3) << ti->id << ") | " << ti->state << " | hi: " << setw(5) << ti->hilimit; cout << "\t(" << setw(3) << ti->id << ") | " << ti->state << " | hi: " << setw(5) << ti->hilimit;
cout << " | low: " << setw(5) << ti->lowlimit; cout << " | low: " << setw(5) << ti->lowlimit;
cout << " | sb: " << setw(5) << ti->sensibility << endl; cout << endl;
} }
} }
} }
......
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