Commit 4def8c92 authored by Pavel Vainerman's avatar Pavel Vainerman

[python]: module refactoring

parent 33108cc9
...@@ -621,7 +621,7 @@ AC_CONFIG_FILES([Makefile ...@@ -621,7 +621,7 @@ AC_CONFIG_FILES([Makefile
testsuite/Makefile testsuite/Makefile
wrappers/Makefile wrappers/Makefile
wrappers/python/lib/Makefile wrappers/python/lib/Makefile
wrappers/python/lib/pyUniSet/Makefile wrappers/python/lib/lib/Makefile
wrappers/python/netdata-plugin/Makefile wrappers/python/netdata-plugin/Makefile
wrappers/python/Makefile]) wrappers/python/Makefile])
......
if ENABLE_PYTHON if ENABLE_PYTHON
SUBDIRS=pyUniSet SUBDIRS=lib
#lib_LTLIBRARIES = libUniSet2Python.la #lib_LTLIBRARIES = libUniSet2Python.la
#libUniSet2Python_la_SOURCES = #libUniSet2Python_la_SOURCES =
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import sys import sys
from .pyUniSet.pyUConnector import * from .lib.UConnector import *
def is_id(str_id): def is_id(str_id):
......
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from .pyUniSet.pyUniSet import * from .lib.UniSet import *
class UInterface(): class UInterface():
......
...@@ -5,7 +5,7 @@ import sys ...@@ -5,7 +5,7 @@ import sys
from .UInterface import * from .UInterface import *
from .UGlobal import * from .UGlobal import *
from .pyUniSet.pyUModbus import * from .lib.UModbus import *
class UInterfaceModbus(UInterface): class UInterfaceModbus(UInterface):
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from .UInterface import * from .UInterface import *
from .UGlobal import * from .UGlobal import *
from .pyUniSet.pyUConnector import * from .lib.UConnector import *
class UInterfaceUniSet(UInterface): class UInterfaceUniSet(UInterface):
......
...@@ -22,8 +22,9 @@ import urllib.request, urllib.parse, urllib.error ...@@ -22,8 +22,9 @@ import urllib.request, urllib.parse, urllib.error
UHTTP_API_VERSION = 'v0' UHTTP_API_VERSION = 'v0'
class UHTTPError: class UHTTPError(BaseException):
def __init__(self, err=''): def __init__(self, err=''):
BaseException.__init__(self)
self.message = err self.message = err
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
__all__ = ["UGlobal", "UInterface", "UInterfaceModbus", "UInterfaceUniSet", "UniSetHTTP", "UniXML"] __all__ = ["UGlobal", "UInterface", "UInterfaceModbus", "UInterfaceUniSet", "UniSetHTTP", "UniXML"]
from .pyUniSet.pyUniSet import * from .lib.UniSet import *
from .pyUniSet.pyUModbus import * from .lib.UModbus import *
from .pyUniSet.pyUConnector import * from .lib.UConnector import *
from .pyUniSet.pyUExceptions import * from .lib.UExceptions import *
if ENABLE_PYTHON
SWIG=swig
#python_SCRIPTS = pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
pydir=$(pkgpythondir)/lib
py_DATA = __init__.py UniSet.py UConnector.py UModbus.py UExceptions.py
BUILD_SRCDIR=$(srcdir)/../../../core
BUILD_SRC=UModbus.cc UConnector.cc UProxyObject.cc
UniSet.py: UInterface_wrap.cxx _UniSet.la
UConnector.py: UConnector_wrap.cxx _UConnector.la
UModbus.py: _UModbus.la UModbus_wrap.cxx
UExceptions.py: _UExceptions.la
pyexec_LTLIBRARIES = _UConnector.la _UModbus.la _UExceptions.la _UniSet.la
_UniSet_la_SOURCES = PyUInterface.cc UInterface_wrap.cxx UProxyObject.cc
_UniSet_la_CXXFLAGS = -I$(BUILD_SRCDIR) $(UNISET_CFLAGS) $(UNISET_EXT_CFLAGS) $(PYTHON_CFLAGS)
_UniSet_la_LDFLAGS = -module -avoid-version
_UniSet_la_LIBADD = $(UNISET_LIBS) $(UNISET_EXT_LIBS) $(PYTHON_LIBS)
UInterface_wrap.cxx: UInterface.i UProxyObject.i PyUInterface.h $(BUILD_SRCDIR)/UProxyObject.h
$(SWIG) -python -py3 -c++ -outcurrentdir -I$(BUILD_SRCDIR) UInterface.i
#PyUObject_wrap.cxx: UObject.i PyUObject.h
# swig -python -c++ -classic UObject.i
_UConnector_la_SOURCES = UConnector.cc UConnector_wrap.cxx
_UConnector_la_CXXFLAGS = -I$(BUILD_SRCDIR) $(UNISET_CFLAGS) $(PYTHON_CFLAGS)
_UConnector_la_LDFLAGS = -module -avoid-version
_UConnector_la_LIBADD = $(UNISET_LIBS) $(PYTHON_LIBS)
UConnector_wrap.cxx: UConnector.i $(BUILD_SRCDIR)/UConnector.h
$(SWIG) -python -py3 -c++ -outcurrentdir -I$(BUILD_SRCDIR) UConnector.i
_UModbus_la_SOURCES = UModbus.cc UModbus_wrap.cxx
_UModbus_la_CXXFLAGS = -I$(BUILD_SRCDIR) $(UNISET_CFLAGS) $(UNISET_EXT_CFLAGS) $(POCO_CFLAGS) $(PYTHON_CFLAGS)
_UModbus_la_LDFLAGS = -module -avoid-version
_UModbus_la_LIBADD = $(UNISET_LIBS) $(UNISET_EXT_LIBS) $(POCO_LIBS) $(PYTHON_LIBS)
UModbus_wrap.cxx: UInterface.i $(BUILD_SRCDIR)/UModbus.h
$(SWIG) -python -py3 -c++ -outcurrentdir -I$(BUILD_SRCDIR) UModbus.i
_UExceptions_la_SOURCES = UExceptions_wrap.cxx
_UExceptions_la_CXXFLAGS = -I$(BUILD_SRCDIR) $(UNISET_CFLAGS) $(UNISET_EXT_CFLAGS) $(PYTHON_CFLAGS)
_UExceptions_la_LDFLAGS = -module -avoid-version
_UExceptions_la_LIBADD = $(UNISET_LIBS) $(UNISET_EXT_LIBS) $(PYTHON_LIBS)
UExceptions_wrap.cxx: UExceptions.i $(BUILD_SRCDIR)/UExceptions.h
$(SWIG) -python -py3 -c++ -outcurrentdir -I$(BUILD_SRCDIR) UExceptions.i
# Специальное правило для удаления сгенерированного кода
# для дальнейшей перегенерации
clean-gen:
rm -rf *.py* *_wrap.cxx
$(BUILD_SRC):
ln -sf $(BUILD_SRCDIR)/$@
all-local: $(BUILD_SRC)
include $(top_builddir)/include.mk
endif
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
***********************************************************/ ***********************************************************/
%include <std_string.i> %include <std_string.i>
%module pyUConnector %module UConnector
%{ %{
#include "UConnector.h" #include "UConnector.h"
%} %}
......
...@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0): ...@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0):
import importlib import importlib
pkg_parts = __name__.rpartition('.') pkg_parts = __name__.rpartition('.')
pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2] pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
mname = '.'.join((pkg, '_pyUConnector')).lstrip('.') mname = '.'.join((pkg, '_UConnector')).lstrip('.')
try: try:
return importlib.import_module(mname) return importlib.import_module(mname)
except ImportError: except ImportError:
return importlib.import_module('_pyUConnector') return importlib.import_module('_UConnector')
_pyUConnector = swig_import_helper() _UConnector = swig_import_helper()
del swig_import_helper del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0): elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper(): def swig_import_helper():
...@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0): ...@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0):
import imp import imp
fp = None fp = None
try: try:
fp, pathname, description = imp.find_module('_pyUConnector', [dirname(__file__)]) fp, pathname, description = imp.find_module('_UConnector', [dirname(__file__)])
except ImportError: except ImportError:
import _pyUConnector import _UConnector
return _pyUConnector return _UConnector
try: try:
_mod = imp.load_module('_pyUConnector', fp, pathname, description) _mod = imp.load_module('_UConnector', fp, pathname, description)
finally: finally:
if fp is not None: if fp is not None:
fp.close() fp.close()
return _mod return _mod
_pyUConnector = swig_import_helper() _UConnector = swig_import_helper()
del swig_import_helper del swig_import_helper
else: else:
raise RuntimeError('Python 2.6 or later required') raise RuntimeError('Python 2.6 or later required')
...@@ -97,43 +97,43 @@ class Params(_object): ...@@ -97,43 +97,43 @@ class Params(_object):
__swig_getmethods__ = {} __swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Params, name) __getattr__ = lambda self, name: _swig_getattr(self, Params, name)
__repr__ = _swig_repr __repr__ = _swig_repr
max = _pyUConnector.Params_max max = _UConnector.Params_max
def __init__(self): def __init__(self):
this = _pyUConnector.new_Params() this = _UConnector.new_Params()
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
def add(self, s: 'char *') -> "bool": def add(self, s: 'char *') -> "bool":
return _pyUConnector.Params_add(self, s) return _UConnector.Params_add(self, s)
def add_str(self, s: 'std::string const') -> "bool": def add_str(self, s: 'std::string const') -> "bool":
return _pyUConnector.Params_add_str(self, s) return _UConnector.Params_add_str(self, s)
__swig_setmethods__["argc"] = _pyUConnector.Params_argc_set __swig_setmethods__["argc"] = _UConnector.Params_argc_set
__swig_getmethods__["argc"] = _pyUConnector.Params_argc_get __swig_getmethods__["argc"] = _UConnector.Params_argc_get
if _newclass: if _newclass:
argc = property(_pyUConnector.Params_argc_get, _pyUConnector.Params_argc_set) argc = property(_UConnector.Params_argc_get, _UConnector.Params_argc_set)
__swig_setmethods__["argv"] = _pyUConnector.Params_argv_set __swig_setmethods__["argv"] = _UConnector.Params_argv_set
__swig_getmethods__["argv"] = _pyUConnector.Params_argv_get __swig_getmethods__["argv"] = _UConnector.Params_argv_get
if _newclass: if _newclass:
argv = property(_pyUConnector.Params_argv_get, _pyUConnector.Params_argv_set) argv = property(_UConnector.Params_argv_get, _UConnector.Params_argv_set)
if _newclass: if _newclass:
inst = staticmethod(_pyUConnector.Params_inst) inst = staticmethod(_UConnector.Params_inst)
else: else:
inst = _pyUConnector.Params_inst inst = _UConnector.Params_inst
__swig_destroy__ = _pyUConnector.delete_Params __swig_destroy__ = _UConnector.delete_Params
__del__ = lambda self: None __del__ = lambda self: None
Params_swigregister = _pyUConnector.Params_swigregister Params_swigregister = _UConnector.Params_swigregister
Params_swigregister(Params) Params_swigregister(Params)
cvar = _pyUConnector.cvar cvar = _UConnector.cvar
DefaultID = cvar.DefaultID DefaultID = cvar.DefaultID
DefaultSupplerID = cvar.DefaultSupplerID DefaultSupplerID = cvar.DefaultSupplerID
def Params_inst() -> "UTypes::Params": def Params_inst() -> "UTypes::Params":
return _pyUConnector.Params_inst() return _UConnector.Params_inst()
Params_inst = _pyUConnector.Params_inst Params_inst = _UConnector.Params_inst
class ShortIOInfo(_object): class ShortIOInfo(_object):
__swig_setmethods__ = {} __swig_setmethods__ = {}
...@@ -141,36 +141,36 @@ class ShortIOInfo(_object): ...@@ -141,36 +141,36 @@ class ShortIOInfo(_object):
__swig_getmethods__ = {} __swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, ShortIOInfo, name) __getattr__ = lambda self, name: _swig_getattr(self, ShortIOInfo, name)
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_setmethods__["value"] = _pyUConnector.ShortIOInfo_value_set __swig_setmethods__["value"] = _UConnector.ShortIOInfo_value_set
__swig_getmethods__["value"] = _pyUConnector.ShortIOInfo_value_get __swig_getmethods__["value"] = _UConnector.ShortIOInfo_value_get
if _newclass: if _newclass:
value = property(_pyUConnector.ShortIOInfo_value_get, _pyUConnector.ShortIOInfo_value_set) value = property(_UConnector.ShortIOInfo_value_get, _UConnector.ShortIOInfo_value_set)
__swig_setmethods__["tv_sec"] = _pyUConnector.ShortIOInfo_tv_sec_set __swig_setmethods__["tv_sec"] = _UConnector.ShortIOInfo_tv_sec_set
__swig_getmethods__["tv_sec"] = _pyUConnector.ShortIOInfo_tv_sec_get __swig_getmethods__["tv_sec"] = _UConnector.ShortIOInfo_tv_sec_get
if _newclass: if _newclass:
tv_sec = property(_pyUConnector.ShortIOInfo_tv_sec_get, _pyUConnector.ShortIOInfo_tv_sec_set) tv_sec = property(_UConnector.ShortIOInfo_tv_sec_get, _UConnector.ShortIOInfo_tv_sec_set)
__swig_setmethods__["tv_nsec"] = _pyUConnector.ShortIOInfo_tv_nsec_set __swig_setmethods__["tv_nsec"] = _UConnector.ShortIOInfo_tv_nsec_set
__swig_getmethods__["tv_nsec"] = _pyUConnector.ShortIOInfo_tv_nsec_get __swig_getmethods__["tv_nsec"] = _UConnector.ShortIOInfo_tv_nsec_get
if _newclass: if _newclass:
tv_nsec = property(_pyUConnector.ShortIOInfo_tv_nsec_get, _pyUConnector.ShortIOInfo_tv_nsec_set) tv_nsec = property(_UConnector.ShortIOInfo_tv_nsec_get, _UConnector.ShortIOInfo_tv_nsec_set)
__swig_setmethods__["supplier"] = _pyUConnector.ShortIOInfo_supplier_set __swig_setmethods__["supplier"] = _UConnector.ShortIOInfo_supplier_set
__swig_getmethods__["supplier"] = _pyUConnector.ShortIOInfo_supplier_get __swig_getmethods__["supplier"] = _UConnector.ShortIOInfo_supplier_get
if _newclass: if _newclass:
supplier = property(_pyUConnector.ShortIOInfo_supplier_get, _pyUConnector.ShortIOInfo_supplier_set) supplier = property(_UConnector.ShortIOInfo_supplier_get, _UConnector.ShortIOInfo_supplier_set)
__swig_setmethods__["supplier_node"] = _pyUConnector.ShortIOInfo_supplier_node_set __swig_setmethods__["supplier_node"] = _UConnector.ShortIOInfo_supplier_node_set
__swig_getmethods__["supplier_node"] = _pyUConnector.ShortIOInfo_supplier_node_get __swig_getmethods__["supplier_node"] = _UConnector.ShortIOInfo_supplier_node_get
if _newclass: if _newclass:
supplier_node = property(_pyUConnector.ShortIOInfo_supplier_node_get, _pyUConnector.ShortIOInfo_supplier_node_set) supplier_node = property(_UConnector.ShortIOInfo_supplier_node_get, _UConnector.ShortIOInfo_supplier_node_set)
def __init__(self): def __init__(self):
this = _pyUConnector.new_ShortIOInfo() this = _UConnector.new_ShortIOInfo()
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUConnector.delete_ShortIOInfo __swig_destroy__ = _UConnector.delete_ShortIOInfo
__del__ = lambda self: None __del__ = lambda self: None
ShortIOInfo_swigregister = _pyUConnector.ShortIOInfo_swigregister ShortIOInfo_swigregister = _UConnector.ShortIOInfo_swigregister
ShortIOInfo_swigregister(ShortIOInfo) ShortIOInfo_swigregister(ShortIOInfo)
class UConnector(_object): class UConnector(_object):
...@@ -181,56 +181,56 @@ class UConnector(_object): ...@@ -181,56 +181,56 @@ class UConnector(_object):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUConnector.new_UConnector(*args) this = _UConnector.new_UConnector(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUConnector.delete_UConnector __swig_destroy__ = _UConnector.delete_UConnector
__del__ = lambda self: None __del__ = lambda self: None
def getUIType(self) -> "std::string": def getUIType(self) -> "std::string":
return _pyUConnector.UConnector_getUIType(self) return _UConnector.UConnector_getUIType(self)
def getConfFileName(self) -> "std::string": def getConfFileName(self) -> "std::string":
return _pyUConnector.UConnector_getConfFileName(self) return _UConnector.UConnector_getConfFileName(self)
def getValue(self, id: 'long', node: 'long') -> "long": def getValue(self, id: 'long', node: 'long') -> "long":
return _pyUConnector.UConnector_getValue(self, id, node) return _UConnector.UConnector_getValue(self, id, node)
def setValue(self, *args) -> "void": def setValue(self, *args) -> "void":
return _pyUConnector.UConnector_setValue(self, *args) return _UConnector.UConnector_setValue(self, *args)
def getTimeChange(self, *args) -> "UTypes::ShortIOInfo": def getTimeChange(self, *args) -> "UTypes::ShortIOInfo":
return _pyUConnector.UConnector_getTimeChange(self, *args) return _UConnector.UConnector_getTimeChange(self, *args)
def getSensorID(self, name: 'std::string const &') -> "long": def getSensorID(self, name: 'std::string const &') -> "long":
return _pyUConnector.UConnector_getSensorID(self, name) return _UConnector.UConnector_getSensorID(self, name)
def getNodeID(self, name: 'std::string const &') -> "long": def getNodeID(self, name: 'std::string const &') -> "long":
return _pyUConnector.UConnector_getNodeID(self, name) return _UConnector.UConnector_getNodeID(self, name)
def getObjectID(self, name: 'std::string const &') -> "long": def getObjectID(self, name: 'std::string const &') -> "long":
return _pyUConnector.UConnector_getObjectID(self, name) return _UConnector.UConnector_getObjectID(self, name)
def getShortName(self, id: 'long') -> "std::string": def getShortName(self, id: 'long') -> "std::string":
return _pyUConnector.UConnector_getShortName(self, id) return _UConnector.UConnector_getShortName(self, id)
def getName(self, id: 'long') -> "std::string": def getName(self, id: 'long') -> "std::string":
return _pyUConnector.UConnector_getName(self, id) return _UConnector.UConnector_getName(self, id)
def getTextName(self, id: 'long') -> "std::string": def getTextName(self, id: 'long') -> "std::string":
return _pyUConnector.UConnector_getTextName(self, id) return _UConnector.UConnector_getTextName(self, id)
def getObjectInfo(self, *args) -> "std::string": def getObjectInfo(self, *args) -> "std::string":
return _pyUConnector.UConnector_getObjectInfo(self, *args) return _UConnector.UConnector_getObjectInfo(self, *args)
def apiRequest(self, *args) -> "std::string": def apiRequest(self, *args) -> "std::string":
return _pyUConnector.UConnector_apiRequest(self, *args) return _UConnector.UConnector_apiRequest(self, *args)
def activate_objects(self) -> "void": def activate_objects(self) -> "void":
return _pyUConnector.UConnector_activate_objects(self) return _UConnector.UConnector_activate_objects(self)
UConnector_swigregister = _pyUConnector.UConnector_swigregister UConnector_swigregister = _UConnector.UConnector_swigregister
UConnector_swigregister(UConnector) UConnector_swigregister(UConnector)
# This file is compatible with both classic and new-style classes. # This file is compatible with both classic and new-style classes.
......
...@@ -2754,16 +2754,16 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; ...@@ -2754,16 +2754,16 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
/*----------------------------------------------- /*-----------------------------------------------
@(target):= _pyUConnector.so @(target):= _UConnector.so
------------------------------------------------*/ ------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__pyUConnector # define SWIG_init PyInit__UConnector
#else #else
# define SWIG_init init_pyUConnector # define SWIG_init init_UConnector
#endif #endif
#define SWIG_name "_pyUConnector" #define SWIG_name "_UConnector"
#define SWIGVERSION 0x030012 #define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
***********************************************************/ ***********************************************************/
%include <std_string.i> %include <std_string.i>
%module pyUExceptions %module UExceptions
%{ %{
#include "UExceptions.h" #include "UExceptions.h"
%} %}
......
...@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0): ...@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0):
import importlib import importlib
pkg_parts = __name__.rpartition('.') pkg_parts = __name__.rpartition('.')
pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2] pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
mname = '.'.join((pkg, '_pyUExceptions')).lstrip('.') mname = '.'.join((pkg, '_UExceptions')).lstrip('.')
try: try:
return importlib.import_module(mname) return importlib.import_module(mname)
except ImportError: except ImportError:
return importlib.import_module('_pyUExceptions') return importlib.import_module('_UExceptions')
_pyUExceptions = swig_import_helper() _UExceptions = swig_import_helper()
del swig_import_helper del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0): elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper(): def swig_import_helper():
...@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0): ...@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0):
import imp import imp
fp = None fp = None
try: try:
fp, pathname, description = imp.find_module('_pyUExceptions', [dirname(__file__)]) fp, pathname, description = imp.find_module('_UExceptions', [dirname(__file__)])
except ImportError: except ImportError:
import _pyUExceptions import _UExceptions
return _pyUExceptions return _UExceptions
try: try:
_mod = imp.load_module('_pyUExceptions', fp, pathname, description) _mod = imp.load_module('_UExceptions', fp, pathname, description)
finally: finally:
if fp is not None: if fp is not None:
fp.close() fp.close()
return _mod return _mod
_pyUExceptions = swig_import_helper() _UExceptions = swig_import_helper()
del swig_import_helper del swig_import_helper
else: else:
raise RuntimeError('Python 2.6 or later required') raise RuntimeError('Python 2.6 or later required')
...@@ -99,22 +99,22 @@ class UException(BaseException, _object): ...@@ -99,22 +99,22 @@ class UException(BaseException, _object):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
BaseException.__init__(self, *args) BaseException.__init__(self, args)
this = _pyUExceptions.new_UException(*args) this = _UExceptions.new_UException(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUExceptions.delete_UException __swig_destroy__ = _UExceptions.delete_UException
__del__ = lambda self: None __del__ = lambda self: None
def getError(self) -> "std::string const": def getError(self) -> "std::string const":
return _pyUExceptions.UException_getError(self) return _UExceptions.UException_getError(self)
__swig_setmethods__["err"] = _pyUExceptions.UException_err_set __swig_setmethods__["err"] = _UExceptions.UException_err_set
__swig_getmethods__["err"] = _pyUExceptions.UException_err_get __swig_getmethods__["err"] = _UExceptions.UException_err_get
if _newclass: if _newclass:
err = property(_pyUExceptions.UException_err_get, _pyUExceptions.UException_err_set) err = property(_UExceptions.UException_err_get, _UExceptions.UException_err_set)
UException_swigregister = _pyUExceptions.UException_swigregister UException_swigregister = _UExceptions.UException_swigregister
UException_swigregister(UException) UException_swigregister(UException)
class UTimeOut(UException): class UTimeOut(UException):
...@@ -129,14 +129,14 @@ class UTimeOut(UException): ...@@ -129,14 +129,14 @@ class UTimeOut(UException):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUExceptions.new_UTimeOut(*args) this = _UExceptions.new_UTimeOut(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUExceptions.delete_UTimeOut __swig_destroy__ = _UExceptions.delete_UTimeOut
__del__ = lambda self: None __del__ = lambda self: None
UTimeOut_swigregister = _pyUExceptions.UTimeOut_swigregister UTimeOut_swigregister = _UExceptions.UTimeOut_swigregister
UTimeOut_swigregister(UTimeOut) UTimeOut_swigregister(UTimeOut)
class USysError(UException): class USysError(UException):
...@@ -151,14 +151,14 @@ class USysError(UException): ...@@ -151,14 +151,14 @@ class USysError(UException):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUExceptions.new_USysError(*args) this = _UExceptions.new_USysError(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUExceptions.delete_USysError __swig_destroy__ = _UExceptions.delete_USysError
__del__ = lambda self: None __del__ = lambda self: None
USysError_swigregister = _pyUExceptions.USysError_swigregister USysError_swigregister = _UExceptions.USysError_swigregister
USysError_swigregister(USysError) USysError_swigregister(USysError)
class UValidateError(UException): class UValidateError(UException):
...@@ -173,14 +173,14 @@ class UValidateError(UException): ...@@ -173,14 +173,14 @@ class UValidateError(UException):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUExceptions.new_UValidateError(*args) this = _UExceptions.new_UValidateError(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUExceptions.delete_UValidateError __swig_destroy__ = _UExceptions.delete_UValidateError
__del__ = lambda self: None __del__ = lambda self: None
UValidateError_swigregister = _pyUExceptions.UValidateError_swigregister UValidateError_swigregister = _UExceptions.UValidateError_swigregister
UValidateError_swigregister(UValidateError) UValidateError_swigregister(UValidateError)
# This file is compatible with both classic and new-style classes. # This file is compatible with both classic and new-style classes.
......
...@@ -2754,16 +2754,16 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; ...@@ -2754,16 +2754,16 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
/*----------------------------------------------- /*-----------------------------------------------
@(target):= _pyUExceptions.so @(target):= _UExceptions.so
------------------------------------------------*/ ------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__pyUExceptions # define SWIG_init PyInit__UExceptions
#else #else
# define SWIG_init init_pyUExceptions # define SWIG_init init_UExceptions
#endif #endif
#define SWIG_name "_pyUExceptions" #define SWIG_name "_UExceptions"
#define SWIGVERSION 0x030012 #define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* swig -python UInterface.i * swig -python UInterface.i
***********************************************************/ ***********************************************************/
%module pyUniSet %module UniSet
%include "std_string.i" %include "std_string.i"
......
...@@ -2758,16 +2758,16 @@ static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0}; ...@@ -2758,16 +2758,16 @@ static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0};
/*----------------------------------------------- /*-----------------------------------------------
@(target):= _pyUniSet.so @(target):= _UniSet.so
------------------------------------------------*/ ------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__pyUniSet # define SWIG_init PyInit__UniSet
#else #else
# define SWIG_init init_pyUniSet # define SWIG_init init_UniSet
#endif #endif
#define SWIG_name "_pyUniSet" #define SWIG_name "_UniSet"
#define SWIGVERSION 0x030012 #define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
***********************************************************/ ***********************************************************/
%include <std_string.i> %include <std_string.i>
%module pyUModbus %module UModbus
%{ %{
#include "UModbus.h" #include "UModbus.h"
%} %}
......
...@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0): ...@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0):
import importlib import importlib
pkg_parts = __name__.rpartition('.') pkg_parts = __name__.rpartition('.')
pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2] pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
mname = '.'.join((pkg, '_pyUModbus')).lstrip('.') mname = '.'.join((pkg, '_UModbus')).lstrip('.')
try: try:
return importlib.import_module(mname) return importlib.import_module(mname)
except ImportError: except ImportError:
return importlib.import_module('_pyUModbus') return importlib.import_module('_UModbus')
_pyUModbus = swig_import_helper() _UModbus = swig_import_helper()
del swig_import_helper del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0): elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper(): def swig_import_helper():
...@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0): ...@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0):
import imp import imp
fp = None fp = None
try: try:
fp, pathname, description = imp.find_module('_pyUModbus', [dirname(__file__)]) fp, pathname, description = imp.find_module('_UModbus', [dirname(__file__)])
except ImportError: except ImportError:
import _pyUModbus import _UModbus
return _pyUModbus return _UModbus
try: try:
_mod = imp.load_module('_pyUModbus', fp, pathname, description) _mod = imp.load_module('_UModbus', fp, pathname, description)
finally: finally:
if fp is not None: if fp is not None:
fp.close() fp.close()
return _mod return _mod
_pyUModbus = swig_import_helper() _UModbus = swig_import_helper()
del swig_import_helper del swig_import_helper
else: else:
raise RuntimeError('Python 2.6 or later required') raise RuntimeError('Python 2.6 or later required')
...@@ -99,53 +99,53 @@ class UModbus(_object): ...@@ -99,53 +99,53 @@ class UModbus(_object):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self): def __init__(self):
this = _pyUModbus.new_UModbus() this = _UModbus.new_UModbus()
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUModbus.delete_UModbus __swig_destroy__ = _UModbus.delete_UModbus
__del__ = lambda self: None __del__ = lambda self: None
def getUIType(self) -> "std::string": def getUIType(self) -> "std::string":
return _pyUModbus.UModbus_getUIType(self) return _UModbus.UModbus_getUIType(self)
def isWriteFunction(self, mbfunc: 'int') -> "bool": def isWriteFunction(self, mbfunc: 'int') -> "bool":
return _pyUModbus.UModbus_isWriteFunction(self, mbfunc) return _UModbus.UModbus_isWriteFunction(self, mbfunc)
def prepare(self, ip: 'std::string const &', port: 'int') -> "void": def prepare(self, ip: 'std::string const &', port: 'int') -> "void":
return _pyUModbus.UModbus_prepare(self, ip, port) return _UModbus.UModbus_prepare(self, ip, port)
def connect(self, ip: 'std::string const &', port: 'int') -> "void": def connect(self, ip: 'std::string const &', port: 'int') -> "void":
return _pyUModbus.UModbus_connect(self, ip, port) return _UModbus.UModbus_connect(self, ip, port)
def conn_port(self) -> "int": def conn_port(self) -> "int":
return _pyUModbus.UModbus_conn_port(self) return _UModbus.UModbus_conn_port(self)
def conn_ip(self) -> "std::string": def conn_ip(self) -> "std::string":
return _pyUModbus.UModbus_conn_ip(self) return _UModbus.UModbus_conn_ip(self)
def isConnection(self) -> "bool": def isConnection(self) -> "bool":
return _pyUModbus.UModbus_isConnection(self) return _UModbus.UModbus_isConnection(self)
def setTimeout(self, msec: 'int') -> "void": def setTimeout(self, msec: 'int') -> "void":
return _pyUModbus.UModbus_setTimeout(self, msec) return _UModbus.UModbus_setTimeout(self, msec)
def mbread(self, *args) -> "long": def mbread(self, *args) -> "long":
return _pyUModbus.UModbus_mbread(self, *args) return _UModbus.UModbus_mbread(self, *args)
def getWord(self, addr: 'int', mbreg: 'int', mbfunc: 'int'=0x4) -> "long": def getWord(self, addr: 'int', mbreg: 'int', mbfunc: 'int'=0x4) -> "long":
return _pyUModbus.UModbus_getWord(self, addr, mbreg, mbfunc) return _UModbus.UModbus_getWord(self, addr, mbreg, mbfunc)
def getByte(self, addr: 'int', mbreg: 'int', mbfunc: 'int'=0x4) -> "long": def getByte(self, addr: 'int', mbreg: 'int', mbfunc: 'int'=0x4) -> "long":
return _pyUModbus.UModbus_getByte(self, addr, mbreg, mbfunc) return _UModbus.UModbus_getByte(self, addr, mbreg, mbfunc)
def getBit(self, addr: 'int', mbreg: 'int', mbfunc: 'int'=0x2) -> "bool": def getBit(self, addr: 'int', mbreg: 'int', mbfunc: 'int'=0x2) -> "bool":
return _pyUModbus.UModbus_getBit(self, addr, mbreg, mbfunc) return _UModbus.UModbus_getBit(self, addr, mbreg, mbfunc)
def mbwrite(self, *args) -> "void": def mbwrite(self, *args) -> "void":
return _pyUModbus.UModbus_mbwrite(self, *args) return _UModbus.UModbus_mbwrite(self, *args)
UModbus_swigregister = _pyUModbus.UModbus_swigregister UModbus_swigregister = _UModbus.UModbus_swigregister
UModbus_swigregister(UModbus) UModbus_swigregister(UModbus)
# This file is compatible with both classic and new-style classes. # This file is compatible with both classic and new-style classes.
......
...@@ -2751,16 +2751,16 @@ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0}; ...@@ -2751,16 +2751,16 @@ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
/*----------------------------------------------- /*-----------------------------------------------
@(target):= _pyUModbus.so @(target):= _UModbus.so
------------------------------------------------*/ ------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__pyUModbus # define SWIG_init PyInit__UModbus
#else #else
# define SWIG_init init_pyUModbus # define SWIG_init init_UModbus
#endif #endif
#define SWIG_name "_pyUModbus" #define SWIG_name "_UModbus"
#define SWIGVERSION 0x030012 #define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* swig -python UInterface.i * swig -python UInterface.i
***********************************************************/ ***********************************************************/
%module pyUniSet %module UniSet
%include <std_string.i> %include <std_string.i>
......
...@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0): ...@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0):
import importlib import importlib
pkg_parts = __name__.rpartition('.') pkg_parts = __name__.rpartition('.')
pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2] pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
mname = '.'.join((pkg, '_pyUniSet')).lstrip('.') mname = '.'.join((pkg, '_UniSet')).lstrip('.')
try: try:
return importlib.import_module(mname) return importlib.import_module(mname)
except ImportError: except ImportError:
return importlib.import_module('_pyUniSet') return importlib.import_module('_UniSet')
_pyUniSet = swig_import_helper() _UniSet = swig_import_helper()
del swig_import_helper del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0): elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper(): def swig_import_helper():
...@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0): ...@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0):
import imp import imp
fp = None fp = None
try: try:
fp, pathname, description = imp.find_module('_pyUniSet', [dirname(__file__)]) fp, pathname, description = imp.find_module('_UniSet', [dirname(__file__)])
except ImportError: except ImportError:
import _pyUniSet import _UniSet
return _pyUniSet return _UniSet
try: try:
_mod = imp.load_module('_pyUniSet', fp, pathname, description) _mod = imp.load_module('_UniSet', fp, pathname, description)
finally: finally:
if fp is not None: if fp is not None:
fp.close() fp.close()
return _mod return _mod
_pyUniSet = swig_import_helper() _UniSet = swig_import_helper()
del swig_import_helper del swig_import_helper
else: else:
raise RuntimeError('Python 2.6 or later required') raise RuntimeError('Python 2.6 or later required')
...@@ -93,91 +93,91 @@ except __builtin__.Exception: ...@@ -93,91 +93,91 @@ except __builtin__.Exception:
def uniset_init_params(p: 'Params', xmlfile: 'std::string const &') -> "void": def uniset_init_params(p: 'Params', xmlfile: 'std::string const &') -> "void":
return _pyUniSet.uniset_init_params(p, xmlfile) return _UniSet.uniset_init_params(p, xmlfile)
uniset_init_params = _pyUniSet.uniset_init_params uniset_init_params = _UniSet.uniset_init_params
def uniset_init(argc: 'int', argv: 'char **', xmlfile: 'std::string const &') -> "void": def uniset_init(argc: 'int', argv: 'char **', xmlfile: 'std::string const &') -> "void":
return _pyUniSet.uniset_init(argc, argv, xmlfile) return _UniSet.uniset_init(argc, argv, xmlfile)
uniset_init = _pyUniSet.uniset_init uniset_init = _UniSet.uniset_init
def uniset_activate_objects() -> "void": def uniset_activate_objects() -> "void":
return _pyUniSet.uniset_activate_objects() return _UniSet.uniset_activate_objects()
uniset_activate_objects = _pyUniSet.uniset_activate_objects uniset_activate_objects = _UniSet.uniset_activate_objects
def getValue(id: 'long') -> "long": def getValue(id: 'long') -> "long":
return _pyUniSet.getValue(id) return _UniSet.getValue(id)
getValue = _pyUniSet.getValue getValue = _UniSet.getValue
def setValue(*args) -> "void": def setValue(*args) -> "void":
return _pyUniSet.setValue(*args) return _UniSet.setValue(*args)
setValue = _pyUniSet.setValue setValue = _UniSet.setValue
def getSensorID(name: 'std::string const &') -> "long": def getSensorID(name: 'std::string const &') -> "long":
return _pyUniSet.getSensorID(name) return _UniSet.getSensorID(name)
getSensorID = _pyUniSet.getSensorID getSensorID = _UniSet.getSensorID
def getObjectID(name: 'std::string const &') -> "long": def getObjectID(name: 'std::string const &') -> "long":
return _pyUniSet.getObjectID(name) return _UniSet.getObjectID(name)
getObjectID = _pyUniSet.getObjectID getObjectID = _UniSet.getObjectID
def getShortName(id: 'long') -> "std::string": def getShortName(id: 'long') -> "std::string":
return _pyUniSet.getShortName(id) return _UniSet.getShortName(id)
getShortName = _pyUniSet.getShortName getShortName = _UniSet.getShortName
def getName(id: 'long') -> "std::string": def getName(id: 'long') -> "std::string":
return _pyUniSet.getName(id) return _UniSet.getName(id)
getName = _pyUniSet.getName getName = _UniSet.getName
def getTextName(id: 'long') -> "std::string": def getTextName(id: 'long') -> "std::string":
return _pyUniSet.getTextName(id) return _UniSet.getTextName(id)
getTextName = _pyUniSet.getTextName getTextName = _UniSet.getTextName
def getConfFileName() -> "std::string": def getConfFileName() -> "std::string":
return _pyUniSet.getConfFileName() return _UniSet.getConfFileName()
getConfFileName = _pyUniSet.getConfFileName getConfFileName = _UniSet.getConfFileName
class Params(_object): class Params(_object):
__swig_setmethods__ = {} __swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Params, name, value) __setattr__ = lambda self, name, value: _swig_setattr(self, Params, name, value)
__swig_getmethods__ = {} __swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Params, name) __getattr__ = lambda self, name: _swig_getattr(self, Params, name)
__repr__ = _swig_repr __repr__ = _swig_repr
max = _pyUniSet.Params_max max = _UniSet.Params_max
def __init__(self): def __init__(self):
this = _pyUniSet.new_Params() this = _UniSet.new_Params()
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
def add(self, s: 'char *') -> "bool": def add(self, s: 'char *') -> "bool":
return _pyUniSet.Params_add(self, s) return _UniSet.Params_add(self, s)
def add_str(self, s: 'std::string const') -> "bool": def add_str(self, s: 'std::string const') -> "bool":
return _pyUniSet.Params_add_str(self, s) return _UniSet.Params_add_str(self, s)
__swig_setmethods__["argc"] = _pyUniSet.Params_argc_set __swig_setmethods__["argc"] = _UniSet.Params_argc_set
__swig_getmethods__["argc"] = _pyUniSet.Params_argc_get __swig_getmethods__["argc"] = _UniSet.Params_argc_get
if _newclass: if _newclass:
argc = property(_pyUniSet.Params_argc_get, _pyUniSet.Params_argc_set) argc = property(_UniSet.Params_argc_get, _UniSet.Params_argc_set)
__swig_setmethods__["argv"] = _pyUniSet.Params_argv_set __swig_setmethods__["argv"] = _UniSet.Params_argv_set
__swig_getmethods__["argv"] = _pyUniSet.Params_argv_get __swig_getmethods__["argv"] = _UniSet.Params_argv_get
if _newclass: if _newclass:
argv = property(_pyUniSet.Params_argv_get, _pyUniSet.Params_argv_set) argv = property(_UniSet.Params_argv_get, _UniSet.Params_argv_set)
if _newclass: if _newclass:
inst = staticmethod(_pyUniSet.Params_inst) inst = staticmethod(_UniSet.Params_inst)
else: else:
inst = _pyUniSet.Params_inst inst = _UniSet.Params_inst
__swig_destroy__ = _pyUniSet.delete_Params __swig_destroy__ = _UniSet.delete_Params
__del__ = lambda self: None __del__ = lambda self: None
Params_swigregister = _pyUniSet.Params_swigregister Params_swigregister = _UniSet.Params_swigregister
Params_swigregister(Params) Params_swigregister(Params)
cvar = _pyUniSet.cvar cvar = _UniSet.cvar
DefaultID = cvar.DefaultID DefaultID = cvar.DefaultID
DefaultSupplerID = cvar.DefaultSupplerID DefaultSupplerID = cvar.DefaultSupplerID
def Params_inst() -> "UTypes::Params": def Params_inst() -> "UTypes::Params":
return _pyUniSet.Params_inst() return _UniSet.Params_inst()
Params_inst = _pyUniSet.Params_inst Params_inst = _UniSet.Params_inst
class ShortIOInfo(_object): class ShortIOInfo(_object):
__swig_setmethods__ = {} __swig_setmethods__ = {}
...@@ -185,39 +185,39 @@ class ShortIOInfo(_object): ...@@ -185,39 +185,39 @@ class ShortIOInfo(_object):
__swig_getmethods__ = {} __swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, ShortIOInfo, name) __getattr__ = lambda self, name: _swig_getattr(self, ShortIOInfo, name)
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_setmethods__["value"] = _pyUniSet.ShortIOInfo_value_set __swig_setmethods__["value"] = _UniSet.ShortIOInfo_value_set
__swig_getmethods__["value"] = _pyUniSet.ShortIOInfo_value_get __swig_getmethods__["value"] = _UniSet.ShortIOInfo_value_get
if _newclass: if _newclass:
value = property(_pyUniSet.ShortIOInfo_value_get, _pyUniSet.ShortIOInfo_value_set) value = property(_UniSet.ShortIOInfo_value_get, _UniSet.ShortIOInfo_value_set)
__swig_setmethods__["tv_sec"] = _pyUniSet.ShortIOInfo_tv_sec_set __swig_setmethods__["tv_sec"] = _UniSet.ShortIOInfo_tv_sec_set
__swig_getmethods__["tv_sec"] = _pyUniSet.ShortIOInfo_tv_sec_get __swig_getmethods__["tv_sec"] = _UniSet.ShortIOInfo_tv_sec_get
if _newclass: if _newclass:
tv_sec = property(_pyUniSet.ShortIOInfo_tv_sec_get, _pyUniSet.ShortIOInfo_tv_sec_set) tv_sec = property(_UniSet.ShortIOInfo_tv_sec_get, _UniSet.ShortIOInfo_tv_sec_set)
__swig_setmethods__["tv_nsec"] = _pyUniSet.ShortIOInfo_tv_nsec_set __swig_setmethods__["tv_nsec"] = _UniSet.ShortIOInfo_tv_nsec_set
__swig_getmethods__["tv_nsec"] = _pyUniSet.ShortIOInfo_tv_nsec_get __swig_getmethods__["tv_nsec"] = _UniSet.ShortIOInfo_tv_nsec_get
if _newclass: if _newclass:
tv_nsec = property(_pyUniSet.ShortIOInfo_tv_nsec_get, _pyUniSet.ShortIOInfo_tv_nsec_set) tv_nsec = property(_UniSet.ShortIOInfo_tv_nsec_get, _UniSet.ShortIOInfo_tv_nsec_set)
__swig_setmethods__["supplier"] = _pyUniSet.ShortIOInfo_supplier_set __swig_setmethods__["supplier"] = _UniSet.ShortIOInfo_supplier_set
__swig_getmethods__["supplier"] = _pyUniSet.ShortIOInfo_supplier_get __swig_getmethods__["supplier"] = _UniSet.ShortIOInfo_supplier_get
if _newclass: if _newclass:
supplier = property(_pyUniSet.ShortIOInfo_supplier_get, _pyUniSet.ShortIOInfo_supplier_set) supplier = property(_UniSet.ShortIOInfo_supplier_get, _UniSet.ShortIOInfo_supplier_set)
__swig_setmethods__["supplier_node"] = _pyUniSet.ShortIOInfo_supplier_node_set __swig_setmethods__["supplier_node"] = _UniSet.ShortIOInfo_supplier_node_set
__swig_getmethods__["supplier_node"] = _pyUniSet.ShortIOInfo_supplier_node_get __swig_getmethods__["supplier_node"] = _UniSet.ShortIOInfo_supplier_node_get
if _newclass: if _newclass:
supplier_node = property(_pyUniSet.ShortIOInfo_supplier_node_get, _pyUniSet.ShortIOInfo_supplier_node_set) supplier_node = property(_UniSet.ShortIOInfo_supplier_node_get, _UniSet.ShortIOInfo_supplier_node_set)
def __init__(self): def __init__(self):
this = _pyUniSet.new_ShortIOInfo() this = _UniSet.new_ShortIOInfo()
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUniSet.delete_ShortIOInfo __swig_destroy__ = _UniSet.delete_ShortIOInfo
__del__ = lambda self: None __del__ = lambda self: None
ShortIOInfo_swigregister = _pyUniSet.ShortIOInfo_swigregister ShortIOInfo_swigregister = _UniSet.ShortIOInfo_swigregister
ShortIOInfo_swigregister(ShortIOInfo) ShortIOInfo_swigregister(ShortIOInfo)
class UException(_object): class UException(BaseException, _object):
__swig_setmethods__ = {} __swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, UException, name, value) __setattr__ = lambda self, name, value: _swig_setattr(self, UException, name, value)
__swig_getmethods__ = {} __swig_getmethods__ = {}
...@@ -225,21 +225,22 @@ class UException(_object): ...@@ -225,21 +225,22 @@ class UException(_object):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUniSet.new_UException(*args) BaseException.__init__(self, args)
this = _UniSet.new_UException(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUniSet.delete_UException __swig_destroy__ = _UniSet.delete_UException
__del__ = lambda self: None __del__ = lambda self: None
def getError(self) -> "std::string const": def getError(self) -> "std::string const":
return _pyUniSet.UException_getError(self) return _UniSet.UException_getError(self)
__swig_setmethods__["err"] = _pyUniSet.UException_err_set __swig_setmethods__["err"] = _UniSet.UException_err_set
__swig_getmethods__["err"] = _pyUniSet.UException_err_get __swig_getmethods__["err"] = _UniSet.UException_err_get
if _newclass: if _newclass:
err = property(_pyUniSet.UException_err_get, _pyUniSet.UException_err_set) err = property(_UniSet.UException_err_get, _UniSet.UException_err_set)
UException_swigregister = _pyUniSet.UException_swigregister UException_swigregister = _UniSet.UException_swigregister
UException_swigregister(UException) UException_swigregister(UException)
class UTimeOut(UException): class UTimeOut(UException):
...@@ -254,14 +255,14 @@ class UTimeOut(UException): ...@@ -254,14 +255,14 @@ class UTimeOut(UException):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUniSet.new_UTimeOut(*args) this = _UniSet.new_UTimeOut(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUniSet.delete_UTimeOut __swig_destroy__ = _UniSet.delete_UTimeOut
__del__ = lambda self: None __del__ = lambda self: None
UTimeOut_swigregister = _pyUniSet.UTimeOut_swigregister UTimeOut_swigregister = _UniSet.UTimeOut_swigregister
UTimeOut_swigregister(UTimeOut) UTimeOut_swigregister(UTimeOut)
class USysError(UException): class USysError(UException):
...@@ -276,14 +277,14 @@ class USysError(UException): ...@@ -276,14 +277,14 @@ class USysError(UException):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUniSet.new_USysError(*args) this = _UniSet.new_USysError(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUniSet.delete_USysError __swig_destroy__ = _UniSet.delete_USysError
__del__ = lambda self: None __del__ = lambda self: None
USysError_swigregister = _pyUniSet.USysError_swigregister USysError_swigregister = _UniSet.USysError_swigregister
USysError_swigregister(USysError) USysError_swigregister(USysError)
class UValidateError(UException): class UValidateError(UException):
...@@ -298,14 +299,14 @@ class UValidateError(UException): ...@@ -298,14 +299,14 @@ class UValidateError(UException):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUniSet.new_UValidateError(*args) this = _UniSet.new_UValidateError(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUniSet.delete_UValidateError __swig_destroy__ = _UniSet.delete_UValidateError
__del__ = lambda self: None __del__ = lambda self: None
UValidateError_swigregister = _pyUniSet.UValidateError_swigregister UValidateError_swigregister = _UniSet.UValidateError_swigregister
UValidateError_swigregister(UValidateError) UValidateError_swigregister(UValidateError)
class UProxyObject(_object): class UProxyObject(_object):
...@@ -316,41 +317,41 @@ class UProxyObject(_object): ...@@ -316,41 +317,41 @@ class UProxyObject(_object):
__repr__ = _swig_repr __repr__ = _swig_repr
def __init__(self, *args): def __init__(self, *args):
this = _pyUniSet.new_UProxyObject(*args) this = _UniSet.new_UProxyObject(*args)
try: try:
self.this.append(this) self.this.append(this)
except __builtin__.Exception: except __builtin__.Exception:
self.this = this self.this = this
__swig_destroy__ = _pyUniSet.delete_UProxyObject __swig_destroy__ = _UniSet.delete_UProxyObject
__del__ = lambda self: None __del__ = lambda self: None
def addToAsk(self, id: 'long') -> "void": def addToAsk(self, id: 'long') -> "void":
return _pyUniSet.UProxyObject_addToAsk(self, id) return _UniSet.UProxyObject_addToAsk(self, id)
def askSensor(self, id: 'long') -> "void": def askSensor(self, id: 'long') -> "void":
return _pyUniSet.UProxyObject_askSensor(self, id) return _UniSet.UProxyObject_askSensor(self, id)
def getValue(self, id: 'long') -> "long": def getValue(self, id: 'long') -> "long":
return _pyUniSet.UProxyObject_getValue(self, id) return _UniSet.UProxyObject_getValue(self, id)
def getFloatValue(self, id: 'long') -> "float": def getFloatValue(self, id: 'long') -> "float":
return _pyUniSet.UProxyObject_getFloatValue(self, id) return _UniSet.UProxyObject_getFloatValue(self, id)
def setValue(self, id: 'long', val: 'long') -> "void": def setValue(self, id: 'long', val: 'long') -> "void":
return _pyUniSet.UProxyObject_setValue(self, id, val) return _UniSet.UProxyObject_setValue(self, id, val)
def askIsOK(self) -> "bool": def askIsOK(self) -> "bool":
return _pyUniSet.UProxyObject_askIsOK(self) return _UniSet.UProxyObject_askIsOK(self)
def reaskSensors(self) -> "bool": def reaskSensors(self) -> "bool":
return _pyUniSet.UProxyObject_reaskSensors(self) return _UniSet.UProxyObject_reaskSensors(self)
def updateValues(self) -> "bool": def updateValues(self) -> "bool":
return _pyUniSet.UProxyObject_updateValues(self) return _UniSet.UProxyObject_updateValues(self)
def smIsOK(self) -> "bool": def smIsOK(self) -> "bool":
return _pyUniSet.UProxyObject_smIsOK(self) return _UniSet.UProxyObject_smIsOK(self)
UProxyObject_swigregister = _pyUniSet.UProxyObject_swigregister UProxyObject_swigregister = _UniSet.UProxyObject_swigregister
UProxyObject_swigregister(UProxyObject) UProxyObject_swigregister(UProxyObject)
# This file is compatible with both classic and new-style classes. # This file is compatible with both classic and new-style classes.
......
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__all__ = ["pyUniSet", "pyUModbus", "pyUConnector", "pyUExceptions"] __all__ = ["UniSet", "UModbus", "UConnector", "UExceptions"]
if ENABLE_PYTHON
SWIG=swig
#python_SCRIPTS = pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
pydir=$(pkgpythondir)/pyUniSet
py_DATA = __init__.py pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
BUILD_SRCDIR=$(srcdir)/../../../core
BUILD_SRC=UModbus.cc UConnector.cc UProxyObject.cc
pyUniSet.py: UInterface_wrap.cxx _pyUniSet.la
pyUConnector.py: UConnector_wrap.cxx _pyUConnector.la
pyUModbus.py: _pyUModbus.la UModbus_wrap.cxx
pyUExceptions.py: _pyUExceptions.la
pyexec_LTLIBRARIES = _pyUConnector.la _pyUModbus.la _pyUExceptions.la _pyUniSet.la
_pyUniSet_la_SOURCES = PyUInterface.cc UInterface_wrap.cxx UProxyObject.cc
_pyUniSet_la_CXXFLAGS = -I$(BUILD_SRCDIR) $(UNISET_CFLAGS) $(UNISET_EXT_CFLAGS) $(PYTHON_CFLAGS)
_pyUniSet_la_LDFLAGS = -module -avoid-version
_pyUniSet_la_LIBADD = $(UNISET_LIBS) $(UNISET_EXT_LIBS) $(PYTHON_LIBS)
UInterface_wrap.cxx: UInterface.i UProxyObject.i PyUInterface.h $(BUILD_SRCDIR)/UProxyObject.h
$(SWIG) -python -py3 -c++ -outcurrentdir -I$(BUILD_SRCDIR) UInterface.i
#PyUObject_wrap.cxx: UObject.i PyUObject.h
# swig -python -c++ -classic UObject.i
_pyUConnector_la_SOURCES = UConnector.cc UConnector_wrap.cxx
_pyUConnector_la_CXXFLAGS = -I$(BUILD_SRCDIR) $(UNISET_CFLAGS) $(PYTHON_CFLAGS)
_pyUConnector_la_LDFLAGS = -module -avoid-version
_pyUConnector_la_LIBADD = $(UNISET_LIBS) $(PYTHON_LIBS)
UConnector_wrap.cxx: UConnector.i $(BUILD_SRCDIR)/UConnector.h
$(SWIG) -python -py3 -c++ -outcurrentdir -I$(BUILD_SRCDIR) UConnector.i
_pyUModbus_la_SOURCES = UModbus.cc UModbus_wrap.cxx
_pyUModbus_la_CXXFLAGS = -I$(BUILD_SRCDIR) $(UNISET_CFLAGS) $(UNISET_EXT_CFLAGS) $(POCO_CFLAGS) $(PYTHON_CFLAGS)
_pyUModbus_la_LDFLAGS = -module -avoid-version
_pyUModbus_la_LIBADD = $(UNISET_LIBS) $(UNISET_EXT_LIBS) $(POCO_LIBS) $(PYTHON_LIBS)
UModbus_wrap.cxx: UInterface.i $(BUILD_SRCDIR)/UModbus.h
$(SWIG) -python -py3 -c++ -outcurrentdir -I$(BUILD_SRCDIR) UModbus.i
_pyUExceptions_la_SOURCES = UExceptions_wrap.cxx
_pyUExceptions_la_CXXFLAGS = -I$(BUILD_SRCDIR) $(UNISET_CFLAGS) $(UNISET_EXT_CFLAGS) $(PYTHON_CFLAGS)
_pyUExceptions_la_LDFLAGS = -module -avoid-version
_pyUExceptions_la_LIBADD = $(UNISET_LIBS) $(UNISET_EXT_LIBS) $(PYTHON_LIBS)
UExceptions_wrap.cxx: UExceptions.i $(BUILD_SRCDIR)/UExceptions.h
$(SWIG) -python -py3 -c++ -outcurrentdir -I$(BUILD_SRCDIR) UExceptions.i
# Специальное правило для удаления сгенерированного кода
# для дальнейшей перегенерации
clean-gen:
rm -rf *.py* *_wrap.cxx
$(BUILD_SRC):
ln -sf $(BUILD_SRCDIR)/$@
all-local: $(BUILD_SRC)
include $(top_builddir)/include.mk
endif
...@@ -30,7 +30,7 @@ import os ...@@ -30,7 +30,7 @@ import os
import sys import sys
import uniset2 import uniset2
from uniset2 import UniXML from uniset2.lib import UniXML
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
sys.path.append("./python_modules") sys.path.append("./python_modules")
......
...@@ -5,10 +5,11 @@ import sys ...@@ -5,10 +5,11 @@ import sys
import time import time
sys.path.append('../../') sys.path.append('../../')
sys.path.append('../../lib/pyUniSet/') sys.path.append('../../lib/lib/')
sys.path.append('../../lib/pyUniSet/.libs') sys.path.append('../../lib/lib/.libs')
from lib import * from UniSet import *
from UConnector import *
def myfunc( act ): def myfunc( act ):
act['test'] = 'test' act['test'] = 'test'
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
import sys import sys
sys.path.append('../../') sys.path.append('../../')
sys.path.append('../../lib/pyUniSet/') sys.path.append('../../lib/lib/')
sys.path.append('../../lib/pyUniSet/.libs') sys.path.append('../../lib/lib/.libs')
from lib import * from UniSet import *
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
import sys import sys
sys.path.append('../../') sys.path.append('../../')
sys.path.append('../../lib/pyUniSet/') sys.path.append('../../lib/lib/')
sys.path.append('../../lib/pyUniSet/.libs') sys.path.append('../../lib/lib/.libs')
from lib import * from UniSet import *
from UModbus import *
if __name__ == "__main__": if __name__ == "__main__":
......
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