Commit 08e088e0 authored by Pavel Vainerman's avatar Pavel Vainerman

Первый этап переделок в связи с переходом на getValue/setValue

parent 8e80c2fd
...@@ -57,7 +57,6 @@ interface IOController_i : ObjectsManager_i ...@@ -57,7 +57,6 @@ interface IOController_i : ObjectsManager_i
{ {
}; };
/*! Информация о датчике */ /*! Информация о датчике */
struct SensorInfo struct SensorInfo
{ {
...@@ -118,8 +117,7 @@ interface IOController_i : ObjectsManager_i ...@@ -118,8 +117,7 @@ interface IOController_i : ObjectsManager_i
typedef sequence<SensorIOInfo> SensorInfoSeq; typedef sequence<SensorIOInfo> SensorInfoSeq;
SensorInfoSeq getSensorsMap(); SensorInfoSeq getSensorsMap();
SensorIOInfo getSInfo(in SensorInfo si) raises(NameNotFound); SensorIOInfo getSensorIOInfo( in SensorInfo si ) raises(NameNotFound);
// -- Функции работы со списком датчиков -- // -- Функции работы со списком датчиков --
......
...@@ -20,7 +20,7 @@ void help_print() ...@@ -20,7 +20,7 @@ void help_print()
struct ExtInfo: struct ExtInfo:
public UniSetTypes::ParamSInfo public UniSetTypes::ParamSInfo
{ {
UniversalIO::IOTypes iotype; UniversalIO::IOType iotype;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int main( int argc, char **argv ) int main( int argc, char **argv )
...@@ -57,8 +57,8 @@ int main( int argc, char **argv ) ...@@ -57,8 +57,8 @@ int main( int argc, char **argv )
std::list<ExtInfo> l; std::list<ExtInfo> l;
for( std::list<UniSetTypes::ParamSInfo>::iterator it = lst.begin(); it!=lst.end(); ++it ) for( std::list<UniSetTypes::ParamSInfo>::iterator it = lst.begin(); it!=lst.end(); ++it )
{ {
UniversalIO::IOTypes t = conf->getIOType( it->si.id ); UniversalIO::IOType t = conf->getIOType( it->si.id );
if( t != UniversalIO::AnalogInput && t != UniversalIO::AnalogOutput ) if( t != UniversalIO::AI && t != UniversalIO::AO )
{ {
cerr << endl << "Неверный типа датчика '" << t << "' для id='" << it->fname << "'. Тип должен быть AI или AO." << endl << endl; cerr << endl << "Неверный типа датчика '" << t << "' для id='" << it->fname << "'. Тип должен быть AI или AO." << endl << endl;
return 1; return 1;
...@@ -122,9 +122,6 @@ int main( int argc, char **argv ) ...@@ -122,9 +122,6 @@ int main( int argc, char **argv )
{ {
try try
{ {
if( it->iotype == UniversalIO::AnalogInput )
ui.saveValue(it->si, j, UniversalIO::AnalogInput, DefaultObjectId);
else
ui.setValue(it->si, j, DefaultObjectId); ui.setValue(it->si, j, DefaultObjectId);
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -150,9 +147,6 @@ int main( int argc, char **argv ) ...@@ -150,9 +147,6 @@ int main( int argc, char **argv )
{ {
try try
{ {
if( it->iotype == UniversalIO::AnalogInput )
ui.saveValue(it->si, i, UniversalIO::AnalogInput, DefaultObjectId);
else
ui.setValue(it->si, i, DefaultObjectId); ui.setValue(it->si, i, DefaultObjectId);
} }
catch( Exception& ex ) catch( Exception& ex )
......
...@@ -346,7 +346,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -346,7 +346,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
- remove deprecated services: InfoServer,TimeService,SystemGuard - remove deprecated services: InfoServer,TimeService,SystemGuard
- remove deprecated intefaces: MessageInterface - remove deprecated intefaces: MessageInterface
- remove deprecated messages: AlarmMessage, InfoMessage, DBMessage - remove deprecated messages: AlarmMessage, InfoMessage, DBMessage
- remove 'state' from SensorMessage
* 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
......
...@@ -470,13 +470,13 @@ void IOControl::ioread( IOInfo* it ) ...@@ -470,13 +470,13 @@ void IOControl::ioread( IOInfo* it )
return; return;
if( testmode == tmOnlyInputs && if( testmode == tmOnlyInputs &&
it->stype != UniversalIO::AnalogInput && it->stype != UniversalIO::AI &&
it->stype != UniversalIO::DigitalInput ) it->stype != UniversalIO::DI )
return; return;
if( testmode == tmOnlyOutputs && if( testmode == tmOnlyOutputs &&
it->stype != UniversalIO::AnalogOutput && it->stype != UniversalIO::AO &&
it->stype != UniversalIO::DigitalOutput ) it->stype != UniversalIO::DO )
return; return;
} }
...@@ -505,7 +505,7 @@ void IOControl::ioread( IOInfo* it ) ...@@ -505,7 +505,7 @@ void IOControl::ioread( IOInfo* it )
try try
{ {
if( it->stype == UniversalIO::AnalogInput ) if( it->stype == UniversalIO::AI )
{ {
int val = card->getAnalogChannel(it->subdev,it->channel, it->range, it->aref); int val = card->getAnalogChannel(it->subdev,it->channel, it->range, it->aref);
...@@ -521,7 +521,7 @@ void IOControl::ioread( IOInfo* it ) ...@@ -521,7 +521,7 @@ void IOControl::ioread( IOInfo* it )
IOBase::processingAsAI( ib, val, shm, force ); IOBase::processingAsAI( ib, val, shm, force );
} }
else if( it->stype == UniversalIO::DigitalInput ) else if( it->stype == UniversalIO::DI )
{ {
bool set = card->getDigitalChannel(it->subdev,it->channel); bool set = card->getDigitalChannel(it->subdev,it->channel);
/* /*
...@@ -548,7 +548,7 @@ void IOControl::ioread( IOInfo* it ) ...@@ -548,7 +548,7 @@ void IOControl::ioread( IOInfo* it )
if( it->si.id == testLamp_S ) if( it->si.id == testLamp_S )
isTestLamp = set; isTestLamp = set;
} }
else if( it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AO )
{ {
if( !it->lamp ) if( !it->lamp )
{ {
...@@ -640,7 +640,7 @@ void IOControl::ioread( IOInfo* it ) ...@@ -640,7 +640,7 @@ void IOControl::ioread( IOInfo* it )
} }
} }
} }
else if( it->stype == UniversalIO::DigitalOutput ) else if( it->stype == UniversalIO::DO )
{ {
bool set = IOBase::processingAsDO(ib,shm,force_out); bool set = IOBase::processingAsDO(ib,shm,force_out);
if( !it->lamp || (it->lamp && !isTestLamp) ) if( !it->lamp || (it->lamp && !isTestLamp) )
...@@ -768,7 +768,7 @@ bool IOControl::initIOItem( UniXML_iterator& it ) ...@@ -768,7 +768,7 @@ bool IOControl::initIOItem( UniXML_iterator& it )
inf.aref = 0; inf.aref = 0;
inf.range = 0; inf.range = 0;
if( inf.stype == UniversalIO::AnalogInput || inf.stype == UniversalIO::AnalogOutput ) if( inf.stype == UniversalIO::AI || inf.stype == UniversalIO::AO )
{ {
inf.range = it.getIntProp("range"); inf.range = it.getIntProp("range");
if( inf.range < 0 || inf.range > 3 ) if( inf.range < 0 || inf.range > 3 )
...@@ -851,12 +851,12 @@ void IOControl::sigterm( int signo ) ...@@ -851,12 +851,12 @@ void IOControl::sigterm( int signo )
if( it->subdev==DefaultSubdev || it->safety == NoSafety ) if( it->subdev==DefaultSubdev || it->safety == NoSafety )
continue; continue;
if( it->stype == UniversalIO::DigitalOutput || it->lamp ) if( it->stype == UniversalIO::DO || it->lamp )
{ {
bool set = it->invert ? !((bool)it->safety) : (bool)it->safety; bool set = it->invert ? !((bool)it->safety) : (bool)it->safety;
card->setDigitalChannel(it->subdev,it->channel,set); card->setDigitalChannel(it->subdev,it->channel,set);
} }
else if( it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AO )
{ {
card->setAnalogChannel(it->subdev,it->channel,it->safety,it->range,it->aref); card->setAnalogChannel(it->subdev,it->channel,it->safety,it->range,it->aref);
} }
...@@ -892,9 +892,9 @@ void IOControl::initOutputs() ...@@ -892,9 +892,9 @@ void IOControl::initOutputs()
{ {
if( it->lamp ) if( it->lamp )
card->setDigitalChannel(it->subdev,it->channel,(bool)it->defval); card->setDigitalChannel(it->subdev,it->channel,(bool)it->defval);
else if( it->stype == UniversalIO::DigitalOutput ) else if( it->stype == UniversalIO::DO )
card->setDigitalChannel(it->subdev,it->channel,(bool)it->defval); card->setDigitalChannel(it->subdev,it->channel,(bool)it->defval);
else if( it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AO )
card->setAnalogChannel(it->subdev,it->channel,it->defval,it->range,it->aref); card->setAnalogChannel(it->subdev,it->channel,it->defval,it->range,it->aref);
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -925,16 +925,16 @@ void IOControl::initIOCard() ...@@ -925,16 +925,16 @@ void IOControl::initIOCard()
// или "лампочки" (т.к. они фиктивные аналоговые датчики) // или "лампочки" (т.к. они фиктивные аналоговые датчики)
if( it->lamp ) if( it->lamp )
card->configureChannel(it->subdev,it->channel,ComediInterface::DO); card->configureChannel(it->subdev,it->channel,ComediInterface::DO);
else if( it->stype == UniversalIO::DigitalInput ) else if( it->stype == UniversalIO::DI )
card->configureChannel(it->subdev,it->channel,ComediInterface::DI); card->configureChannel(it->subdev,it->channel,ComediInterface::DI);
else if( it->stype == UniversalIO::DigitalOutput ) else if( it->stype == UniversalIO::DO )
card->configureChannel(it->subdev,it->channel,ComediInterface::DO); card->configureChannel(it->subdev,it->channel,ComediInterface::DO);
else if( it->stype == UniversalIO::AnalogInput ) else if( it->stype == UniversalIO::AI )
{ {
card->configureChannel(it->subdev,it->channel,ComediInterface::AI); card->configureChannel(it->subdev,it->channel,ComediInterface::AI);
it->df.init( card->getAnalogChannel(it->subdev, it->channel, it->range, it->aref) ); it->df.init( card->getAnalogChannel(it->subdev, it->channel, it->range, it->aref) );
} }
else if( it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AO )
card->configureChannel(it->subdev,it->channel,ComediInterface::AO); card->configureChannel(it->subdev,it->channel,ComediInterface::AO);
} }
...@@ -1041,12 +1041,12 @@ void IOControl::check_testmode() ...@@ -1041,12 +1041,12 @@ void IOControl::check_testmode()
if( it->subdev==DefaultSubdev || it->safety == NoSafety ) if( it->subdev==DefaultSubdev || it->safety == NoSafety )
continue; continue;
if( it->stype == UniversalIO::DigitalOutput || it->lamp ) if( it->stype == UniversalIO::DO || it->lamp )
{ {
bool set = it->invert ? !((bool)it->safety) : (bool)it->safety; bool set = it->invert ? !((bool)it->safety) : (bool)it->safety;
card->setDigitalChannel(it->subdev,it->channel,set); card->setDigitalChannel(it->subdev,it->channel,set);
} }
else if( it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AO )
{ {
card->setAnalogChannel(it->subdev,it->channel,it->safety,it->range,it->aref); card->setAnalogChannel(it->subdev,it->channel,it->safety,it->range,it->aref);
} }
...@@ -1095,7 +1095,7 @@ void IOControl::check_testlamp() ...@@ -1095,7 +1095,7 @@ void IOControl::check_testlamp()
if( !it->lamp || it->no_testlamp ) if( !it->lamp || it->no_testlamp )
continue; continue;
if( it->stype == UniversalIO::AnalogOutput ) if( it->stype == UniversalIO::AO )
{ {
if( isTestLamp ) if( isTestLamp )
{ {
...@@ -1116,7 +1116,7 @@ void IOControl::check_testlamp() ...@@ -1116,7 +1116,7 @@ void IOControl::check_testlamp()
delBlink(&(*it),lstBlink3); delBlink(&(*it),lstBlink3);
} }
} }
else if( it->stype == UniversalIO::DigitalOutput ) else if( it->stype == UniversalIO::DO )
{ {
if( isTestLamp ) if( isTestLamp )
addBlink(&(*it),lstBlink); addBlink(&(*it),lstBlink);
...@@ -1371,8 +1371,8 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -1371,8 +1371,8 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
if( card == NULL || it->subdev==DefaultSubdev || it->channel==DefaultChannel ) if( card == NULL || it->subdev==DefaultSubdev || it->channel==DefaultChannel )
continue; continue;
if( it->stype == UniversalIO::AnalogOutput || if( it->stype == UniversalIO::AO ||
it->stype == UniversalIO::DigitalOutput ) it->stype == UniversalIO::DO )
{ {
try try
{ {
...@@ -1420,7 +1420,7 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm ) ...@@ -1420,7 +1420,7 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm )
<< endl; << endl;
} }
if( it->stype == UniversalIO::AnalogOutput ) if( it->stype == UniversalIO::AO )
{ {
long prev_val = 0; long prev_val = 0;
long cur_val = 0; long cur_val = 0;
...@@ -1513,7 +1513,7 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm ) ...@@ -1513,7 +1513,7 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm )
} }
} }
} }
else if( it->stype == UniversalIO::DigitalOutput ) else if( it->stype == UniversalIO::DO )
{ {
if( unideb.debugging(Debug::LEVEL1) ) if( unideb.debugging(Debug::LEVEL1) )
{ {
......
...@@ -359,7 +359,7 @@ class IOControl: ...@@ -359,7 +359,7 @@ class IOControl:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator aitHeartBeat;
bool force; /*!< флаг, означающий, что надо сохранять в SM, даже если значение не менялось */ bool force; /*!< флаг, означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out; /*!< флаг, включающий принудительное чтения выходов */ bool force_out; /*!< флаг, включающий принудительное чтения выходов */
...@@ -376,7 +376,7 @@ class IOControl: ...@@ -376,7 +376,7 @@ class IOControl:
UniSetTypes::ObjectId testMode_as; UniSetTypes::ObjectId testMode_as;
IOController::AIOStateList::iterator aitTestMode; IOController::IOStateList::iterator aitTestMode;
long testmode; long testmode;
long prev_testmode; long prev_testmode;
......
...@@ -145,11 +145,11 @@ void LProcessor::setOuts() ...@@ -145,11 +145,11 @@ void LProcessor::setOuts()
{ {
switch(it->iotype) switch(it->iotype)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
ui.saveState(it->sid,it->lnk->from->getOut(),it->iotype); ui.saveState(it->sid,it->lnk->from->getOut(),it->iotype);
break; break;
case UniversalIO::DigitalOutput: case UniversalIO::DO:
ui.setState(it->sid,it->lnk->from->getOut()); ui.setState(it->sid,it->lnk->from->getOut());
break; break;
......
...@@ -112,7 +112,7 @@ class LProcessor ...@@ -112,7 +112,7 @@ class LProcessor
struct EXTInfo struct EXTInfo
{ {
UniSetTypes::ObjectId sid; UniSetTypes::ObjectId sid;
UniversalIO::IOTypes iotype; UniversalIO::IOType iotype;
bool state; bool state;
const Schema::EXTLink* lnk; const Schema::EXTLink* lnk;
}; };
...@@ -120,7 +120,7 @@ class LProcessor ...@@ -120,7 +120,7 @@ class LProcessor
struct EXTOutInfo struct EXTOutInfo
{ {
UniSetTypes::ObjectId sid; UniSetTypes::ObjectId sid;
UniversalIO::IOTypes iotype; UniversalIO::IOType iotype;
const Schema::EXTOut* lnk; const Schema::EXTOut* lnk;
}; };
......
...@@ -155,11 +155,11 @@ void PassiveLProcessor::setOuts() ...@@ -155,11 +155,11 @@ void PassiveLProcessor::setOuts()
{ {
switch(it->iotype) switch(it->iotype)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
shm->saveLocalState(it->sid,it->lnk->from->getOut(),it->iotype); shm->saveLocalState(it->sid,it->lnk->from->getOut(),it->iotype);
break; break;
case UniversalIO::DigitalOutput: case UniversalIO::DO:
shm->setState(it->sid,it->lnk->from->getOut()); shm->setState(it->sid,it->lnk->from->getOut());
break; break;
...@@ -187,11 +187,11 @@ void PassiveLProcessor::sigterm( int signo ) ...@@ -187,11 +187,11 @@ void PassiveLProcessor::sigterm( int signo )
{ {
switch(it->iotype) switch(it->iotype)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
shm->saveLocalState(it->sid,false,it->iotype); shm->saveLocalState(it->sid,false,it->iotype);
break; break;
case UniversalIO::DigitalOutput: case UniversalIO::DO:
shm->setState(it->sid,false); shm->setState(it->sid,false);
break; break;
......
...@@ -51,7 +51,7 @@ class PassiveLProcessor: ...@@ -51,7 +51,7 @@ class PassiveLProcessor:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator aitHeartBeat;
UniSetTypes::uniset_mutex mutex_start; UniSetTypes::uniset_mutex mutex_start;
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
......
...@@ -669,8 +669,8 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty ...@@ -669,8 +669,8 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty
if( p->rnum <= 1 ) if( p->rnum <= 1 )
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
IOBase::processingAsDI( p, data[0], shm, force ); IOBase::processingAsDI( p, data[0], shm, force );
} }
...@@ -687,8 +687,8 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty ...@@ -687,8 +687,8 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty
} }
else if( p->vType == VTypes::vtSigned ) else if( p->vType == VTypes::vtSigned )
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
IOBase::processingAsDI( p, data[0], shm, force ); IOBase::processingAsDI( p, data[0], shm, force );
} }
...@@ -699,8 +699,8 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty ...@@ -699,8 +699,8 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty
} }
else if( p->vType == VTypes::vtUnsigned ) else if( p->vType == VTypes::vtUnsigned )
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
IOBase::processingAsDI( p, data[0], shm, force ); IOBase::processingAsDI( p, data[0], shm, force );
} }
...@@ -1140,8 +1140,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only ) ...@@ -1140,8 +1140,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{ {
if( r->mb_initOK ) if( r->mb_initOK )
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
r->mbval = IOBase::processingAsDO( p, shm, force_out ); r->mbval = IOBase::processingAsDO( p, shm, force_out );
} }
...@@ -1153,8 +1153,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only ) ...@@ -1153,8 +1153,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
} }
else else
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
IOBase::processingAsDI( p, r->mbval, shm, force ); IOBase::processingAsDI( p, r->mbval, shm, force );
} }
...@@ -1175,8 +1175,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only ) ...@@ -1175,8 +1175,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{ {
if( r->mb_initOK ) if( r->mb_initOK )
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
r->mbval = (signed short)IOBase::processingAsDO( p, shm, force_out ); r->mbval = (signed short)IOBase::processingAsDO( p, shm, force_out );
} }
...@@ -1188,8 +1188,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only ) ...@@ -1188,8 +1188,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
} }
else else
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
IOBase::processingAsDI( p, r->mbval, shm, force ); IOBase::processingAsDI( p, r->mbval, shm, force );
} }
...@@ -1206,8 +1206,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only ) ...@@ -1206,8 +1206,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{ {
if( r->mb_initOK ) if( r->mb_initOK )
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
r->mbval = (unsigned short)IOBase::processingAsDO( p, shm, force_out ); r->mbval = (unsigned short)IOBase::processingAsDO( p, shm, force_out );
} }
...@@ -1219,8 +1219,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only ) ...@@ -1219,8 +1219,8 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
} }
else else
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
IOBase::processingAsDI( p, r->mbval, shm, force ); IOBase::processingAsDI( p, r->mbval, shm, force );
} }
...@@ -1683,12 +1683,12 @@ void MBExchange::updateRTU188( RegMap::iterator& rit ) ...@@ -1683,12 +1683,12 @@ void MBExchange::updateRTU188( RegMap::iterator& rit )
{ {
try try
{ {
if( it->stype == UniversalIO::DigitalInput ) if( it->stype == UniversalIO::DI )
{ {
bool set = r->dev->rtu->getState(r->rtuJack,r->rtuChan,it->stype); bool set = r->dev->rtu->getState(r->rtuJack,r->rtuChan,it->stype);
IOBase::processingAsDI( &(*it), set, shm, force ); IOBase::processingAsDI( &(*it), set, shm, force );
} }
else if( it->stype == UniversalIO::AnalogInput ) else if( it->stype == UniversalIO::AI )
{ {
long val = r->dev->rtu->getInt(r->rtuJack,r->rtuChan,it->stype); long val = r->dev->rtu->getInt(r->rtuJack,r->rtuChan,it->stype);
IOBase::processingAsAI( &(*it), val, shm, force ); IOBase::processingAsAI( &(*it), val, shm, force );
...@@ -1870,8 +1870,8 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML_iterator& it ) ...@@ -1870,8 +1870,8 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML_iterator& it )
} }
if( p.nbit > 0 && if( p.nbit > 0 &&
( p.stype == UniversalIO::AnalogInput || ( p.stype == UniversalIO::AI ||
p.stype == UniversalIO::AnalogOutput ) ) p.stype == UniversalIO::AO ) )
{ {
dlog[Debug::WARN] << "(initRSProperty): (ignore) uncorrect param`s nbit>1 (" << p.nbit << ")" dlog[Debug::WARN] << "(initRSProperty): (ignore) uncorrect param`s nbit>1 (" << p.nbit << ")"
<< " but iotype=" << p.stype << " for " << it.getProp("name") << endl; << " but iotype=" << p.stype << " for " << it.getProp("name") << endl;
...@@ -1935,7 +1935,7 @@ bool MBExchange::initRegInfo( RegInfo* r, UniXML_iterator& it, MBExchange::RTUD ...@@ -1935,7 +1935,7 @@ bool MBExchange::initRegInfo( RegInfo* r, UniXML_iterator& it, MBExchange::RTUD
if( !initRTU188item(it,r) ) if( !initRTU188item(it,r) )
return false; return false;
UniversalIO::IOTypes t = UniSetTypes::getIOType(it.getProp("iotype")); UniversalIO::IOType t = UniSetTypes::getIOType(it.getProp("iotype"));
r->mbreg = RTUStorage::getRegister(r->rtuJack,r->rtuChan,t); r->mbreg = RTUStorage::getRegister(r->rtuJack,r->rtuChan,t);
r->mbfunc = RTUStorage::getFunction(r->rtuJack,r->rtuChan,t); r->mbfunc = RTUStorage::getFunction(r->rtuJack,r->rtuChan,t);
...@@ -2324,7 +2324,7 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::RSProperty& p ) ...@@ -2324,7 +2324,7 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::RSProperty& p )
<< " safety=" << p.safety << " safety=" << p.safety
<< " invert=" << p.invert; << " invert=" << p.invert;
if( p.stype == UniversalIO::AnalogInput || p.stype == UniversalIO::AnalogOutput ) if( p.stype == UniversalIO::AI || p.stype == UniversalIO::AO )
{ {
os << p.cal os << p.cal
<< " cdiagram=" << ( p.cdiagram ? "yes" : "no" ); << " cdiagram=" << ( p.cdiagram ? "yes" : "no" );
...@@ -2389,8 +2389,8 @@ bool MBExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniXM ...@@ -2389,8 +2389,8 @@ bool MBExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniXM
return false; return false;
} }
UniversalIO::IOTypes m_iotype = conf->getIOType(d->second->mode_id); UniversalIO::IOType m_iotype = conf->getIOType(d->second->mode_id);
if( m_iotype != UniversalIO::AnalogInput ) if( m_iotype != UniversalIO::AI )
{ {
dlog[Debug::CRIT] << myname << "(initDeviceInfo): modeSensor='" << mod << "' must be 'AI'" << endl; dlog[Debug::CRIT] << myname << "(initDeviceInfo): modeSensor='" << mod << "' must be 'AI'" << endl;
return false; return false;
......
...@@ -170,7 +170,7 @@ class MBExchange: ...@@ -170,7 +170,7 @@ class MBExchange:
bool resp_init; bool resp_init;
bool ask_every_reg; bool ask_every_reg;
UniSetTypes::ObjectId mode_id; UniSetTypes::ObjectId mode_id;
IOController::AIOStateList::iterator mode_ait; IOController::IOStateList::iterator mode_ait;
long mode; // режим работы с устройством (см. ExchangeMode) long mode; // режим работы с устройством (см. ExchangeMode)
// return TRUE if state changed // return TRUE if state changed
...@@ -292,11 +292,11 @@ class MBExchange: ...@@ -292,11 +292,11 @@ class MBExchange:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator aitHeartBeat;
UniSetTypes::ObjectId test_id; UniSetTypes::ObjectId test_id;
UniSetTypes::ObjectId sidExchangeMode; /*!< иденидентификатор для датчика режима работы */ UniSetTypes::ObjectId sidExchangeMode; /*!< иденидентификатор для датчика режима работы */
IOController::AIOStateList::iterator aitExchangeMode; IOController::IOStateList::iterator aitExchangeMode;
long exchangeMode; /*!< режим работы см. ExchangeMode */ long exchangeMode; /*!< режим работы см. ExchangeMode */
UniSetTypes::uniset_rwmutex actMutex; UniSetTypes::uniset_rwmutex actMutex;
......
...@@ -165,14 +165,14 @@ void RTUStorage::poll( ModbusRTUMaster* mb ) ...@@ -165,14 +165,14 @@ void RTUStorage::poll( ModbusRTUMaster* mb )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
long RTUStorage::getInt( RTUJack jack, unsigned short int chan, UniversalIO::IOTypes t ) long RTUStorage::getInt( RTUJack jack, unsigned short int chan, UniversalIO::IOType t )
{ {
return lroundf( getFloat(jack,chan,t) ); return lroundf( getFloat(jack,chan,t) );
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
float RTUStorage::getFloat( RTUJack jack, unsigned short int chan, UniversalIO::IOTypes t ) float RTUStorage::getFloat( RTUJack jack, unsigned short int chan, UniversalIO::IOType t )
{ {
if( t == UniversalIO::AnalogInput ) if( t == UniversalIO::AI )
{ {
switch( jack ) switch( jack )
{ {
...@@ -194,7 +194,7 @@ float RTUStorage::getFloat( RTUJack jack, unsigned short int chan, UniversalIO:: ...@@ -194,7 +194,7 @@ float RTUStorage::getFloat( RTUJack jack, unsigned short int chan, UniversalIO::
return 0; return 0;
} }
if( t == UniversalIO::AnalogOutput ) if( t == UniversalIO::AO )
{ {
switch( jack ) switch( jack )
{ {
...@@ -219,9 +219,9 @@ float RTUStorage::getFloat( RTUJack jack, unsigned short int chan, UniversalIO:: ...@@ -219,9 +219,9 @@ float RTUStorage::getFloat( RTUJack jack, unsigned short int chan, UniversalIO::
return 0; return 0;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool RTUStorage::getState( RTUJack jack, unsigned short int chan, UniversalIO::IOTypes t ) bool RTUStorage::getState( RTUJack jack, unsigned short int chan, UniversalIO::IOType t )
{ {
if( t == UniversalIO::DigitalInput ) if( t == UniversalIO::DI )
{ {
switch( jack ) switch( jack )
{ {
...@@ -243,7 +243,7 @@ bool RTUStorage::getState( RTUJack jack, unsigned short int chan, UniversalIO::I ...@@ -243,7 +243,7 @@ bool RTUStorage::getState( RTUJack jack, unsigned short int chan, UniversalIO::I
return false; return false;
} }
if( t == UniversalIO::DigitalOutput ) if( t == UniversalIO::DO )
{ {
switch( jack ) switch( jack )
{ {
...@@ -264,9 +264,9 @@ bool RTUStorage::getState( RTUJack jack, unsigned short int chan, UniversalIO::I ...@@ -264,9 +264,9 @@ bool RTUStorage::getState( RTUJack jack, unsigned short int chan, UniversalIO::I
return false; return false;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan, UniversalIO::IOTypes t ) ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan, UniversalIO::IOType t )
{ {
if( t == UniversalIO::AnalogInput ) if( t == UniversalIO::AI )
{ {
switch( jack ) switch( jack )
{ {
...@@ -288,7 +288,7 @@ ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan ...@@ -288,7 +288,7 @@ ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan
return -1; return -1;
} }
if( t == UniversalIO::AnalogOutput ) if( t == UniversalIO::AO )
{ {
switch( jack ) switch( jack )
{ {
...@@ -310,7 +310,7 @@ ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan ...@@ -310,7 +310,7 @@ ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan
return -1; return -1;
} }
if( t == UniversalIO::DigitalInput ) if( t == UniversalIO::DI )
{ {
switch( jack ) switch( jack )
{ {
...@@ -332,7 +332,7 @@ ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan ...@@ -332,7 +332,7 @@ ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan
return -1; return -1;
} }
if( t == UniversalIO::DigitalOutput ) if( t == UniversalIO::DO )
{ {
switch( jack ) switch( jack )
{ {
...@@ -353,9 +353,9 @@ ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan ...@@ -353,9 +353,9 @@ ModbusRTU::ModbusData RTUStorage::getRegister( RTUJack jack, unsigned short chan
return -1; return -1;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
ModbusRTU::SlaveFunctionCode RTUStorage::getFunction( RTUJack jack, unsigned short chan, UniversalIO::IOTypes t ) ModbusRTU::SlaveFunctionCode RTUStorage::getFunction( RTUJack jack, unsigned short chan, UniversalIO::IOType t )
{ {
if( t == UniversalIO::AnalogInput ) if( t == UniversalIO::AI )
{ {
switch( jack ) switch( jack )
{ {
...@@ -373,7 +373,7 @@ ModbusRTU::SlaveFunctionCode RTUStorage::getFunction( RTUJack jack, unsigned sho ...@@ -373,7 +373,7 @@ ModbusRTU::SlaveFunctionCode RTUStorage::getFunction( RTUJack jack, unsigned sho
return ModbusRTU::fnUnknown; return ModbusRTU::fnUnknown;
} }
if( t == UniversalIO::AnalogOutput ) if( t == UniversalIO::AO )
{ {
switch( jack ) switch( jack )
{ {
...@@ -393,7 +393,7 @@ ModbusRTU::SlaveFunctionCode RTUStorage::getFunction( RTUJack jack, unsigned sho ...@@ -393,7 +393,7 @@ ModbusRTU::SlaveFunctionCode RTUStorage::getFunction( RTUJack jack, unsigned sho
return ModbusRTU::fnUnknown; return ModbusRTU::fnUnknown;
} }
if( t == UniversalIO::DigitalInput ) if( t == UniversalIO::DI )
{ {
switch( jack ) switch( jack )
{ {
...@@ -411,7 +411,7 @@ ModbusRTU::SlaveFunctionCode RTUStorage::getFunction( RTUJack jack, unsigned sho ...@@ -411,7 +411,7 @@ ModbusRTU::SlaveFunctionCode RTUStorage::getFunction( RTUJack jack, unsigned sho
return ModbusRTU::fnUnknown; return ModbusRTU::fnUnknown;
} }
if( t == UniversalIO::DigitalOutput ) if( t == UniversalIO::DO )
{ {
switch( jack ) switch( jack )
{ {
......
...@@ -41,13 +41,13 @@ class RTUStorage ...@@ -41,13 +41,13 @@ class RTUStorage
static RTUJack s2j( const std::string& jack ); static RTUJack s2j( const std::string& jack );
static std::string j2s( RTUJack j ); static std::string j2s( RTUJack j );
long getInt( RTUJack jack, unsigned short channel, UniversalIO::IOTypes t ); long getInt( RTUJack jack, unsigned short channel, UniversalIO::IOType t );
float getFloat( RTUJack jack, unsigned short channel, UniversalIO::IOTypes t ); float getFloat( RTUJack jack, unsigned short channel, UniversalIO::IOType t );
bool getState( RTUJack jack, unsigned short channel, UniversalIO::IOTypes t ); bool getState( RTUJack jack, unsigned short channel, UniversalIO::IOType t );
static ModbusRTU::ModbusData getRegister( RTUJack jack, unsigned short channel, UniversalIO::IOTypes t ); static ModbusRTU::ModbusData getRegister( RTUJack jack, unsigned short channel, UniversalIO::IOType t );
static ModbusRTU::SlaveFunctionCode getFunction( RTUJack jack, unsigned short channel, UniversalIO::IOTypes t ); static ModbusRTU::SlaveFunctionCode getFunction( RTUJack jack, unsigned short channel, UniversalIO::IOType t );
// ДОДЕЛАТЬ: setState, setValue // ДОДЕЛАТЬ: setState, setValue
void print(); void print();
......
...@@ -105,9 +105,9 @@ int main( int argc, char **argv ) ...@@ -105,9 +105,9 @@ int main( int argc, char **argv )
cout << rtu << endl; cout << rtu << endl;
for( int i=0; i<24; i++ ) for( int i=0; i<24; i++ )
cout << "UNIO1 AI" << i << ": " << rtu.getFloat( RTUStorage::nJ1, i, UniversalIO::AnalogInput ) << endl; cout << "UNIO1 AI" << i << ": " << rtu.getFloat( RTUStorage::nJ1, i, UniversalIO::AI ) << endl;
for( int i=0; i<24; i++ ) for( int i=0; i<24; i++ )
cout << "UNIO1 DI" << i << ": " << rtu.getState( RTUStorage::nJ1, i, UniversalIO::DigitalInput ) << endl; cout << "UNIO1 DI" << i << ": " << rtu.getState( RTUStorage::nJ1, i, UniversalIO::DI ) << endl;
return 0; return 0;
} }
......
...@@ -683,7 +683,7 @@ void MBSlave::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -683,7 +683,7 @@ void MBSlave::askSensors( UniversalIO::UIOCommand cmd )
{ {
IOProperty* p(&it->second); IOProperty* p(&it->second);
// if( p->stype != UniversalIO::DigitalOutput && p->stype != UniversalIO::AnalogOutput ) // if( p->stype != UniversalIO::DO && p->stype != UniversalIO::AO )
// continue; // continue;
// if( p->safety == NoSafetyState ) // if( p->safety == NoSafetyState )
...@@ -708,14 +708,14 @@ void MBSlave::sensorInfo( UniSetTypes::SensorMessage* sm ) ...@@ -708,14 +708,14 @@ void MBSlave::sensorInfo( UniSetTypes::SensorMessage* sm )
if( it->second.si.id == sm->id ) if( it->second.si.id == sm->id )
{ {
IOProperty* p(&it->second); IOProperty* p(&it->second);
if( p->stype == UniversalIO::DigitalOutput || if( p->stype == UniversalIO::DO ||
p->stype == UniversalIO::DigitalInput ) p->stype == UniversalIO::DI )
{ {
uniset_rwmutex_wrlock lock(p->val_lock); uniset_rwmutex_wrlock lock(p->val_lock);
p->value = sm->state ? 1 : 0; p->value = sm->state ? 1 : 0;
} }
else if( p->stype == UniversalIO::AnalogOutput || else if( p->stype == UniversalIO::AO ||
p->stype == UniversalIO::AnalogInput ) p->stype == UniversalIO::AI )
{ {
uniset_rwmutex_wrlock lock(p->val_lock); uniset_rwmutex_wrlock lock(p->val_lock);
p->value = sm->value; p->value = sm->value;
...@@ -963,7 +963,7 @@ std::ostream& operator<<( std::ostream& os, MBSlave::IOProperty& p ) ...@@ -963,7 +963,7 @@ std::ostream& operator<<( std::ostream& os, MBSlave::IOProperty& p )
<< " safety=" << p.safety << " safety=" << p.safety
<< " invert=" << p.invert; << " invert=" << p.invert;
if( p.stype == UniversalIO::AnalogInput || p.stype == UniversalIO::AnalogOutput ) if( p.stype == UniversalIO::AI || p.stype == UniversalIO::AO )
{ {
os << p.cal os << p.cal
<< " cdiagram=" << ( p.cdiagram ? "yes" : "no" ); << " cdiagram=" << ( p.cdiagram ? "yes" : "no" );
...@@ -1090,8 +1090,8 @@ ModbusRTU::mbErrCode MBSlave::real_write_it( IOMap::iterator& it, ModbusRTU::Mod ...@@ -1090,8 +1090,8 @@ ModbusRTU::mbErrCode MBSlave::real_write_it( IOMap::iterator& it, ModbusRTU::Mod
if( p->vtype == VTypes::vtUnknown ) if( p->vtype == VTypes::vtUnknown )
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
IOBase::processingAsDI( p, mbval, shm, force ); IOBase::processingAsDI( p, mbval, shm, force );
} }
...@@ -1147,14 +1147,14 @@ ModbusRTU::mbErrCode MBSlave::real_write_it( IOMap::iterator& it, ModbusRTU::Mod ...@@ -1147,14 +1147,14 @@ ModbusRTU::mbErrCode MBSlave::real_write_it( IOMap::iterator& it, ModbusRTU::Mod
*/ */
/* /*
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
bool set = val ? true : false; bool set = val ? true : false;
IOBase::processingAsDI(p,set,shm,force); IOBase::processingAsDI(p,set,shm,force);
} }
else if( p->stype == UniversalIO::AnalogInput || else if( p->stype == UniversalIO::AI ||
p->stype == UniversalIO::AnalogOutput ) p->stype == UniversalIO::AO )
{ {
IOBase::processingAsAI( p, val, shm, force ); IOBase::processingAsAI( p, val, shm, force );
} }
...@@ -1274,13 +1274,13 @@ ModbusRTU::mbErrCode MBSlave::real_read_it( IOMap::iterator& it, ModbusRTU::Modb ...@@ -1274,13 +1274,13 @@ ModbusRTU::mbErrCode MBSlave::real_read_it( IOMap::iterator& it, ModbusRTU::Modb
if( p->amode == MBSlave::amWO ) if( p->amode == MBSlave::amWO )
return ModbusRTU::erBadDataAddress; return ModbusRTU::erBadDataAddress;
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
val = IOBase::processingAsDO(p,shm,force) ? 1 : 0; val = IOBase::processingAsDO(p,shm,force) ? 1 : 0;
} }
else if( p->stype == UniversalIO::AnalogInput || else if( p->stype == UniversalIO::AI ||
p->stype == UniversalIO::AnalogOutput ) p->stype == UniversalIO::AO )
{ {
if( p->vtype == VTypes::vtUnknown ) if( p->vtype == VTypes::vtUnknown )
{ {
......
...@@ -174,10 +174,10 @@ class MBSlave: ...@@ -174,10 +174,10 @@ class MBSlave:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator aitHeartBeat;
UniSetTypes::ObjectId test_id; UniSetTypes::ObjectId test_id;
IOController::AIOStateList::iterator aitAskCount; IOController::IOStateList::iterator aitAskCount;
UniSetTypes::ObjectId askcount_id; UniSetTypes::ObjectId askcount_id;
IOController::DIOStateList::iterator ditRespond; IOController::DIOStateList::iterator ditRespond;
......
...@@ -38,7 +38,7 @@ class SMDBServer: ...@@ -38,7 +38,7 @@ class SMDBServer:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator aitHeartBeat;
UniSetTypes::ObjectId test_id; UniSetTypes::ObjectId test_id;
std::string db_locale; std::string db_locale;
......
...@@ -41,7 +41,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ) ...@@ -41,7 +41,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
activated(false), activated(false),
workready(false), workready(false),
dblogging(false), dblogging(false),
iotypePulsar(UniversalIO::DigitalInput), iotypePulsar(UniversalIO::DI),
msecPulsar(0) msecPulsar(0)
{ {
mutex_start.setName(myname + "_mutex_start"); mutex_start.setName(myname + "_mutex_start");
...@@ -128,7 +128,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ) ...@@ -128,7 +128,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
{ {
iotypePulsar = UniSetTypes::getIOType(t); iotypePulsar = UniSetTypes::getIOType(t);
if( iotypePulsar == UniversalIO::UnknownIOType || if( iotypePulsar == UniversalIO::UnknownIOType ||
iotypePulsar == UniversalIO::AnalogInput || iotypePulsar == UniversalIO::AnalogOutput ) iotypePulsar == UniversalIO::AI || iotypePulsar == UniversalIO::AO )
{ {
ostringstream err; ostringstream err;
err << myname << ": Invalid iotype '" << t << "' for pulsar. Must be 'DI' or 'DO'"; err << myname << ": Invalid iotype '" << t << "' for pulsar. Must be 'DI' or 'DO'";
...@@ -239,9 +239,9 @@ void SharedMemory::timerInfo( TimerMessage *tm ) ...@@ -239,9 +239,9 @@ void SharedMemory::timerInfo( TimerMessage *tm )
{ {
bool st = localGetState(ditPulsar,siPulsar); bool st = localGetState(ditPulsar,siPulsar);
st ^= true; st ^= true;
if( iotypePulsar == UniversalIO::DigitalInput ) if( iotypePulsar == UniversalIO::DI )
localSaveState(ditPulsar,siPulsar,st,getId()); localSaveState(ditPulsar,siPulsar,st,getId());
else if( iotypePulsar == UniversalIO::DigitalOutput ) else if( iotypePulsar == UniversalIO::DO )
localSetState(ditPulsar,siPulsar,st,getId()); localSetState(ditPulsar,siPulsar,st,getId());
} }
} }
...@@ -336,7 +336,7 @@ bool SharedMemory::activateObject() ...@@ -336,7 +336,7 @@ bool SharedMemory::activateObject()
// инициализируем указатели // инициализируем указатели
for( HeartBeatList::iterator it=hlist.begin(); it!=hlist.end(); ++it ) for( HeartBeatList::iterator it=hlist.begin(); it!=hlist.end(); ++it )
{ {
it->ait = myaioEnd(); it->ait = myioEnd();
it->dit = mydioEnd(); it->dit = mydioEnd();
} }
...@@ -348,7 +348,7 @@ bool SharedMemory::activateObject() ...@@ -348,7 +348,7 @@ bool SharedMemory::activateObject()
// cerr << "history for id=" << it->id << " count=" << it->hlst.size() << endl; // cerr << "history for id=" << it->id << " count=" << it->hlst.size() << endl;
for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit ) for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit )
{ {
hit->ait = myaioEnd(); hit->ait = myioEnd();
hit->dit = mydioEnd(); hit->dit = mydioEnd();
} }
} }
...@@ -750,7 +750,7 @@ void SharedMemory::saveHistory() ...@@ -750,7 +750,7 @@ void SharedMemory::saveHistory()
{ {
for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit ) for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit )
{ {
if( hit->ait != myaioEnd() ) if( hit->ait != myioEnd() )
hit->add( localGetValue( hit->ait, hit->ait->second.si ), it->size ); hit->add( localGetValue( hit->ait, hit->ait->second.si ), it->size );
else if( hit->dit != mydioEnd() ) else if( hit->dit != mydioEnd() )
hit->add( localGetState( hit->dit, hit->dit->second.si ), it->size ); hit->add( localGetState( hit->dit, hit->dit->second.si ), it->size );
...@@ -794,7 +794,25 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm ) ...@@ -794,7 +794,25 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm )
for( History::iterator it=hist.begin(); it!=hist.end(); ++it ) for( History::iterator it=hist.begin(); it!=hist.end(); ++it )
{ {
if( sm->id == it->fuse_id ) History::iterator it( (*it1) );
if( sm->sensor_type == UniversalIO::DI ||
sm->sensor_type == UniversalIO::DO )
{
bool st = it->fuse_invert ? !sm->state : sm->state;
if( st )
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(updateHistory): HISTORY EVENT for " << (*it) << endl;
it->fuse_sec = sm->sm_tv_sec;
it->fuse_usec = sm->sm_tv_usec;
m_historySignal.emit( &(*it) );
}
}
else if( sm->sensor_type == UniversalIO::AI ||
sm->sensor_type == UniversalIO::AO )
>>>>>>> Первый этап переделок в связи с переходом на getValue/setValue
{ {
if( sm->sensor_type == UniversalIO::DigitalInput || if( sm->sensor_type == UniversalIO::DigitalInput ||
sm->sensor_type == UniversalIO::DigitalOutput ) sm->sensor_type == UniversalIO::DigitalOutput )
......
...@@ -283,7 +283,7 @@ class SharedMemory: ...@@ -283,7 +283,7 @@ class SharedMemory:
UniSetTypes::ObjectId id; UniSetTypes::ObjectId id;
HBuffer buf; HBuffer buf;
AIOStateList::iterator ait; IOStateList::iterator ait;
DIOStateList::iterator dit; DIOStateList::iterator dit;
void add( long val, size_t size ) void add( long val, size_t size )
...@@ -375,7 +375,7 @@ class SharedMemory: ...@@ -375,7 +375,7 @@ class SharedMemory:
UniSetTypes::ObjectId a_sid; // аналоговый счётчик UniSetTypes::ObjectId a_sid; // аналоговый счётчик
UniSetTypes::ObjectId d_sid; // дискретный датчик состояния процесса UniSetTypes::ObjectId d_sid; // дискретный датчик состояния процесса
AIOStateList::iterator ait; IOStateList::iterator ait;
DIOStateList::iterator dit; DIOStateList::iterator dit;
int reboot_msec; /*!< Время в течение которого, процесс обязан подтвердить своё существование, int reboot_msec; /*!< Время в течение которого, процесс обязан подтвердить своё существование,
...@@ -432,7 +432,7 @@ class SharedMemory: ...@@ -432,7 +432,7 @@ class SharedMemory:
DIOStateList::iterator ditPulsar; DIOStateList::iterator ditPulsar;
IOController_i::SensorInfo siPulsar; IOController_i::SensorInfo siPulsar;
UniversalIO::IOTypes iotypePulsar; UniversalIO::IOType iotypePulsar;
int msecPulsar; int msecPulsar;
UniSetTypes::uniset_mutex act_mutex; UniSetTypes::uniset_mutex act_mutex;
......
...@@ -130,7 +130,7 @@ class UNetExchange: ...@@ -130,7 +130,7 @@ class UNetExchange:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator aitHeartBeat;
UniSetTypes::ObjectId test_id; UniSetTypes::ObjectId test_id;
int steptime; /*!< периодичность вызова step, [мсек] */ int steptime; /*!< периодичность вызова step, [мсек] */
...@@ -178,7 +178,7 @@ class UNetExchange: ...@@ -178,7 +178,7 @@ class UNetExchange:
IOController::DIOStateList::iterator ditRespond; IOController::DIOStateList::iterator ditRespond;
bool respondInvert; bool respondInvert;
UniSetTypes::ObjectId sidLostPackets; UniSetTypes::ObjectId sidLostPackets;
IOController::AIOStateList::iterator aitLostPackets; IOController::IOStateList::iterator aitLostPackets;
}; };
typedef std::list<ReceiverInfo> ReceiverList; typedef std::list<ReceiverInfo> ReceiverList;
......
...@@ -299,13 +299,13 @@ void UNetReceiver::real_update() ...@@ -299,13 +299,13 @@ void UNetReceiver::real_update()
continue; continue;
} }
if( ii.iotype == UniversalIO::DigitalInput ) if( ii.iotype == UniversalIO::DI )
shm->localSaveState(ii.dit,id,val,shm->ID()); shm->localSaveState(ii.dit,id,val,shm->ID());
else if( ii.iotype == UniversalIO::AnalogInput ) else if( ii.iotype == UniversalIO::AI )
shm->localSaveValue(ii.ait,id,val,shm->ID()); shm->localSaveValue(ii.ait,id,val,shm->ID());
else if( ii.iotype == UniversalIO::AnalogOutput ) else if( ii.iotype == UniversalIO::AO )
shm->localSetValue(ii.ait,id,val,shm->ID()); shm->localSetValue(ii.ait,id,val,shm->ID());
else if( ii.iotype == UniversalIO::DigitalOutput ) else if( ii.iotype == UniversalIO::DO )
shm->localSetState(ii.dit,id,val,shm->ID()); shm->localSetState(ii.dit,id,val,shm->ID());
else else
dlog[Debug::CRIT] << myname << "(update): Unknown iotype for sid=" << id << endl; dlog[Debug::CRIT] << myname << "(update): Unknown iotype for sid=" << id << endl;
...@@ -342,13 +342,13 @@ void UNetReceiver::real_update() ...@@ -342,13 +342,13 @@ void UNetReceiver::real_update()
continue; continue;
} }
if( ii.iotype == UniversalIO::DigitalInput ) if( ii.iotype == UniversalIO::DI )
shm->localSaveState(ii.dit,d.id,d.val,shm->ID()); shm->localSaveState(ii.dit,d.id,d.val,shm->ID());
else if( ii.iotype == UniversalIO::AnalogInput ) else if( ii.iotype == UniversalIO::AI )
shm->localSaveValue(ii.ait,d.id,d.val,shm->ID()); shm->localSaveValue(ii.ait,d.id,d.val,shm->ID());
else if( ii.iotype == UniversalIO::AnalogOutput ) else if( ii.iotype == UniversalIO::AO )
shm->localSetValue(ii.ait,d.id,d.val,shm->ID()); shm->localSetValue(ii.ait,d.id,d.val,shm->ID());
else if( ii.iotype == UniversalIO::DigitalOutput ) else if( ii.iotype == UniversalIO::DO )
shm->localSetState(ii.dit,d.id,d.val,shm->ID()); shm->localSetState(ii.dit,d.id,d.val,shm->ID());
else else
dlog[Debug::CRIT] << myname << "(update): Unknown iotype for sid=" << d.id << endl; dlog[Debug::CRIT] << myname << "(update): Unknown iotype for sid=" << d.id << endl;
......
...@@ -128,7 +128,7 @@ class UNetReceiver ...@@ -128,7 +128,7 @@ class UNetReceiver
IOController::DIOStateList::iterator ditRespond; IOController::DIOStateList::iterator ditRespond;
bool respondInvert; bool respondInvert;
UniSetTypes::ObjectId sidLostPackets; UniSetTypes::ObjectId sidLostPackets;
IOController::AIOStateList::iterator aitLostPackets; IOController::IOStateList::iterator aitLostPackets;
bool activated; bool activated;
...@@ -171,9 +171,9 @@ class UNetReceiver ...@@ -171,9 +171,9 @@ class UNetReceiver
struct ItemInfo struct ItemInfo
{ {
long id; long id;
IOController::AIOStateList::iterator ait; IOController::IOStateList::iterator ait;
IOController::DIOStateList::iterator dit; IOController::DIOStateList::iterator dit;
UniversalIO::IOTypes iotype; UniversalIO::IOType iotype;
ItemInfo(): ItemInfo():
id(UniSetTypes::DefaultObjectId), id(UniSetTypes::DefaultObjectId),
......
...@@ -90,9 +90,9 @@ void UNetSender::updateFromSM() ...@@ -90,9 +90,9 @@ void UNetSender::updateFromSM()
{ {
long value = 0; long value = 0;
if( it->iotype == UniversalIO::DigitalInput || it->iotype == UniversalIO::DigitalOutput ) if( it->iotype == UniversalIO::DI || it->iotype == UniversalIO::DO )
value = shm->localGetState(it->dit,it->id) ? 1 : 0; value = shm->localGetState(it->dit,it->id) ? 1 : 0;
else if( it->iotype == UniversalIO::AnalogInput || it->iotype == UniversalIO::AnalogOutput ) else if( it->iotype == UniversalIO::AI || it->iotype == UniversalIO::AO )
value = shm->localGetValue(it->ait,it->id); value = shm->localGetValue(it->ait,it->id);
else else
{ {
...@@ -126,12 +126,12 @@ void UNetSender::updateItem( DMap::iterator& it, long value ) ...@@ -126,12 +126,12 @@ void UNetSender::updateItem( DMap::iterator& it, long value )
if( it == dlist.end() ) if( it == dlist.end() )
return; return;
if( it->iotype == UniversalIO::DigitalInput || it->iotype == UniversalIO::DigitalOutput ) if( it->iotype == UniversalIO::DI || it->iotype == UniversalIO::DO )
{ {
UniSetTypes::uniset_rwmutex_wrlock l(pack_mutex); UniSetTypes::uniset_rwmutex_wrlock l(pack_mutex);
mypack.setDData(it->pack_ind,value); mypack.setDData(it->pack_ind,value);
} }
else if( it->iotype == UniversalIO::AnalogInput || it->iotype == UniversalIO::AnalogOutput ) else if( it->iotype == UniversalIO::AI || it->iotype == UniversalIO::AO )
{ {
UniSetTypes::uniset_rwmutex_wrlock l(pack_mutex); UniSetTypes::uniset_rwmutex_wrlock l(pack_mutex);
mypack.setAData(it->pack_ind,value); mypack.setAData(it->pack_ind,value);
...@@ -286,7 +286,7 @@ bool UNetSender::initItem( UniXML_iterator& it ) ...@@ -286,7 +286,7 @@ bool UNetSender::initItem( UniXML_iterator& it )
p.id = sid; p.id = sid;
if( p.iotype == UniversalIO::DigitalInput || p.iotype == UniversalIO::DigitalOutput ) if( p.iotype == UniversalIO::DI || p.iotype == UniversalIO::DO )
{ {
p.pack_ind = mypack.addDData(sid,0); p.pack_ind = mypack.addDData(sid,0);
if ( p.pack_ind >= UniSetUDP::MaxDCount ) if ( p.pack_ind >= UniSetUDP::MaxDCount )
...@@ -299,7 +299,7 @@ bool UNetSender::initItem( UniXML_iterator& it ) ...@@ -299,7 +299,7 @@ bool UNetSender::initItem( UniXML_iterator& it )
return false; return false;
} }
} }
else if( p.iotype == UniversalIO::AnalogInput || p.iotype == UniversalIO::AnalogOutput ) else if( p.iotype == UniversalIO::AI || p.iotype == UniversalIO::AO )
{ {
p.pack_ind = mypack.addAData(sid,0); p.pack_ind = mypack.addAData(sid,0);
if ( p.pack_ind >= UniSetUDP::MaxACount ) if ( p.pack_ind >= UniSetUDP::MaxACount )
......
...@@ -31,9 +31,9 @@ class UNetSender ...@@ -31,9 +31,9 @@ class UNetSender
id(UniSetTypes::DefaultObjectId), id(UniSetTypes::DefaultObjectId),
pack_ind(-1){} pack_ind(-1){}
UniversalIO::IOTypes iotype; UniversalIO::IOType iotype;
UniSetTypes::ObjectId id; UniSetTypes::ObjectId id;
IOController::AIOStateList::iterator ait; IOController::IOStateList::iterator ait;
IOController::DIOStateList::iterator dit; IOController::DIOStateList::iterator dit;
int pack_ind; int pack_ind;
......
...@@ -224,13 +224,13 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI ...@@ -224,13 +224,13 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI
try try
{ {
if( m->type == UniversalIO::DigitalInput ) if( m->type == UniversalIO::DI )
shm->localSaveState( s->dit, m->id, (m->value ? true : false ), shm->ID() ); shm->localSaveState( s->dit, m->id, (m->value ? true : false ), shm->ID() );
else if( m->type == UniversalIO::DigitalOutput ) else if( m->type == UniversalIO::DO )
shm->localSetState( s->dit, m->id, (m->value ? true : false ), shm->ID() ); shm->localSetState( s->dit, m->id, (m->value ? true : false ), shm->ID() );
else if( map[i].type == UniversalIO::AnalogInput ) else if( map[i].type == UniversalIO::AI )
shm->localSaveValue( s->ait, m->id, m->value, shm->ID() ); shm->localSaveValue( s->ait, m->id, m->value, shm->ID() );
else if( map[i].type == UniversalIO::AnalogOutput ) else if( map[i].type == UniversalIO::AO )
shm->localSetValue( s->ait, m->id, m->value, shm->ID() ); shm->localSetValue( s->ait, m->id, m->value, shm->ID() );
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -275,13 +275,13 @@ void UniExchange::updateLocalData() ...@@ -275,13 +275,13 @@ void UniExchange::updateLocalData()
try try
{ {
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
if( it->type == UniversalIO::DigitalInput || if( it->type == UniversalIO::DI ||
it->type == UniversalIO::DigitalOutput ) it->type == UniversalIO::DO )
{ {
it->val = shm->localGetState( it->dit, it->id ); it->val = shm->localGetState( it->dit, it->id );
} }
else if( it->type == UniversalIO::AnalogInput || else if( it->type == UniversalIO::AI ||
it->type == UniversalIO::AnalogOutput ) it->type == UniversalIO::AO )
{ {
it->val = shm->localGetValue( it->ait, it->id ); it->val = shm->localGetValue( it->ait, it->id );
} }
......
...@@ -74,10 +74,10 @@ class UniExchange: ...@@ -74,10 +74,10 @@ class UniExchange:
{} {}
IOController::DIOStateList::iterator dit; IOController::DIOStateList::iterator dit;
IOController::AIOStateList::iterator ait; IOController::IOStateList::iterator ait;
long val; long val;
long id; long id;
UniversalIO::IOTypes type; UniversalIO::IOType type;
UniSetTypes::uniset_rwmutex val_lock; UniSetTypes::uniset_rwmutex val_lock;
}; };
......
...@@ -53,7 +53,7 @@ static const int NoSafety = -1; ...@@ -53,7 +53,7 @@ static const int NoSafety = -1;
bool check_depend( SMInterface* shm ); /*!< проверка разрешения(зависимости) от другого датчика */ bool check_depend( SMInterface* shm ); /*!< проверка разрешения(зависимости) от другого датчика */
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
UniversalIO::IOTypes stype; /*!< тип канала (DI,DO,AI,AO) */ UniversalIO::IOType stype; /*!< тип канала (DI,DO,AI,AO) */
IOController_i::CalibrateInfo cal; /*!< калибровочные параметры */ IOController_i::CalibrateInfo cal; /*!< калибровочные параметры */
Calibration* cdiagram; /*!< специальная калибровочная диаграмма */ Calibration* cdiagram; /*!< специальная калибровочная диаграмма */
...@@ -89,11 +89,11 @@ static const int NoSafety = -1; ...@@ -89,11 +89,11 @@ static const int NoSafety = -1;
// Зависимость (d - depend) // Зависимость (d - depend)
UniSetTypes::ObjectId d_id; /*!< идентификатор датчика, от которого зависит данный */ UniSetTypes::ObjectId d_id; /*!< идентификатор датчика, от которого зависит данный */
IOController::AIOStateList::iterator d_ait; /*! итератор на датчик от которого зависит данный */ IOController::IOStateList::iterator d_ait; /*! итератор на датчик от которого зависит данный */
IOController::DIOStateList::iterator d_dit; /*! итератор на датчик от которого зависит данный */ IOController::DIOStateList::iterator d_dit; /*! итератор на датчик от которого зависит данный */
long d_value; /*!< разрешающее работу значение датчика от которого зависит данный */ long d_value; /*!< разрешающее работу значение датчика от которого зависит данный */
long d_off_value; /*!< блокирующее значение */ long d_off_value; /*!< блокирующее значение */
UniversalIO::IOTypes d_iotype; UniversalIO::IOType d_iotype;
// Порог // Порог
UniSetTypes::ObjectId t_ai; /*!< если данный датчик дискретный, UniSetTypes::ObjectId t_ai; /*!< если данный датчик дискретный,
...@@ -103,7 +103,7 @@ static const int NoSafety = -1; ...@@ -103,7 +103,7 @@ static const int NoSafety = -1;
IONotifyController_i::ThresholdInfo ti; IONotifyController_i::ThresholdInfo ti;
IOController::AIOStateList::iterator t_ait; /*! итератор на датчик по которому формируется порог */ IOController::AIOStateList::iterator t_ait; /*! итератор на датчик по которому формируется порог */
IOController::AIOStateList::iterator ait; IOController::IOStateList::iterator ait;
IOController::DIOStateList::iterator dit; IOController::DIOStateList::iterator dit;
UniSetTypes::uniset_rwmutex val_lock; /*!< блокировка на время "работы" со значением */ UniSetTypes::uniset_rwmutex val_lock; /*!< блокировка на время "работы" со значением */
......
...@@ -16,11 +16,11 @@ class SMInterface ...@@ -16,11 +16,11 @@ class SMInterface
void setState ( UniSetTypes::ObjectId, bool state ); void setState ( UniSetTypes::ObjectId, bool state );
void setValue ( UniSetTypes::ObjectId, long value ); void setValue ( UniSetTypes::ObjectId, long value );
bool saveState ( IOController_i::SensorInfo& si, bool state, UniversalIO::IOTypes type, UniSetTypes::ObjectId supplier ); bool saveState ( IOController_i::SensorInfo& si, bool state, UniversalIO::IOType type, UniSetTypes::ObjectId supplier );
bool saveValue ( IOController_i::SensorInfo& si, long value, UniversalIO::IOTypes type, UniSetTypes::ObjectId supplier ); bool saveValue ( IOController_i::SensorInfo& si, long value, UniversalIO::IOType type, UniSetTypes::ObjectId supplier );
bool saveLocalState ( UniSetTypes::ObjectId id, bool state, UniversalIO::IOTypes type=UniversalIO::DigitalInput ); bool saveLocalState ( UniSetTypes::ObjectId id, bool state, UniversalIO::IOType type=UniversalIO::DI );
bool saveLocalValue ( UniSetTypes::ObjectId id, long value, UniversalIO::IOTypes type=UniversalIO::AnalogInput ); bool saveLocalValue ( UniSetTypes::ObjectId id, long value, UniversalIO::IOType type=UniversalIO::AI );
void setUndefinedState( IOController_i::SensorInfo& si, bool undefined, UniSetTypes::ObjectId supplier ); void setUndefinedState( IOController_i::SensorInfo& si, bool undefined, UniSetTypes::ObjectId supplier );
...@@ -34,7 +34,7 @@ class SMInterface ...@@ -34,7 +34,7 @@ class SMInterface
IOController_i::ASensorInfoSeq* getAnalogSensorsMap(); IOController_i::ASensorInfoSeq* getAnalogSensorsMap();
IONotifyController_i::ThresholdsListSeq* getThresholdsList(); IONotifyController_i::ThresholdsListSeq* getThresholdsList();
void localSaveValue( IOController::AIOStateList::iterator& it, void localSaveValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid, UniSetTypes::ObjectId sid,
CORBA::Long newvalue, UniSetTypes::ObjectId sup_id ); CORBA::Long newvalue, UniSetTypes::ObjectId sup_id );
...@@ -46,26 +46,26 @@ class SMInterface ...@@ -46,26 +46,26 @@ class SMInterface
UniSetTypes::ObjectId sid, UniSetTypes::ObjectId sid,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id ); CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id );
void localSetValue( IOController::AIOStateList::iterator& it, void localSetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid, UniSetTypes::ObjectId sid,
CORBA::Long value, UniSetTypes::ObjectId sup_id ); CORBA::Long value, UniSetTypes::ObjectId sup_id );
bool localGetState( IOController::DIOStateList::iterator& it, bool localGetState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid ); UniSetTypes::ObjectId sid );
long localGetValue( IOController::AIOStateList::iterator& it, long localGetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid ); UniSetTypes::ObjectId sid );
/*! функция выставления признака неопределённого состояния для аналоговых датчиков /*! функция выставления признака неопределённого состояния для аналоговых датчиков
// для дискретных датчиков необходимости для подобной функции нет. // для дискретных датчиков необходимости для подобной функции нет.
// см. логику выставления в функции localSaveState // см. логику выставления в функции localSaveState
*/ */
void localSetUndefinedState( IOController::AIOStateList::iterator& it, void localSetUndefinedState( IOController::IOStateList::iterator& it,
bool undefined, UniSetTypes::ObjectId sid ); bool undefined, UniSetTypes::ObjectId sid );
// специальные функции // специальные функции
IOController::DIOStateList::iterator dioEnd(); IOController::DIOStateList::iterator dioEnd();
IOController::AIOStateList::iterator aioEnd(); IOController::IOStateList::iterator ioEnd();
void initAIterator( IOController::AIOStateList::iterator& it ); void initAIterator( IOController::IOStateList::iterator& it );
void initDIterator( IOController::DIOStateList::iterator& it ); void initDIterator( IOController::DIOStateList::iterator& it );
bool exist(); bool exist();
......
...@@ -97,7 +97,7 @@ bool IOBase::check_depend( SMInterface* shm ) ...@@ -97,7 +97,7 @@ bool IOBase::check_depend( SMInterface* shm )
if( d_id == DefaultObjectId ) if( d_id == DefaultObjectId )
return true; return true;
if( d_iotype == UniversalIO::DigitalInput || d_iotype == UniversalIO::DigitalOutput ) if( d_iotype == UniversalIO::DI || d_iotype == UniversalIO::DO )
{ {
if( shm->localGetState(d_dit,d_id) == (bool)d_value ) if( shm->localGetState(d_dit,d_id) == (bool)d_value )
return true; return true;
...@@ -105,7 +105,7 @@ bool IOBase::check_depend( SMInterface* shm ) ...@@ -105,7 +105,7 @@ bool IOBase::check_depend( SMInterface* shm )
return false; return false;
} }
if( d_iotype == UniversalIO::AnalogInput || d_iotype == UniversalIO::AnalogOutput ) if( d_iotype == UniversalIO::AI || d_iotype == UniversalIO::AO )
{ {
if( shm->localGetValue(d_ait,d_id) == d_value ) if( shm->localGetValue(d_ait,d_id) == d_value )
return true; return true;
...@@ -176,13 +176,13 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force ...@@ -176,13 +176,13 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force
if( force || it->value != val ) if( force || it->value != val )
{ {
if( it->stype == UniversalIO::AnalogInput ) if( it->stype == UniversalIO::AI )
shm->localSaveValue( it->ait,it->si.id,val,shm->ID() ); shm->localSaveValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,val,shm->ID() ); shm->localSetValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::DigitalOutput ) else if( it->stype == UniversalIO::DO )
shm->localSetState( it->dit,it->si.id,(bool)val,shm->ID() ); shm->localSetState( it->dit,it->si.id,(bool)val,shm->ID() );
else if( it->stype == UniversalIO::DigitalInput ) else if( it->stype == UniversalIO::DI )
shm->localSaveState( it->dit,it->si.id,(bool)val,shm->ID() ); shm->localSaveState( it->dit,it->si.id,(bool)val,shm->ID() );
it->value = val; it->value = val;
...@@ -234,13 +234,13 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for ...@@ -234,13 +234,13 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for
if( force || it->value != val ) if( force || it->value != val )
{ {
if( it->stype == UniversalIO::AnalogInput ) if( it->stype == UniversalIO::AI )
shm->localSaveValue( it->ait,it->si.id,val,shm->ID() ); shm->localSaveValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,val,shm->ID() ); shm->localSetValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::DigitalOutput ) else if( it->stype == UniversalIO::DO )
shm->localSetState( it->dit,it->si.id,(bool)val,shm->ID() ); shm->localSetState( it->dit,it->si.id,(bool)val,shm->ID() );
else if( it->stype == UniversalIO::DigitalInput ) else if( it->stype == UniversalIO::DI )
shm->localSaveState( it->dit,it->si.id,(bool)val,shm->ID() ); shm->localSaveState( it->dit,it->si.id,(bool)val,shm->ID() );
it->value = val; it->value = val;
...@@ -265,13 +265,13 @@ void IOBase::processingAsDI( IOBase* it, bool set, SMInterface* shm, bool force ...@@ -265,13 +265,13 @@ void IOBase::processingAsDI( IOBase* it, bool set, SMInterface* shm, bool force
uniset_rwmutex_wrlock lock(it->val_lock); uniset_rwmutex_wrlock lock(it->val_lock);
if( force || (bool)it->value!=set ) if( force || (bool)it->value!=set )
{ {
if( it->stype == UniversalIO::DigitalInput ) if( it->stype == UniversalIO::DI )
shm->localSaveState(it->dit,it->si.id,set,shm->ID()); shm->localSaveState(it->dit,it->si.id,set,shm->ID());
else if( it->stype == UniversalIO::DigitalOutput ) else if( it->stype == UniversalIO::DO )
shm->localSetState(it->dit,it->si.id,set,shm->ID()); shm->localSetState(it->dit,it->si.id,set,shm->ID());
else if( it->stype == UniversalIO::AnalogInput ) else if( it->stype == UniversalIO::AI )
shm->localSaveValue( it->ait,it->si.id,(set ? 1:0),shm->ID() ); shm->localSaveValue( it->ait,it->si.id,(set ? 1:0),shm->ID() );
else if( it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,(set ? 1:0),shm->ID() ); shm->localSetValue( it->ait,it->si.id,(set ? 1:0),shm->ID() );
it->value = set ? 1 : 0; it->value = set ? 1 : 0;
...@@ -290,16 +290,16 @@ long IOBase::processingAsAO( IOBase* it, SMInterface* shm, bool force ) ...@@ -290,16 +290,16 @@ long IOBase::processingAsAO( IOBase* it, SMInterface* shm, bool force )
if( force ) if( force )
{ {
if( it->stype == UniversalIO::DigitalInput || it->stype == UniversalIO::DigitalOutput ) if( it->stype == UniversalIO::DI || it->stype == UniversalIO::DO )
val = shm->localGetState(it->dit,it->si.id) ? 1 : 0; val = shm->localGetState(it->dit,it->si.id) ? 1 : 0;
else if( it->stype == UniversalIO::AnalogInput || it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AI || it->stype == UniversalIO::AO )
val = shm->localGetValue(it->ait,it->si.id); val = shm->localGetValue(it->ait,it->si.id);
it->value = val; it->value = val;
} }
if( it->stype == UniversalIO::AnalogOutput || if( it->stype == UniversalIO::AO ||
it->stype == UniversalIO::AnalogInput ) it->stype == UniversalIO::AI )
{ {
if( it->cdiagram ) // задана специальная калибровочная диаграмма if( it->cdiagram ) // задана специальная калибровочная диаграмма
{ {
...@@ -343,9 +343,9 @@ bool IOBase::processingAsDO( IOBase* it, SMInterface* shm, bool force ) ...@@ -343,9 +343,9 @@ bool IOBase::processingAsDO( IOBase* it, SMInterface* shm, bool force )
if( force ) if( force )
{ {
if( it->stype == UniversalIO::DigitalInput || it->stype == UniversalIO::DigitalOutput ) if( it->stype == UniversalIO::DI || it->stype == UniversalIO::DO )
set = shm->localGetState(it->dit,it->si.id); set = shm->localGetState(it->dit,it->si.id);
else if( it->stype == UniversalIO::AnalogInput || it->stype == UniversalIO::AnalogOutput ) else if( it->stype == UniversalIO::AI || it->stype == UniversalIO::AO )
set = shm->localGetValue(it->ait,it->si.id) ? true : false; set = shm->localGetValue(it->ait,it->si.id) ? true : false;
} }
...@@ -368,8 +368,8 @@ float IOBase::processingFasAO( IOBase* it, SMInterface* shm, bool force ) ...@@ -368,8 +368,8 @@ float IOBase::processingFasAO( IOBase* it, SMInterface* shm, bool force )
it->value = val; it->value = val;
} }
if( it->stype == UniversalIO::AnalogOutput || if( it->stype == UniversalIO::AO ||
it->stype == UniversalIO::AnalogInput ) it->stype == UniversalIO::AI )
{ {
if( it->cdiagram ) // задана специальная калибровочная диаграмма if( it->cdiagram ) // задана специальная калибровочная диаграмма
{ {
...@@ -522,7 +522,7 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm, ...@@ -522,7 +522,7 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->d_iotype = conf->getIOType(b->d_id); b->d_iotype = conf->getIOType(b->d_id);
} }
if( b->stype == UniversalIO::AnalogInput || b->stype == UniversalIO::AnalogOutput ) if( b->stype == UniversalIO::AI || b->stype == UniversalIO::AO )
{ {
b->cal.minRaw = it.getIntProp("rmin"); b->cal.minRaw = it.getIntProp("rmin");
b->cal.maxRaw = it.getIntProp("rmax"); b->cal.maxRaw = it.getIntProp("rmax");
...@@ -572,7 +572,7 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm, ...@@ -572,7 +572,7 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
if( !it.getProp("iir_coeff_new").empty() ) if( !it.getProp("iir_coeff_new").empty() )
f_iir_coeff_new = atof(it.getProp("iir_coeff_new").c_str()); f_iir_coeff_new = atof(it.getProp("iir_coeff_new").c_str());
if( b->stype == UniversalIO::AnalogInput ) if( b->stype == UniversalIO::AI )
b->df.setSettings( f_size, f_T, f_lsparam, f_iir, b->df.setSettings( f_size, f_T, f_lsparam, f_iir,
f_iir_coeff_prev, f_iir_coeff_new ); f_iir_coeff_prev, f_iir_coeff_new );
...@@ -582,7 +582,7 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm, ...@@ -582,7 +582,7 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
if( !caldiagram.empty() ) if( !caldiagram.empty() )
b->cdiagram = UniSetExtensions::buildCalibrationDiagram(caldiagram); b->cdiagram = UniSetExtensions::buildCalibrationDiagram(caldiagram);
} }
else if( b->stype == UniversalIO::DigitalInput || b->stype == UniversalIO::DigitalOutput ) else if( b->stype == UniversalIO::DI || b->stype == UniversalIO::DO )
{ {
string tai(it.getProp("threshold_aid")); string tai(it.getProp("threshold_aid"));
if( !tai.empty() ) if( !tai.empty() )
......
...@@ -140,7 +140,7 @@ void SMInterface::setValue ( UniSetTypes::ObjectId id, long value ) ...@@ -140,7 +140,7 @@ void SMInterface::setValue ( UniSetTypes::ObjectId id, long value )
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool SMInterface::saveState ( IOController_i::SensorInfo& si, bool state, bool SMInterface::saveState ( IOController_i::SensorInfo& si, bool state,
UniversalIO::IOTypes type, UniSetTypes::ObjectId sup_id ) UniversalIO::IOType type, UniSetTypes::ObjectId sup_id )
{ {
if( ic ) if( ic )
{ {
...@@ -157,7 +157,7 @@ bool SMInterface::saveState ( IOController_i::SensorInfo& si, bool state, ...@@ -157,7 +157,7 @@ bool SMInterface::saveState ( IOController_i::SensorInfo& si, bool state,
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool SMInterface::saveValue ( IOController_i::SensorInfo& si, long value, bool SMInterface::saveValue ( IOController_i::SensorInfo& si, long value,
UniversalIO::IOTypes type, UniSetTypes::ObjectId sup_id ) UniversalIO::IOType type, UniSetTypes::ObjectId sup_id )
{ {
if( ic ) if( ic )
{ {
...@@ -210,7 +210,7 @@ bool SMInterface::getState ( UniSetTypes::ObjectId id ) ...@@ -210,7 +210,7 @@ bool SMInterface::getState ( UniSetTypes::ObjectId id )
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool SMInterface::saveLocalState( UniSetTypes::ObjectId id, bool state, bool SMInterface::saveLocalState( UniSetTypes::ObjectId id, bool state,
UniversalIO::IOTypes type ) UniversalIO::IOType type )
{ {
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
si.id = id; si.id = id;
...@@ -219,7 +219,7 @@ bool SMInterface::saveLocalState( UniSetTypes::ObjectId id, bool state, ...@@ -219,7 +219,7 @@ bool SMInterface::saveLocalState( UniSetTypes::ObjectId id, bool state,
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool SMInterface::saveLocalValue ( UniSetTypes::ObjectId id, long value, bool SMInterface::saveLocalValue ( UniSetTypes::ObjectId id, long value,
UniversalIO::IOTypes type ) UniversalIO::IOType type )
{ {
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
si.id = id; si.id = id;
...@@ -325,13 +325,13 @@ IOController::DIOStateList::iterator SMInterface::dioEnd() ...@@ -325,13 +325,13 @@ IOController::DIOStateList::iterator SMInterface::dioEnd()
return ic->dioEnd(); return ic->dioEnd();
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
IOController::AIOStateList::iterator SMInterface::aioEnd() IOController::IOStateList::iterator SMInterface::ioEnd()
{ {
CHECK_IC_PTR(aioEnd) CHECK_IC_PTR(ioEnd)
return ic->aioEnd(); return ic->ioEnd();
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void SMInterface::localSaveValue( IOController::IOController::AIOStateList::iterator& it, void SMInterface::localSaveValue( IOController::IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid, UniSetTypes::ObjectId sid,
CORBA::Long nval, UniSetTypes::ObjectId sup_id ) CORBA::Long nval, UniSetTypes::ObjectId sup_id )
{ {
...@@ -376,7 +376,7 @@ void SMInterface::localSetState( IOController::DIOStateList::iterator& it, ...@@ -376,7 +376,7 @@ void SMInterface::localSetState( IOController::DIOStateList::iterator& it,
ic->localSetState(it,si,newstate,sup_id); ic->localSetState(it,si,newstate,sup_id);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void SMInterface::localSetValue( IOController::AIOStateList::iterator& it, void SMInterface::localSetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid, UniSetTypes::ObjectId sid,
CORBA::Long value, UniSetTypes::ObjectId sup_id ) CORBA::Long value, UniSetTypes::ObjectId sup_id )
{ {
...@@ -402,7 +402,7 @@ bool SMInterface::localGetState( IOController::DIOStateList::iterator& it, UniSe ...@@ -402,7 +402,7 @@ bool SMInterface::localGetState( IOController::DIOStateList::iterator& it, UniSe
return ic->localGetState(it,si); return ic->localGetState(it,si);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
long SMInterface::localGetValue( IOController::AIOStateList::iterator& it, UniSetTypes::ObjectId sid ) long SMInterface::localGetValue( IOController::IOStateList::iterator& it, UniSetTypes::ObjectId sid )
{ {
if( !ic ) if( !ic )
return getValue( sid ); return getValue( sid );
...@@ -414,7 +414,7 @@ long SMInterface::localGetValue( IOController::AIOStateList::iterator& it, UniSe ...@@ -414,7 +414,7 @@ long SMInterface::localGetValue( IOController::AIOStateList::iterator& it, UniSe
return ic->localGetValue(it,si); return ic->localGetValue(it,si);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void SMInterface::localSetUndefinedState( IOController::AIOStateList::iterator& it, void SMInterface::localSetUndefinedState( IOController::IOStateList::iterator& it,
bool undefined, bool undefined,
UniSetTypes::ObjectId sid ) UniSetTypes::ObjectId sid )
{ {
...@@ -434,10 +434,10 @@ void SMInterface::localSetUndefinedState( IOController::AIOStateList::iterator& ...@@ -434,10 +434,10 @@ void SMInterface::localSetUndefinedState( IOController::AIOStateList::iterator&
ic->localSetUndefinedState(it,undefined,si); ic->localSetUndefinedState(it,undefined,si);
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void SMInterface::initAIterator( IOController::AIOStateList::iterator& it ) void SMInterface::initAIterator( IOController::IOStateList::iterator& it )
{ {
if( ic ) if( ic )
it = ic->aioEnd(); it = ic->ioEnd();
// else // else
// cerr << "(SMInterface::initAIterator): ic=NULL" << endl; // cerr << "(SMInterface::initAIterator): ic=NULL" << endl;
} }
......
...@@ -399,7 +399,7 @@ void UObject_SK::callback() ...@@ -399,7 +399,7 @@ void UObject_SK::callback()
// "сердцебиение" // "сердцебиение"
if( idHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() ) if( idHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
{ {
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AnalogInput); ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
......
...@@ -105,8 +105,8 @@ namespace UniSetTypes ...@@ -105,8 +105,8 @@ namespace UniSetTypes
xmlNode* getXMLServicesSection(); xmlNode* getXMLServicesSection();
xmlNode* getXMLNodesSection(); xmlNode* getXMLNodesSection();
xmlNode* getXMLObjectNode( UniSetTypes::ObjectId ); xmlNode* getXMLObjectNode( UniSetTypes::ObjectId );
UniversalIO::IOTypes getIOType( UniSetTypes::ObjectId ); UniversalIO::IOType getIOType( UniSetTypes::ObjectId );
UniversalIO::IOTypes getIOType( const std::string name ); UniversalIO::IOType getIOType( const std::string name );
// net // net
inline unsigned int getCountOfNet() const { return countOfNet; } inline unsigned int getCountOfNet() const { return countOfNet; }
......
...@@ -119,16 +119,12 @@ class IONotifyController: ...@@ -119,16 +119,12 @@ class IONotifyController:
virtual UniSetTypes::ObjectType getType(){ return UniSetTypes::getObjectType("IONotifyController"); } virtual UniSetTypes::ObjectType getType(){ return UniSetTypes::getObjectType("IONotifyController"); }
virtual void askSensor(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci, UniversalIO::UIOCommand cmd); virtual void askSensor(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci, UniversalIO::UIOCommand cmd);
virtual void askState(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci, UniversalIO::UIOCommand cmd);
virtual void askValue(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci, UniversalIO::UIOCommand cmd);
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, CORBA::Long sensibility,
UniversalIO::UIOCommand cmd ); UniversalIO::UIOCommand cmd );
virtual void askOutput(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci, 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);
...@@ -183,7 +179,7 @@ class IONotifyController: ...@@ -183,7 +179,7 @@ class IONotifyController:
/*! итератор в списке датчиков /*! итератор в списке датчиков
(для оптимально-быстрого доступа) (для оптимально-быстрого доступа)
*/ */
IOController::DIOStateList::iterator itSID; IOController::IOStateList::iterator itSID;
/*! инверсная логика */ /*! инверсная логика */
bool inverse; bool inverse;
...@@ -207,31 +203,19 @@ class IONotifyController: ...@@ -207,31 +203,19 @@ class IONotifyController:
{ {
ThresholdsListInfo(){} ThresholdsListInfo(){}
ThresholdsListInfo( IOController_i::SensorInfo& si, ThresholdExtList& list, ThresholdsListInfo( IOController_i::SensorInfo& si, ThresholdExtList& list,
UniversalIO::IOTypes t=UniversalIO::AnalogInput ): UniversalIO::IOType t=UniversalIO::AI ):
si(si),type(t),list(list){} si(si),type(t),list(list){}
IOController_i::SensorInfo si; IOController_i::SensorInfo si;
AIOStateList::iterator ait; IOStateList::iterator ait;
UniversalIO::IOTypes type; UniversalIO::IOType type;
ThresholdExtList list; ThresholdExtList list;
}; };
/*! массив пар датчик->список порогов */ /*! массив пар датчик->список порогов */
typedef std::map<UniSetTypes::KeyType,ThresholdsListInfo> AskThresholdMap; typedef std::map<UniSetTypes::KeyType,ThresholdsListInfo> AskThresholdMap;
virtual void localSaveValue( IOController::AIOStateList::iterator& it, virtual void localSetValue( IOController::IOStateList::iterator& it,
const IOController_i::SensorInfo& si,
CORBA::Long newvalue, UniSetTypes::ObjectId sup_id );
virtual void localSaveState( IOController::DIOStateList::iterator& it,
const IOController_i::SensorInfo& si,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id );
virtual void localSetState( IOController::DIOStateList::iterator& it,
const IOController_i::SensorInfo& si,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id );
virtual void localSetValue( IOController::AIOStateList::iterator& it,
const IOController_i::SensorInfo& si, const IOController_i::SensorInfo& si,
CORBA::Long value, UniSetTypes::ObjectId sup_id ); CORBA::Long value, UniSetTypes::ObjectId sup_id );
...@@ -240,15 +224,14 @@ class IONotifyController: ...@@ -240,15 +224,14 @@ class IONotifyController:
virtual bool activateObject(); virtual bool activateObject();
// ФИЛЬТРЫ // ФИЛЬТРЫ
bool myAFilter(const UniAnalogIOInfo& ai, CORBA::Long newvalue, UniSetTypes::ObjectId sup_id); bool myIOFilter(const USensorIOInfo& ai, CORBA::Long newvalue, UniSetTypes::ObjectId sup_id);
bool myDFilter(const UniDigitalIOInfo& ai, CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id);
//! посылка информации об изменении состояния датчика //! посылка информации об изменении состояния датчика
virtual void send(ConsumerList& lst, UniSetTypes::SensorMessage& sm); virtual void send(ConsumerList& lst, UniSetTypes::SensorMessage& sm);
//! проверка срабатывания пороговых датчиков //! проверка срабатывания пороговых датчиков
virtual void checkThreshold( AIOStateList::iterator& li, virtual void checkThreshold( IOStateList::iterator& li,
const IOController_i::SensorInfo& si, bool send=true ); const IOController_i::SensorInfo& si, bool send=true );
//! поиск информации о пороговом датчике //! поиск информации о пороговом датчике
...@@ -298,24 +281,13 @@ class IONotifyController: ...@@ -298,24 +281,13 @@ class IONotifyController:
bool removeThreshold(ThresholdExtList& lst, ThresholdInfoExt& ti, const UniSetTypes::ConsumerInfo& ci); bool removeThreshold(ThresholdExtList& lst, ThresholdInfoExt& ti, const UniSetTypes::ConsumerInfo& ci);
AskMap askDIOList; /*!< список потребителей по дискретным датчикам */ AskMap askIOList; /*!< список потребителей по аналоговым датчикам */
AskMap askAIOList; /*!< список потребителей по аналоговым датчикам */
AskThresholdMap askTMap; /*!< список порогов по аналоговым датчикам */ AskThresholdMap askTMap; /*!< список порогов по аналоговым датчикам */
// Выходы /*! замок для блокирования совместного доступа к cписку потребителей датчиков */
AskMap askDOList; /*!< список потребителей по дискретным выходам */ UniSetTypes::uniset_rwmutex askIOMutex;
AskMap askAOList; /*!< список потребителей по аналоговым выходам */
/*! замок для блокирования совместного доступа к cписку потребителей дискретных датчиков */
UniSetTypes::uniset_rwmutex askDMutex;
/*! замок для блокирования совместного доступа к cписку потребителей аналоговых датчиков */
UniSetTypes::uniset_rwmutex askAMutex;
/*! замок для блокирования совместного доступа к cписку потребителей пороговых датчиков */ /*! замок для блокирования совместного доступа к cписку потребителей пороговых датчиков */
UniSetTypes::uniset_rwmutex trshMutex; UniSetTypes::uniset_rwmutex trshMutex;
/*! замок для блокирования совместного доступа к cписку потребителей аналоговых выходов */
UniSetTypes::uniset_rwmutex askAOMutex;
/*! замок для блокирования совместного доступа к cписку потребителей дискретных выходов */
UniSetTypes::uniset_rwmutex askDOMutex;
int maxAttemtps; /*! timeout for consumer */ int maxAttemtps; /*! timeout for consumer */
}; };
......
...@@ -104,7 +104,6 @@ namespace UniSetTypes ...@@ -104,7 +104,6 @@ namespace UniSetTypes
public: public:
ObjectId id; ObjectId id;
bool state;
long value; long value;
bool undefined; bool undefined;
...@@ -112,7 +111,7 @@ namespace UniSetTypes ...@@ -112,7 +111,7 @@ namespace UniSetTypes
long sm_tv_sec; long sm_tv_sec;
long sm_tv_usec; long sm_tv_usec;
UniversalIO::IOTypes sensor_type; UniversalIO::IOType sensor_type;
IOController_i::CalibrateInfo ci; IOController_i::CalibrateInfo ci;
// для пороговых датчиков // для пороговых датчиков
...@@ -120,13 +119,9 @@ namespace UniSetTypes ...@@ -120,13 +119,9 @@ namespace UniSetTypes
UniSetTypes::ThresholdId tid; UniSetTypes::ThresholdId tid;
SensorMessage(); SensorMessage();
SensorMessage(ObjectId id, bool state, Priority priority = Message::Medium, SensorMessage(ObjectId id, long value, const IOController_i::CalibrateInfo& ci=IOController_i::CalibrateInfo(),
UniversalIO::IOTypes st = UniversalIO::DigitalInput,
ObjectId consumer=UniSetTypes::DefaultObjectId);
SensorMessage(ObjectId id, long value, const IOController_i::CalibrateInfo& ci,
Priority priority = Message::Medium, Priority priority = Message::Medium,
UniversalIO::IOTypes st = UniversalIO::AnalogInput, UniversalIO::IOType st = UniversalIO::AI,
ObjectId consumer=UniSetTypes::DefaultObjectId); ObjectId consumer=UniSetTypes::DefaultObjectId);
SensorMessage(const VoidMessage *msg); SensorMessage(const VoidMessage *msg);
......
...@@ -43,9 +43,9 @@ class NCRestorer ...@@ -43,9 +43,9 @@ class NCRestorer
virtual ~NCRestorer(); virtual ~NCRestorer();
struct SInfo: struct SInfo:
public IOController::UniAnalogIOInfo public IOController::USensorIOInfo
{ {
SInfo( IOController_i::SensorInfo& si, UniversalIO::IOTypes& t, SInfo( IOController_i::SensorInfo& si, UniversalIO::IOType& t,
UniSetTypes::Message::Message::Priority& p, long& def ) UniSetTypes::Message::Message::Priority& p, long& def )
{ {
this->si = si; this->si = si;
...@@ -56,15 +56,12 @@ class NCRestorer ...@@ -56,15 +56,12 @@ class NCRestorer
SInfo() SInfo()
{ {
this->type = UniversalIO::DigitalInput; this->type = UniversalIO::DI;
this->priority = UniSetTypes::Message::Medium; this->priority = UniSetTypes::Message::Medium;
this->default_val = 0; this->default_val = 0;
} }
SInfo &operator=(IOController_i::DigitalIOInfo& inf); SInfo &operator=(IOController_i::SensorIOInfo& inf);
SInfo &operator=(IOController_i::AnalogIOInfo& inf);
operator IOController::UniDigitalIOInfo();
}; };
virtual void read(IONotifyController* ic, const std::string fn="" )=0; virtual void read(IONotifyController* ic, const std::string fn="" )=0;
...@@ -79,46 +76,25 @@ class NCRestorer ...@@ -79,46 +76,25 @@ class NCRestorer
// добавление списка порогов и заказчиков // добавление списка порогов и заказчиков
static void addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyController::ThresholdExtList& lst, bool force=false ); static void addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyController::ThresholdExtList& lst, bool force=false );
/*! регистрация дискретного датчика*/
static inline void dsRegistration( IONotifyController* ic, IOController::UniDigitalIOInfo& inf, bool force=false )
{
ic->dsRegistration(inf,force);
}
/*! регистрация аналогового датчика*/
static inline void asRegistration( IONotifyController* ic, IOController::UniAnalogIOInfo& inf, bool force=false )
{
ic->asRegistration(inf,force);
}
static inline IOController::AIOStateList::iterator aioFind(IONotifyController* ic, UniSetTypes::KeyType k) static inline void ioRegistration( IONotifyController* ic, IOController::USensorIOInfo& inf, bool force=false )
{ {
return ic->myafind(k); ic->ioRegistration(inf,force);
} }
static inline IOController::DIOStateList::iterator dioFind(IONotifyController* ic, UniSetTypes::KeyType k) static inline IOController::IOStateList::iterator ioFind( IONotifyController* ic, UniSetTypes::KeyType k )
{ {
return ic->mydfind(k); return ic->myiofind(k);
} }
static inline IOController::DIOStateList::iterator dioEnd( IONotifyController* ic ) static inline IOController::IOStateList::iterator ioEnd( IONotifyController* ic )
{ {
return ic->mydioEnd(); return ic->myioEnd();
} }
static inline IOController::AIOStateList::iterator aioEnd( IONotifyController* ic ) static inline IOController::IOStateList::iterator ioBegin( IONotifyController* ic )
{ {
return ic->myaioEnd(); return ic->myioBegin();
} }
static inline IOController::DIOStateList::iterator dioBegin( IONotifyController* ic )
{
return ic->mydioBegin();
}
static inline IOController::AIOStateList::iterator aioBegin( IONotifyController* ic )
{
return ic->myaioBegin();
}
}; };
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
/*! /*!
......
...@@ -48,9 +48,8 @@ class SViewer ...@@ -48,9 +48,8 @@ class SViewer
void readSection(const std::string sec, const std::string secRoot); void readSection(const std::string sec, const std::string secRoot);
void getInfo(UniSetTypes::ObjectId id); void getInfo(UniSetTypes::ObjectId id);
virtual void updateDSensors(IOController_i::DSensorInfoSeq_var& dmap, UniSetTypes::ObjectId oid); virtual void updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetTypes::ObjectId oid );
virtual void updateASensors(IOController_i::ASensorInfoSeq_var& amap, UniSetTypes::ObjectId oid); virtual void updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tlst, UniSetTypes::ObjectId oid );
virtual void updateThresholds(IONotifyController_i::ThresholdsListSeq_var& tlst, UniSetTypes::ObjectId oid);
const std::string csec; const std::string csec;
void printInfo(UniSetTypes::ObjectId id, const std::string& sname, long value, const std::string& owner, void printInfo(UniSetTypes::ObjectId id, const std::string& sname, long value, const std::string& owner,
......
...@@ -45,7 +45,7 @@ class StorageInterface ...@@ -45,7 +45,7 @@ class StorageInterface
virtual long getValue(const IOController_i::SensorInfo& si)=0; virtual long getValue(const IOController_i::SensorInfo& si)=0;
virtual void saveState(const IOController_i::DigitalIOInfo& di,bool st)=0; virtual void saveState(const IOController_i::DigitalIOInfo& di,bool st)=0;
virtual void saveValue(const IOController_i::AnalogIOInfo& ai, long val)=0; virtual void saveValue(const IOController_i::SensorIOInfo& ai, long val)=0;
protected: protected:
...@@ -70,7 +70,7 @@ class STLStorage: ...@@ -70,7 +70,7 @@ class STLStorage:
virtual long getValue(const IOController_i::SensorInfo& si); virtual long getValue(const IOController_i::SensorInfo& si);
virtual void saveState(const IOController_i::DigitalIOInfo& di,bool st); virtual void saveState(const IOController_i::DigitalIOInfo& di,bool st);
virtual void saveValue(const IOController_i::AnalogIOInfo& ai, long val); virtual void saveValue(const IOController_i::SensorIOInfo& ai, long val);
protected: protected:
private: private:
......
...@@ -57,8 +57,8 @@ namespace UniSetTypes ...@@ -57,8 +57,8 @@ namespace UniSetTypes
/*! Функция делает ObjectType из const char * (переводит const-строку в обычную, что плохо, но мы обещаем не писать в неё :) ) */ /*! Функция делает ObjectType из const char * (переводит const-строку в обычную, что плохо, но мы обещаем не писать в неё :) ) */
inline static UniSetTypes::ObjectType getObjectType(const char * name) { const void *t = name; return (UniSetTypes::ObjectType)t; } inline static UniSetTypes::ObjectType getObjectType(const char * name) { const void *t = name; return (UniSetTypes::ObjectType)t; }
UniversalIO::IOTypes getIOType( const std::string s ); UniversalIO::IOType getIOType( const std::string s );
std::ostream& operator<<( std::ostream& os, const UniversalIO::IOTypes t ); std::ostream& operator<<( std::ostream& os, const UniversalIO::IOType t );
std::ostream& operator<<( std::ostream& os, const IOController_i::CalibrateInfo c ); std::ostream& operator<<( std::ostream& os, const IOController_i::CalibrateInfo c );
...@@ -102,27 +102,9 @@ namespace UniSetTypes ...@@ -102,27 +102,9 @@ namespace UniSetTypes
}; };
const ObjectId DefaultObjectId = -1; /*!< Идентификатор объекта по умолчанию */ const ObjectId DefaultObjectId = -1; /*!< Идентификатор объекта по умолчанию */
// typedef long MessageCode;
const MessageCode DefaultMessageCode = 0; /*!< код пустого сообщения */
const ThresholdId DefaultThresholdId = -1; /*!< идентификатор порогов по умолчанию */ const ThresholdId DefaultThresholdId = -1; /*!< идентификатор порогов по умолчанию */
const ThresholdId DefaultTimerId = -1; /*!< идентификатор таймера по умолчанию */ const ThresholdId DefaultTimerId = -1; /*!< идентификатор таймера по умолчанию */
/*! Информация о сообщении */
struct MessageInfo
{
UniSetTypes::MessageCode code; /*!< идентификатор */
std::string text; /*!< текст */
std::string idname; /*!< текстовое название идентификатора */
inline bool operator < ( const MessageInfo& m ) const
{
return (code < m.code);
}
};
/*! Информация об имени объекта */ /*! Информация об имени объекта */
struct ObjectInfo struct ObjectInfo
{ {
...@@ -245,7 +227,6 @@ namespace UniSetTypes ...@@ -245,7 +227,6 @@ namespace UniSetTypes
long setoutregion(long raw, long rawMin, long rawMax); long setoutregion(long raw, long rawMin, long rawMax);
bool file_exist( const std::string filename ); bool file_exist( const std::string filename );
IDList explode( const std::string str, char sep=',' ); IDList explode( const std::string str, char sep=',' );
...@@ -268,6 +249,7 @@ namespace UniSetTypes ...@@ -268,6 +249,7 @@ namespace UniSetTypes
// Проверка xml-узла на соответсвие <...f_prop="f_val">, // Проверка xml-узла на соответсвие <...f_prop="f_val">,
// если не задано f_val, то проверяется, что просто f_prop!="" // если не задано f_val, то проверяется, что просто f_prop!=""
bool check_filter( UniXML_iterator& it, const std::string f_prop, const std::string f_val="" ); bool check_filter( UniXML_iterator& it, const std::string f_prop, const std::string f_val="" );
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
} }
......
...@@ -78,7 +78,7 @@ class UniversalInterface ...@@ -78,7 +78,7 @@ class UniversalInterface
// Группа должна принадлежать одному процессу! // Группа должна принадлежать одному процессу!
//! Получение состояния для списка указанных датчиков //! Получение состояния для списка указанных датчиков
IOController_i::ASensorInfoSeq_var getSensorSeq( UniSetTypes::IDList& lst ); IOController_i::SensorInfoSeq_var getSensorSeq( UniSetTypes::IDList& lst );
// Изменения состояния списка входов/выходов // Изменения состояния списка входов/выходов
// Возвращает список не найденных идентификаторов // Возвращает список не найденных идентификаторов
...@@ -90,40 +90,15 @@ class UniversalInterface ...@@ -90,40 +90,15 @@ class UniversalInterface
// ------------------------------------------------------ // ------------------------------------------------------
//! Получение состояния датчика
//! Получение состояния дискретного датчика
bool getState ( UniSetTypes::ObjectId id, UniSetTypes::ObjectId node ) throw(IO_THROW_EXCEPTIONS);
bool getState ( UniSetTypes::ObjectId id );
//! Получение состояния аналогового датчика
long getValue ( UniSetTypes::ObjectId id, UniSetTypes::ObjectId node )throw(IO_THROW_EXCEPTIONS); long getValue ( UniSetTypes::ObjectId id, UniSetTypes::ObjectId node )throw(IO_THROW_EXCEPTIONS);
long getValue ( UniSetTypes::ObjectId id ); long getValue ( UniSetTypes::ObjectId id );
//! Вывод для дискретного датчика //! Выставление состояния датчика
void setState ( UniSetTypes::ObjectId id, bool state, UniSetTypes::ObjectId node ) throw(IO_THROW_EXCEPTIONS);
void setState ( UniSetTypes::ObjectId id, bool state );
void setState ( IOController_i::SensorInfo& si, bool state, UniSetTypes::ObjectId supplier );
//! Вывод для аналогового датчика
void setValue ( UniSetTypes::ObjectId id, long value, UniSetTypes::ObjectId node ) throw(IO_THROW_EXCEPTIONS); void setValue ( UniSetTypes::ObjectId id, long value, UniSetTypes::ObjectId node ) throw(IO_THROW_EXCEPTIONS);
void setValue ( UniSetTypes::ObjectId id, long value); void setValue ( UniSetTypes::ObjectId id, long value);
void setValue ( IOController_i::SensorInfo& si, long value, UniSetTypes::ObjectId supplier ); void setValue ( IOController_i::SensorInfo& si, long value, UniSetTypes::ObjectId supplier );
//! Запись состояния дискретного датчика на удаленный контроллер
bool saveState ( UniSetTypes::ObjectId id, bool state, UniversalIO::IOTypes type, UniSetTypes::ObjectId node ) throw(IO_THROW_EXCEPTIONS);
bool saveState ( UniSetTypes::ObjectId id, bool state, UniversalIO::IOTypes type );
bool saveState ( IOController_i::SensorInfo& si, bool state, UniversalIO::IOTypes type, UniSetTypes::ObjectId supplier );
//! Запись состояния аналогового датчика на удаленный контроллер
bool saveValue ( UniSetTypes::ObjectId id, long value, UniversalIO::IOTypes type, UniSetTypes::ObjectId node ) throw(IO_THROW_EXCEPTIONS);
bool saveValue ( UniSetTypes::ObjectId id, long value, UniversalIO::IOTypes type );
bool saveValue ( IOController_i::SensorInfo& si, long value, UniversalIO::IOTypes type, UniSetTypes::ObjectId supplier );
// функции не вырабатывающие исключений...
void fastSaveValue( IOController_i::SensorInfo& si, long value, UniversalIO::IOTypes type, UniSetTypes::ObjectId supplier );
void fastSaveState( IOController_i::SensorInfo& si, bool state, UniversalIO::IOTypes type, UniSetTypes::ObjectId supplier );
void fastSetState( IOController_i::SensorInfo& si, bool state, UniSetTypes::ObjectId supplier );
void fastSetValue( IOController_i::SensorInfo& si, long value, UniSetTypes::ObjectId supplier ); void fastSetValue( IOController_i::SensorInfo& si, long value, UniSetTypes::ObjectId supplier );
// установка неопределённого состояния // установка неопределённого состояния
...@@ -141,18 +116,6 @@ class UniversalInterface ...@@ -141,18 +116,6 @@ class UniversalInterface
//! Заказ информации об изменении дискретного датчика //! Заказ информации об изменении дискретного датчика
void askRemoteState( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId )throw(IO_THROW_EXCEPTIONS);
void askState( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
//! Заказ информации об изменении аналогового датчика
void askRemoteValue ( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId ) throw(IO_THROW_EXCEPTIONS);
void askValue ( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
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, CORBA::Long sensibility=0,
...@@ -170,33 +133,14 @@ class UniversalInterface ...@@ -170,33 +133,14 @@ class UniversalInterface
void askRemoteSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node, void askRemoteSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId )throw(IO_THROW_EXCEPTIONS); UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId )throw(IO_THROW_EXCEPTIONS);
UniversalIO::IOType getIOType(UniSetTypes::ObjectId id, UniSetTypes::ObjectId node) throw(IO_THROW_EXCEPTIONS);
UniversalIO::IOType getIOType(UniSetTypes::ObjectId id);
void askOutput( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
void askRemoteOutput( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId )throw(IO_THROW_EXCEPTIONS);
//! Заказ таймера
void askTimer( UniSetTypes::TimerId timerid, CORBA::Long timeMS, CORBA::Short ticks=-1,
UniSetTypes::Message::Priority piority=UniSetTypes::Message::High,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId) throw(IO_THROW_EXCEPTIONS);
//! Заказ сообщения
void askMessage( UniSetTypes::MessageCode mid, UniversalIO::UIOCommand cmd, bool ack = true,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId ) throw(IO_THROW_EXCEPTIONS);
void askMessageRange( UniSetTypes::MessageCode from, UniSetTypes::MessageCode to,
UniversalIO::UIOCommand cmd, bool ack = true,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId ) throw(IO_THROW_EXCEPTIONS);
UniversalIO::IOTypes getIOType(UniSetTypes::ObjectId id, UniSetTypes::ObjectId node) throw(IO_THROW_EXCEPTIONS);
UniversalIO::IOTypes getIOType(UniSetTypes::ObjectId id);
UniSetTypes::ObjectType getType(UniSetTypes::ObjectId id, UniSetTypes::ObjectId node) throw(IO_THROW_EXCEPTIONS); UniSetTypes::ObjectType getType(UniSetTypes::ObjectId id, UniSetTypes::ObjectId node) throw(IO_THROW_EXCEPTIONS);
UniSetTypes::ObjectType getType(UniSetTypes::ObjectId id); UniSetTypes::ObjectType getType(UniSetTypes::ObjectId id);
// read from xml (only for xml!) // read from xml (only for xml!)
UniversalIO::IOTypes getConfIOType( UniSetTypes::ObjectId id ); UniversalIO::IOType getConfIOType( UniSetTypes::ObjectId id );
IOController_i::ShortIOInfo getChangedTime( UniSetTypes::ObjectId id, UniSetTypes::ObjectId node ); IOController_i::ShortIOInfo getChangedTime( UniSetTypes::ObjectId id, UniSetTypes::ObjectId node );
IOController_i::ShortMapSeq* getSensors( UniSetTypes::ObjectId id, IOController_i::ShortMapSeq* getSensors( UniSetTypes::ObjectId id,
......
#include "UConnector.h" #include "UConnector.h"
#include "ORepHelpers.h" #include "ORepHelpers.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
using namespace std; using namespace std;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
UConnector::UConnector( UTypes::Params* p, const char* xfile )throw(UException): UConnector::UConnector( UTypes::Params* p, const char* xfile )throw(UException):
conf(0), conf(0),
ui(0), ui(0),
...@@ -42,7 +42,7 @@ xmlfile(xfile) ...@@ -42,7 +42,7 @@ xmlfile(xfile)
throw UException(); throw UException();
} }
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
UConnector::~UConnector() UConnector::~UConnector()
{ {
delete ui; delete ui;
...@@ -54,34 +54,34 @@ const char* UConnector::getConfFileName() ...@@ -54,34 +54,34 @@ const char* UConnector::getConfFileName()
// return xmlfile; // return xmlfile;
if( conf ) if( conf )
return conf->getConfFileName().c_str(); return conf->getConfFileName().c_str();
return ""; return "";
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
long UConnector::getValue( long id, long node )throw(UException) long UConnector::getValue( long id, long node )throw(UException)
{ {
if( !conf || !ui ) if( !conf || !ui )
throw USysError(); throw USysError();
if( node == UTypes::DefaultID ) if( node == UTypes::DefaultID )
node = conf->getLocalNode(); node = conf->getLocalNode();
UniversalIO::IOTypes t = conf->getIOType(id); UniversalIO::IOType t = conf->getIOType(id);
try try
{ {
switch(t) switch(t)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
case UniversalIO::DigitalOutput: case UniversalIO::DO:
return (ui->getState(id,node) ? 1 : 0); return (ui->getState(id,node) ? 1 : 0);
break; break;
case UniversalIO::AnalogInput: case UniversalIO::AI:
case UniversalIO::AnalogOutput: case UniversalIO::AO:
return ui->getValue(id,node); return ui->getValue(id,node);
break; break;
default: default:
{ {
ostringstream e; ostringstream e;
...@@ -102,7 +102,7 @@ long UConnector::getValue( long id, long node )throw(UException) ...@@ -102,7 +102,7 @@ long UConnector::getValue( long id, long node )throw(UException)
{ {
throw UException("(getValue): catch..."); throw UException("(getValue): catch...");
} }
throw UException("(getValue): unknown error"); throw UException("(getValue): unknown error");
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -110,32 +110,32 @@ void UConnector::setValue( long id, long val, long node )throw(UException) ...@@ -110,32 +110,32 @@ void UConnector::setValue( long id, long val, long node )throw(UException)
{ {
if( !conf || !ui ) if( !conf || !ui )
throw USysError(); throw USysError();
if( node == UTypes::DefaultID ) if( node == UTypes::DefaultID )
node = conf->getLocalNode(); node = conf->getLocalNode();
UniversalIO::IOTypes t = conf->getIOType(id); UniversalIO::IOType t = conf->getIOType(id);
try try
{ {
switch(t) switch(t)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
ui->saveState(id,val,t,node); ui->saveState(id,val,t,node);
break; break;
case UniversalIO::DigitalOutput: case UniversalIO::DO:
ui->setState(id,val,node); ui->setState(id,val,node);
break; break;
case UniversalIO::AnalogInput: case UniversalIO::AI:
ui->saveValue(id,val,t,node); ui->saveValue(id,val,t,node);
break; break;
case UniversalIO::AnalogOutput: case UniversalIO::AO:
ui->setValue(id,val,node); ui->setValue(id,val,node);
break; break;
default: default:
{ {
ostringstream e; ostringstream e;
...@@ -162,7 +162,7 @@ long UConnector::getSensorID( const char* name ) ...@@ -162,7 +162,7 @@ long UConnector::getSensorID( const char* name )
{ {
if( conf ) if( conf )
return conf->getSensorID(name); return conf->getSensorID(name);
return UTypes::DefaultID; return UTypes::DefaultID;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -170,7 +170,7 @@ long UConnector::getNodeID( const char* name ) ...@@ -170,7 +170,7 @@ long UConnector::getNodeID( const char* name )
{ {
if( conf ) if( conf )
return conf->getNodeID(name); return conf->getNodeID(name);
return UTypes::DefaultID; return UTypes::DefaultID;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -178,7 +178,7 @@ const char* UConnector::getName( long id ) ...@@ -178,7 +178,7 @@ const char* UConnector::getName( long id )
{ {
if( conf ) if( conf )
return conf->oind->getMapName(id).c_str(); return conf->oind->getMapName(id).c_str();
return ""; return "";
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -186,7 +186,7 @@ const char* UConnector::getShortName( long id ) ...@@ -186,7 +186,7 @@ const char* UConnector::getShortName( long id )
{ {
if( conf ) if( conf )
return ORepHelpers::getShortName(conf->oind->getMapName(id)).c_str(); return ORepHelpers::getShortName(conf->oind->getMapName(id)).c_str();
return ""; return "";
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -194,7 +194,7 @@ const char* UConnector::getTextName( long id ) ...@@ -194,7 +194,7 @@ const char* UConnector::getTextName( long id )
{ {
if( conf ) if( conf )
return conf->oind->getTextName(id).c_str(); return conf->oind->getTextName(id).c_str();
return ""; return "";
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -38,22 +38,22 @@ long UInterface::getValue( long id )throw(UException) ...@@ -38,22 +38,22 @@ long UInterface::getValue( long id )throw(UException)
{ {
if( !UniSetTypes::conf || !ui ) if( !UniSetTypes::conf || !ui )
throw USysError(); throw USysError();
UniversalIO::IOTypes t = UniSetTypes::conf->getIOType(id); UniversalIO::IOType t = UniSetTypes::conf->getIOType(id);
try try
{ {
switch(t) switch(t)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
case UniversalIO::DigitalOutput: case UniversalIO::DO:
return (ui->getState(id) ? 1 : 0); return (ui->getState(id) ? 1 : 0);
break; break;
case UniversalIO::AnalogInput: case UniversalIO::AI:
case UniversalIO::AnalogOutput: case UniversalIO::AO:
return ui->getValue(id); return ui->getValue(id);
break; break;
default: default:
{ {
ostringstream e; ostringstream e;
...@@ -74,7 +74,7 @@ long UInterface::getValue( long id )throw(UException) ...@@ -74,7 +74,7 @@ long UInterface::getValue( long id )throw(UException)
{ {
throw UException("(getValue): catch..."); throw UException("(getValue): catch...");
} }
throw UException("(getValue): unknown error"); throw UException("(getValue): unknown error");
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -82,28 +82,28 @@ void UInterface::setValue( long id, long val )throw(UException) ...@@ -82,28 +82,28 @@ void UInterface::setValue( long id, long val )throw(UException)
{ {
if( !UniSetTypes::conf || !ui ) if( !UniSetTypes::conf || !ui )
throw USysError(); throw USysError();
UniversalIO::IOTypes t = UniSetTypes::conf->getIOType(id); UniversalIO::IOType t = UniSetTypes::conf->getIOType(id);
try try
{ {
switch(t) switch(t)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
ui->saveState(id,val,t); ui->saveState(id,val,t);
break; break;
case UniversalIO::DigitalOutput: case UniversalIO::DO:
ui->setState(id,val); ui->setState(id,val);
break; break;
case UniversalIO::AnalogInput: case UniversalIO::AI:
ui->saveValue(id,val,t); ui->saveValue(id,val,t);
break; break;
case UniversalIO::AnalogOutput: case UniversalIO::AO:
ui->setValue(id,val); ui->setValue(id,val);
break; break;
default: default:
{ {
ostringstream e; ostringstream e;
...@@ -130,7 +130,7 @@ long UInterface::getSensorID( const char* name ) ...@@ -130,7 +130,7 @@ long UInterface::getSensorID( const char* name )
{ {
if( UniSetTypes::conf ) if( UniSetTypes::conf )
return UniSetTypes::conf->getSensorID(name); return UniSetTypes::conf->getSensorID(name);
return -1; return -1;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -138,7 +138,7 @@ const char* UInterface::getName( long id ) ...@@ -138,7 +138,7 @@ const char* UInterface::getName( long id )
{ {
if( UniSetTypes::conf ) if( UniSetTypes::conf )
return UniSetTypes::conf->oind->getMapName(id).c_str(); return UniSetTypes::conf->oind->getMapName(id).c_str();
return ""; return "";
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -146,7 +146,7 @@ const char* UInterface::getShortName( long id ) ...@@ -146,7 +146,7 @@ const char* UInterface::getShortName( long id )
{ {
if( UniSetTypes::conf ) if( UniSetTypes::conf )
return ORepHelpers::getShortName(UniSetTypes::conf->oind->getMapName(id)).c_str(); return ORepHelpers::getShortName(UniSetTypes::conf->oind->getMapName(id)).c_str();
return ""; return "";
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -154,7 +154,7 @@ const char* UInterface::getTextName( long id ) ...@@ -154,7 +154,7 @@ const char* UInterface::getTextName( long id )
{ {
if( UniSetTypes::conf ) if( UniSetTypes::conf )
return UniSetTypes::conf->oind->getTextName(id).c_str(); return UniSetTypes::conf->oind->getTextName(id).c_str();
return ""; return "";
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -162,7 +162,7 @@ const char* UInterface::getConfFileName() ...@@ -162,7 +162,7 @@ const char* UInterface::getConfFileName()
{ {
if( UniSetTypes::conf ) if( UniSetTypes::conf )
return UniSetTypes::conf->getConfFileName().c_str(); return UniSetTypes::conf->getConfFileName().c_str();
return ""; return "";
} }
......
...@@ -226,8 +226,8 @@ long UModbus::data2value( VTypes::VType vtype, ModbusRTU::ModbusData* data ) ...@@ -226,8 +226,8 @@ long UModbus::data2value( VTypes::VType vtype, ModbusRTU::ModbusData* data )
if( p->rnum <= 1 ) if( p->rnum <= 1 )
{ {
if( p->stype == UniversalIO::DigitalInput || if( p->stype == UniversalIO::DI ||
p->stype == UniversalIO::DigitalOutput ) p->stype == UniversalIO::DO )
{ {
IOBase::processingAsDI( p, data[0], shm, force ); IOBase::processingAsDI( p, data[0], shm, force );
} }
......
...@@ -241,9 +241,6 @@ struct MsgInfo ...@@ -241,9 +241,6 @@ struct MsgInfo
MsgInfo(): MsgInfo():
type(Message::Unused), type(Message::Unused),
id(DefaultObjectId), id(DefaultObjectId),
acode(DefaultMessageCode),
ccode(DefaultMessageCode),
ch(0),
node(DefaultObjectId) node(DefaultObjectId)
{ {
// struct timezone tz; // struct timezone tz;
...@@ -254,9 +251,6 @@ struct MsgInfo ...@@ -254,9 +251,6 @@ struct MsgInfo
int type; int type;
ObjectId id; // от кого ObjectId id; // от кого
MessageCode acode; // код сообщения
MessageCode ccode; // код причины
int ch; // характер
struct timeval tm; // время struct timeval tm; // время
ObjectId node; // откуда ObjectId node; // откуда
...@@ -271,12 +265,6 @@ struct MsgInfo ...@@ -271,12 +265,6 @@ struct MsgInfo
if( node != mi.node ) if( node != mi.node )
return node < mi.node; return node < mi.node;
if( acode != mi.acode )
return acode < mi.acode;
if( ch != mi.ch )
return ch < mi.ch;
if( tm.tv_sec != mi.tm.tv_sec ) if( tm.tv_sec != mi.tm.tv_sec )
return tm.tv_sec < mi.tm.tv_sec; return tm.tv_sec < mi.tm.tv_sec;
......
...@@ -313,16 +313,16 @@ using namespace UniSetTypes; ...@@ -313,16 +313,16 @@ using namespace UniSetTypes;
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
std::ostream& UniSetTypes::operator<<( std::ostream& os, const UniversalIO::IOType t ) std::ostream& UniSetTypes::operator<<( std::ostream& os, const UniversalIO::IOType t )
{ {
if( t == UniversalIO::AnalogInput ) if( t == UniversalIO::AI )
return os << "AI"; return os << "AI";
if( t == UniversalIO::DigitalInput ) if( t == UniversalIO::DI )
return os << "DI"; return os << "DI";
if( t == UniversalIO::AnalogOutput ) if( t == UniversalIO::AO )
return os << "AO"; return os << "AO";
if( t == UniversalIO::DigitalOutput ) if( t == UniversalIO::DO )
return os << "DO"; return os << "DO";
return os << "UnknownIOType"; return os << "UnknownIOType";
...@@ -351,3 +351,4 @@ using namespace UniSetTypes; ...@@ -351,3 +351,4 @@ using namespace UniSetTypes;
return true; return true;
} }
// ------------------------------------------------------------------------------------------
...@@ -970,7 +970,7 @@ xmlNode* Configuration::getXMLObjectNode( UniSetTypes::ObjectId id ) ...@@ -970,7 +970,7 @@ xmlNode* Configuration::getXMLObjectNode( UniSetTypes::ObjectId id )
return 0; return 0;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
UniversalIO::IOTypes Configuration::getIOType( UniSetTypes::ObjectId id ) UniversalIO::IOType Configuration::getIOType( UniSetTypes::ObjectId id )
{ {
const ObjectInfo* i = oind->getObjectInfo(id); const ObjectInfo* i = oind->getObjectInfo(id);
if( i && (xmlNode*)(i->data) ) if( i && (xmlNode*)(i->data) )
...@@ -982,7 +982,7 @@ UniversalIO::IOTypes Configuration::getIOType( UniSetTypes::ObjectId id ) ...@@ -982,7 +982,7 @@ UniversalIO::IOTypes Configuration::getIOType( UniSetTypes::ObjectId id )
return UniversalIO::UnknownIOType; return UniversalIO::UnknownIOType;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
UniversalIO::IOTypes Configuration::getIOType( const std::string name ) UniversalIO::IOType Configuration::getIOType( const std::string name )
{ {
// Если указано "короткое" имя // Если указано "короткое" имя
// то просто сперва ищём ID, а потом по нему // то просто сперва ищём ID, а потом по нему
......
...@@ -71,10 +71,9 @@ VoidMessage::VoidMessage() ...@@ -71,10 +71,9 @@ VoidMessage::VoidMessage()
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
SensorMessage::SensorMessage(): SensorMessage::SensorMessage():
id(DefaultObjectId), id(DefaultObjectId),
state(false),
value(0), value(0),
undefined(false), undefined(false),
sensor_type(UniversalIO::DigitalInput), sensor_type(UniversalIO::DI),
threshold(false), threshold(false),
tid(UniSetTypes::DefaultThresholdId) tid(UniSetTypes::DefaultThresholdId)
{ {
...@@ -90,37 +89,10 @@ tid(UniSetTypes::DefaultThresholdId) ...@@ -90,37 +89,10 @@ tid(UniSetTypes::DefaultThresholdId)
ci.precision = 0; ci.precision = 0;
} }
SensorMessage::SensorMessage(ObjectId id, bool state, Priority priority,
UniversalIO::IOTypes st, ObjectId consumer):
id(id),
state(state),
value(0),
undefined(false),
sensor_type(st),
threshold(false),
tid(UniSetTypes::DefaultThresholdId)
{
value = state ? 1:0;
type = Message::SensorInfo;
this->priority = priority;
this->consumer = consumer;
sm_tv_sec = tm.tv_sec;
sm_tv_usec = tm.tv_usec;
ci.minRaw = 0;
ci.maxRaw = 0;
ci.minCal = 0;
ci.maxCal = 0;
ci.sensibility = 0;
ci.precision = 0;
}
SensorMessage::SensorMessage(ObjectId id, long value, const IOController_i::CalibrateInfo& ci, SensorMessage::SensorMessage(ObjectId id, long value, const IOController_i::CalibrateInfo& ci,
Priority priority, Priority priority,
UniversalIO::IOTypes st, ObjectId consumer): UniversalIO::IOType st, ObjectId consumer):
id(id), id(id),
state(false),
value(value), value(value),
undefined(false), undefined(false),
sensor_type(st), sensor_type(st),
...@@ -128,7 +100,6 @@ ci(ci), ...@@ -128,7 +100,6 @@ ci(ci),
threshold(false), threshold(false),
tid(UniSetTypes::DefaultThresholdId) tid(UniSetTypes::DefaultThresholdId)
{ {
state = value != 0;
type = Message::SensorInfo; type = Message::SensorInfo;
this->priority = priority; this->priority = priority;
this->consumer = consumer; this->consumer = consumer;
......
...@@ -57,14 +57,11 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController ...@@ -57,14 +57,11 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController
// Регистрируем (если не найден) // Регистрируем (если не найден)
switch(inf.type) switch(inf.type)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
case UniversalIO::DigitalOutput: case UniversalIO::DO:
ic->dsRegistration(inf); case UniversalIO::AI:
break; case UniversalIO::AO:
ic->ioRegistration(inf);
case UniversalIO::AnalogInput:
case UniversalIO::AnalogOutput:
ic->asRegistration(inf);
break; break;
default: default:
...@@ -79,20 +76,11 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController ...@@ -79,20 +76,11 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController
switch(inf.type) switch(inf.type)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
ic->askDIOList[k]=lst; case UniversalIO::AI:
break; case UniversalIO::DO:
case UniversalIO::AO:
case UniversalIO::AnalogInput: ic->askIOList[k]=lst;
ic->askAIOList[k]=lst;
break;
case UniversalIO::DigitalOutput:
ic->askDOList[k]=lst;
break;
case UniversalIO::AnalogOutput:
ic->askAOList[k]=lst;
break; break;
default: default:
...@@ -117,14 +105,11 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC ...@@ -117,14 +105,11 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
// Регистрируем (если не найден) // Регистрируем (если не найден)
switch(inf.type) switch(inf.type)
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
case UniversalIO::DigitalOutput: case UniversalIO::DO:
ic->dsRegistration(inf); case UniversalIO::AI:
break; case UniversalIO::AO:
ic->ioRegistration(inf);
case UniversalIO::AnalogInput:
case UniversalIO::AnalogOutput:
ic->asRegistration(inf);
break; break;
default: default:
...@@ -135,26 +120,26 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC ...@@ -135,26 +120,26 @@ 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->mydioEnd(); it->itSID = 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;
ic->askTMap[k].type = inf.type; ic->askTMap[k].type = inf.type;
ic->askTMap[k].list = lst; ic->askTMap[k].list = lst;
ic->askTMap[k].ait = ic->myaioEnd(); ic->askTMap[k].ait = ic->myioEnd();
try try
{ {
switch( inf.type ) switch( inf.type )
{ {
case UniversalIO::DigitalInput: case UniversalIO::DI:
case UniversalIO::DigitalOutput: case UniversalIO::DO:
case UniversalIO::AnalogOutput:
break; break;
case UniversalIO::AnalogInput: case UniversalIO::AO:
case UniversalIO::AI:
{ {
IOController::AIOStateList::iterator it(ic->myaioEnd()); IOController::IOStateList::iterator it(ic->myioEnd());
ic->checkThreshold(it,inf.si,false); ic->checkThreshold(it,inf.si,false);
} }
break; break;
...@@ -178,25 +163,7 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC ...@@ -178,25 +163,7 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
} }
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
NCRestorer::SInfo& NCRestorer::SInfo::operator=(IOController_i::DigitalIOInfo& inf) NCRestorer::SInfo& NCRestorer::SInfo::operator=(IOController_i::SensorIOInfo& inf)
{
this->si = inf.si;
this->type = inf.type;
this->priority = inf.priority;
this->default_val = inf.default_val;
this->real_value = inf.real_state ? 1 : 0;
this->ci.minRaw = 0;
this->ci.maxRaw = 0;
this->ci.minCal = 0;
this->ci.maxCal = 0;
this->ci.sensibility = 0;
this->db_ignore = false;
this->undefined = false;
this->any = 0;
return *this;
}
// ------------------------------------------------------------------------------------------
NCRestorer::SInfo& NCRestorer::SInfo::operator=(IOController_i::AnalogIOInfo& inf)
{ {
this->si = inf.si; this->si = inf.si;
this->type = inf.type; this->type = inf.type;
...@@ -210,18 +177,3 @@ NCRestorer::SInfo& NCRestorer::SInfo::operator=(IOController_i::AnalogIOInfo& in ...@@ -210,18 +177,3 @@ NCRestorer::SInfo& NCRestorer::SInfo::operator=(IOController_i::AnalogIOInfo& in
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
NCRestorer::SInfo::operator IOController::UniDigitalIOInfo()
{
IOController::UniDigitalIOInfo ret;
ret.state = this->value ? true : false;
ret.si = this->si;
ret.type = this->type;
ret.priority = this->priority;
ret.default_val = this->default_val ? true : false;
ret.any = this->any;
ret.undefined = this->undefined;
ret.db_ignore = this->db_ignore;
return ret;
}
// ------------------------------------------------------------------------------------------
...@@ -132,28 +132,14 @@ void NCRestorer_XML::read_list( UniXML& xml, xmlNode* node, IONotifyController* ...@@ -132,28 +132,14 @@ void NCRestorer_XML::read_list( UniXML& xml, xmlNode* node, IONotifyController*
switch(inf.type) switch(inf.type)
{ {
case UniversalIO::DigitalOutput: case UniversalIO::DO:
case UniversalIO::DigitalInput: case UniversalIO::DI:
{ case UniversalIO::AO:
try case UniversalIO::AI:
{
IOController::UniDigitalIOInfo dinf(inf);
dinf.real_state = dinf.state;
dsRegistration(ic,dinf,true);
}
catch(Exception& ex)
{
unideb[Debug::WARN] << "(read_list): " << ex << endl;
}
}
break;
case UniversalIO::AnalogOutput:
case UniversalIO::AnalogInput:
{ {
try try
{ {
asRegistration(ic, inf, true); ioRegistration(ic, inf, true);
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -294,7 +280,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf ) ...@@ -294,7 +280,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
} }
// калибровка // калибровка
if( inf.type == UniversalIO::AnalogInput || inf.type == UniversalIO::AnalogOutput ) if( inf.type == UniversalIO::AI || inf.type == UniversalIO::AO )
{ {
inf.ci.minRaw = xml.getIntProp(it,"rmin"); inf.ci.minRaw = xml.getIntProp(it,"rmin");
inf.ci.maxRaw = xml.getIntProp(it,"rmax"); inf.ci.maxRaw = xml.getIntProp(it,"rmax");
...@@ -456,9 +442,9 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node, ...@@ -456,9 +442,9 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node,
} }
else else
{ {
UniversalIO::IOTypes iotype = conf->getIOType(ti.sid); UniversalIO::IOType iotype = conf->getIOType(ti.sid);
// Пока что IONotifyController поддерживает работу только с 'DI'. // Пока что IONotifyController поддерживает работу только с 'DI'.
if( iotype != UniversalIO::DigitalInput ) if( iotype != UniversalIO::DI )
{ {
unideb[Debug::CRIT] << "(NCRestorer_XML:getThresholdInfo): " unideb[Debug::CRIT] << "(NCRestorer_XML:getThresholdInfo): "
<< " Bad iotype(" << iotype << ") for " << sid_name << ". iotype must be 'DI'!" << endl; << " Bad iotype(" << iotype << ") for " << sid_name << ". iotype must be 'DI'!" << endl;
...@@ -580,9 +566,8 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll ...@@ -580,9 +566,8 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll
continue; continue;
UniSetTypes::KeyType k = UniSetTypes::key(mydepinfo.si.id,mydepinfo.si.node); UniSetTypes::KeyType k = UniSetTypes::key(mydepinfo.si.id,mydepinfo.si.node);
mydepinfo.dit = dioFind(ic,k); mydepinfo.it = ioFind(ic,k);
mydepinfo.ait = aioFind(ic,k); if( mydepinfo.it==ioEnd(ic) )
if( mydepinfo.dit==dioEnd(ic) && mydepinfo.ait==aioEnd(ic) )
{ {
unideb[Debug::CRIT] << "(NCRestorer_XML:build_depends): Датчик " unideb[Debug::CRIT] << "(NCRestorer_XML:build_depends): Датчик "
<< xml.getProp(node,"name") << xml.getProp(node,"name")
...@@ -602,9 +587,8 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll ...@@ -602,9 +587,8 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll
if( getDependsInfo(xml,dit,blk) ) if( getDependsInfo(xml,dit,blk) )
{ {
k = UniSetTypes::key(blk.si.id,blk.si.node); k = UniSetTypes::key(blk.si.id,blk.si.node);
blk.dit = dioFind(ic,k); blk.it = ioFind(ic,k);
blk.ait = aioFind(ic,k); if( blk.it==ioEnd(ic) )
if( blk.dit==dioEnd(ic) && blk.ait==aioEnd(ic) )
{ {
unideb[Debug::CRIT] << ic->getName() << "(NCRestorer_XML:build_depends): " unideb[Debug::CRIT] << ic->getName() << "(NCRestorer_XML:build_depends): "
<< " Не найдена зависимость на " << xml.getProp(dit,"name") << " Не найдена зависимость на " << xml.getProp(dit,"name")
...@@ -616,33 +600,22 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll ...@@ -616,33 +600,22 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll
long block_val = dit.getIntProp("block_value"); long block_val = dit.getIntProp("block_value");
long defval = 0; long defval = 0;
if( blk.dit != dioEnd(ic) ) if( blk.it != ioEnd(ic) )
defval = blk.dit->second.default_val; defval = blk.it->second.default_val;
else if( blk.ait != aioEnd(ic) )
defval = blk.ait->second.default_val;
// Проверка начальных условий для высталения блокировки // Проверка начальных условий для высталения блокировки
bool blk_set = defval ? false : true; bool blk_set = defval ? false : true;
if( mydepinfo.block_invert ) if( mydepinfo.block_invert )
blk_set ^= true; blk_set ^= true;
if( mydepinfo.dit!=dioEnd(ic) ) if( mydepinfo.it!=ioEnd(ic) )
{
mydepinfo.dit->second.blocked = blk_set;
mydepinfo.dit->second.block_state = (bool)block_val;
mydepinfo.dit->second.state = defval;
mydepinfo.dit->second.real_state = defval;
if( blk_set )
mydepinfo.dit->second.state = (bool)block_val;
}
else if( mydepinfo.ait!=aioEnd(ic) )
{ {
mydepinfo.ait->second.blocked = blk_set; mydepinfo.it->second.blocked = blk_set;
mydepinfo.ait->second.block_value = block_val; mydepinfo.it->second.block_value = block_val;
if( blk_set ) if( blk_set )
{ {
mydepinfo.ait->second.real_value = mydepinfo.ait->second.value; mydepinfo.it->second.real_value = mydepinfo.it->second.value;
mydepinfo.ait->second.value = block_val; mydepinfo.it->second.value = block_val;
} }
} }
...@@ -650,21 +623,9 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll ...@@ -650,21 +623,9 @@ void NCRestorer_XML::build_depends( UniXML& xml, xmlNode* node, IONotifyControll
// (без проверки на дублирование // (без проверки на дублирование
// т.к. не может быть два одинаковых ID // т.к. не может быть два одинаковых ID
// в конф. файле... // в конф. файле...
if( blk.dit != dioEnd(ic) ) if( blk.it != ioEnd(ic) )
{
blk.dit->second.dlst.push_back(mydepinfo);
if( unideb.debugging(Debug::INFO) )
{
unideb[Debug::INFO] << ic->getName() << "(NCRestorer_XML:build_depends):"
<< " add " << xml.getProp(it,"name")
<< " to list of depends for " << xml.getProp(dit,"name")
<< " blk_set=" << blk_set
<< endl;
}
}
else if( blk.ait != aioEnd(ic) )
{ {
blk.ait->second.dlst.push_back(mydepinfo); blk.it->second.dlst.push_back(mydepinfo);
if( unideb.debugging(Debug::INFO) ) if( unideb.debugging(Debug::INFO) )
{ {
unideb[Debug::INFO] << ic->getName() << "(NCRestorer_XML:build_depends):" unideb[Debug::INFO] << ic->getName() << "(NCRestorer_XML:build_depends):"
......
...@@ -130,12 +130,7 @@ void SMonitor::sensorInfo( SensorMessage *si ) ...@@ -130,12 +130,7 @@ void SMonitor::sensorInfo( SensorMessage *si )
cout << "(" << setw(6) << si->id << "): " << setw(8) << UniversalInterface::timeToString(si->sm_tv_sec,":") cout << "(" << setw(6) << si->id << "): " << setw(8) << UniversalInterface::timeToString(si->sm_tv_sec,":")
<< "(" << setw(6) << si->sm_tv_usec << "): "; << "(" << setw(6) << si->sm_tv_usec << "): ";
cout << setw(45) << conf->oind->getMapName(si->id); cout << setw(45) << conf->oind->getMapName(si->id);
if( si->sensor_type == UniversalIO::DigitalInput || si->sensor_type == UniversalIO::DigitalOutput ) cout << "\tvalue=" << si->value << "\tfvalue=" << ( (float)si->value / pow(10.0,si->ci.precision) ) << endl;
cout << "\tstate=" << si->state << endl;
else if( si->sensor_type == UniversalIO::AnalogInput || si->sensor_type == UniversalIO::AnalogOutput )
cout << "\tvalue=" << si->value << "\tfvalue=" << ( (float)si->value / pow(10.0,si->ci.precision) ) << endl;
if( !script.empty() ) if( !script.empty() )
{ {
...@@ -147,13 +142,7 @@ void SMonitor::sensorInfo( SensorMessage *si ) ...@@ -147,13 +142,7 @@ void SMonitor::sensorInfo( SensorMessage *si )
else else
cmd << conf->getBinDir() << script; cmd << conf->getBinDir() << script;
cmd << " " << si->id << " "; cmd << " " << si->id << " " << si->value << " " << si->sm_tv_sec << " " << si->sm_tv_usec;
if( si->sensor_type == UniversalIO::DigitalInput || si->sensor_type == UniversalIO::DigitalOutput )
cmd << si->state;
else if( si->sensor_type == UniversalIO::AnalogInput || si->sensor_type == UniversalIO::AnalogOutput )
cmd << si->value;
cmd << " " << si->sm_tv_sec << " " << si->sm_tv_usec;
(void)system(cmd.str().c_str()); (void)system(cmd.str().c_str());
// if( WIFSIGNALED(ret) && (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT)) // if( WIFSIGNALED(ret) && (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
......
...@@ -63,7 +63,7 @@ void STLStorage::saveState(const IOController_i::DigitalIOInfo& di,bool st) ...@@ -63,7 +63,7 @@ void STLStorage::saveState(const IOController_i::DigitalIOInfo& di,bool st)
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void STLStorage::saveValue(const IOController_i::AnalogIOInfo& ai, long val) void STLStorage::saveValue(const IOController_i::SensorIOInfo& ai, long val)
{ {
} }
......
...@@ -182,16 +182,11 @@ void SViewer::getInfo( ObjectId id ) ...@@ -182,16 +182,11 @@ void SViewer::getInfo( ObjectId id )
return; return;
} }
IOController_i::DSensorInfoSeq_var dmap = ioc->getDigitalSensorsMap(); IOController_i::SensorInfoSeq_var amap = ioc->getSensorsMap();
IOController_i::ASensorInfoSeq_var amap = ioc->getAnalogSensorsMap();
IONotifyController_i::ThresholdsListSeq_var tlst = ioc->getThresholdsList(); IONotifyController_i::ThresholdsListSeq_var tlst = ioc->getThresholdsList();
try try
{ updateDSensors(dmap, id); { updateSensors(amap, id);
}catch(...){};
try
{ updateASensors(amap, id);
}catch(...){} }catch(...){}
try try
...@@ -213,59 +208,16 @@ void SViewer::getInfo( ObjectId id ) ...@@ -213,59 +208,16 @@ void SViewer::getInfo( ObjectId id )
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void SViewer::updateDSensors(IOController_i::DSensorInfoSeq_var& dmap, UniSetTypes::ObjectId oid ) void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetTypes::ObjectId oid )
{
string owner = ORepHelpers::getShortName(conf->oind->getMapName(oid));
cout << "\n======================================================\n" << owner;
cout << "\t Дискретные датчики";
cout << "\n------------------------------------------------------"<< endl;
int size = dmap->length();
for(int i=0; i<size; i++)
{
if( dmap[i].type == UniversalIO::DigitalInput )
{
// UniSetTypes::KeyType k = key(dmap[i].si.id, dmap[i].si.node);
string name(conf->oind->getNameById(dmap[i].si.id, dmap[i].si.node));
if( isShort )
name = ORepHelpers::getShortName(name);
string txtname( conf->oind->getTextName(dmap[i].si.id) );
printInfo(dmap[i].si.id, name, dmap[i].state, owner, txtname,"DI");
}
}
cout << "------------------------------------------------------\n";
cout << "\n======================================================\n" << owner;
cout << "\t Дискретные выходы";
cout << "\n------------------------------------------------------"<< endl;
for(int i=0; i<size; i++)
{
if( dmap[i].type == UniversalIO::DigitalOutput )
{
// UniSetTypes::KeyType k = key(dmap[i].si.id, dmap[i].si.node);
string name(conf->oind->getNameById(dmap[i].si.id, dmap[i].si.node));
if( isShort )
name = ORepHelpers::getShortName(name);
string txtname( conf->oind->getTextName(dmap[i].si.id) );
printInfo(dmap[i].si.id, name, dmap[i].state, owner, txtname, "DO");
}
}
cout << "------------------------------------------------------\n";
}
// ---------------------------------------------------------------------------
void SViewer::updateASensors(IOController_i::ASensorInfoSeq_var& amap, UniSetTypes::ObjectId oid)
{ {
string owner = ORepHelpers::getShortName(conf->oind->getMapName(oid)); string owner = ORepHelpers::getShortName(conf->oind->getMapName(oid));
cout << "\n======================================================\n" << owner; cout << "\n======================================================\n" << owner;
cout << "\t Аналоговые датчики"; cout << "\t Датчики";
cout << "\n------------------------------------------------------"<< endl; cout << "\n------------------------------------------------------"<< endl;
int size = amap->length(); int size = amap->length();
for(int i=0; i<size; i++) for(int i=0; i<size; i++)
{ {
if( amap[i].type == UniversalIO::AnalogInput ) if( amap[i].type == UniversalIO::AI || amap[i].type == UniversalIO::DI )
{ {
// UniSetTypes::KeyType k = key(amap[i].si.id, amap[i].si.node); // UniSetTypes::KeyType k = key(amap[i].si.id, amap[i].si.node);
string name(conf->oind->getNameById(amap[i].si.id, amap[i].si.node)); string name(conf->oind->getNameById(amap[i].si.id, amap[i].si.node));
...@@ -278,11 +230,11 @@ void SViewer::updateASensors(IOController_i::ASensorInfoSeq_var& amap, UniSetTyp ...@@ -278,11 +230,11 @@ void SViewer::updateASensors(IOController_i::ASensorInfoSeq_var& amap, UniSetTyp
cout << "------------------------------------------------------\n"; cout << "------------------------------------------------------\n";
cout << "\n======================================================\n" << owner; cout << "\n======================================================\n" << owner;
cout << "\t Аналоговые выходы"; cout << "\t Выходы";
cout << "\n------------------------------------------------------"<< endl; cout << "\n------------------------------------------------------"<< endl;
for(int i=0; i<size; i++) for(int i=0; i<size; i++)
{ {
if( amap[i].type == UniversalIO::AnalogOutput ) if( amap[i].type == UniversalIO::AO || amap[i].type == UniversalIO::DO )
{ {
// UniSetTypes::KeyType k = key(amap[i].si.id, amap[i].si.node); // UniSetTypes::KeyType k = key(amap[i].si.id, amap[i].si.node);
string name(conf->oind->getNameById(amap[i].si.id, amap[i].si.node)); string name(conf->oind->getNameById(amap[i].si.id, amap[i].si.node));
...@@ -309,11 +261,11 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls ...@@ -309,11 +261,11 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls
cout << "(" << setw(5) << tlst[i].si.id << ") | "; cout << "(" << setw(5) << tlst[i].si.id << ") | ";
switch( tlst[i].type ) switch( tlst[i].type )
{ {
case UniversalIO::AnalogInput: case UniversalIO::AI:
cout << "AI"; cout << "AI";
break; break;
case UniversalIO::AnalogOutput: case UniversalIO::AO:
cout << "AO"; cout << "AO";
break; break;
......
...@@ -14,7 +14,7 @@ int main(int argc, const char **argv) ...@@ -14,7 +14,7 @@ int main(int argc, const char **argv)
cout << "--confile - Configuration file. Default: test.xml" << endl; cout << "--confile - Configuration file. Default: test.xml" << endl;
return 0; return 0;
} }
cout << "**** uni_atoi('')=" << uni_atoi("") << endl; cout << "**** uni_atoi('')=" << uni_atoi("") << endl;
try try
...@@ -32,38 +32,37 @@ int main(int argc, const char **argv) ...@@ -32,38 +32,37 @@ int main(int argc, const char **argv)
string mn(conf->oind->getMapName(1)); string mn(conf->oind->getMapName(1));
cout << "**** check getMapName: " << ( mn.empty() ? "FAILED" : "OK" ) << endl; cout << "**** check getMapName: " << ( mn.empty() ? "FAILED" : "OK" ) << endl;
UniversalIO::IOTypes t1=conf->getIOType(1); UniversalIO::IOType t1=conf->getIOType(1);
cout << "**** getIOType for " << mn << endl; cout << "**** getIOType for " << mn << endl;
cout << "**** check getIOType(id): (" << t1 << ") " << ( t1 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl; cout << "**** check getIOType(id): (" << t1 << ") " << ( t1 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl;
UniversalIO::IOTypes t2=conf->getIOType(mn); UniversalIO::IOType t2=conf->getIOType(mn);
cout << "**** check getIOType(name): (" << t2 << ") " << ( t2 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl; cout << "**** check getIOType(name): (" << t2 << ") " << ( t2 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl;
UniversalIO::IOTypes t3=conf->getIOType("Input1_S"); UniversalIO::IOType t3=conf->getIOType("Input1_S");
cout << "**** check getIOType(name): for short name 'Input1_S': (" << t3 << ") " << ( t3 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl; cout << "**** check getIOType(name): for short name 'Input1_S': (" << t3 << ") " << ( t3 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl;
int i1 = uni_atoi("-100"); int i1 = uni_atoi("-100");
cout << "**** check uni_atoi: '-100' " << ( ( i1 != -100 ) ? "FAILED" : "OK" ) << endl; cout << "**** check uni_atoi: '-100' " << ( ( i1 != -100 ) ? "FAILED" : "OK" ) << endl;
int i2 = uni_atoi("20"); int i2 = uni_atoi("20");
cout << "**** check uni_atoi: '20' " << ( ( i2 != 20 ) ? "FAILED" : "OK" ) << endl; cout << "**** check uni_atoi: '20' " << ( ( i2 != 20 ) ? "FAILED" : "OK" ) << endl;
xmlNode* cnode = conf->getNode("testnode"); xmlNode* cnode = conf->getNode("testnode");
if( cnode == NULL ) if( cnode == NULL )
{ {
cerr << "<testnode name='testnode'> not found" << endl; cerr << "<testnode name='testnode'> not found" << endl;
return 1; return 1;
} }
cout << "**** check conf->getNode function [OK] " << endl; cout << "**** check conf->getNode function [OK] " << endl;
UniXML_iterator it(cnode); UniXML_iterator it(cnode);
int prop2 = conf->getArgInt("--prop-id2",it.getProp("id2")); int prop2 = conf->getArgInt("--prop-id2",it.getProp("id2"));
cerr << "**** check conf->getArgInt(arg1,...): " << ( (prop2 == 0) ? "[FAILED]" : "OK" ) << endl; cerr << "**** check conf->getArgInt(arg1,...): " << ( (prop2 == 0) ? "[FAILED]" : "OK" ) << endl;
int prop3 = conf->getArgInt("--prop-dummy",it.getProp("id2")); int prop3 = conf->getArgInt("--prop-dummy",it.getProp("id2"));
cerr << "**** check conf->getArgInt(...,arg2): " << ( (prop3 != -100) ? "[FAILED]" : "OK" ) << endl; cerr << "**** check conf->getArgInt(...,arg2): " << ( (prop3 != -100) ? "[FAILED]" : "OK" ) << endl;
int prop1 = conf->getArgPInt("--prop-id2",it.getProp("id2"),0); int prop1 = conf->getArgPInt("--prop-id2",it.getProp("id2"),0);
cerr << "**** check conf->getArgPInt(...): " << ( (prop1 == 0) ? "[FAILED]" : "OK" ) << endl; cerr << "**** check conf->getArgPInt(...): " << ( (prop1 == 0) ? "[FAILED]" : "OK" ) << endl;
...@@ -72,10 +71,10 @@ int main(int argc, const char **argv) ...@@ -72,10 +71,10 @@ int main(int argc, const char **argv)
int prop5 = conf->getArgPInt("--prop-dummy",it.getProp("dummy"),0); int prop5 = conf->getArgPInt("--prop-dummy",it.getProp("dummy"),0);
cerr << "**** check conf->getArgPInt(...,...,defval): " << ( (prop5 != 0) ? "[FAILED]" : "OK" ) << endl; cerr << "**** check conf->getArgPInt(...,...,defval): " << ( (prop5 != 0) ? "[FAILED]" : "OK" ) << endl;
return 0; return 0;
} }
catch(SystemError& err) catch(SystemError& err)
......
...@@ -22,9 +22,9 @@ int main( int argc, const char **argv ) ...@@ -22,9 +22,9 @@ int main( int argc, const char **argv )
} }
cout << "** check getConfIOType function **" << endl; cout << "** check getConfIOType function **" << endl;
UniversalIO::IOTypes t = ui.getConfIOType(id1); UniversalIO::IOType t = ui.getConfIOType(id1);
cout << "sensor ID=" << id1 << " iotype=" << t << endl; cout << "sensor ID=" << id1 << " iotype=" << t << endl;
if( t != UniversalIO::DigitalInput ) if( t != UniversalIO::DI )
{ {
cout << "** FAILED! check getSensorID function **" << endl; cout << "** FAILED! check getSensorID function **" << endl;
return 1; return 1;
......
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