Commit 180b7d9b authored by Pavel Vainerman's avatar Pavel Vainerman

(python): подправил UConnector, убрал лишнюю проверку iotype

parent 5e6966a9
...@@ -67,25 +67,9 @@ long UConnector::getValue( long id, long node )throw(UException) ...@@ -67,25 +67,9 @@ long UConnector::getValue( long id, long node )throw(UException)
if( node == UTypes::DefaultID ) if( node == UTypes::DefaultID )
node = conf->getLocalNode(); node = conf->getLocalNode();
UniversalIO::IOType t = conf->getIOType(id);
try try
{ {
switch(t) return ui->getValue(id,node);
{
case UniversalIO::DI:
case UniversalIO::DO:
case UniversalIO::AI:
case UniversalIO::AO:
return ui->getValue(id,node);
break;
default:
{
ostringstream e;
e << "(getValue): Unknown iotype for id=" << id;
throw UException(e.str());
}
}
} }
catch( UException& ex ) catch( UException& ex )
{ {
...@@ -112,25 +96,9 @@ void UConnector::setValue( long id, long val, long node )throw(UException) ...@@ -112,25 +96,9 @@ void UConnector::setValue( long id, long val, long node )throw(UException)
if( node == UTypes::DefaultID ) if( node == UTypes::DefaultID )
node = conf->getLocalNode(); node = conf->getLocalNode();
UniversalIO::IOType t = conf->getIOType(id);
try try
{ {
switch(t) ui->setValue(id,val,node);
{
case UniversalIO::DI:
case UniversalIO::DO:
case UniversalIO::AI:
case UniversalIO::AO:
ui->setValue(id,val,node);
break;
default:
{
ostringstream e;
e << "(setValue): Unknown iotype for id=" << id;
throw UException(e.str());
}
}
} }
catch( UException& ex ) catch( UException& ex )
{ {
......
...@@ -37,7 +37,8 @@ if __name__ == "__main__": ...@@ -37,7 +37,8 @@ if __name__ == "__main__":
print "getValue exception: " + str(e.getError()) print "getValue exception: " + str(e.getError())
try: try:
print "setValue: %d=%d" % (14,setValue(14,22)) print "setValue: %d=%d" % (14,22)
setValue(14,22)
except UException, e: except UException, e:
print "setValue exception: " + str(e.getError()) print "setValue exception: " + str(e.getError())
......
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