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
5928091b
Commit
5928091b
authored
Jul 31, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправил компиляцию python-модуля
parent
a6a26242
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
10 deletions
+72
-10
UExceptions.h
wrappers/core/UExceptions.h
+2
-0
UModbus.cc
wrappers/core/UModbus.cc
+4
-4
UModbus.h
wrappers/core/UModbus.h
+2
-1
Makefile.am
wrappers/python/lib/pyUniSet/Makefile.am
+3
-0
UConnector_wrap.cxx
wrappers/python/lib/pyUniSet/UConnector_wrap.cxx
+54
-0
UProxyObject.i
wrappers/python/lib/pyUniSet/UProxyObject.i
+5
-5
pyUConnector.py
wrappers/python/lib/pyUniSet/pyUConnector.py
+2
-0
No files found.
wrappers/core/UExceptions.h
View file @
5928091b
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
#ifndef UExceptions_H_
#ifndef UExceptions_H_
#define UExceptions_H_
#define UExceptions_H_
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#include <string>
// --------------------------------------------------------------------------
struct
UException
struct
UException
{
{
UException
()
:
err
(
"UException"
)
{}
UException
()
:
err
(
"UException"
)
{}
...
...
wrappers/core/UModbus.cc
View file @
5928091b
...
@@ -68,7 +68,7 @@ UModbus::~UModbus()
...
@@ -68,7 +68,7 @@ UModbus::~UModbus()
delete
mb
;
delete
mb
;
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
void
UModbus
::
prepare
(
const
string
&
_ip
,
int
_port
)
throw
(
UException
)
void
UModbus
::
prepare
(
const
st
d
::
st
ring
&
_ip
,
int
_port
)
throw
(
UException
)
{
{
if
(
!
mb
)
if
(
!
mb
)
throw
UException
(
"(connect): mb=NULL?!"
);
throw
UException
(
"(connect): mb=NULL?!"
);
...
@@ -87,7 +87,7 @@ void UModbus::prepare( const string& _ip, int _port )throw(UException)
...
@@ -87,7 +87,7 @@ void UModbus::prepare( const string& _ip, int _port )throw(UException)
port
=
_port
;
port
=
_port
;
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
void
UModbus
::
connect
(
const
string
&
_ip
,
int
_port
)
throw
(
UException
)
void
UModbus
::
connect
(
const
st
d
::
st
ring
&
_ip
,
int
_port
)
throw
(
UException
)
{
{
if
(
!
mb
)
if
(
!
mb
)
throw
UException
(
"(connect): mb=NULL?!"
);
throw
UException
(
"(connect): mb=NULL?!"
);
...
@@ -291,9 +291,9 @@ long UModbus::data2value( uniset::VTypes::VType vtype, uniset::ModbusRTU::Modbus
...
@@ -291,9 +291,9 @@ long UModbus::data2value( uniset::VTypes::VType vtype, uniset::ModbusRTU::Modbus
return
0
;
return
0
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
UModbus
::
mbwrite
(
int
mbaddr
,
int
mbreg
,
int
val
,
int
mbfunc
,
const
string
&
new_ip
,
int
new_port
)
throw
(
UException
)
void
UModbus
::
mbwrite
(
int
mbaddr
,
int
mbreg
,
int
val
,
int
mbfunc
,
const
st
d
::
st
ring
&
new_ip
,
int
new_port
)
throw
(
UException
)
{
{
string
n_ip
(
(
new_ip
.
empty
()
?
ip
:
new_ip
)
);
st
d
::
st
ring
n_ip
(
(
new_ip
.
empty
()
?
ip
:
new_ip
)
);
int
n_port
=
(
new_port
>
0
)
?
new_port
:
port
;
int
n_port
=
(
new_port
>
0
)
?
new_port
:
port
;
connect
(
n_ip
,
n_port
);
connect
(
n_ip
,
n_port
);
...
...
wrappers/core/UModbus.h
View file @
5928091b
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#ifndef UModbus_H_
#ifndef UModbus_H_
#define UModbus_H_
#define UModbus_H_
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#include <string>
#include "Configuration.h"
#include "Configuration.h"
#include "UInterface.h"
#include "UInterface.h"
#include "modbus/ModbusTCPMaster.h"
#include "modbus/ModbusTCPMaster.h"
...
@@ -35,7 +36,7 @@ class UModbus
...
@@ -35,7 +36,7 @@ class UModbus
inline
std
::
string
getUIType
()
inline
std
::
string
getUIType
()
{
{
return
string
(
"modbus"
);
return
st
d
::
st
ring
(
"modbus"
);
}
}
inline
bool
isWriteFunction
(
int
mbfunc
)
inline
bool
isWriteFunction
(
int
mbfunc
)
...
...
wrappers/python/lib/pyUniSet/Makefile.am
View file @
5928091b
if
DISABLE_PYTHON
if
DISABLE_PYTHON
else
else
SWIG
=
swig
#python_SCRIPTS = pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
#python_SCRIPTS = pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
pydir
=
$(pkgpythondir)
pydir
=
$(pkgpythondir)
py_DATA
=
pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
py_DATA
=
pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
...
...
wrappers/python/lib/pyUniSet/UConnector_wrap.cxx
View file @
5928091b
...
@@ -3997,6 +3997,58 @@ fail:
...
@@ -3997,6 +3997,58 @@ fail:
}
}
SWIGINTERN
PyObject
*
_wrap_ShortIOInfo_supplier_node_set
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
UTypes
::
ShortIOInfo
*
arg1
=
(
UTypes
::
ShortIOInfo
*
)
0
;
long
arg2
;
void
*
argp1
=
0
;
int
res1
=
0
;
long
val2
;
int
ecode2
=
0
;
PyObject
*
obj0
=
0
;
PyObject
*
obj1
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,(
char
*
)
"OO:ShortIOInfo_supplier_node_set"
,
&
obj0
,
&
obj1
))
SWIG_fail
;
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_UTypes__ShortIOInfo
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"ShortIOInfo_supplier_node_set"
"', argument "
"1"" of type '"
"UTypes::ShortIOInfo *""'"
);
}
arg1
=
reinterpret_cast
<
UTypes
::
ShortIOInfo
*
>
(
argp1
);
ecode2
=
SWIG_AsVal_long
(
obj1
,
&
val2
);
if
(
!
SWIG_IsOK
(
ecode2
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
ecode2
),
"in method '"
"ShortIOInfo_supplier_node_set"
"', argument "
"2"" of type '"
"long""'"
);
}
arg2
=
static_cast
<
long
>
(
val2
);
if
(
arg1
)
(
arg1
)
->
supplier_node
=
arg2
;
resultobj
=
SWIG_Py_Void
();
return
resultobj
;
fail
:
return
NULL
;
}
SWIGINTERN
PyObject
*
_wrap_ShortIOInfo_supplier_node_get
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
UTypes
::
ShortIOInfo
*
arg1
=
(
UTypes
::
ShortIOInfo
*
)
0
;
void
*
argp1
=
0
;
int
res1
=
0
;
PyObject
*
obj0
=
0
;
long
result
;
if
(
!
PyArg_ParseTuple
(
args
,(
char
*
)
"O:ShortIOInfo_supplier_node_get"
,
&
obj0
))
SWIG_fail
;
res1
=
SWIG_ConvertPtr
(
obj0
,
&
argp1
,
SWIGTYPE_p_UTypes__ShortIOInfo
,
0
|
0
);
if
(
!
SWIG_IsOK
(
res1
))
{
SWIG_exception_fail
(
SWIG_ArgError
(
res1
),
"in method '"
"ShortIOInfo_supplier_node_get"
"', argument "
"1"" of type '"
"UTypes::ShortIOInfo *""'"
);
}
arg1
=
reinterpret_cast
<
UTypes
::
ShortIOInfo
*
>
(
argp1
);
result
=
(
long
)
((
arg1
)
->
supplier_node
);
resultobj
=
SWIG_From_long
(
static_cast
<
long
>
(
result
));
return
resultobj
;
fail
:
return
NULL
;
}
SWIGINTERN
PyObject
*
_wrap_new_ShortIOInfo
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
SWIGINTERN
PyObject
*
_wrap_new_ShortIOInfo
(
PyObject
*
SWIGUNUSEDPARM
(
self
),
PyObject
*
args
)
{
PyObject
*
resultobj
=
0
;
PyObject
*
resultobj
=
0
;
UTypes
::
ShortIOInfo
*
result
=
0
;
UTypes
::
ShortIOInfo
*
result
=
0
;
...
@@ -5251,6 +5303,8 @@ static PyMethodDef SwigMethods[] = {
...
@@ -5251,6 +5303,8 @@ static PyMethodDef SwigMethods[] = {
{
(
char
*
)
"ShortIOInfo_tv_nsec_get"
,
_wrap_ShortIOInfo_tv_nsec_get
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_tv_nsec_get"
,
_wrap_ShortIOInfo_tv_nsec_get
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_set"
,
_wrap_ShortIOInfo_supplier_set
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_set"
,
_wrap_ShortIOInfo_supplier_set
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_get"
,
_wrap_ShortIOInfo_supplier_get
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_get"
,
_wrap_ShortIOInfo_supplier_get
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_node_set"
,
_wrap_ShortIOInfo_supplier_node_set
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_supplier_node_get"
,
_wrap_ShortIOInfo_supplier_node_get
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"new_ShortIOInfo"
,
_wrap_new_ShortIOInfo
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"new_ShortIOInfo"
,
_wrap_new_ShortIOInfo
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"delete_ShortIOInfo"
,
_wrap_delete_ShortIOInfo
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"delete_ShortIOInfo"
,
_wrap_delete_ShortIOInfo
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_swigregister"
,
ShortIOInfo_swigregister
,
METH_VARARGS
,
NULL
},
{
(
char
*
)
"ShortIOInfo_swigregister"
,
ShortIOInfo_swigregister
,
METH_VARARGS
,
NULL
},
...
...
wrappers/python/lib/pyUniSet/UProxyObject.i
View file @
5928091b
...
@@ -6,13 +6,13 @@
...
@@ -6,13 +6,13 @@
%module pyUniSet
%module pyUniSet
%include
"std_string.i"
%include
<std_string.i>
%{
%{
#include "UProxyObject.h"
//
#include "UProxyObject.h"
%}
%}
/* Для генерации классов и констант в Питоне */
/* Для генерации классов и констант в Питоне */
%include "UProxyObject.h"
//
%include "UProxyObject.h"
%include "UTypes.h"
//
%include "UTypes.h"
%include "UExceptions.h"
//
%include "UExceptions.h"
wrappers/python/lib/pyUniSet/pyUConnector.py
View file @
5928091b
...
@@ -124,6 +124,8 @@ class ShortIOInfo:
...
@@ -124,6 +124,8 @@ class ShortIOInfo:
__swig_getmethods__
[
"tv_nsec"
]
=
_pyUConnector
.
ShortIOInfo_tv_nsec_get
__swig_getmethods__
[
"tv_nsec"
]
=
_pyUConnector
.
ShortIOInfo_tv_nsec_get
__swig_setmethods__
[
"supplier"
]
=
_pyUConnector
.
ShortIOInfo_supplier_set
__swig_setmethods__
[
"supplier"
]
=
_pyUConnector
.
ShortIOInfo_supplier_set
__swig_getmethods__
[
"supplier"
]
=
_pyUConnector
.
ShortIOInfo_supplier_get
__swig_getmethods__
[
"supplier"
]
=
_pyUConnector
.
ShortIOInfo_supplier_get
__swig_setmethods__
[
"supplier_node"
]
=
_pyUConnector
.
ShortIOInfo_supplier_node_set
__swig_getmethods__
[
"supplier_node"
]
=
_pyUConnector
.
ShortIOInfo_supplier_node_get
def
__init__
(
self
):
def
__init__
(
self
):
this
=
_pyUConnector
.
new_ShortIOInfo
()
this
=
_pyUConnector
.
new_ShortIOInfo
()
...
...
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