Commit 5928091b authored by Pavel Vainerman's avatar Pavel Vainerman

Исправил компиляцию python-модуля

parent a6a26242
...@@ -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") {}
......
...@@ -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 std::string& _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 std::string& _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 std::string& new_ip, int new_port )throw(UException)
{ {
string n_ip( ( new_ip.empty() ? ip : new_ip ) ); std::string 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);
......
...@@ -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 std::string("modbus");
} }
inline bool isWriteFunction( int mbfunc ) inline bool isWriteFunction( int mbfunc )
......
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
......
...@@ -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},
......
...@@ -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"
...@@ -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()
......
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