Commit 83cb7af0 authored by Pavel Vainerman's avatar Pavel Vainerman

Merge tag '2.8-alt10' into p9

libuniset2 2.8-alt10
parents 026e2664 a8f13962
......@@ -109,7 +109,7 @@ before_install:
install:
# have no catch package
- sudo apt-get install libcomedi-dev libpoco-dev libmysqlclient-dev libomniorb4-dev libev-dev omniidl xsltproc libpqxx3-dev librrd-dev libsigc++-2.0-dev libsqlite3-dev python-dev libmosquittopp0-dev
- sudo apt-get install libcomedi-dev libpoco-dev libmysqlclient-dev libomniorb4-dev libev-dev omniidl xsltproc libpqxx3-dev librrd-dev libsigc++-2.0-dev libsqlite3-dev python-dev libmosquittopp-dev
# catch 2.x
# - wget https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp -O include/catch.hpp
......@@ -145,7 +145,7 @@ addons:
# - libsigc++-2.0-dev
# - libsqlite3-dev
# - python-dev
# - libmosquittopp0-dev
# - libmosquittopp-dev
# - libev-dev
coverity_scan:
project:
......
......@@ -24,7 +24,7 @@
Name: libuniset2
Version: 2.8
Release: alt8
Release: alt10
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
......@@ -544,6 +544,12 @@ rm -f %buildroot%_docdir/%oname/html/*.md5
# history of current unpublished changes
%changelog
* Thu Dec 19 2019 Pavel Vainerman <pv@altlinux.ru> 2.8-alt10
- (DBServer_PostrgeSQL): fix for check connection
* Mon Jul 15 2019 Pavel Vainerman <pv@altlinux.ru> 2.8-alt9
- (UNetUDP): fix bug in init digital sensors
* Mon Mar 18 2019 Pavel Vainerman <pv@altlinux.ru> 2.8-alt8
- minor fixes
......
......@@ -275,7 +275,7 @@ void BackendOpenTSDB::sensorInfo( const uniset::SensorMessage* sm )
s << it->second.name
<< " " << setw(10) << setfill('0') << sm->sm_tv.tv_sec
<< setw(3) << setfill('0') << std::round( sm->sm_tv.tv_nsec / 10e6 )
<< setw(3) << setfill('0') << std::round( sm->sm_tv.tv_nsec / 1e6 )
<< " "
<< sm->value;
......
......@@ -383,7 +383,7 @@ void DBServer_PostgreSQL::initDBServer()
<< " pingTime=" << PingTime
<< " ReconnectTime=" << ReconnectTime << endl;
if( !db->nconnect(dbnode, dbuser, dbpass, dbname, dbport) )
if( !db->reconnect(dbnode, dbuser, dbpass, dbname, dbport) )
{
dbwarn << myname << "(init): DB connection error: " << db->error() << endl;
askTimer(DBServer_PostgreSQL::ReconnectTimer, ReconnectTime);
......
......@@ -40,14 +40,39 @@ PostgreSQLInterface::~PostgreSQLInterface()
}
catch( ... ) // пропускаем все необработанные исключения, если требуется обработать нужно вызывать close() до деструктора
{
cerr << "MySQLInterface::~MySQLInterface(): an error occured while closing connection!" << endl;
cerr << "PostgresSQLInterface::~PostgresSQLInterface(): an error occured while closing connection!" << endl;
}
}
// -----------------------------------------------------------------------------------------
bool PostgreSQLInterface::ping() const
{
return db && db->is_open();
if( !db )
return false;
try
{
nontransaction n(*(db.get()));
n.exec("select 1;");
return true;
}
catch( const std::exception& e )
{
// lastE = string(e.what());
}
return false;
// return db && db->is_open();
}
// -----------------------------------------------------------------------------------------
bool PostgreSQLInterface::reconnect(const string& host, const string& user, const string& pswd, const string& dbname, unsigned int port )
{
if( db )
close();
return nconnect(host,user,pswd, dbname, port);
}
// -----------------------------------------------------------------------------------------
bool PostgreSQLInterface::nconnect(const string& host, const string& user, const string& pswd, const string& dbname, unsigned int port )
......@@ -224,7 +249,8 @@ void PostgreSQLInterface::save_inserted_id( const pqxx::result& res )
// -----------------------------------------------------------------------------------------
bool PostgreSQLInterface::isConnection() const
{
return (db && db->is_open());
return db && ping();
// return (db && db->is_open())
}
// -----------------------------------------------------------------------------------------
DBResult PostgreSQLInterface::makeResult( const pqxx::result& res )
......
......@@ -61,6 +61,10 @@ namespace uniset
virtual const std::string error() override;
bool reconnect(const std::string& host, const std::string& user,
const std::string& pswd, const std::string& dbname,
unsigned int port = 5432);
protected:
private:
......
......@@ -82,6 +82,7 @@ namespace uniset
packs_anum[0] = 0;
packs_dnum[0] = 0;
auto& mypack(mypacks[0][0]);
// выставляем поля, которые не меняются
{
uniset_rwmutex_wrlock l(mypack.mut);
......@@ -412,6 +413,7 @@ namespace uniset
return false;
}
int priority = it.getPIntProp(prop_prefix + "_sendfactor", 0);
auto& pk = mypacks[priority];
......@@ -419,6 +421,7 @@ namespace uniset
UItem p;
p.iotype = uniset::getIOType(it.getProp("iotype"));
p.pack_sendfactor = priority;
long defval = it.getIntProp("default");
if( !it.getProp("undefined_value").empty() )
p.undefined_value = it.getIntProp("undefined_value");
......@@ -438,11 +441,12 @@ namespace uniset
if( pk.size() <= dnum )
pk.resize(dnum + 1);
auto& mypack(pk[dnum]);
auto& mypack = pk[dnum];
{
uniset_rwmutex_wrlock l(mypack.mut);
p.pack_ind = mypack.msg.addDData(sid, 0);
p.pack_ind = mypack.msg.addDData(sid, defval);
} // unlock mutex....
if( p.pack_ind >= maxDData )
{
......@@ -451,21 +455,21 @@ namespace uniset
if( dnum >= pk.size() )
pk.resize(dnum + 1);
auto& mypack2( pk[dnum] );
auto& mypack2 = pk[dnum];
uniset_rwmutex_wrlock l2(mypack2.mut);
p.pack_ind = mypack2.msg.addDData(sid, 0);
p.pack_ind = mypack2.msg.addDData(sid, defval);
mypack2.msg.nodeID = uniset_conf()->getLocalNode();
mypack2.msg.procID = shm->ID();
}
p.pack_num = dnum;
packs_anum[priority] = dnum;
packs_dnum[priority] = dnum;
if ( p.pack_ind >= UniSetUDP::MaxDCount )
{
unetcrit << myname
<< "(readItem): OVERFLOW! MAX UDP DIGITAL DATA LIMIT! max="
<< UniSetUDP::MaxDCount << endl;
<< UniSetUDP::MaxDCount << endl << flush;
std::terminate();
return false;
......@@ -478,20 +482,22 @@ namespace uniset
if( pk.size() <= anum )
pk.resize(anum + 1);
auto& mypack(pk[anum]);
auto& mypack = pk[anum];
{
uniset_rwmutex_wrlock l(mypack.mut);
p.pack_ind = mypack.msg.addAData(sid, 0);
p.pack_ind = mypack.msg.addAData(sid, defval);
}
if( p.pack_ind >= maxAData )
{
anum++;
if( anum >= pk.size() )
pk.resize(anum + 1);
auto& mypack2(pk[anum]);
auto& mypack2 = pk[anum];
uniset_rwmutex_wrlock l2(mypack2.mut);
p.pack_ind = mypack2.msg.addAData(sid, 0);
p.pack_ind = mypack2.msg.addAData(sid, defval);
mypack2.msg.nodeID = uniset_conf()->getLocalNode();
mypack2.msg.procID = shm->ID();
}
......@@ -503,7 +509,7 @@ namespace uniset
{
unetcrit << myname
<< "(readItem): OVERFLOW! MAX UDP ANALOG DATA LIMIT! max="
<< UniSetUDP::MaxACount << endl;
<< UniSetUDP::MaxACount << endl << flush;
std::terminate();
return false;
......
......@@ -50,7 +50,7 @@ namespace uniset
* \note Вызывается через system()! Это может быть опасно с точки зрения безопасности..
* \todo Возможно стоит написать свою реализацию ping
*/
static bool ping( const std::string& _ip, timeout_t tout = 1000, const std::string& ping_argc = "-c 1 -w 0.1 -q -n" ) noexcept;
static bool ping( const std::string& _ip, timeout_t tout = 1100, const std::string& ping_argc = "-c 1 -w 1 -q -n" ) noexcept;
};
// -------------------------------------------------------------------------
} // end of uniset namespace
......
......@@ -269,7 +269,7 @@ namespace uniset
rcache.erase(si.id, si.node);
uwarn << set_err("UI(setUndefinedState): object not exist", si.id, si.node) << endl;
}
catch( const CORBA::COMM_FAILURE ) {}
catch( const CORBA::COMM_FAILURE& ) {}
catch( const CORBA::SystemException& ex ) {}
catch(...) {}
......@@ -985,17 +985,17 @@ namespace uniset
oref = CORBA::Object::_nil();
}
}
catch( const uniset::ORepFailed )
catch( const uniset::ORepFailed& )
{
rcache.erase(name, node);
throw uniset::IOBadParam(set_err("UI(send): resolve failed ", name, node));
}
catch( const CORBA::NO_IMPLEMENT )
catch( const CORBA::NO_IMPLEMENT& )
{
rcache.erase(name, node);
throw uniset::IOBadParam(set_err("UI(send): method no implement", name, node));
}
catch( const CORBA::OBJECT_NOT_EXIST )
catch( const CORBA::OBJECT_NOT_EXIST& )
{
rcache.erase(name, node);
throw uniset::IOBadParam(set_err("UI(send): object not exist", name, node));
......@@ -1062,17 +1062,17 @@ namespace uniset
oref = CORBA::Object::_nil();
}
}
catch( const uniset::ORepFailed )
catch( const uniset::ORepFailed& )
{
rcache.erase(name, onode);
throw uniset::IOBadParam(set_err("UI(sendText): resolve failed ", name, onode));
}
catch( const CORBA::NO_IMPLEMENT )
catch( const CORBA::NO_IMPLEMENT& )
{
rcache.erase(name, onode);
throw uniset::IOBadParam(set_err("UI(sendText): method no implement", name, onode));
}
catch( const CORBA::OBJECT_NOT_EXIST )
catch( const CORBA::OBJECT_NOT_EXIST& )
{
rcache.erase(name, onode);
throw uniset::IOBadParam(set_err("UI(sendText): object not exist", name, onode));
......@@ -1136,17 +1136,17 @@ namespace uniset
oref = CORBA::Object::_nil();
}
}
catch( const uniset::ORepFailed )
catch( const uniset::ORepFailed& )
{
rcache.erase(name, node);
throw uniset::IOBadParam(set_err("UI(sendText): resolve failed ", name, node));
}
catch( const CORBA::NO_IMPLEMENT )
catch( const CORBA::NO_IMPLEMENT& )
{
rcache.erase(name, node);
throw uniset::IOBadParam(set_err("UI(sendText): method no implement", name, node));
}
catch( const CORBA::OBJECT_NOT_EXIST )
catch( const CORBA::OBJECT_NOT_EXIST& )
{
rcache.erase(name, node);
throw uniset::IOBadParam(set_err("UI(sendText): object not exist", name, node));
......@@ -1801,7 +1801,7 @@ namespace uniset
}
catch( const CORBA::TRANSIENT& ) {}
catch( const CORBA::OBJECT_NOT_EXIST& ) {}
catch( const CORBA::SystemException& ex ) {}
catch( const CORBA::SystemException& ) {}
msleep(uconf->getRepeatTimeout());
oref = CORBA::Object::_nil();
......
......@@ -86,7 +86,7 @@ TEST_CASE( "Configuration", "[Configuration]" )
{
int t_argc = 0;
char t_argv[] = {""};
REQUIRE_THROWS_AS( Configuration(t_argc, (const char* const*)(t_argv), ""), uniset::SystemError );
REQUIRE_THROWS_AS( Configuration(t_argc, (const char* const*)(t_argv), ""), uniset::SystemError& );
}
// SECTION( "ObjectIndex Constructor" )
......@@ -98,7 +98,7 @@ TEST_CASE( "Configuration", "[Configuration]" )
int t_argc = 0;
char t_argv[] = {""};
ulog()->level(Debug::NONE);
REQUIRE_THROWS_AS( Configuration(t_argc, (const char* const*)(t_argv), "tests_no_objectsmap.xml"), uniset::SystemError );
REQUIRE_THROWS_AS( Configuration(t_argc, (const char* const*)(t_argv), "tests_no_objectsmap.xml"), uniset::SystemError& );
}
SECTION( "Bad conf: no <UniSet>" )
......@@ -106,7 +106,7 @@ TEST_CASE( "Configuration", "[Configuration]" )
int t_argc = 0;
char t_argv[] = {""};
ulog()->level(Debug::NONE);
REQUIRE_THROWS_AS( Configuration(t_argc, (const char* const*)(t_argv), "tests_no_uniset_section.xml"), uniset::SystemError );
REQUIRE_THROWS_AS( Configuration(t_argc, (const char* const*)(t_argv), "tests_no_uniset_section.xml"), uniset::SystemError& );
}
}
......@@ -27,25 +27,25 @@ TEST_CASE("UInterface", "[UInterface]")
CHECK( ui.getConfIOType(sid) != UniversalIO::UnknownIOType );
REQUIRE_THROWS_AS( ui.getValue(DefaultObjectId), uniset::ORepFailed );
REQUIRE_THROWS_AS( ui.getValue(sid), uniset::Exception );
REQUIRE_THROWS_AS( ui.getValue(sid, DefaultObjectId), uniset::Exception );
REQUIRE_THROWS_AS( ui.getValue(sid, 100), uniset::Exception );
REQUIRE_THROWS_AS( ui.getValue(DefaultObjectId), uniset::ORepFailed& );
REQUIRE_THROWS_AS( ui.getValue(sid), uniset::Exception& );
REQUIRE_THROWS_AS( ui.getValue(sid, DefaultObjectId), uniset::Exception& );
REQUIRE_THROWS_AS( ui.getValue(sid, 100), uniset::Exception& );
REQUIRE_THROWS_AS( ui.resolve(sid), uniset::ORepFailed );
REQUIRE_THROWS_AS( ui.resolve(sid, 10), uniset::ResolveNameError );
REQUIRE_THROWS_AS( ui.resolve(sid, DefaultObjectId), ResolveNameError );
REQUIRE_THROWS_AS( ui.resolve(sid), uniset::ORepFailed& );
REQUIRE_THROWS_AS( ui.resolve(sid, 10), uniset::ResolveNameError& );
REQUIRE_THROWS_AS( ui.resolve(sid, DefaultObjectId), ResolveNameError& );
TransportMessage tm( SensorMessage(sid, 10).transport_msg() );
REQUIRE_THROWS_AS( ui.send(testOID, tm), uniset::Exception );
REQUIRE_THROWS_AS( ui.send(testOID, tm, -20), uniset::Exception );
REQUIRE_THROWS_AS( ui.send(testOID, tm, DefaultObjectId), uniset::Exception );
REQUIRE_THROWS_AS( ui.getTimeChange(sid, -20), uniset::Exception );
REQUIRE_THROWS_AS( ui.getTimeChange(sid, DefaultObjectId), uniset::Exception );
REQUIRE_THROWS_AS( ui.getTimeChange(sid, conf->getLocalNode()), uniset::Exception );
REQUIRE_THROWS_AS( ui.sendText(testOID, "hello", 1), uniset::Exception );
REQUIRE_THROWS_AS( ui.sendText(testOID, "hello", 1, -20), uniset::Exception );
REQUIRE_THROWS_AS( ui.send(testOID, tm), uniset::Exception& );
REQUIRE_THROWS_AS( ui.send(testOID, tm, -20), uniset::Exception& );
REQUIRE_THROWS_AS( ui.send(testOID, tm, DefaultObjectId), uniset::Exception& );
REQUIRE_THROWS_AS( ui.getTimeChange(sid, -20), uniset::Exception& );
REQUIRE_THROWS_AS( ui.getTimeChange(sid, DefaultObjectId), uniset::Exception& );
REQUIRE_THROWS_AS( ui.getTimeChange(sid, conf->getLocalNode()), uniset::Exception& );
REQUIRE_THROWS_AS( ui.sendText(testOID, "hello", 1), uniset::Exception& );
REQUIRE_THROWS_AS( ui.sendText(testOID, "hello", 1, -20), uniset::Exception& );
CHECK_FALSE( ui.isExist(sid) );
CHECK_FALSE( ui.isExist(sid, DefaultObjectId) );
......
......@@ -20,8 +20,8 @@ TEST_CASE("UniXML", "[unixml][basic]" )
SECTION( "Bad file" )
{
REQUIRE_THROWS_AS( UniXML("unknown.xml"), uniset::NameNotFound );
REQUIRE_THROWS_AS( UniXML("tests_unixml_badfile.xml"), uniset::Exception );
REQUIRE_THROWS_AS( UniXML("unknown.xml"), uniset::NameNotFound& );
REQUIRE_THROWS_AS( UniXML("tests_unixml_badfile.xml"), uniset::Exception& );
}
UniXML uxml("tests_unixml.xml");
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg_parts = __name__.rpartition('.')
pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
mname = '.'.join((pkg, '_pyUConnector')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_pyUConnector')
_pyUConnector = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
......@@ -19,17 +27,22 @@ if version_info >= (2, 6, 0):
except ImportError:
import _pyUConnector
return _pyUConnector
if fp is not None:
try:
_mod = imp.load_module('_pyUConnector', fp, pathname, description)
finally:
if fp is not None:
fp.close()
return _mod
_pyUConnector = swig_import_helper()
del swig_import_helper
else:
import _pyUConnector
del version_info
raise RuntimeError('Python 2.6 or later required')
del _swig_python_version_info
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
......@@ -51,25 +64,19 @@ def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
......@@ -85,7 +92,7 @@ class Params:
this = _pyUConnector.new_Params()
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
def add(self, s):
......@@ -97,7 +104,7 @@ class Params:
__swig_getmethods__["argc"] = _pyUConnector.Params_argc_get
__swig_setmethods__["argv"] = _pyUConnector.Params_argv_set
__swig_getmethods__["argv"] = _pyUConnector.Params_argv_get
__swig_getmethods__["inst"] = lambda x: _pyUConnector.Params_inst
inst = _pyUConnector.Params_inst
__swig_destroy__ = _pyUConnector.delete_Params
__del__ = lambda self: None
Params_swigregister = _pyUConnector.Params_swigregister
......@@ -131,7 +138,7 @@ class ShortIOInfo:
this = _pyUConnector.new_ShortIOInfo()
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUConnector.delete_ShortIOInfo
__del__ = lambda self: None
......@@ -149,7 +156,7 @@ class UConnector:
this = _pyUConnector.new_UConnector(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUConnector.delete_UConnector
__del__ = lambda self: None
......@@ -198,6 +205,5 @@ class UConnector:
UConnector_swigregister = _pyUConnector.UConnector_swigregister
UConnector_swigregister(UConnector)
# This file is compatible with both classic and new-style classes.
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg_parts = __name__.rpartition('.')
pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
mname = '.'.join((pkg, '_pyUExceptions')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_pyUExceptions')
_pyUExceptions = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
......@@ -19,17 +27,22 @@ if version_info >= (2, 6, 0):
except ImportError:
import _pyUExceptions
return _pyUExceptions
if fp is not None:
try:
_mod = imp.load_module('_pyUExceptions', fp, pathname, description)
finally:
if fp is not None:
fp.close()
return _mod
_pyUExceptions = swig_import_helper()
del swig_import_helper
else:
import _pyUExceptions
del version_info
raise RuntimeError('Python 2.6 or later required')
del _swig_python_version_info
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
......@@ -51,25 +64,19 @@ def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
......@@ -84,7 +91,7 @@ class UException:
this = _pyUExceptions.new_UException(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUExceptions.delete_UException
__del__ = lambda self: None
......@@ -111,7 +118,7 @@ class UTimeOut(UException):
this = _pyUExceptions.new_UTimeOut(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUExceptions.delete_UTimeOut
__del__ = lambda self: None
......@@ -133,7 +140,7 @@ class USysError(UException):
this = _pyUExceptions.new_USysError(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUExceptions.delete_USysError
__del__ = lambda self: None
......@@ -155,13 +162,12 @@ class UValidateError(UException):
this = _pyUExceptions.new_UValidateError(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUExceptions.delete_UValidateError
__del__ = lambda self: None
UValidateError_swigregister = _pyUExceptions.UValidateError_swigregister
UValidateError_swigregister(UValidateError)
# This file is compatible with both classic and new-style classes.
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg_parts = __name__.rpartition('.')
pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
mname = '.'.join((pkg, '_pyUModbus')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_pyUModbus')
_pyUModbus = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
......@@ -19,17 +27,22 @@ if version_info >= (2, 6, 0):
except ImportError:
import _pyUModbus
return _pyUModbus
if fp is not None:
try:
_mod = imp.load_module('_pyUModbus', fp, pathname, description)
finally:
if fp is not None:
fp.close()
return _mod
_pyUModbus = swig_import_helper()
del swig_import_helper
else:
import _pyUModbus
del version_info
raise RuntimeError('Python 2.6 or later required')
del _swig_python_version_info
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
......@@ -51,25 +64,19 @@ def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
......@@ -84,7 +91,7 @@ class UModbus:
this = _pyUModbus.new_UModbus()
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUModbus.delete_UModbus
__del__ = lambda self: None
......@@ -130,6 +137,5 @@ class UModbus:
UModbus_swigregister = _pyUModbus.UModbus_swigregister
UModbus_swigregister(UModbus)
# This file is compatible with both classic and new-style classes.
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg_parts = __name__.rpartition('.')
pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
mname = '.'.join((pkg, '_pyUniSet')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_pyUniSet')
_pyUniSet = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
......@@ -19,17 +27,22 @@ if version_info >= (2, 6, 0):
except ImportError:
import _pyUniSet
return _pyUniSet
if fp is not None:
try:
_mod = imp.load_module('_pyUniSet', fp, pathname, description)
finally:
if fp is not None:
fp.close()
return _mod
_pyUniSet = swig_import_helper()
del swig_import_helper
else:
import _pyUniSet
del version_info
raise RuntimeError('Python 2.6 or later required')
del _swig_python_version_info
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
......@@ -51,25 +64,19 @@ def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
......@@ -129,7 +136,7 @@ class Params:
this = _pyUniSet.new_Params()
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
def add(self, s):
......@@ -141,7 +148,7 @@ class Params:
__swig_getmethods__["argc"] = _pyUniSet.Params_argc_get
__swig_setmethods__["argv"] = _pyUniSet.Params_argv_set
__swig_getmethods__["argv"] = _pyUniSet.Params_argv_get
__swig_getmethods__["inst"] = lambda x: _pyUniSet.Params_inst
inst = _pyUniSet.Params_inst
__swig_destroy__ = _pyUniSet.delete_Params
__del__ = lambda self: None
Params_swigregister = _pyUniSet.Params_swigregister
......@@ -175,7 +182,7 @@ class ShortIOInfo:
this = _pyUniSet.new_ShortIOInfo()
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUniSet.delete_ShortIOInfo
__del__ = lambda self: None
......@@ -193,7 +200,7 @@ class UException(Exception):
this = _pyUniSet.new_UException(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUniSet.delete_UException
__del__ = lambda self: None
......@@ -220,7 +227,7 @@ class UTimeOut(UException):
this = _pyUniSet.new_UTimeOut(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUniSet.delete_UTimeOut
__del__ = lambda self: None
......@@ -242,7 +249,7 @@ class USysError(UException):
this = _pyUniSet.new_USysError(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUniSet.delete_USysError
__del__ = lambda self: None
......@@ -264,7 +271,7 @@ class UValidateError(UException):
this = _pyUniSet.new_UValidateError(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUniSet.delete_UValidateError
__del__ = lambda self: None
......@@ -282,7 +289,7 @@ class UProxyObject:
this = _pyUniSet.new_UProxyObject(*args)
try:
self.this.append(this)
except Exception:
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyUniSet.delete_UProxyObject
__del__ = lambda self: None
......@@ -313,6 +320,5 @@ class UProxyObject:
UProxyObject_swigregister = _pyUniSet.UProxyObject_swigregister
UProxyObject_swigregister(UProxyObject)
# This file is compatible with both classic and new-style classes.
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