Commit daa36794 authored by Pavel Vainerman's avatar Pavel Vainerman

ГЛОБАЛЬНАЯ ПЕРЕДЕЛКА В СВЯЗИ С ПЕРЕХОДОМ НА ДВЕ ФУНКЦИИ getValue и setValue.

parent dede3ec2
......@@ -4,25 +4,6 @@
<xsl:output method="text" indent="yes" encoding="utf-8"/>
<xsl:template name="settype">
<xsl:param name="iotype"/>
<xsl:choose>
<xsl:when test="$iotype='DO'">bool</xsl:when>
<xsl:when test="$iotype='DI'">bool</xsl:when>
<xsl:when test="$iotype='AO'">long</xsl:when>
<xsl:when test="$iotype='AI'">long</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="gettype">
<xsl:param name="iotype"/>
<xsl:choose>
<xsl:when test="$iotype='DO'">UniversalIO::DigitalOutput</xsl:when>
<xsl:when test="$iotype='DI'">UniversalIO::DigitalInput</xsl:when>
<xsl:when test="$iotype='AO'">UniversalIO::AnalogOutput</xsl:when>
<xsl:when test="$iotype='AI'">UniversalIO::AnalogInput</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="setprefix">
<xsl:choose>
<xsl:when test="normalize-space(@vartype)='in'">in_</xsl:when>
......@@ -59,8 +40,8 @@
<xsl:if test="normalize-space(@vartype)!='io'">
const UniSetTypes::ObjectId <xsl:value-of select="../../@name"/>; /*!&lt; <xsl:value-of select="../../@textname"/> */
UniSetTypes::ObjectId node_<xsl:value-of select="../../@name"/>;
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="../../@iotype" /></xsl:call-template><xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; /*!&lt; текущее значение */
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="../../@iotype" /></xsl:call-template><xsl:text> prev_</xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; /*!&lt; предыдущее значение */
long <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; /*!&lt; текущее значение */
long prev_<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>; /*!&lt; предыдущее значение */
</xsl:if>
<xsl:if test="normalize-space(@vartype)='io'">#warning (uniset-codegen): vartype='io' NO LONGER SUPPORTED! (ignore variable: '<xsl:value-of select="../../@name"/>')
</xsl:if>
......@@ -115,18 +96,19 @@
</xsl:when>
<xsl:when test="$GENTYPE='U'">
si.id = mid_<xsl:value-of select="../../@name"/>;
ui.saveState( si,m_<xsl:value-of select="../../@name"/>, UniversalIO::DigitalInput, getId() );
ui.setValue( si,( m_<xsl:value-of select="../../@name"/> ? 1:0), getId() );
</xsl:when>
<xsl:when test="$GENTYPE='A'">
if( _code == mid_<xsl:value-of select="../../@name"/> )
{
unideb(Debug::LEVEL8) &lt;&lt; "<xsl:value-of select="../../@name"/>" &lt;&lt; endl;
if( unideb.debugging(Debug::LEVEL8) )
unideb(Debug::LEVEL8) &lt;&lt; "<xsl:value-of select="../../@name"/>" &lt;&lt; endl;
m_<xsl:value-of select="../../@name"/> = _state;
try
{
// сохраняем сразу...
si.id = mid_<xsl:value-of select="../../@name"/>;
ui.saveState( si,m_<xsl:value-of select="../../@name"/>,UniversalIO::DigitalInput,getId() );
ui.setValue( si,(m_<xsl:value-of select="../../@name"/> ? 1:0), getId() );
return true;
}
catch(...){}
......@@ -140,11 +122,12 @@
try
{
si.id = mid_<xsl:value-of select="../../@name"/>;
ui.saveState( si,false,UniversalIO::DigitalInput,getId() );
ui.setValue( si,0,getId() );
}
catch( UniSetTypes::Exception&amp; ex )
{
unideb[Debug::LEVEL1] &lt;&lt; getName() &lt;&lt; ex &lt;&lt; endl;
if( unideb.debugging(Debug::LEVEL1) )
unideb[Debug::LEVEL1] &lt;&lt; getName() &lt;&lt; ex &lt;&lt; endl;
}
}
</xsl:when>
......@@ -175,18 +158,13 @@
</xsl:template>
<xsl:template name="COMMON-HEAD-PUBLIC">
bool alarm( UniSetTypes::ObjectId sid, bool state );
bool getState( UniSetTypes::ObjectId sid );
long getValue( UniSetTypes::ObjectId sid );
void setValue( UniSetTypes::ObjectId sid, long value );
void setState( UniSetTypes::ObjectId sid, bool state );
void askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void askSensor( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void updateValues();
void setMsg( UniSetTypes::ObjectId code, bool state );
DebugStream dlog;
void init_dlog(DebugStream&amp; dlog);
</xsl:template>
......@@ -349,11 +327,6 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::sysCommand( SystemMessage* _sm )
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setState( UniSetTypes::ObjectId _sid, bool _state )
{
setValue(_sid, _state ? 1 : 0 );
}
// -----------------------------------------------------------------------------
<xsl:if test="normalize-space($TESTMODE)!=''">
bool <xsl:value-of select="$CLASSNAME"/>_SK::checkTestMode()
{
......@@ -635,16 +608,6 @@ end_private(false)
<xsl:if test="normalize-space(@no_check_id)!='1'">
if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
throw Exception( myname + ": Not found ID for (<xsl:value-of select="@name"/>) " + conf->getProp(cnode,"<xsl:value-of select="@name"/>") );
<xsl:if test="normalize-space(@no_check_iotype)!='1'">
if( conf->getIOType( <xsl:value-of select="normalize-space(@name)"/> ) != <xsl:call-template name="gettype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template> )
{
ostringstream err;
err &lt;&lt; myname &lt;&lt; "(init): Invalid 'iotype' for '<xsl:value-of select="normalize-space(@name)"/>' set '<xsl:value-of select="normalize-space(@iotype)"/>' but "
&lt;&lt; conf->getProp(cnode,"<xsl:value-of select="normalize-space(@name)"/>") &lt;&lt; "='" &lt;&lt; conf->getIOType( <xsl:value-of select="normalize-space(@name)"/> ) &lt;&lt; "'";
throw Exception( err.str() );
}
</xsl:if>
</xsl:if>
if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
......@@ -767,8 +730,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateValues()
{
// Опрашиваем все входы...
<xsl:if test="normalize-space($TESTMODE)!=''">
in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui.getState(idTestMode_S):false;
in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui.getState(idLocalTestMode_S):false;
in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui.getValue(idTestMode_S):false;
in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui.getValue(idLocalTestMode_S):false;
</xsl:if>
<xsl:for-each select="//smap/item">
<xsl:choose>
......@@ -830,7 +793,7 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId _code,
// сохраняем сразу...
si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si,m_<xsl:value-of select="@name"/>,UniversalIO::DigitalInput,getId() );
ui.setValue( si,m_<xsl:value-of select="@name"/>,getId() );
return true;
}
catch(...){}
......@@ -853,7 +816,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::resetMsg()
{
si.id = <xsl:value-of select="@name"/>;
si.node = node_<xsl:value-of select="@name"/>;
ui.saveState( si,false,UniversalIO::DigitalInput,getId() );
ui.setValue( si, 0, getId() );
}
catch( UniSetTypes::Exception&amp; ex )
{
......@@ -1014,8 +977,8 @@ askPause(conf->getPIntProp(cnode,"askPause",2000))
void <xsl:value-of select="$CLASSNAME"/>_SK::updateValues()
{
<xsl:if test="normalize-space($TESTMODE)!=''">
in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui.getState(idTestMode_S):false;
in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui.getState(idLocalTestMode_S):false;
in_TestMode_S = (idTestMode_S!=DefaultObjectId) ? ui.getValue(idTestMode_S):false;
in_LocalTestMode_S = (idLocalTestMode_S!=DefaultObjectId) ? ui.getValue(idLocalTestMode_S):false;
</xsl:if>
// Опрашиваем все входы...
<xsl:for-each select="//sensors/item/consumers/consumer">
......@@ -1101,4 +1064,22 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::alarm( UniSetTypes::ObjectId _code,
// -----------------------------------------------------------------------------
</xsl:template>
<xsl:template name="check_changes">
<xsl:param name="onlymsg"></xsl:param>
<xsl:if test="normalize-space($onlymsg)=''">
if( prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> != <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> )
</xsl:if>
{
<xsl:if test="normalize-space($onlymsg)=''">
</xsl:if>
// приходится искуственно использовать третий параметр,
// что-бы компилятор выбрал
// правильный(для аналоговых) конструктор у SensorMessage
IOController_i::CalibrateInfo _ci;
SensorMessage _sm( <xsl:value-of select="@name"/>, (long)<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, _ci);
_sm.sensor_type = UniversalIO::AI;
sensorInfo(&amp;_sm);
}
</xsl:template>
</xsl:stylesheet>
......@@ -81,8 +81,8 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
// Текущее значение и предыдущее значение
<xsl:for-each select="//smap/item">
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template><xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template><xsl:text> prev_</xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
long <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
long prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:for-each>
// --- public variables ---
......
......@@ -13,10 +13,10 @@ GENERATED=TestGen_SK.h TestGen_SK.cc TestGen-main.cc
GENERATED2=TestGenAlone_SK.h TestGenAlone_SK.cc TestGenAlone-main.cc
GENUOBJ=UObject_SK.cc UObject_SK.h
$(GENERATED): ../@PACKAGE@-codegen testgen.src.xml ../*.xsl
TestGen_SK.cc: ../@PACKAGE@-codegen testgen.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include -n TestGen testgen.src.xml
$(GENERATED2): ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
TestGenAlone_SK.cc: ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include --alone -n TestGenAlone testgen-alone.src.xml
$(GENUOBJ): ../@PACKAGE@-codegen uobject.src.xml ../*.xsl
......
......@@ -39,10 +39,10 @@
</variables>
<smap>
<!-- name - название переменной в конф. файле -->
<item name="input1_s" vartype="in" iotype="DI" comment="comment for input1" smTestID="1"/>
<item name="input2_s" vartype="in" iotype="DI" comment="comment for input2" />
<item name="output1_c" vartype="out" iotype="DO" omment="comment for output1" no_check_id="1"/>
<item name="loglevel_s" vartype="in" iotype="AI" omment="log level control" loglevel="1"/>
<item name="input1_s" vartype="in" comment="comment for input1" smTestID="1"/>
<item name="input2_s" vartype="in" comment="comment for input2" />
<item name="output1_c" vartype="out" omment="comment for output1" no_check_id="1"/>
<item name="loglevel_s" vartype="in" comment="log level control" loglevel="1"/>
</smap>
<msgmap>
......
......@@ -347,6 +347,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
- remove deprecated intefaces: MessageInterface
- remove deprecated messages: AlarmMessage, InfoMessage, DBMessage
- remove 'state' from SensorMessage
- remove deprecated function setState,getState,askState
use simple function: setValue,getValue,askSensor
- possible use of the property 'iotype' in uniset-codegen
* Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3
- add RRDServer
......
......@@ -274,12 +274,11 @@ void IOControl::execute()
else
{
iomap.resize(maxItem);
// init iterators
for( IOMap::iterator it=iomap.begin(); it!=iomap.end(); ++it )
{
shm->initAIterator(it->ait);
shm->initDIterator(it->dit);
}
shm->initIterator(it->ioit);
readconf_ok = true; // т.к. waitSM() уже был...
}
......@@ -295,9 +294,9 @@ void IOControl::execute()
if( !skip_iout )
initOutputs();
shm->initAIterator(aitHeartBeat);
shm->initDIterator(ditTestLamp);
shm->initAIterator(aitTestMode);
shm->initIterator(itHeartBeat);
shm->initIterator(itTestLamp);
shm->initIterator(itTestMode);
PassiveTimer ptAct(activateTimeout);
while( !activated && !ptAct.checkTime() )
......@@ -373,7 +372,7 @@ void IOControl::execute()
if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
{
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,myid);
shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,myid);
ptHeartBeat.reset();
}
}
......@@ -560,7 +559,7 @@ void IOControl::ioread( IOInfo* it )
uniset_rwmutex_wrlock lock(it->val_lock);
long prev_val = it->value;
if( force_out )
it->value = shm->localGetValue(it->ait,it->si.id);
it->value = shm->localGetValue(it->ioit,it->si.id);
switch( it->value )
{
......@@ -1008,7 +1007,7 @@ void IOControl::check_testmode()
try
{
if( force_out )
testmode = shm->localGetValue( aitTestMode, testMode_as );
testmode = shm->localGetValue( itTestMode, testMode_as );
if( prev_testmode == testmode )
return;
......@@ -1078,7 +1077,7 @@ void IOControl::check_testlamp()
try
{
if( force_out )
isTestLamp = shm->localGetState( ditTestLamp, testLamp_S );
isTestLamp = shm->localGetValue( itTestLamp, testLamp_S );
if( !trTestLamp.change(isTestLamp) )
return; // если состояние не менялось, то продолжаем работу...
......@@ -1399,8 +1398,9 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm )
if( sm->id == testLamp_S )
{
dlog[Debug::INFO] << myname << "(sensorInfo): test_lamp=" << sm->state << endl;
isTestLamp = sm->state;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(sensorInfo): test_lamp=" << sm->value << endl;
isTestLamp = (bool)sm->value;
}
else if( sm->id == testMode_as )
{
......@@ -1415,7 +1415,6 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm )
if( unideb.debugging(Debug::INFO) )
{
dlog[Debug::INFO] << myname << "(sensorInfo): sid=" << sm->id
<< " state=" << sm->state
<< " value=" << sm->value
<< endl;
}
......@@ -1521,7 +1520,7 @@ void IOControl::sensorInfo( UniSetTypes::SensorMessage* sm )
<< " val=" << sm->value << endl;
}
uniset_rwmutex_wrlock lock(it->val_lock);
it->value = sm->state ? 1:0;
it->value = sm->value ? 1:0;
}
break;
}
......
......@@ -354,12 +354,12 @@ class IOControl:
UniSetTypes::ObjectId testLamp_S;
Trigger trTestLamp;
bool isTestLamp;
IOController::DIOStateList::iterator ditTestLamp;
IOController::IOStateList::iterator itTestLamp;
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat;
IOController::IOStateList::iterator itHeartBeat;
bool force; /*!< флаг, означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out; /*!< флаг, включающий принудительное чтения выходов */
......@@ -376,7 +376,7 @@ class IOControl:
UniSetTypes::ObjectId testMode_as;
IOController::IOStateList::iterator aitTestMode;
IOController::IOStateList::iterator itTestMode;
long testmode;
long prev_testmode;
......
......@@ -120,7 +120,7 @@ void LProcessor::getInputs()
{
// try
// {
it->state = ui.getState(it->sid);
it->state = (bool)ui.getValue(it->sid);
// }
}
}
......@@ -143,20 +143,7 @@ void LProcessor::setOuts()
{
try
{
switch(it->iotype)
{
case UniversalIO::DI:
ui.saveState(it->sid,it->lnk->from->getOut(),it->iotype);
break;
case UniversalIO::DO:
ui.setState(it->sid,it->lnk->from->getOut());
break;
default:
dlog[Debug::CRIT] << "(LProcessor::setOuts): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
ui.setValue(it->sid,it->lnk->from->getOut(),DefaultObjectId);
}
catch( Exception& ex )
{
......
......@@ -59,7 +59,7 @@ void PassiveLProcessor::step()
{
try
{
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId());
shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset();
}
catch(Exception& ex)
......@@ -95,7 +95,7 @@ void PassiveLProcessor::sensorInfo( UniSetTypes::SensorMessage*sm )
for( EXTList::iterator it=extInputs.begin(); it!=extInputs.end(); ++it )
{
if( it->sid == sm->id )
it->state = sm->state;
it->state = (bool)sm->value;
}
}
// -------------------------------------------------------------------------
......@@ -185,7 +185,7 @@ bool PassiveLProcessor::activateObject()
// ------------------------------------------------------------------------------------------
void PassiveLProcessor::initIterators()
{
shm->initAIterator(aitHeartBeat);
shm->initIterator(itHeartBeat);
}
// -------------------------------------------------------------------------
void PassiveLProcessor::setOuts()
......@@ -195,20 +195,7 @@ void PassiveLProcessor::setOuts()
{
try
{
switch(it->iotype)
{
case UniversalIO::DI:
shm->saveLocalState(it->sid,it->lnk->from->getOut(),it->iotype);
break;
case UniversalIO::DO:
shm->setState(it->sid,it->lnk->from->getOut());
break;
default:
dlog[Debug::CRIT] << myname << "(setOuts): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
shm->setValue( it->sid,it->lnk->from->getOut() );
}
catch( Exception& ex )
{
......@@ -227,20 +214,7 @@ void PassiveLProcessor::sigterm( int signo )
{
try
{
switch(it->iotype)
{
case UniversalIO::DI:
shm->saveLocalState(it->sid,false,it->iotype);
break;
case UniversalIO::DO:
shm->setState(it->sid,false);
break;
default:
dlog[Debug::CRIT] << myname << "(sigterm): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
shm->setValue(it->sid,0);
}
catch( Exception& ex )
{
......
......@@ -51,7 +51,7 @@ class PassiveLProcessor:
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat;
IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::uniset_mutex mutex_start;
};
// ---------------------------------------------------------------------------
......
......@@ -5,7 +5,8 @@
if HAVE_EXTENTIONS
SUBDIRS = lib include SharedMemory IOControl LogicProcessor \
ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP DBServer-MySQL DBServer-SQLite \
RRDServer SharedMemoryPlus tests
RRDServer SharedMemoryPlus tests
#SMDBServer
#SharedMemoryPlus
#UDPExchange
......
......@@ -213,7 +213,7 @@ void MBExchange::step()
{
try
{
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId());
shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset();
}
catch(Exception& ex)
......@@ -298,20 +298,17 @@ MBExchange::DeviceType MBExchange::getDeviceType( const std::string& dtype )
// ------------------------------------------------------------------------------------------
void MBExchange::initIterators()
{
shm->initAIterator(aitHeartBeat);
shm->initAIterator(aitExchangeMode);
shm->initIterator(itHeartBeat);
shm->initIterator(itExchangeMode);
for( MBExchange::RTUDeviceMap::iterator it1=rmap.begin(); it1!=rmap.end(); ++it1 )
{
RTUDevice* d(it1->second);
shm->initDIterator(d->resp_dit);
shm->initAIterator(d->mode_ait);
shm->initIterator(d->resp_it);
shm->initIterator(d->mode_it);
for( MBExchange::RegMap::iterator it=d->regmap.begin(); it!=d->regmap.end(); ++it )
{
for( PList::iterator it2=it->second->slst.begin();it2!=it->second->slst.end(); ++it2 )
{
shm->initDIterator(it2->dit);
shm->initAIterator(it2->ait);
}
shm->initIterator(it2->ioit);
}
}
}
......@@ -992,7 +989,7 @@ void MBExchange::updateSM()
try
{
if( !shm->isLocalwork() )
d->mode = shm->localGetValue(d->mode_ait,d->mode_id);
d->mode = shm->localGetValue(d->mode_it,d->mode_id);
}
catch(IOController_i::NameNotFound &ex)
{
......@@ -2921,7 +2918,7 @@ void MBExchange::updateRespondSensors()
try
{
bool set = d->resp_invert ? !d->resp_state : d->resp_state;
shm->localSaveState(d->resp_dit,d->resp_id,set,getId());
shm->localSetValue(d->resp_it,d->resp_id,( set ? 1:0 ),getId());
}
catch( Exception& ex )
{
......
......@@ -161,7 +161,7 @@ class MBExchange:
DeviceType dtype; /*!< тип устройства */
UniSetTypes::ObjectId resp_id;
IOController::DIOStateList::iterator resp_dit;
IOController::IOStateList::iterator resp_it;
PassiveTimer resp_ptTimeout;
Trigger resp_trTimeout;
bool resp_state;
......@@ -170,7 +170,7 @@ class MBExchange:
bool resp_init;
bool ask_every_reg;
UniSetTypes::ObjectId mode_id;
IOController::IOStateList::iterator mode_ait;
IOController::IOStateList::iterator mode_it;
long mode; // режим работы с устройством (см. ExchangeMode)
// return TRUE if state changed
......@@ -292,11 +292,11 @@ class MBExchange:
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat;
IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::ObjectId test_id;
UniSetTypes::ObjectId sidExchangeMode; /*!< иденидентификатор для датчика режима работы */
IOController::IOStateList::iterator aitExchangeMode;
IOController::IOStateList::iterator itExchangeMode;
long exchangeMode; /*!< режим работы см. ExchangeMode */
UniSetTypes::uniset_rwmutex actMutex;
......
......@@ -146,7 +146,7 @@ void MBTCPMaster::poll_thread()
try
{
if( sidExchangeMode != DefaultObjectId && force )
exchangeMode = shm->localGetValue(aitExchangeMode,sidExchangeMode);
exchangeMode = shm->localGetValue(itExchangeMode,sidExchangeMode);
}
catch(...){}
try
......
......@@ -287,7 +287,7 @@ void MBTCPMultiMaster::poll_thread()
try
{
if( sidExchangeMode != DefaultObjectId && force )
exchangeMode = shm->localGetValue(aitExchangeMode,sidExchangeMode);
exchangeMode = shm->localGetValue(itExchangeMode,sidExchangeMode);
}
catch(...){}
try
......@@ -320,7 +320,7 @@ void MBTCPMultiMaster::check_thread()
if( it->respond_id != DefaultObjectId && (force_out || r != it->respond) )
{
bool set = it->respond_invert ? !it->respond : it->respond;
shm->localSaveState(it->respond_dit,it->respond_id,set,getId());
shm->localSetValue(it->respond_it,it->respond_id,(set ? 1:0),getId());
}
}
catch( Exception& ex )
......@@ -353,7 +353,7 @@ void MBTCPMultiMaster::initIterators()
{
MBExchange::initIterators();
for( MBGateList::iterator it=mblist.begin(); it!=mblist.end(); ++it )
shm->initDIterator(it->respond_dit);
shm->initIterator(it->respond_it);
}
// -----------------------------------------------------------------------------
void MBTCPMultiMaster::help_print( int argc, const char* const* argv )
......
......@@ -256,7 +256,7 @@ class MBTCPMultiMaster:
bool respond;
UniSetTypes::ObjectId respond_id;
IOController::DIOStateList::iterator respond_dit;
IOController::IOStateList::iterator respond_it;
bool respond_invert;
inline bool operator < ( const MBSlaveInfo& mbs ) const
......
......@@ -158,7 +158,7 @@ void RTUExchange::step()
try
{
if( sidExchangeMode != DefaultObjectId && force )
exchangeMode = shm->localGetValue(aitExchangeMode,sidExchangeMode);
exchangeMode = shm->localGetValue(itExchangeMode,sidExchangeMode);
}
catch(...){}
......
......@@ -411,7 +411,7 @@ void MBSlave::execute_rtu()
{
try
{
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId());
shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset();
}
catch(Exception& ex)
......@@ -429,7 +429,7 @@ void MBSlave::execute_rtu()
try
{
shm->localSaveState(ditRespond,respond_id,state,getId());
shm->localSetValue(itRespond,respond_id,state,getId());
}
catch(Exception& ex)
{
......@@ -442,7 +442,7 @@ void MBSlave::execute_rtu()
{
try
{
shm->localSaveValue(aitAskCount,askcount_id,askCount,getId());
shm->localSetValue(itAskCount,askcount_id,askCount,getId());
}
catch(Exception& ex)
{
......@@ -492,7 +492,7 @@ void MBSlave::execute_tcp()
{
try
{
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId());
shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset();
}
catch(Exception& ex)
......@@ -509,7 +509,7 @@ void MBSlave::execute_tcp()
state ^= true;
try
{
shm->localSaveState(ditRespond,respond_id,state,getId());
shm->localSetValue(itRespond,respond_id,state,getId());
}
catch(Exception& ex)
{
......@@ -522,7 +522,7 @@ void MBSlave::execute_tcp()
{
try
{
shm->localSaveValue(aitAskCount,askcount_id,askCount,getId());
shm->localSetValue(itAskCount,askcount_id,askCount,getId());
}
catch(Exception& ex)
{
......@@ -712,7 +712,7 @@ void MBSlave::sensorInfo( UniSetTypes::SensorMessage* sm )
p->stype == UniversalIO::DI )
{
uniset_rwmutex_wrlock lock(p->val_lock);
p->value = sm->state ? 1 : 0;
p->value = sm->value ? 1 : 0;
}
else if( p->stype == UniversalIO::AO ||
p->stype == UniversalIO::AI )
......@@ -893,14 +893,11 @@ void MBSlave::initIterators()
{
IOMap::iterator it=iomap.begin();
for( ; it!=iomap.end(); it++ )
{
shm->initDIterator(it->second.dit);
shm->initAIterator(it->second.ait);
}
shm->initIterator(it->second.ioit);
shm->initAIterator(aitHeartBeat);
shm->initAIterator(aitAskCount);
shm->initDIterator(ditRespond);
shm->initIterator(itHeartBeat);
shm->initIterator(itAskCount);
shm->initIterator(itRespond);
}
// -----------------------------------------------------------------------------
void MBSlave::help_print( int argc, const char* const* argv )
......
......@@ -174,13 +174,13 @@ class MBSlave:
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat;
IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::ObjectId test_id;
IOController::IOStateList::iterator aitAskCount;
IOController::IOStateList::iterator itAskCount;
UniSetTypes::ObjectId askcount_id;
IOController::DIOStateList::iterator ditRespond;
IOController::IOStateList::iterator itRespond;
UniSetTypes::ObjectId respond_id;
bool respond_invert;
......
......@@ -19,15 +19,10 @@ SMViewer::~SMViewer()
// --------------------------------------------------------------------------
void SMViewer::run()
{
IOController_i::DSensorInfoSeq_var dmap = shm->getDigitalSensorsMap();
IOController_i::ASensorInfoSeq_var amap = shm->getAnalogSensorsMap();
IOController_i::SensorInfoSeq_var amap = shm->getSensorsMap();
IONotifyController_i::ThresholdsListSeq_var tlst = shm->getThresholdsList();
try
{ updateDSensors(dmap,getSharedMemoryID());
}catch(...){};
try
{ updateASensors(amap,getSharedMemoryID());
{ updateSensors(amap,getSharedMemoryID());
}catch(...){}
try
......
......@@ -30,7 +30,6 @@ void SharedMemory::help_print( int argc, const char* const* argv )
cout << "--sm-no-history - отключить ведение истории (аварийного следа)" << endl;
cout << "--pulsar-id - датчик 'мигания'" << endl;
cout << "--pulsar-msec - период 'мигания'. По умолчанию: 5000." << endl;
cout << "--pulsar-iotype - [DI|DO]тип датчика для 'мигания'. По умолчанию DI." << endl;
}
// -----------------------------------------------------------------------------
SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ):
......@@ -41,7 +40,6 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
activated(false),
workready(false),
dblogging(false),
iotypePulsar(UniversalIO::DI),
msecPulsar(0)
{
mutex_start.setName(myname + "_mutex_start");
......@@ -120,22 +118,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
throw SystemError(err.str());
}
siPulsar.node = conf->getLocalNode();
msecPulsar = conf->getArgPInt("--pulsar-msec",it.getProp("pulsar_msec"), 5000);
string t = conf->getArgParam("--pulsar-iotype",it.getProp("pulsar_iotype"));
if( !t.empty() )
{
iotypePulsar = UniSetTypes::getIOType(t);
if( iotypePulsar == UniversalIO::UnknownIOType ||
iotypePulsar == UniversalIO::AI || iotypePulsar == UniversalIO::AO )
{
ostringstream err;
err << myname << ": Invalid iotype '" << t << "' for pulsar. Must be 'DI' or 'DO'";
dlog[Debug::CRIT] << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
}
}
}
......@@ -237,12 +220,9 @@ void SharedMemory::timerInfo( TimerMessage *tm )
{
if( siPulsar.id != DefaultObjectId )
{
bool st = localGetState(ditPulsar,siPulsar);
bool st = (bool)localGetValue(itPulsar,siPulsar);
st ^= true;
if( iotypePulsar == UniversalIO::DI )
localSaveState(ditPulsar,siPulsar,st,getId());
else if( iotypePulsar == UniversalIO::DO )
localSetState(ditPulsar,siPulsar,st,getId());
localSetValue(itPulsar,siPulsar, (st ? 1:0), getId() );
}
}
}
......@@ -336,21 +316,15 @@ bool SharedMemory::activateObject()
// инициализируем указатели
for( HeartBeatList::iterator it=hlist.begin(); it!=hlist.end(); ++it )
{
it->ait = myioEnd();
it->dit = mydioEnd();
it->ioit = myioEnd();
}
ditPulsar = mydioEnd();
itPulsar = myioEnd();
// cerr << "history count=" << hist.size() << endl;
for( History::iterator it=hist.begin(); it!=hist.end(); ++it )
{
// 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 = myioEnd();
hit->dit = mydioEnd();
}
hit->ioit = myioEnd();
}
{
......@@ -395,17 +369,14 @@ void SharedMemory::checkHeartBeat()
try
{
si.id = it->a_sid;
long val = localGetValue(it->ait,si);
long val = localGetValue(it->ioit,si);
val --;
if( val < -1 )
val = -1;
localSaveValue(it->ait,si,val,getId());
localSetValue(it->ioit,si,val,getId());
si.id = it->d_sid;
if( val >= 0 )
localSaveState(it->dit,si,true,getId());
else
localSaveState(it->dit,si,false,getId());
localSetValue(it->ioit,si,( val >= 0 ? true:false),getId());
// проверяем нужна ли "перезагрузка" по данному датчику
if( wdt && it->ptReboot.getInterval() )
......@@ -750,10 +721,8 @@ void SharedMemory::saveHistory()
{
for( HistoryList::iterator hit=it->hlst.begin(); hit!=it->hlst.end(); ++hit )
{
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 );
if( hit->ioit != myioEnd() )
hit->add( localGetValue( hit->ioit, hit->ioit->second.si ), it->size );
else
{
IOController_i::SensorInfo si;
......@@ -762,14 +731,7 @@ void SharedMemory::saveHistory()
try
{
hit->add( localGetValue( hit->ait, si ), it->size );
continue;
}
catch(...){}
try
{
hit->add( localGetState( hit->dit, si ), it->size );
hit->add( localGetValue( hit->ioit, si ), it->size );
continue;
}
catch(...){}
......@@ -787,7 +749,6 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm )
{
dlog[Debug::INFO] << myname << "(updateHistory): "
<< " sid=" << sm->id
<< " state=" << sm->state
<< " value=" << sm->value
<< endl;
}
......@@ -799,7 +760,11 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm )
if( sm->sensor_type == UniversalIO::DI ||
sm->sensor_type == UniversalIO::DO )
{
bool st = it->fuse_invert ? !sm->state : sm->state;
bool st = (bool)sm->value;
if( it->fuse_invert )
st^=true;
if( st )
{
if( dlog.debugging(Debug::INFO) )
......@@ -812,13 +777,16 @@ void SharedMemory::updateHistory( UniSetTypes::SensorMessage* sm )
}
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 )
{
bool st = it->fuse_invert ? !sm->state : sm->state;
if( st )
bool st = (bool)sm->value;
if( it->fuse_invert )
st^=true;
if( !st )
{
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << myname << "(updateHistory): HISTORY EVENT for " << (*it) << endl;
......
......@@ -283,8 +283,7 @@ class SharedMemory:
UniSetTypes::ObjectId id;
HBuffer buf;
IOStateList::iterator ait;
DIOStateList::iterator dit;
IOStateList::iterator ioit;
void add( long val, size_t size )
{
......@@ -364,8 +363,7 @@ class SharedMemory:
UniSetTypes::ObjectId a_sid; // аналоговый счётчик
UniSetTypes::ObjectId d_sid; // дискретный датчик состояния процесса
IOStateList::iterator ait;
DIOStateList::iterator dit;
IOStateList::iterator ioit;
int reboot_msec; /*!< Время в течение которого, процесс обязан подтвердить своё существование,
иначе будет произведена перезагрузка контроллера по WDT (в случае если он включён).
......@@ -418,9 +416,8 @@ class SharedMemory:
bool isActivated();
DIOStateList::iterator ditPulsar;
IOStateList::iterator itPulsar;
IOController_i::SensorInfo siPulsar;
UniversalIO::IOType iotypePulsar;
int msecPulsar;
UniSetTypes::uniset_rwmutex mutex_act;
......
......@@ -410,7 +410,7 @@ void UNetExchange::step()
{
try
{
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId());
shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset();
}
catch(Exception& ex)
......@@ -433,8 +433,8 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string& myna
bool resp = ( (r1 && r1->isRecvOK()) || (r2 && r2->isRecvOK()) );
if( respondInvert )
resp = !resp;
shm->localSaveState(ditRespond,sidRespond,resp,shm->ID());
shm->localSetValue(itRespond,sidRespond,resp,shm->ID());
}
}
catch( Exception& ex )
......@@ -452,7 +452,7 @@ void UNetExchange::ReceiverInfo::step( SMInterface* shm, const std::string& myna
if( r2 )
l += r2->getLostPacketsNum();
shm->localSaveValue(aitLostPackets,sidLostPackets,l,shm->ID());
shm->localSetValue(itLostPackets,sidLostPackets,l,shm->ID());
}
}
catch( Exception& ex )
......@@ -672,7 +672,7 @@ void UNetExchange::sigterm( int signo )
// ------------------------------------------------------------------------------------------
void UNetExchange::initIterators()
{
shm->initAIterator(aitHeartBeat);
shm->initIterator(itHeartBeat);
if( sender )
sender->initIterators();
if( sender2 )
......
......@@ -130,7 +130,7 @@ class UNetExchange:
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat;
IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::ObjectId test_id;
int steptime; /*!< периодичность вызова step, [мсек] */
......@@ -166,8 +166,8 @@ class UNetExchange:
inline void setLostPacketsID( UniSetTypes::ObjectId id ){ sidLostPackets = id; }
inline void initIterators( SMInterface* shm )
{
shm->initAIterator(aitLostPackets);
shm->initDIterator(ditRespond);
shm->initIterator(itLostPackets);
shm->initIterator(itRespond);
}
// Сводная информация по двум каналам
......@@ -175,10 +175,10 @@ class UNetExchange:
// хотя бы по одному каналу
// ( реализацию см. ReceiverInfo::step() )
UniSetTypes::ObjectId sidRespond;
IOController::DIOStateList::iterator ditRespond;
IOController::IOStateList::iterator itRespond;
bool respondInvert;
UniSetTypes::ObjectId sidLostPackets;
IOController::IOStateList::iterator aitLostPackets;
IOController::IOStateList::iterator itLostPackets;
};
typedef std::list<ReceiverInfo> ReceiverList;
......
......@@ -132,13 +132,13 @@ void UNetReceiver::setRespondID( UniSetTypes::ObjectId id, bool invert )
{
sidRespond = id;
respondInvert = invert;
shm->initDIterator(ditRespond);
shm->initIterator(itRespond);
}
// -----------------------------------------------------------------------------
void UNetReceiver::setLostPacketsID( UniSetTypes::ObjectId id )
{
sidLostPackets = id;
shm->initAIterator(aitLostPackets);
shm->initIterator(itLostPackets);
}
// -----------------------------------------------------------------------------
void UNetReceiver::setLockUpdate( bool st )
......@@ -189,7 +189,7 @@ void UNetReceiver::update()
try
{
bool r = respondInvert ? !isRecvOK() : isRecvOK();
shm->localSaveState(ditRespond,sidRespond,r,shm->ID());
shm->localSetValue(itRespond,sidRespond,( r ? 1:0 ),shm->ID());
}
catch(Exception& ex)
{
......@@ -201,7 +201,7 @@ void UNetReceiver::update()
{
try
{
shm->localSaveValue(aitLostPackets,sidLostPackets,getLostPacketsNum(),shm->ID());
shm->localSetValue(itLostPackets,sidLostPackets,getLostPacketsNum(),shm->ID());
}
catch(Exception& ex)
{
......@@ -288,8 +288,7 @@ void UNetReceiver::real_update()
{
dlog[Debug::WARN] << myname << "(update): reinit cache for sid=" << id << endl;
ii.id = id;
shm->initAIterator(ii.ait);
shm->initDIterator(ii.dit);
shm->initIterator(ii.ioit);
}
// обновление данных в SM (блокировано)
......@@ -299,16 +298,7 @@ void UNetReceiver::real_update()
continue;
}
if( ii.iotype == UniversalIO::DI )
shm->localSaveState(ii.dit,id,val,shm->ID());
else if( ii.iotype == UniversalIO::AI )
shm->localSaveValue(ii.ait,id,val,shm->ID());
else if( ii.iotype == UniversalIO::AO )
shm->localSetValue(ii.ait,id,val,shm->ID());
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;
shm->localSetValue(ii.ioit,id,val,shm->ID());
}
catch( UniSetTypes::Exception& ex)
{
......@@ -331,8 +321,7 @@ void UNetReceiver::real_update()
{
dlog[Debug::WARN] << myname << "(update): reinit cache for sid=" << d.id << endl;
ii.id = d.id;
shm->initAIterator(ii.ait);
shm->initDIterator(ii.dit);
shm->initIterator(ii.ioit);
}
// обновление данных в SM (блокировано)
......@@ -341,17 +330,8 @@ void UNetReceiver::real_update()
if( lockUpdate )
continue;
}
if( ii.iotype == UniversalIO::DI )
shm->localSaveState(ii.dit,d.id,d.val,shm->ID());
else if( ii.iotype == UniversalIO::AI )
shm->localSaveValue(ii.ait,d.id,d.val,shm->ID());
else if( ii.iotype == UniversalIO::AO )
shm->localSetValue(ii.ait,d.id,d.val,shm->ID());
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;
shm->localSetValue(ii.ioit,d.id,d.val,shm->ID());
}
catch( UniSetTypes::Exception& ex)
{
......@@ -519,15 +499,10 @@ bool UNetReceiver::recv()
void UNetReceiver::initIterators()
{
for( ItemVec::iterator it=d_icache.begin(); it!=d_icache.end(); ++it )
{
shm->initAIterator(it->ait);
shm->initDIterator(it->dit);
}
shm->initIterator(it->ioit);
for( ItemVec::iterator it=a_icache.begin(); it!=a_icache.end(); ++it )
{
shm->initAIterator(it->ait);
shm->initDIterator(it->dit);
}
shm->initIterator(it->ioit);
}
// -----------------------------------------------------------------------------
void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force )
......@@ -547,8 +522,7 @@ void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force )
{
d.id = pack.d_id[i];
d.iotype = conf->getIOType(d.id);
shm->initAIterator(d.ait);
shm->initDIterator(d.dit);
shm->initIterator(d.ioit);
}
}
}
......@@ -569,8 +543,7 @@ void UNetReceiver::initACache( UniSetUDP::UDPMessage& pack, bool force )
{
d.id = pack.a_dat[i].id;
d.iotype = conf->getIOType(d.id);
shm->initAIterator(d.ait);
shm->initDIterator(d.dit);
shm->initIterator(d.ioit);
}
}
}
......
......@@ -125,10 +125,10 @@ class UNetReceiver
unsigned long lostPackets; /*!< счётчик потерянных пакетов */
UniSetTypes::ObjectId sidRespond;
IOController::DIOStateList::iterator ditRespond;
IOController::IOStateList::iterator itRespond;
bool respondInvert;
UniSetTypes::ObjectId sidLostPackets;
IOController::IOStateList::iterator aitLostPackets;
IOController::IOStateList::iterator itLostPackets;
bool activated;
......@@ -171,13 +171,11 @@ class UNetReceiver
struct ItemInfo
{
long id;
IOController::IOStateList::iterator ait;
IOController::DIOStateList::iterator dit;
IOController::IOStateList::iterator ioit;
UniversalIO::IOType iotype;
ItemInfo():
id(UniSetTypes::DefaultObjectId),
iotype(UniversalIO::UnknownIOType){}
id(UniSetTypes::DefaultObjectId),iotype(UniversalIO::UnknownIOType){}
};
typedef std::vector<ItemInfo> ItemVec;
......
......@@ -88,18 +88,7 @@ void UNetSender::updateFromSM()
DMap::iterator it=dlist.begin();
for( ; it!=dlist.end(); ++it )
{
long value = 0;
if( it->iotype == UniversalIO::DI || it->iotype == UniversalIO::DO )
value = shm->localGetState(it->dit,it->id) ? 1 : 0;
else if( it->iotype == UniversalIO::AI || it->iotype == UniversalIO::AO )
value = shm->localGetValue(it->ait,it->id);
else
{
dlog[Debug::CRIT] << myname << "(update): Unknown iotype for sid=" << it->id << endl;
continue;
}
long value = shm->localGetValue(it->ioit,it->id);
updateItem(it,value);
}
}
......@@ -334,10 +323,7 @@ void UNetSender::initIterators()
{
DMap::iterator it=dlist.begin();
for( ; it!=dlist.end(); it++ )
{
shm->initDIterator(it->dit);
shm->initAIterator(it->ait);
}
shm->initIterator(it->ioit);
}
// -----------------------------------------------------------------------------
void UNetSender::askSensors( UniversalIO::UIOCommand cmd )
......
......@@ -33,8 +33,7 @@ class UNetSender
UniversalIO::IOType iotype;
UniSetTypes::ObjectId id;
IOController::IOStateList::iterator ait;
IOController::DIOStateList::iterator dit;
IOController::IOStateList::iterator ioit;
int pack_ind;
friend std::ostream& operator<<( std::ostream& os, UItem& p );
......
......@@ -173,11 +173,12 @@ void UniExchange::execute()
{
try
{
shm->localSaveState(it->conn_dit,it->sidConnection,ok,getId());
shm->localSetValue(it->conn_it,it->sidConnection,ok,getId());
}
catch(...)
{
dlog[Debug::CRIT]<< myname << "(execute): sensor not avalible "
if( dlog.debugging(Debug::CRIT) )
dlog[Debug::CRIT]<< myname << "(execute): sensor not avalible "
<< conf->oind->getNameById( it->sidConnection)
<< endl;
}
......@@ -214,8 +215,7 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI
IOController_i::ShortMap* m = &(map[i]);
if( reinit )
{
shm->initDIterator(s->dit);
shm->initAIterator(s->ait);
shm->initIterator(s->ioit);
s->type = m->type;
s->id = m->id;
}
......@@ -224,14 +224,13 @@ void UniExchange::NetNodeInfo::update( IOController_i::ShortMapSeq_var& map, SMI
try
{
if( m->type == UniversalIO::DI )
shm->localSaveState( s->dit, m->id, (m->value ? true : false ), shm->ID() );
else if( m->type == UniversalIO::DO )
shm->localSetState( s->dit, m->id, (m->value ? true : false ), shm->ID() );
else if( map[i].type == UniversalIO::AI )
shm->localSaveValue( s->ait, m->id, m->value, shm->ID() );
else if( map[i].type == UniversalIO::AO )
shm->localSetValue( s->ait, m->id, m->value, shm->ID() );
/*
if( s->type == UniversalIO::DO || s->type == UniversalIO::DI )
shm->localSetValue( s->ioit, m->id, (m->value ? 1:0), shm->ID() );
else
shm->localSetValue( s->ioit, m->id, m->value, shm->ID() );
*/
shm->localSetValue( s->ioit, m->id, m->value, shm->ID() );
}
catch( Exception& ex )
{
......@@ -275,24 +274,15 @@ void UniExchange::updateLocalData()
try
{
uniset_rwmutex_wrlock lock(it->val_lock);
if( it->type == UniversalIO::DI ||
it->type == UniversalIO::DO )
{
it->val = shm->localGetState( it->dit, it->id );
}
else if( it->type == UniversalIO::AI ||
it->type == UniversalIO::AO )
{
it->val = shm->localGetValue( it->ait, it->id );
}
it->val = shm->localGetValue( it->ioit, it->id );
}
catch( Exception& ex )
{
dlog[Debug::INFO] << "(update): " << ex << endl;
dlog[Debug::WARN] << "(update): " << ex << endl;
}
catch( ... )
{
dlog[Debug::INFO] << "(update): catch ..." << endl;
dlog[Debug::WARN] << "(update): catch ..." << endl;
}
}
......@@ -302,10 +292,7 @@ void UniExchange::updateLocalData()
void UniExchange::initIterators()
{
for( SList::iterator it=mymap.begin(); it!=mymap.end(); ++it )
{
shm->initDIterator(it->dit);
shm->initAIterator(it->ait);
}
shm->initIterator(it->ioit);
}
// --------------------------------------------------------------------------
void UniExchange::askSensors( UniversalIO::UIOCommand cmd )
......
......@@ -73,8 +73,7 @@ class UniExchange:
type(UniversalIO::UnknownIOType)
{}
IOController::DIOStateList::iterator dit;
IOController::IOStateList::iterator ait;
IOController::IOStateList::iterator ioit;
long val;
long id;
UniversalIO::IOType type;
......@@ -92,7 +91,7 @@ class UniExchange:
UniSetTypes::ObjectId id;
UniSetTypes::ObjectId node;
UniSetTypes::ObjectId sidConnection; /*!< датчик связи */
IOController::DIOStateList::iterator conn_dit;
IOController::IOStateList::iterator conn_it;
SList smap;
void update(IOController_i::ShortMapSeq_var& map, SMInterface* shm );
......
......@@ -90,8 +90,7 @@ static const int NoSafety = -1;
// Зависимость (d - depend)
UniSetTypes::ObjectId d_id; /*!< идентификатор датчика, от которого зависит данный */
IOController::IOStateList::iterator d_ait; /*! итератор на датчик от которого зависит данный */
IOController::DIOStateList::iterator d_dit; /*! итератор на датчик от которого зависит данный */
IOController::IOStateList::iterator d_ioit; /*! итератор на датчик от которого зависит данный */
long d_value; /*!< разрешающее работу значение датчика от которого зависит данный */
long d_off_value; /*!< блокирующее значение */
UniversalIO::IOType d_iotype;
......@@ -104,8 +103,7 @@ static const int NoSafety = -1;
IONotifyController_i::ThresholdInfo ti;
IOController::IOStateList::iterator ait;
IOController::DIOStateList::iterator dit;
IOController::IOStateList::iterator ioit;
UniSetTypes::uniset_rwmutex val_lock; /*!< блокировка на время "работы" со значением */
friend std::ostream& operator<<(std::ostream& os, IOBase& inf );
......
......@@ -15,45 +15,22 @@ class SMInterface
UniSetTypes::ObjectId myid, IONotifyController* ic=0 );
~SMInterface();
void setState ( UniSetTypes::ObjectId, bool state );
void setValue ( UniSetTypes::ObjectId, long value );
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::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 );
long getValue ( UniSetTypes::ObjectId id );
bool getState ( UniSetTypes::ObjectId id );
void askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
IOController_i::DSensorInfoSeq* getDigitalSensorsMap();
IOController_i::ASensorInfoSeq* getAnalogSensorsMap();
IOController_i::SensorInfoSeq* getSensorsMap();
IONotifyController_i::ThresholdsListSeq* getThresholdsList();
void localSaveValue( IOController::IOStateList::iterator& it,
void localSetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Long newvalue, UniSetTypes::ObjectId sup_id );
void localSaveState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id );
void localSetState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id );
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::IOStateList::iterator& it,
long localGetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid );
/*! функция выставления признака неопределённого состояния для аналоговых датчиков
......@@ -64,10 +41,8 @@ class SMInterface
bool undefined, UniSetTypes::ObjectId sid );
// специальные функции
IOController::DIOStateList::iterator dioEnd();
IOController::IOStateList::iterator ioEnd();
void initAIterator( IOController::IOStateList::iterator& it );
void initDIterator( IOController::DIOStateList::iterator& it );
void initIterator( IOController::IOStateList::iterator& it );
bool exist();
bool waitSMready( int msec, int pause=5000 );
......
// --------------------------------------------------------------------------
/*
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
ALL YOUR CHANGES WILL BE LOST.
НЕ РЕДАКТИРУЙТЕ ЭТОТ ФАЙЛ. ЭТОТ ФАЙЛ СОЗДАН АВТОМАТИЧЕСКИ.
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2013-12-15+04:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
......@@ -19,17 +29,15 @@ class UObject_SK:
virtual ~UObject_SK();
bool alarm( UniSetTypes::ObjectId sid, bool state );
bool getState( UniSetTypes::ObjectId sid );
long getValue( UniSetTypes::ObjectId sid );
void setValue( UniSetTypes::ObjectId sid, long value );
void setState( UniSetTypes::ObjectId sid, bool state );
void askState( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand );
void askValue( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand );
void askThreshold ( UniSetTypes::ObjectId sensorId, UniSetTypes::ThresholdId tid,
UniversalIO::UIOCommand cmd,
CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Long sensibility,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
void askSensor( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand, UniSetTypes::ObjectId node = UniSetTypes::conf->getLocalNode() );
void updateValues();
void setMsg( UniSetTypes::ObjectId code, bool state );
DebugStream dlog;
void init_dlog(DebugStream& dlog);
void updateValues();
void setInfo( UniSetTypes::ObjectId code, bool state );
......
......@@ -97,21 +97,8 @@ bool IOBase::check_depend( SMInterface* shm )
if( d_id == DefaultObjectId )
return true;
if( d_iotype == UniversalIO::DI || d_iotype == UniversalIO::DO )
{
if( shm->localGetState(d_dit,d_id) == (bool)d_value )
return true;
if( shm->localGetValue(d_ioit,d_id) != d_value )
return false;
}
if( d_iotype == UniversalIO::AI || d_iotype == UniversalIO::AO )
{
if( shm->localGetValue(d_ait,d_id) == d_value )
return true;
return false;
}
return true;
}
......@@ -123,7 +110,7 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force
{
uniset_rwmutex_wrlock lock(it->val_lock);
it->value = ChannelBreakValue;
shm->localSetUndefinedState(it->ait,true,it->si.id);
shm->localSetUndefinedState(it->ioit,true,it->si.id);
return;
}
......@@ -172,19 +159,11 @@ void IOBase::processingAsAI( IOBase* it, long val, SMInterface* shm, bool force
{
uniset_rwmutex_wrlock lock(it->val_lock);
if( it->value == ChannelBreakValue )
shm->localSetUndefinedState(it->ait,false,it->si.id);
shm->localSetUndefinedState(it->ioit,false,it->si.id);
if( force || it->value != val )
{
if( it->stype == UniversalIO::AI )
shm->localSaveValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::DO )
shm->localSetState( it->dit,it->si.id,(bool)val,shm->ID() );
else if( it->stype == UniversalIO::DI )
shm->localSaveState( it->dit,it->si.id,(bool)val,shm->ID() );
shm->localSetValue( it->ioit,it->si.id,val,shm->ID() );
it->value = val;
}
}
......@@ -202,7 +181,7 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for
{
uniset_rwmutex_wrlock lock(it->val_lock);
it->value = ChannelBreakValue;
shm->localSetUndefinedState(it->ait,true,it->si.id);
shm->localSetUndefinedState(it->ioit,true,it->si.id);
return;
}
......@@ -230,19 +209,11 @@ void IOBase::processingFasAI( IOBase* it, float fval, SMInterface* shm, bool for
{
uniset_rwmutex_wrlock lock(it->val_lock);
if( it->value == ChannelBreakValue )
shm->localSetUndefinedState(it->ait,false,it->si.id);
shm->localSetUndefinedState(it->ioit,false,it->si.id);
if( force || it->value != val )
{
if( it->stype == UniversalIO::AI )
shm->localSaveValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,val,shm->ID() );
else if( it->stype == UniversalIO::DO )
shm->localSetState( it->dit,it->si.id,(bool)val,shm->ID() );
else if( it->stype == UniversalIO::DI )
shm->localSaveState( it->dit,it->si.id,(bool)val,shm->ID() );
shm->localSetValue( it->ioit,it->si.id,val,shm->ID() );
it->value = val;
}
}
......@@ -265,15 +236,7 @@ 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::DI )
shm->localSaveState(it->dit,it->si.id,set,shm->ID());
else if( it->stype == UniversalIO::DO )
shm->localSetState(it->dit,it->si.id,set,shm->ID());
else if( it->stype == UniversalIO::AI )
shm->localSaveValue( it->ait,it->si.id,(set ? 1:0),shm->ID() );
else if( it->stype == UniversalIO::AO )
shm->localSetValue( it->ait,it->si.id,(set ? 1:0),shm->ID() );
shm->localSetValue( it->ioit,it->si.id,(set ? 1:0),shm->ID() );
it->value = set ? 1 : 0;
}
}
......@@ -290,11 +253,7 @@ long IOBase::processingAsAO( IOBase* it, SMInterface* shm, bool force )
if( force )
{
if( it->stype == UniversalIO::DI || it->stype == UniversalIO::DO )
val = shm->localGetState(it->dit,it->si.id) ? 1 : 0;
else if( it->stype == UniversalIO::AI || it->stype == UniversalIO::AO )
val = shm->localGetValue(it->ait,it->si.id);
val = shm->localGetValue(it->ioit,it->si.id);
it->value = val;
}
......@@ -342,12 +301,7 @@ bool IOBase::processingAsDO( IOBase* it, SMInterface* shm, bool force )
bool set = it->value;
if( force )
{
if( it->stype == UniversalIO::DI || it->stype == UniversalIO::DO )
set = shm->localGetState(it->dit,it->si.id);
else if( it->stype == UniversalIO::AI || it->stype == UniversalIO::AO )
set = shm->localGetValue(it->ait,it->si.id) ? true : false;
}
set = shm->localGetValue(it->ioit,it->si.id) ? true : false;
set = it->invert ? !set : set;
return set;
......@@ -364,7 +318,7 @@ float IOBase::processingFasAO( IOBase* it, SMInterface* shm, bool force )
if( force )
{
val = shm->localGetValue(it->ait,it->si.id);
val = shm->localGetValue(it->ioit,it->si.id);
it->value = val;
}
......@@ -406,7 +360,7 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
if( it->t_ai == DefaultObjectId )
return;
long val = shm->localGetValue(it->ait,it->t_ai);
long val = shm->localGetValue(it->ioit,it->t_ai);
bool set = it->value ? true : false;
// cout << "val=" << val << " set=" << set << endl;
......@@ -497,10 +451,8 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->f_ls = false;
b->f_filter_iir = false;
shm->initAIterator(b->ait);
shm->initAIterator(b->d_ait);
shm->initDIterator(b->dit);
shm->initDIterator(b->d_dit);
shm->initIterator(b->ioit);
shm->initIterator(b->d_ioit);
string d_txt(it.getProp("depend"));
if( !d_txt.empty() )
......
......@@ -7,5 +7,3 @@ libUniSetExtensions_la_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/in
libUniSetExtensions_la_LIBADD = $(SIGC_LIBS) $(top_builddir)/lib/libUniSet.la
libUniSetExtensions_la_SOURCES = Extensions.cc SMInterface.cc Calibration.cc SingleProcess.cc \
IOBase.cc DigitalFilter.cc PID.cc MTR.cc VTypes.cc UObject_SK.cc
#UObject_SK.cc
\ No newline at end of file
......@@ -99,26 +99,6 @@ SMInterface::~SMInterface()
}
// --------------------------------------------------------------------------
void SMInterface::setState ( UniSetTypes::ObjectId id, bool state )
{
IOController_i::SensorInfo si;
si.id = id;
si.node = conf->getLocalNode();
if( ic )
{
BEG_FUNC1(SMInterface::setState)
ic->fastSetState(si,state,myid);
return;
END_FUNC(SMInterface::setState)
}
BEG_FUNC1(SMInterface::setState)
ui->fastSetState(si,state,myid);
return;
END_FUNC(SMInterface::setState)
}
// --------------------------------------------------------------------------
void SMInterface::setValue ( UniSetTypes::ObjectId id, long value )
{
IOController_i::SensorInfo si;
......@@ -139,40 +119,6 @@ void SMInterface::setValue ( UniSetTypes::ObjectId id, long value )
END_FUNC(SMInterface::setValue)
}
// --------------------------------------------------------------------------
bool SMInterface::saveState ( IOController_i::SensorInfo& si, bool state,
UniversalIO::IOType type, UniSetTypes::ObjectId sup_id )
{
if( ic )
{
BEG_FUNC1(SMInterface::saveState)
ic->fastSaveState(si,state,type,sup_id);
return true;
END_FUNC(SMInterface::saveState)
}
BEG_FUNC1(SMInterface::saveState)
ui->fastSaveState(si,state,type,sup_id);
return true;
END_FUNC(SMInterface::saveState)
}
// --------------------------------------------------------------------------
bool SMInterface::saveValue ( IOController_i::SensorInfo& si, long value,
UniversalIO::IOType type, UniSetTypes::ObjectId sup_id )
{
if( ic )
{
BEG_FUNC1(SMInterface::saveValue)
ic->fastSaveValue(si,value,type,sup_id);
return true;
END_FUNC(SMInterface::saveValue)
}
BEG_FUNC1(SMInterface::saveValue)
ui->fastSaveValue(si,value,type,sup_id);
return true;
END_FUNC(SMInterface::saveValue)
}
// --------------------------------------------------------------------------
long SMInterface::getValue ( UniSetTypes::ObjectId id )
{
IOController_i::SensorInfo si;
......@@ -191,42 +137,6 @@ long SMInterface::getValue ( UniSetTypes::ObjectId id )
END_FUNC(SMInterface::getValue)
}
// --------------------------------------------------------------------------
bool SMInterface::getState ( UniSetTypes::ObjectId id )
{
IOController_i::SensorInfo si;
si.id = id;
si.node = conf->getLocalNode();
if( ic )
{
BEG_FUNC1(SMInterface::getState)
return ic->getState(si);
END_FUNC(SMInterface::getState)
}
BEG_FUNC1(SMInterface::getState)
return ui->getState(si.id,si.node);
END_FUNC(SMInterface::getState)
}
// --------------------------------------------------------------------------
bool SMInterface::saveLocalState( UniSetTypes::ObjectId id, bool state,
UniversalIO::IOType type )
{
IOController_i::SensorInfo si;
si.id = id;
si.node = conf->getLocalNode();
return saveState(si,state,type,myid);
}
// --------------------------------------------------------------------------
bool SMInterface::saveLocalValue ( UniSetTypes::ObjectId id, long value,
UniversalIO::IOType type )
{
IOController_i::SensorInfo si;
si.id = id;
si.node = conf->getLocalNode();
return saveValue(si,value,type,myid);
}
// --------------------------------------------------------------------------
void SMInterface::askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId backid )
{
IOController_i::SensorInfo_var si;
......@@ -250,32 +160,18 @@ void SMInterface::askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand c
END_FUNC(SMInterface::askSensor)
}
// --------------------------------------------------------------------------
IOController_i::DSensorInfoSeq* SMInterface::getDigitalSensorsMap()
IOController_i::SensorInfoSeq* SMInterface::getSensorsMap()
{
if( ic )
{
BEG_FUNC1(SMInterface::getDigitalSensorsMap)
return ic->getDigitalSensorsMap();
END_FUNC(SMInterface::getDigitalSensorsMap)
BEG_FUNC1(SMInterface::getSensorsMap)
return ic->getSensorsMap();
END_FUNC(SMInterface::getSensorsMap)
}
BEG_FUNC(SMInterface::getDigitalSensorsMap)
return shm->getDigitalSensorsMap();
END_FUNC(SMInterface::getDigitalSensorsMap)
}
// --------------------------------------------------------------------------
IOController_i::ASensorInfoSeq* SMInterface::getAnalogSensorsMap()
{
if( ic )
{
BEG_FUNC1(SMInterface::getAnalogSensorsMap)
return ic->getAnalogSensorsMap();
END_FUNC(SMInterface::getAnalogSensorsMap)
}
BEG_FUNC(SMInterface::getAnalogSensorsMap)
return shm->getAnalogSensorsMap();
END_FUNC(SMInterface::getAnalogSensorsMap)
BEG_FUNC(SMInterface::getSensorsMap)
return shm->getSensorsMap();
END_FUNC(SMInterface::getSensorsMap)
}
// --------------------------------------------------------------------------
IONotifyController_i::ThresholdsListSeq* SMInterface::getThresholdsList()
......@@ -319,64 +215,13 @@ bool SMInterface::exist()
return ui->isExist(shmID);
}
// --------------------------------------------------------------------------
IOController::DIOStateList::iterator SMInterface::dioEnd()
{
CHECK_IC_PTR(dioEnd)
return ic->dioEnd();
}
// --------------------------------------------------------------------------
IOController::IOStateList::iterator SMInterface::ioEnd()
{
CHECK_IC_PTR(ioEnd)
return ic->ioEnd();
}
// --------------------------------------------------------------------------
void SMInterface::localSaveValue( IOController::IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Long nval, UniSetTypes::ObjectId sup_id )
{
if( !ic )
{
saveLocalValue( sid, nval );
return;
}
IOController_i::SensorInfo si;
si.id = sid;
si.node = conf->getLocalNode();
ic->localSaveValue(it,si,nval,sup_id);
}
// --------------------------------------------------------------------------
void SMInterface::localSaveState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Boolean nstate, UniSetTypes::ObjectId sup_id )
{
if( !ic )
{
saveLocalState( sid, nstate );
return;
}
IOController_i::SensorInfo si;
si.id = sid;
si.node = conf->getLocalNode();
ic->localSaveState(it,si,nstate,sup_id);
}
// --------------------------------------------------------------------------
void SMInterface::localSetState( IOController::DIOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Boolean newstate, UniSetTypes::ObjectId sup_id )
{
if( !ic )
return setState( sid, newstate );
// CHECK_IC_PTR(localSetState)
IOController_i::SensorInfo si;
si.id = sid;
si.node = conf->getLocalNode();
ic->localSetState(it,si,newstate,sup_id);
}
// --------------------------------------------------------------------------
void SMInterface::localSetValue( IOController::IOStateList::iterator& it,
void SMInterface::localSetValue( IOController::IOStateList::iterator& it,
UniSetTypes::ObjectId sid,
CORBA::Long value, UniSetTypes::ObjectId sup_id )
{
......@@ -390,18 +235,6 @@ void SMInterface::localSetValue( IOController::IOStateList::iterator& it,
ic->localSetValue(it,si,value,sup_id);
}
// --------------------------------------------------------------------------
bool SMInterface::localGetState( IOController::DIOStateList::iterator& it, UniSetTypes::ObjectId sid )
{
// CHECK_IC_PTR(localGetState)
if( !ic )
return getState(sid);
IOController_i::SensorInfo si;
si.id = sid;
si.node = conf->getLocalNode();
return ic->localGetState(it,si);
}
// --------------------------------------------------------------------------
long SMInterface::localGetValue( IOController::IOStateList::iterator& it, UniSetTypes::ObjectId sid )
{
if( !ic )
......@@ -434,20 +267,10 @@ void SMInterface::localSetUndefinedState( IOController::IOStateList::iterator& i
ic->localSetUndefinedState(it,undefined,si);
}
// --------------------------------------------------------------------------
void SMInterface::initAIterator( IOController::IOStateList::iterator& it )
void SMInterface::initIterator( IOController::IOStateList::iterator& it )
{
if( ic )
it = ic->ioEnd();
// else
// cerr << "(SMInterface::initAIterator): ic=NULL" << endl;
}
// --------------------------------------------------------------------------
void SMInterface::initDIterator( IOController::DIOStateList::iterator& it )
{
if( ic )
it = ic->dioEnd();
// else
// cerr << "(SMInterface::initDIterator): ic=NULL" << endl;
}
// --------------------------------------------------------------------------
bool SMInterface::waitSMready( int ready_timeout, int pmsec )
......@@ -479,7 +302,7 @@ bool SMInterface::waitSMworking( UniSetTypes::ObjectId sid, int msec, int pmsec
{
try
{
getState(sid);
getValue(sid);
sm_ready = true;
break;
}
......
......@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2013-12-10+04:00
// generate timestamp: 2013-12-15+04:00
// -----------------------------------------------------------------------------
#include "Configuration.h"
#include "Exceptions.h"
......@@ -300,11 +300,6 @@ void UObject_SK::sysCommand( SystemMessage* _sm )
}
}
// -----------------------------------------------------------------------------
void UObject_SK::setState( UniSetTypes::ObjectId _sid, bool _state )
{
setValue(_sid, _state ? 1 : 0 );
}
// -----------------------------------------------------------------------------
void UObject_SK::sigterm( int signo )
{
......@@ -399,7 +394,7 @@ void UObject_SK::callback()
// "сердцебиение"
if( idHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
{
ui.saveValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ui.setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
ptHeartBeat.reset();
}
......@@ -445,32 +440,24 @@ void UObject_SK::preSensorInfo( UniSetTypes::SensorMessage* _sm )
sensorInfo(_sm);
}
// -----------------------------------------------------------------------------
void UObject_SK::askState( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{
ui.askRemoteSensor(_sid,_cmd,_node,getId());
}
// -----------------------------------------------------------------------------
void UObject_SK::askValue( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
void UObject_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
{
ui.askRemoteSensor(_sid,_cmd,_node,getId());
}
// -----------------------------------------------------------------------------
bool UObject_SK::getState( UniSetTypes::ObjectId _sid )
{
return (bool)getValue(_sid);
}
// -----------------------------------------------------------------------------
long UObject_SK::getValue( UniSetTypes::ObjectId _sid )
{
try
{
unideb[Debug::CRIT] << myname << "(getState): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid="
<< _sid << endl;
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(getValue): Обращение к неизвестному ДИСКРЕТНОМУ датчику sid="
<< _sid << endl;
}
catch(Exception& ex)
{
unideb[Debug::CRIT] << myname << "(getState): " << ex << endl;
if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(getValue): " << ex << endl;
throw;
}
......
......@@ -215,10 +215,9 @@ class IONotifyController:
/*! массив пар датчик->список порогов */
typedef std::map<UniSetTypes::KeyType,ThresholdsListInfo> AskThresholdMap;
virtual void localSetValue( IOController::IOStateList::iterator& it,
const IOController_i::SensorInfo& si,
CORBA::Long value, UniSetTypes::ObjectId sup_id );
virtual void localSetValue( IOController::IOStateList::iterator& it,
const IOController_i::SensorInfo& si,
CORBA::Long value, UniSetTypes::ObjectId sup_id );
protected:
IONotifyController();
virtual bool activateObject();
......
......@@ -60,7 +60,7 @@ class ObjectIndex_XML:
unsigned int read_nodes( UniXML& xml, const std::string sec, unsigned int ind );
private:
typedef std::map<std::string, ObjectId> MapObjectKey;
typedef std::map<std::string, ObjectId> MapObjectKey;
MapObjectKey mok; // для обратного писка
std::vector<ObjectInfo> omap; // для прямого поиска
......
......@@ -32,6 +32,9 @@ class ObjectIndex_idXML:
private:
typedef std::map<UniSetTypes::ObjectId, UniSetTypes::ObjectInfo> MapObjects;
MapObjects omap;
typedef std::map<std::string, UniSetTypes::ObjectId> MapObjectKey;
MapObjectKey mok; // для обратного писка
};
// -----------------------------------------------------------------------------------------
#endif
......@@ -74,9 +74,6 @@ long UConnector::getValue( long id, long node )throw(UException)
{
case UniversalIO::DI:
case UniversalIO::DO:
return (ui->getState(id,node) ? 1 : 0);
break;
case UniversalIO::AI:
case UniversalIO::AO:
return ui->getValue(id,node);
......@@ -121,17 +118,8 @@ void UConnector::setValue( long id, long val, long node )throw(UException)
switch(t)
{
case UniversalIO::DI:
ui->saveState(id,val,t,node);
break;
case UniversalIO::DO:
ui->setState(id,val,node);
break;
case UniversalIO::AI:
ui->saveValue(id,val,t,node);
break;
case UniversalIO::AO:
ui->setValue(id,val,node);
break;
......
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.8
*
* This file is not intended to be easily readable and contains a number of
* Version 2.0.10
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
......@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast
# define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif
......@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
int equiv = 0;
SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 1;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne;
}
return equiv;
......@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) {
int equiv = 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
SWIG_TypeEquiv(const char *nb, const char *tb) {
return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
}
/*
Check the typename
*/
......@@ -927,6 +916,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
}
#endif
#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif
#if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op) \
do { \
......@@ -1198,7 +1191,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
/* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
......@@ -1821,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args)
static PyMethodDef
swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
......@@ -2637,7 +2630,7 @@ void *SWIG_ReturnGlobalTypeList(void *);
#endif
SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void) {
SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
static void *type_pointer = (void *)0;
/* first check if module already created */
if (!type_pointer) {
......@@ -2763,7 +2756,7 @@ SWIG_Python_TypeQuery(const char *type)
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
#endif
} else {
swig_module_info *swig_module = SWIG_Python_GetModule();
swig_module_info *swig_module = SWIG_GetModule(0);
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) {
#ifdef SWIGPY_USE_CAPSULE
......@@ -2987,7 +2980,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
#endif
#define SWIG_name "_pyUConnector"
#define SWIGVERSION 0x020008
#define SWIGVERSION 0x020010
#define SWIG_VERSION SWIGVERSION
......@@ -4158,7 +4151,6 @@ SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
int found, init;
(void *)clientdata;
/* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next==0) {
......
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.9
*
* This file is not intended to be easily readable and contains a number of
* Version 2.0.10
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
......@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast
# define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif
......@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
int equiv = 0;
SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 1;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne;
}
return equiv;
......@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) {
int equiv = 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
SWIG_TypeEquiv(const char *nb, const char *tb) {
return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
}
/*
Check the typename
*/
......@@ -1825,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args)
static PyMethodDef
swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
......@@ -2991,7 +2980,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
#endif
#define SWIG_name "_pyUExceptions"
#define SWIGVERSION 0x020009
#define SWIGVERSION 0x020010
#define SWIG_VERSION SWIGVERSION
......
......@@ -46,9 +46,6 @@ long UInterface::getValue( long id )throw(UException)
{
case UniversalIO::DI:
case UniversalIO::DO:
return (ui->getState(id) ? 1 : 0);
break;
case UniversalIO::AI:
case UniversalIO::AO:
return ui->getValue(id);
......@@ -89,17 +86,8 @@ void UInterface::setValue( long id, long val )throw(UException)
switch(t)
{
case UniversalIO::DI:
ui->saveState(id,val,t);
break;
case UniversalIO::DO:
ui->setState(id,val);
break;
case UniversalIO::AI:
ui->saveValue(id,val,t);
break;
case UniversalIO::AO:
ui->setValue(id,val);
break;
......
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.8
*
* This file is not intended to be easily readable and contains a number of
* Version 2.0.10
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
......@@ -319,7 +319,7 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast
# define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif
......@@ -383,18 +383,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
int equiv = 0;
SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 1;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne;
}
return equiv;
......@@ -402,24 +402,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) {
int equiv = 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
SWIG_TypeEquiv(const char *nb, const char *tb) {
return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
}
/*
Check the typename
*/
......@@ -927,6 +916,10 @@ static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
}
#endif
#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif
#if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op) \
do { \
......@@ -1198,7 +1191,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
/* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
......@@ -1821,7 +1814,7 @@ SwigPyObject_own(PyObject *v, PyObject *args)
static PyMethodDef
swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
......@@ -2637,7 +2630,7 @@ void *SWIG_ReturnGlobalTypeList(void *);
#endif
SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void) {
SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
static void *type_pointer = (void *)0;
/* first check if module already created */
if (!type_pointer) {
......@@ -2763,7 +2756,7 @@ SWIG_Python_TypeQuery(const char *type)
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
#endif
} else {
swig_module_info *swig_module = SWIG_Python_GetModule();
swig_module_info *swig_module = SWIG_GetModule(0);
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) {
#ifdef SWIGPY_USE_CAPSULE
......@@ -2988,7 +2981,7 @@ static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0};
#endif
#define SWIG_name "_pyUModbus"
#define SWIGVERSION 0x020008
#define SWIGVERSION 0x020010
#define SWIG_VERSION SWIGVERSION
......@@ -5348,8 +5341,7 @@ SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
int found, init;
(void *)clientdata;
/* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next==0) {
/* Initialize the swig_module */
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.8
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.9
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.8
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.8
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
......
......@@ -30,11 +30,9 @@ ObjectIndex_idXML::~ObjectIndex_idXML()
// -----------------------------------------------------------------------------------------
ObjectId ObjectIndex_idXML::getIdByName( const string& name )
{
for( MapObjects::iterator it=omap.begin(); it!=omap.end(); ++it )
{
if( it->second.repName == name )
return it->second.id;
}
MapObjectKey::iterator it = mok.find(name);
if( it != mok.end() )
return it->second;
return DefaultObjectId;
}
......@@ -159,7 +157,8 @@ void ObjectIndex_idXML::read_section( UniXML& xml, const std::string sec )
inf.data = (void*)(xmlNode*)(it);
omap[inf.id] = inf;
omap.insert(MapObjects::value_type(inf.id,inf)); // omap[inf.id] = inf;
mok.insert(MapObjectKey::value_type(name,inf.id)); // mok[name] = inf.id;
}
}
// ------------------------------------------------------------------------------------------
......@@ -216,7 +215,10 @@ void ObjectIndex_idXML::read_nodes( UniXML& xml, const std::string sec )
inf.data = (void*)(xmlNode*)(it);
omap[inf.id] = inf;
// omap[inf.id] = inf;
// mok[nodename] = inf.id;
omap.insert(MapObjects::value_type(inf.id,inf)); // omap[inf.id] = inf;
mok.insert(MapObjectKey::value_type(nodename,inf.id)); // mok[name] = inf.id;
}
}
// ------------------------------------------------------------------------------------------
......
......@@ -22,6 +22,8 @@ int main(int argc, const char **argv)
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "test.xml" );
conf = new Configuration(argc, argv, confile);
cout << "getLocalNode()=" << conf->getLocalNode() << endl;
string t(conf->oind->getTextName(1));
cout << "**** check getTextName: " << ( t.empty() ? "FAILED" : "OK" ) << endl;
......@@ -32,6 +34,15 @@ int main(int argc, const char **argv)
string mn(conf->oind->getMapName(1));
cout << "**** check getMapName: " << ( mn.empty() ? "FAILED" : "OK" ) << endl;
cout << "getSensorID(Input1_S): " << conf->getSensorID("Input1_S") << endl;
std::string iname = conf->oind->getNameById(1);
cout << "getNameById(1): " << iname << endl;
ObjectId i_id = conf->oind->getIdByName(mn);
cout << "getIdByName(" << iname << "): " << (i_id == DefaultObjectId ? "FAIL" : "OK" ) << endl;
UniversalIO::IOType t1=conf->getIOType(1);
cout << "**** getIOType for " << mn << endl;
cout << "**** check getIOType(id): (" << t1 << ") " << ( t1 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl;
......
......@@ -29,6 +29,7 @@
<DocDir name=""/>
<LockDir name=""/>
<testnode name="testnode" id2="-100"/>
<Services>
<LocalTimeService name="TimeService" MaxCountTimers="100" AskLifeTimeSEC="10"/>
<LocalInfoServer name="InfoServer" dbrepeat="1">
......
......@@ -12,7 +12,6 @@ int main( int argc, const char **argv )
uniset_init(argc,argv,"test.xml");
UniversalInterface ui;
cout << "** check getSensorID function **" << endl;
ObjectId id1 = conf->getSensorID("Input1_S");
if( id1 != 1 )
......@@ -50,6 +49,12 @@ int main( int argc, const char **argv )
cout << "id=" << id
<< " value=" << inf.value
<< " last changed: " << string(t_str) << endl;
cout << "check getValue: " << ui.getValue(id1) << endl;
cout << "check setValue: id='" << id1 << "' val=2" << endl;
ui.setValue(id1,2,DefaultObjectId);
cout << "OK" << endl;
}
catch( Exception& ex )
{
......
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