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
0f5f6560
Commit
0f5f6560
authored
Mar 05, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил python/examples. Откорректировал ошибки сборки.
parent
021e94ee
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
108 additions
and
34 deletions
+108
-34
libuniset.spec
conf/libuniset.spec
+10
-4
start_fg_UC.sh
python/examples/start_fg_UC.sh
+5
-0
test.xml
python/examples/test.xml
+2
-0
testUC.py
python/examples/testUC.py
+47
-0
testUModbus.py
python/examples/testUModbus.py
+36
-0
UGlobal.py
python/lib/UGlobal.py
+0
-24
Makefile.am
python/lib/pyUniSet/Makefile.am
+8
-6
No files found.
conf/libuniset.spec
View file @
0f5f6560
...
...
@@ -7,7 +7,7 @@
Name: libuniset
Version: 1.6
Release: alt0.
3
Release: alt0.
5
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -316,14 +316,20 @@ mv -f %buildroot%python_sitelibdir_noarch/%oname/%oname.py %buildroot%python_sit
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Tue Mar 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt0.5
- python: test build
* Tue Mar 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt0.4
- python: test build
* Tue Mar 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt0.3
-
new
build
-
python: test
build
* Tue Mar 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt0.2
-
test build (with python)
-
python: test build
* Mon Mar 04 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt0.1
-
new build
-
add python interface
* Mon Jan 14 2013 Pavel Vainerman <pv@altlinux.ru> 1.5-alt10
- add error code for MTR (eterbug #8659)
...
...
python/examples/start_fg_UC.sh
0 → 100755
View file @
0f5f6560
#!/bin/sh
START
=
uniset-start.sh
${
START
}
-f
./testUC.py
--unideb-add-levels
info,warn,crit
python/examples/test.xml
0 → 120000
View file @
0f5f6560
../../conf/test.xml
\ No newline at end of file
python/examples/testUC.py
0 → 100755
View file @
0f5f6560
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
sys
from
uniset
import
*
if
__name__
==
"__main__"
:
lst
=
Params_inst
()
for
i
in
range
(
0
,
len
(
sys
.
argv
)):
if
i
>=
Params
.
max
:
break
;
lst
.
add
(
sys
.
argv
[
i
]
)
p
=
[]
print
"lst: class: "
+
str
(
p
.
__class__
.
__name__
)
try
:
uc1
=
UConnector
(
lst
,
"test.xml"
)
# print "(0)UIType: %s" % uc1.getUIType()
print
"(1)getShortName: id=
%
d name=
%
s"
%
(
1
,
uc1
.
getShortName
(
1
))
# print " getName: id=%d name=%s" % (1, uc1.getName(101))
# print " getTextName: id=%d name=%s" % (1, uc1.getTextName(101))
# print "\n"
# print "getShortName: id=%d name=%s" % (2, uc1.getShortName(109))
# print " getName: id=%d name=%s" % (2, uc1.getName(109))
# print " getTextName: id=%d name=%s" % (2, uc1.getTextName(109))
try
:
print
"(1)setValue:
%
d=
%
d"
%
(
3
,
22
)
uc1
.
setValue
(
3
,
22
,
DefaultID
)
except
UException
,
e
:
print
"(1)setValue exception: "
+
str
(
e
.
getError
())
try
:
print
"(1)getValue:
%
d=
%
d"
%
(
3
,
uc1
.
getValue
(
3
,
DefaultID
)
)
except
UException
,
e
:
print
"(1)getValue exception: "
+
str
(
e
.
getError
())
except
UException
,
e
:
print
"(testUI): catch exception: "
+
str
(
e
.
getError
())
python/examples/testUModbus.py
0 → 100755
View file @
0f5f6560
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
sys
from
uniset
import
*
if
__name__
==
"__main__"
:
try
:
mb
=
UModbus
()
print
"UIType:
%
s"
%
mb
.
getUIType
()
mb
.
connect
(
"localhost"
,
2048
)
try
:
print
"Test READ functions..."
for
f
in
range
(
1
,
5
):
print
"func=
%
d reg=
%
d"
%
(
f
,
22
)
val
=
mb
.
mbread
(
0x01
,
22
,
f
,
"unsigned"
,
-
1
)
# val = mb.mbread(0x01,22)
print
"val=
%
d"
%
val
print
"getWord:
%
d"
%
mb
.
getWord
(
0x01
,
22
)
print
"getByte:
%
d"
%
mb
.
getByte
(
0x01
,
22
)
print
"getBit:
%
d"
%
mb
.
getBit
(
0x01
,
22
,
3
)
# print ""
# print "Test WRITE functions..."
# for f in range(1,6):
# print "func=%d reg=%d" % (f,22)
# val = mb.getValue(f,0x01,22,"unsigned",-1)
except
UException
,
e
:
print
"exception: "
+
str
(
e
.
getError
())
except
UException
,
e
:
print
"(testUModbus): catch exception: "
+
str
(
e
.
getError
())
python/lib/UGlobal.py
View file @
0f5f6560
...
...
@@ -4,16 +4,6 @@
from
pyUConnector
import
*
import
time
# различные глобальные вспомогательные функции
t_NONE
=
""
t_FAILED
=
"FAILED"
t_PASSED
=
"PASSED"
t_IGNORE
=
"IGNORE"
t_BREAK
=
"BREAK"
t_PAUSE
=
"PAUSE"
t_WARNING
=
"WARNING"
t_UNKNOWN
=
"UNKNOWN"
def
is_id
(
str_id
):
if
str_id
.
__class__
.
__name__
==
"int"
:
return
True
...
...
@@ -229,17 +219,3 @@ def fcalibrate( raw, rawMin, rawMax, calMin, calMax ):
return
0
;
# деление на 0!!!
return
1.0
*
(
raw
-
rawMin
)
*
(
calMax
-
calMin
)
/
(
rawMax
-
rawMin
)
+
calMin
;
class
TestSuiteException
(
Exception
):
def
__init__
(
self
,
e
=
""
,
test_time
=-
1
):
self
.
err
=
e
self
.
ftime
=
test_time
if
test_time
==
-
1
:
self
.
ftime
=
time
.
time
()
def
getError
(
self
):
return
self
.
err
def
getFinishTime
(
self
):
return
self
.
ftime
python/lib/pyUniSet/Makefile.am
View file @
0f5f6560
if
DISABLE_PYTHON
else
pyexec_LTLIBRARIES
=
_pyUniSet.la _pyUConnector.la _pyUModbus.la _pyUExceptions.la
pyexec_LTLIBRARIES
=
_pyUConnector.la _pyUModbus.la _pyUExceptions.la
#_pyUniSet.la
_pyUniSet_la_SOURCES
=
UInterface.cc UInterface_wrap.cxx
_pyUniSet_la_CXXFLAGS
=
$(UNISET_CFLAGS)
$(PYTHON_CFLAGS)
_pyUniSet_la_LDFLAGS
=
-module
-avoid-version
_pyUniSet_la_LIBADD
=
$(UNISET_LIBS)
$(PYTHON_LIBS)
# DEPRECATED (use UConnector)
#_pyUniSet_la_SOURCES = UInterface.cc UInterface_wrap.cxx
#_pyUniSet_la_CXXFLAGS = $(UNISET_CFLAGS) $(PYTHON_CFLAGS)
#_pyUniSet_la_LDFLAGS = -module -avoid-version
#_pyUniSet_la_LIBADD = $(UNISET_LIBS) $(PYTHON_LIBS)
UInterface_wrap.cxx
:
UInterface.i UInterface.h
swig
-python
-c
++
-classic
UInterface.i
...
...
@@ -34,7 +36,7 @@ _pyUExceptions_la_LIBADD = $(UNISET_LIBS) $(UNISET_EXT_LIBS) $(PYTHON_LIBS)
UExceptions_wrap.cxx
:
UExceptions.i UExceptions.h
swig
-python
-c
++
-classic
UExceptions.i
py
exec
_SCRIPTS
=
pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
py
thon
_SCRIPTS
=
pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
clean-local
:
rm
-rf
*
.py
*
*
_wrap.cxx
...
...
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