Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
4def8c92
Commit
4def8c92
authored
Oct 14, 2021
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[python]: module refactoring
parent
33108cc9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
166 additions
and
163 deletions
+166
-163
configure.ac
configure.ac
+1
-1
Makefile.am
wrappers/python/lib/Makefile.am
+1
-1
UGlobal.py
wrappers/python/lib/UGlobal.py
+1
-1
UInterface.py
wrappers/python/lib/UInterface.py
+1
-1
UInterfaceModbus.py
wrappers/python/lib/UInterfaceModbus.py
+1
-1
UInterfaceUniSet.py
wrappers/python/lib/UInterfaceUniSet.py
+1
-1
UniSetHTTP.py
wrappers/python/lib/UniSetHTTP.py
+2
-1
__init__.py
wrappers/python/lib/__init__.py
+4
-4
Makefile.am
wrappers/python/lib/lib/Makefile.am
+71
-0
PyUInterface.cc
wrappers/python/lib/lib/PyUInterface.cc
+0
-0
PyUInterface.h
wrappers/python/lib/lib/PyUInterface.h
+0
-0
UConnector.i
wrappers/python/lib/lib/UConnector.i
+1
-1
UConnector.py
wrappers/python/lib/lib/UConnector.py
+0
-0
UConnector_wrap.cxx
wrappers/python/lib/lib/UConnector_wrap.cxx
+4
-4
UExceptions.i
wrappers/python/lib/lib/UExceptions.i
+1
-1
UExceptions.py
wrappers/python/lib/lib/UExceptions.py
+25
-25
UExceptions_wrap.cxx
wrappers/python/lib/lib/UExceptions_wrap.cxx
+4
-4
UInterface.i
wrappers/python/lib/lib/UInterface.i
+1
-1
UInterface_wrap.cxx
wrappers/python/lib/lib/UInterface_wrap.cxx
+4
-4
UModbus.i
wrappers/python/lib/lib/UModbus.i
+1
-1
UModbus.py
wrappers/python/lib/lib/UModbus.py
+24
-24
UModbus_wrap.cxx
wrappers/python/lib/lib/UModbus_wrap.cxx
+4
-4
UProxyObject.i
wrappers/python/lib/lib/UProxyObject.i
+1
-1
UniSet.py
wrappers/python/lib/lib/UniSet.py
+0
-0
__init__.py
wrappers/python/lib/lib/__init__.py
+1
-1
Makefile.am
wrappers/python/lib/pyUniSet/Makefile.am
+0
-71
uniset.chart.py
wrappers/python/netdata-plugin/uniset.chart.py
+1
-1
testUC.py
wrappers/python/tests/UConnector/testUC.py
+4
-3
testUI.py
wrappers/python/tests/UInterface/testUI.py
+3
-3
testUModbus.py
wrappers/python/tests/UModbus/testUModbus.py
+4
-3
No files found.
configure.ac
View file @
4def8c92
...
...
@@ -621,7 +621,7 @@ AC_CONFIG_FILES([Makefile
testsuite/Makefile
wrappers/Makefile
wrappers/python/lib/Makefile
wrappers/python/lib/
pyUniSet
/Makefile
wrappers/python/lib/
lib
/Makefile
wrappers/python/netdata-plugin/Makefile
wrappers/python/Makefile])
...
...
wrappers/python/lib/Makefile.am
View file @
4def8c92
if
ENABLE_PYTHON
SUBDIRS
=
pyUniSet
SUBDIRS
=
lib
#lib_LTLIBRARIES = libUniSet2Python.la
#libUniSet2Python_la_SOURCES =
...
...
wrappers/python/lib/UGlobal.py
View file @
4def8c92
...
...
@@ -3,7 +3,7 @@
import
sys
from
.
pyUniSet.py
UConnector
import
*
from
.
lib.
UConnector
import
*
def
is_id
(
str_id
):
...
...
wrappers/python/lib/UInterface.py
View file @
4def8c92
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from
.
pyUniSet.py
UniSet
import
*
from
.
lib.
UniSet
import
*
class
UInterface
():
...
...
wrappers/python/lib/UInterfaceModbus.py
View file @
4def8c92
...
...
@@ -5,7 +5,7 @@ import sys
from
.UInterface
import
*
from
.UGlobal
import
*
from
.
pyUniSet.py
UModbus
import
*
from
.
lib.
UModbus
import
*
class
UInterfaceModbus
(
UInterface
):
...
...
wrappers/python/lib/UInterfaceUniSet.py
View file @
4def8c92
...
...
@@ -3,7 +3,7 @@
from
.UInterface
import
*
from
.UGlobal
import
*
from
.
pyUniSet.py
UConnector
import
*
from
.
lib.
UConnector
import
*
class
UInterfaceUniSet
(
UInterface
):
...
...
wrappers/python/lib/UniSetHTTP.py
View file @
4def8c92
...
...
@@ -22,8 +22,9 @@ import urllib.request, urllib.parse, urllib.error
UHTTP_API_VERSION
=
'v0'
class
UHTTPError
:
class
UHTTPError
(
BaseException
)
:
def
__init__
(
self
,
err
=
''
):
BaseException
.
__init__
(
self
)
self
.
message
=
err
...
...
wrappers/python/lib/__init__.py
View file @
4def8c92
...
...
@@ -3,8 +3,8 @@
__all__
=
[
"UGlobal"
,
"UInterface"
,
"UInterfaceModbus"
,
"UInterfaceUniSet"
,
"UniSetHTTP"
,
"UniXML"
]
from
.
pyUniSet.py
UniSet
import
*
from
.
pyUniSet.py
UModbus
import
*
from
.
pyUniSet.py
UConnector
import
*
from
.
lib.
UniSet
import
*
from
.
lib.
UModbus
import
*
from
.
lib.
UConnector
import
*
from
.
pyUniSet.py
UExceptions
import
*
from
.
lib.
UExceptions
import
*
wrappers/python/lib/lib/Makefile.am
0 → 100644
View file @
4def8c92
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
wrappers/python/lib/
pyUniSet
/PyUInterface.cc
→
wrappers/python/lib/
lib
/PyUInterface.cc
View file @
4def8c92
File moved
wrappers/python/lib/
pyUniSet
/PyUInterface.h
→
wrappers/python/lib/
lib
/PyUInterface.h
View file @
4def8c92
File moved
wrappers/python/lib/
pyUniSet
/UConnector.i
→
wrappers/python/lib/
lib
/UConnector.i
View file @
4def8c92
...
...
@@ -5,7 +5,7 @@
***********************************************************/
%include <std_string.i>
%module
py
UConnector
%module UConnector
%{
#include "UConnector.h"
%}
...
...
wrappers/python/lib/
pyUniSet/py
UConnector.py
→
wrappers/python/lib/
lib/
UConnector.py
View file @
4def8c92
This diff is collapsed.
Click to expand it.
wrappers/python/lib/
pyUniSet
/UConnector_wrap.cxx
→
wrappers/python/lib/
lib
/UConnector_wrap.cxx
View file @
4def8c92
...
...
@@ -2754,16 +2754,16 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
/*-----------------------------------------------
@(target):= _
py
UConnector.so
@(target):= _UConnector.so
------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__
py
UConnector
# define SWIG_init PyInit__UConnector
#else
# define SWIG_init init_
py
UConnector
# define SWIG_init init_UConnector
#endif
#define SWIG_name "_
py
UConnector"
#define SWIG_name "_UConnector"
#define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION
...
...
wrappers/python/lib/
pyUniSet
/UExceptions.i
→
wrappers/python/lib/
lib
/UExceptions.i
View file @
4def8c92
...
...
@@ -5,7 +5,7 @@
***********************************************************/
%include <std_string.i>
%module
py
UExceptions
%module UExceptions
%{
#include "UExceptions.h"
%}
...
...
wrappers/python/lib/
pyUniSet/py
UExceptions.py
→
wrappers/python/lib/
lib/
UExceptions.py
View file @
4def8c92
...
...
@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0):
import
importlib
pkg_parts
=
__name__
.
rpartition
(
'.'
)
pkg
=
pkg_parts
[
0
]
if
pkg_parts
[
1
]
==
'.'
else
pkg_parts
[
2
]
mname
=
'.'
.
join
((
pkg
,
'_
py
UExceptions'
))
.
lstrip
(
'.'
)
mname
=
'.'
.
join
((
pkg
,
'_UExceptions'
))
.
lstrip
(
'.'
)
try
:
return
importlib
.
import_module
(
mname
)
except
ImportError
:
return
importlib
.
import_module
(
'_
py
UExceptions'
)
_
py
UExceptions
=
swig_import_helper
()
return
importlib
.
import_module
(
'_UExceptions'
)
_UExceptions
=
swig_import_helper
()
del
swig_import_helper
elif
_swig_python_version_info
>=
(
2
,
6
,
0
):
def
swig_import_helper
():
...
...
@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0):
import
imp
fp
=
None
try
:
fp
,
pathname
,
description
=
imp
.
find_module
(
'_
py
UExceptions'
,
[
dirname
(
__file__
)])
fp
,
pathname
,
description
=
imp
.
find_module
(
'_UExceptions'
,
[
dirname
(
__file__
)])
except
ImportError
:
import
_
py
UExceptions
return
_
py
UExceptions
import
_UExceptions
return
_UExceptions
try
:
_mod
=
imp
.
load_module
(
'_
py
UExceptions'
,
fp
,
pathname
,
description
)
_mod
=
imp
.
load_module
(
'_UExceptions'
,
fp
,
pathname
,
description
)
finally
:
if
fp
is
not
None
:
fp
.
close
()
return
_mod
_
py
UExceptions
=
swig_import_helper
()
_UExceptions
=
swig_import_helper
()
del
swig_import_helper
else
:
raise
RuntimeError
(
'Python 2.6 or later required'
)
...
...
@@ -99,22 +99,22 @@ class UException(BaseException, _object):
__repr__
=
_swig_repr
def
__init__
(
self
,
*
args
):
BaseException
.
__init__
(
self
,
*
args
)
this
=
_
py
UExceptions
.
new_UException
(
*
args
)
BaseException
.
__init__
(
self
,
args
)
this
=
_UExceptions
.
new_UException
(
*
args
)
try
:
self
.
this
.
append
(
this
)
except
__builtin__
.
Exception
:
self
.
this
=
this
__swig_destroy__
=
_
py
UExceptions
.
delete_UException
__swig_destroy__
=
_UExceptions
.
delete_UException
__del__
=
lambda
self
:
None
def
getError
(
self
)
->
"std::string const"
:
return
_
py
UExceptions
.
UException_getError
(
self
)
__swig_setmethods__
[
"err"
]
=
_
py
UExceptions
.
UException_err_set
__swig_getmethods__
[
"err"
]
=
_
py
UExceptions
.
UException_err_get
return
_UExceptions
.
UException_getError
(
self
)
__swig_setmethods__
[
"err"
]
=
_UExceptions
.
UException_err_set
__swig_getmethods__
[
"err"
]
=
_UExceptions
.
UException_err_get
if
_newclass
:
err
=
property
(
_
pyUExceptions
.
UException_err_get
,
_py
UExceptions
.
UException_err_set
)
UException_swigregister
=
_
py
UExceptions
.
UException_swigregister
err
=
property
(
_
UExceptions
.
UException_err_get
,
_
UExceptions
.
UException_err_set
)
UException_swigregister
=
_UExceptions
.
UException_swigregister
UException_swigregister
(
UException
)
class
UTimeOut
(
UException
):
...
...
@@ -129,14 +129,14 @@ class UTimeOut(UException):
__repr__
=
_swig_repr
def
__init__
(
self
,
*
args
):
this
=
_
py
UExceptions
.
new_UTimeOut
(
*
args
)
this
=
_UExceptions
.
new_UTimeOut
(
*
args
)
try
:
self
.
this
.
append
(
this
)
except
__builtin__
.
Exception
:
self
.
this
=
this
__swig_destroy__
=
_
py
UExceptions
.
delete_UTimeOut
__swig_destroy__
=
_UExceptions
.
delete_UTimeOut
__del__
=
lambda
self
:
None
UTimeOut_swigregister
=
_
py
UExceptions
.
UTimeOut_swigregister
UTimeOut_swigregister
=
_UExceptions
.
UTimeOut_swigregister
UTimeOut_swigregister
(
UTimeOut
)
class
USysError
(
UException
):
...
...
@@ -151,14 +151,14 @@ class USysError(UException):
__repr__
=
_swig_repr
def
__init__
(
self
,
*
args
):
this
=
_
py
UExceptions
.
new_USysError
(
*
args
)
this
=
_UExceptions
.
new_USysError
(
*
args
)
try
:
self
.
this
.
append
(
this
)
except
__builtin__
.
Exception
:
self
.
this
=
this
__swig_destroy__
=
_
py
UExceptions
.
delete_USysError
__swig_destroy__
=
_UExceptions
.
delete_USysError
__del__
=
lambda
self
:
None
USysError_swigregister
=
_
py
UExceptions
.
USysError_swigregister
USysError_swigregister
=
_UExceptions
.
USysError_swigregister
USysError_swigregister
(
USysError
)
class
UValidateError
(
UException
):
...
...
@@ -173,14 +173,14 @@ class UValidateError(UException):
__repr__
=
_swig_repr
def
__init__
(
self
,
*
args
):
this
=
_
py
UExceptions
.
new_UValidateError
(
*
args
)
this
=
_UExceptions
.
new_UValidateError
(
*
args
)
try
:
self
.
this
.
append
(
this
)
except
__builtin__
.
Exception
:
self
.
this
=
this
__swig_destroy__
=
_
py
UExceptions
.
delete_UValidateError
__swig_destroy__
=
_UExceptions
.
delete_UValidateError
__del__
=
lambda
self
:
None
UValidateError_swigregister
=
_
py
UExceptions
.
UValidateError_swigregister
UValidateError_swigregister
=
_UExceptions
.
UValidateError_swigregister
UValidateError_swigregister
(
UValidateError
)
# This file is compatible with both classic and new-style classes.
...
...
wrappers/python/lib/
pyUniSet
/UExceptions_wrap.cxx
→
wrappers/python/lib/
lib
/UExceptions_wrap.cxx
View file @
4def8c92
...
...
@@ -2754,16 +2754,16 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
/*-----------------------------------------------
@(target):= _
py
UExceptions.so
@(target):= _UExceptions.so
------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__
py
UExceptions
# define SWIG_init PyInit__UExceptions
#else
# define SWIG_init init_
py
UExceptions
# define SWIG_init init_UExceptions
#endif
#define SWIG_name "_
py
UExceptions"
#define SWIG_name "_UExceptions"
#define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION
...
...
wrappers/python/lib/
pyUniSet
/UInterface.i
→
wrappers/python/lib/
lib
/UInterface.i
View file @
4def8c92
...
...
@@ -4,7 +4,7 @@
* swig -python UInterface.i
***********************************************************/
%module
py
UniSet
%module UniSet
%include "std_string.i"
...
...
wrappers/python/lib/
pyUniSet
/UInterface_wrap.cxx
→
wrappers/python/lib/
lib
/UInterface_wrap.cxx
View file @
4def8c92
...
...
@@ -2758,16 +2758,16 @@ static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0};
/*-----------------------------------------------
@(target):= _
py
UniSet.so
@(target):= _UniSet.so
------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__
py
UniSet
# define SWIG_init PyInit__UniSet
#else
# define SWIG_init init_
py
UniSet
# define SWIG_init init_UniSet
#endif
#define SWIG_name "_
py
UniSet"
#define SWIG_name "_UniSet"
#define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION
...
...
wrappers/python/lib/
pyUniSet
/UModbus.i
→
wrappers/python/lib/
lib
/UModbus.i
View file @
4def8c92
...
...
@@ -5,7 +5,7 @@
***********************************************************/
%include <std_string.i>
%module
py
UModbus
%module UModbus
%{
#include "UModbus.h"
%}
...
...
wrappers/python/lib/
pyUniSet/py
UModbus.py
→
wrappers/python/lib/
lib/
UModbus.py
View file @
4def8c92
...
...
@@ -10,12 +10,12 @@ if _swig_python_version_info >= (2, 7, 0):
import
importlib
pkg_parts
=
__name__
.
rpartition
(
'.'
)
pkg
=
pkg_parts
[
0
]
if
pkg_parts
[
1
]
==
'.'
else
pkg_parts
[
2
]
mname
=
'.'
.
join
((
pkg
,
'_
py
UModbus'
))
.
lstrip
(
'.'
)
mname
=
'.'
.
join
((
pkg
,
'_UModbus'
))
.
lstrip
(
'.'
)
try
:
return
importlib
.
import_module
(
mname
)
except
ImportError
:
return
importlib
.
import_module
(
'_
py
UModbus'
)
_
py
UModbus
=
swig_import_helper
()
return
importlib
.
import_module
(
'_UModbus'
)
_UModbus
=
swig_import_helper
()
del
swig_import_helper
elif
_swig_python_version_info
>=
(
2
,
6
,
0
):
def
swig_import_helper
():
...
...
@@ -23,17 +23,17 @@ elif _swig_python_version_info >= (2, 6, 0):
import
imp
fp
=
None
try
:
fp
,
pathname
,
description
=
imp
.
find_module
(
'_
py
UModbus'
,
[
dirname
(
__file__
)])
fp
,
pathname
,
description
=
imp
.
find_module
(
'_UModbus'
,
[
dirname
(
__file__
)])
except
ImportError
:
import
_
py
UModbus
return
_
py
UModbus
import
_UModbus
return
_UModbus
try
:
_mod
=
imp
.
load_module
(
'_
py
UModbus'
,
fp
,
pathname
,
description
)
_mod
=
imp
.
load_module
(
'_UModbus'
,
fp
,
pathname
,
description
)
finally
:
if
fp
is
not
None
:
fp
.
close
()
return
_mod
_
py
UModbus
=
swig_import_helper
()
_UModbus
=
swig_import_helper
()
del
swig_import_helper
else
:
raise
RuntimeError
(
'Python 2.6 or later required'
)
...
...
@@ -99,53 +99,53 @@ class UModbus(_object):
__repr__
=
_swig_repr
def
__init__
(
self
):
this
=
_
py
UModbus
.
new_UModbus
()
this
=
_UModbus
.
new_UModbus
()
try
:
self
.
this
.
append
(
this
)
except
__builtin__
.
Exception
:
self
.
this
=
this
__swig_destroy__
=
_
py
UModbus
.
delete_UModbus
__swig_destroy__
=
_UModbus
.
delete_UModbus
__del__
=
lambda
self
:
None
def
getUIType
(
self
)
->
"std::string"
:
return
_
py
UModbus
.
UModbus_getUIType
(
self
)
return
_UModbus
.
UModbus_getUIType
(
self
)
def
isWriteFunction
(
self
,
mbfunc
:
'int'
)
->
"bool"
:
return
_
py
UModbus
.
UModbus_isWriteFunction
(
self
,
mbfunc
)
return
_UModbus
.
UModbus_isWriteFunction
(
self
,
mbfunc
)
def
prepare
(
self
,
ip
:
'std::string const &'
,
port
:
'int'
)
->
"void"
:
return
_
py
UModbus
.
UModbus_prepare
(
self
,
ip
,
port
)
return
_UModbus
.
UModbus_prepare
(
self
,
ip
,
port
)
def
connect
(
self
,
ip
:
'std::string const &'
,
port
:
'int'
)
->
"void"
:
return
_
py
UModbus
.
UModbus_connect
(
self
,
ip
,
port
)
return
_UModbus
.
UModbus_connect
(
self
,
ip
,
port
)
def
conn_port
(
self
)
->
"int"
:
return
_
py
UModbus
.
UModbus_conn_port
(
self
)
return
_UModbus
.
UModbus_conn_port
(
self
)
def
conn_ip
(
self
)
->
"std::string"
:
return
_
py
UModbus
.
UModbus_conn_ip
(
self
)
return
_UModbus
.
UModbus_conn_ip
(
self
)
def
isConnection
(
self
)
->
"bool"
:
return
_
py
UModbus
.
UModbus_isConnection
(
self
)
return
_UModbus
.
UModbus_isConnection
(
self
)
def
setTimeout
(
self
,
msec
:
'int'
)
->
"void"
:
return
_
py
UModbus
.
UModbus_setTimeout
(
self
,
msec
)
return
_UModbus
.
UModbus_setTimeout
(
self
,
msec
)
def
mbread
(
self
,
*
args
)
->
"long"
:
return
_
py
UModbus
.
UModbus_mbread
(
self
,
*
args
)
return
_UModbus
.
UModbus_mbread
(
self
,
*
args
)
def
getWord
(
self
,
addr
:
'int'
,
mbreg
:
'int'
,
mbfunc
:
'int'
=
0x4
)
->
"long"
:
return
_
py
UModbus
.
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"
:
return
_
py
UModbus
.
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"
:
return
_
py
UModbus
.
UModbus_getBit
(
self
,
addr
,
mbreg
,
mbfunc
)
return
_UModbus
.
UModbus_getBit
(
self
,
addr
,
mbreg
,
mbfunc
)
def
mbwrite
(
self
,
*
args
)
->
"void"
:
return
_
py
UModbus
.
UModbus_mbwrite
(
self
,
*
args
)
UModbus_swigregister
=
_
py
UModbus
.
UModbus_swigregister
return
_UModbus
.
UModbus_mbwrite
(
self
,
*
args
)
UModbus_swigregister
=
_UModbus
.
UModbus_swigregister
UModbus_swigregister
(
UModbus
)
# This file is compatible with both classic and new-style classes.
...
...
wrappers/python/lib/
pyUniSet
/UModbus_wrap.cxx
→
wrappers/python/lib/
lib
/UModbus_wrap.cxx
View file @
4def8c92
...
...
@@ -2751,16 +2751,16 @@ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
/*-----------------------------------------------
@(target):= _
py
UModbus.so
@(target):= _UModbus.so
------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__
py
UModbus
# define SWIG_init PyInit__UModbus
#else
# define SWIG_init init_
py
UModbus
# define SWIG_init init_UModbus
#endif
#define SWIG_name "_
py
UModbus"
#define SWIG_name "_UModbus"
#define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION
...
...
wrappers/python/lib/
pyUniSet
/UProxyObject.i
→
wrappers/python/lib/
lib
/UProxyObject.i
View file @
4def8c92
...
...
@@ -4,7 +4,7 @@
* swig -python UInterface.i
***********************************************************/
%module
py
UniSet
%module UniSet
%include <std_string.i>
...
...
wrappers/python/lib/
pyUniSet/py
UniSet.py
→
wrappers/python/lib/
lib/
UniSet.py
View file @
4def8c92
This diff is collapsed.
Click to expand it.
wrappers/python/lib/
pyUniSet
/__init__.py
→
wrappers/python/lib/
lib
/__init__.py
View file @
4def8c92
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__all__
=
[
"
pyUniSet"
,
"pyUModbus"
,
"pyUConnector"
,
"py
UExceptions"
]
__all__
=
[
"
UniSet"
,
"UModbus"
,
"UConnector"
,
"
UExceptions"
]
wrappers/python/lib/pyUniSet/Makefile.am
deleted
100644 → 0
View file @
33108cc9
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
wrappers/python/netdata-plugin/uniset.chart.py
View file @
4def8c92
...
...
@@ -30,7 +30,7 @@ import os
import
sys
import
uniset2
from
uniset2
import
UniXML
from
uniset2
.lib
import
UniXML
from
subprocess
import
Popen
,
PIPE
sys
.
path
.
append
(
"./python_modules"
)
...
...
wrappers/python/tests/UConnector/testUC.py
View file @
4def8c92
...
...
@@ -5,10 +5,11 @@ import sys
import
time
sys
.
path
.
append
(
'../../'
)
sys
.
path
.
append
(
'../../lib/
pyUniSet
/'
)
sys
.
path
.
append
(
'../../lib/
pyUniSet
/.libs'
)
sys
.
path
.
append
(
'../../lib/
lib
/'
)
sys
.
path
.
append
(
'../../lib/
lib
/.libs'
)
from
lib
import
*
from
UniSet
import
*
from
UConnector
import
*
def
myfunc
(
act
):
act
[
'test'
]
=
'test'
...
...
wrappers/python/tests/UInterface/testUI.py
View file @
4def8c92
...
...
@@ -4,10 +4,10 @@
import
sys
sys
.
path
.
append
(
'../../'
)
sys
.
path
.
append
(
'../../lib/
pyUniSet
/'
)
sys
.
path
.
append
(
'../../lib/
pyUniSet
/.libs'
)
sys
.
path
.
append
(
'../../lib/
lib
/'
)
sys
.
path
.
append
(
'../../lib/
lib
/.libs'
)
from
lib
import
*
from
UniSet
import
*
if
__name__
==
"__main__"
:
...
...
wrappers/python/tests/UModbus/testUModbus.py
View file @
4def8c92
...
...
@@ -4,10 +4,11 @@
import
sys
sys
.
path
.
append
(
'../../'
)
sys
.
path
.
append
(
'../../lib/
pyUniSet
/'
)
sys
.
path
.
append
(
'../../lib/
pyUniSet
/.libs'
)
sys
.
path
.
append
(
'../../lib/
lib
/'
)
sys
.
path
.
append
(
'../../lib/
lib
/.libs'
)
from
lib
import
*
from
UniSet
import
*
from
UModbus
import
*
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment