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

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

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