diff --git a/client/client_with_swig/testembedded.lua b/client/client_with_swig/testembedded.lua index e67630e7d..469bfff7a 100755 --- a/client/client_with_swig/testembedded.lua +++ b/client/client_with_swig/testembedded.lua @@ -1,4 +1,4 @@ local pm3 = require("pm3") -p=pm3.device() +p=pm3.pm3() p:console("hw status") print(p.name) diff --git a/client/client_with_swig/testembedded.py b/client/client_with_swig/testembedded.py index 6f5afc37e..12ae8b741 100755 --- a/client/client_with_swig/testembedded.py +++ b/client/client_with_swig/testembedded.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import pm3 -p=pm3.device() +p=pm3.pm3() p.console("hw status") print("Device:", p.name) diff --git a/client/include/pm3.h b/client/include/pm3.h index 56ab56f82..cfdb69944 100644 --- a/client/include/pm3.h +++ b/client/include/pm3.h @@ -1,11 +1,11 @@ #ifndef LIBPM3_H #define LIBPM3_H -typedef struct pm3_device pm3_device; +typedef struct pm3_device pm3; -pm3_device* pm3_open(char *port); -int pm3_device_console(pm3_device* dev, char *cmd); -const char * pm3_device_name_get(pm3_device* dev); -void pm3_device_close(pm3_device* dev); -pm3_device* pm3_device_get_current_dev(void); +pm3 *pm3_open(char *port); +int pm3_console(pm3* dev, char *cmd); +const char *pm3_name_get(pm3* dev); +void pm3_close(pm3* dev); +pm3 *pm3_get_current_dev(void); #endif // LIBPM3_H diff --git a/client/lib/example_c/test.c b/client/lib/example_c/test.c index 9c3ce6e92..a3cf212dc 100644 --- a/client/lib/example_c/test.c +++ b/client/lib/example_c/test.c @@ -1,8 +1,8 @@ #include "pm3.h" int main(int argc, char *argv[]) { - pm3_device *p; + pm3 *p; p = pm3_open("/dev/ttyACM0"); - pm3_device_console(p, "hw status"); - pm3_device_close(p); + pm3_console(p, "hw status"); + pm3_close(p); } diff --git a/client/lib/example_lua/test.lua b/client/lib/example_lua/test.lua index f640d5abf..be12f1d5b 100755 --- a/client/lib/example_lua/test.lua +++ b/client/lib/example_lua/test.lua @@ -1,6 +1,6 @@ #!/usr/bin/env lua local pm3 = require("pm3") -p=pm3.device("/dev/ttyACM0") +p=pm3.pm3("/dev/ttyACM0") p:console("hw status") print(p.name) diff --git a/client/lib/example_py/test.py b/client/lib/example_py/test.py index 5bdbee089..39cee5301 100755 --- a/client/lib/example_py/test.py +++ b/client/lib/example_py/test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import pm3 -p=pm3.device("/dev/ttyACM0") +p=pm3.pm3("/dev/ttyACM0") p.console("hw status") print("Device:", p.name) diff --git a/client/src/pm3.i b/client/src/pm3.i index 533c7e23a..5b4a1fb47 100644 --- a/client/src/pm3.i +++ b/client/src/pm3.i @@ -10,30 +10,30 @@ %feature("immutable","1") pm3_current_dev; typedef struct { %extend { - pm3_device() { - printf("SWIG pm3_device constructor, get current pm3\n"); - pm3_device * p = pm3_device_get_current_dev(); + pm3() { + printf("SWIG pm3 constructor, get current pm3\n"); + pm3_device * p = pm3_get_current_dev(); p->script_embedded = 1; return p; } - pm3_device(char *port) { - printf("SWIG pm3_device constructor with port, open pm3\n"); + pm3(char *port) { + printf("SWIG pm3 constructor with port, open pm3\n"); pm3_device * p = pm3_open(port); p->script_embedded = 0; return p; } - ~pm3_device() { + ~pm3() { if ($self->script_embedded) { - printf("SWIG pm3_device destructor, nothing to do\n"); + printf("SWIG pm3 destructor, nothing to do\n"); } else { - printf("SWIG pm3_device destructor, close pm3\n"); - pm3_device_close($self); + printf("SWIG pm3 destructor, close pm3\n"); + pm3_close($self); } } int console(char *cmd); char const * const name; } -} pm3_device; +} pm3; //%nodefaultctor device; //%nodefaultdtor device; -/* Parse the header file to generate wrappers */ \ No newline at end of file +/* Parse the header file to generate wrappers */ diff --git a/client/src/pm3.py b/client/src/pm3.py index 1d89c8fc7..1c321a2ec 100644 --- a/client/src/pm3.py +++ b/client/src/pm3.py @@ -61,20 +61,20 @@ class _SwigNonDynamicMeta(type): __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) -class device(object): +class pm3(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, *args): - _pm3.device_swiginit(self, _pm3.new_device(*args)) - __swig_destroy__ = _pm3.delete_device + _pm3.pm3_swiginit(self, _pm3.new_pm3(*args)) + __swig_destroy__ = _pm3.delete_pm3 def console(self, cmd): - return _pm3.device_console(self, cmd) - name = property(_pm3.device_name_get) + return _pm3.pm3_console(self, cmd) + name = property(_pm3.pm3_name_get) -# Register device in _pm3: -_pm3.device_swigregister(device) +# Register pm3 in _pm3: +_pm3.pm3_swigregister(pm3) diff --git a/client/src/pm3_luawrap.c b/client/src/pm3_luawrap.c index cf3b3a746..2dc4a8dc0 100644 --- a/client/src/pm3_luawrap.c +++ b/client/src/pm3_luawrap.c @@ -2668,7 +2668,7 @@ SWIG_Lua_dostring(lua_State *L, const char *str) { /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_p_pm3_device swig_types[0] +#define SWIGTYPE_p_pm3 swig_types[0] static swig_type_info *swig_types[2]; static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) @@ -2686,9 +2686,9 @@ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0}; #include "pm3.h" #include "comms.h" -SWIGINTERN pm3_device *new_pm3_device__SWIG_0(void){ - printf("SWIG pm3_device constructor, get current pm3\n"); - pm3_device * p = pm3_device_get_current_dev(); +SWIGINTERN pm3 *new_pm3__SWIG_0(void){ + printf("SWIG pm3 constructor, get current pm3\n"); + pm3_device * p = pm3_get_current_dev(); p->script_embedded = 1; return p; } @@ -2700,30 +2700,30 @@ SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) { return ret; } -SWIGINTERN pm3_device *new_pm3_device__SWIG_1(char *port){ - printf("SWIG pm3_device constructor with port, open pm3\n"); +SWIGINTERN pm3 *new_pm3__SWIG_1(char *port){ + printf("SWIG pm3 constructor with port, open pm3\n"); pm3_device * p = pm3_open(port); p->script_embedded = 0; return p; } -SWIGINTERN void delete_pm3_device(pm3_device *self){ +SWIGINTERN void delete_pm3(pm3 *self){ if (self->script_embedded) { - printf("SWIG pm3_device destructor, nothing to do\n"); + printf("SWIG pm3 destructor, nothing to do\n"); } else { - printf("SWIG pm3_device destructor, close pm3\n"); - pm3_device_close(self); + printf("SWIG pm3 destructor, close pm3\n"); + pm3_close(self); } } #ifdef __cplusplus extern "C" { #endif -static int _wrap_new_device__SWIG_0(lua_State* L) { +static int _wrap_new_pm3__SWIG_0(lua_State* L) { int SWIG_arg = 0; - pm3_device *result = 0 ; + pm3 *result = 0 ; - SWIG_check_num_args("pm3_device::pm3_device",0,0) - result = (pm3_device *)new_pm3_device__SWIG_0(); - SWIG_NewPointerObj(L,result,SWIGTYPE_p_pm3_device,1); SWIG_arg++; + SWIG_check_num_args("pm3::pm3",0,0) + result = (pm3 *)new_pm3__SWIG_0(); + SWIG_NewPointerObj(L,result,SWIGTYPE_p_pm3,1); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; @@ -2734,16 +2734,16 @@ fail: } -static int _wrap_new_device__SWIG_1(lua_State* L) { +static int _wrap_new_pm3__SWIG_1(lua_State* L) { int SWIG_arg = 0; char *arg1 = (char *) 0 ; - pm3_device *result = 0 ; + pm3 *result = 0 ; - SWIG_check_num_args("pm3_device::pm3_device",1,1) - if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("pm3_device::pm3_device",1,"char *"); + SWIG_check_num_args("pm3::pm3",1,1) + if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("pm3::pm3",1,"char *"); arg1 = (char *)lua_tostring(L, 1); - result = (pm3_device *)new_pm3_device__SWIG_1(arg1); - SWIG_NewPointerObj(L,result,SWIGTYPE_p_pm3_device,1); SWIG_arg++; + result = (pm3 *)new_pm3__SWIG_1(arg1); + SWIG_NewPointerObj(L,result,SWIGTYPE_p_pm3,1); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; @@ -2754,7 +2754,7 @@ fail: } -static int _wrap_new_device(lua_State* L) { +static int _wrap_new_pm3(lua_State* L) { int argc; int argv[2]={ 1,2 @@ -2762,7 +2762,7 @@ static int _wrap_new_device(lua_State* L) { argc = lua_gettop(L); if (argc == 0) { - return _wrap_new_device__SWIG_0(L); + return _wrap_new_pm3__SWIG_0(L); } if (argc == 1) { int _v; @@ -2770,34 +2770,34 @@ static int _wrap_new_device(lua_State* L) { _v = SWIG_lua_isnilstring(L,argv[0]); } if (_v) { - return _wrap_new_device__SWIG_1(L); + return _wrap_new_pm3__SWIG_1(L); } } - SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_device'\n" + SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_pm3'\n" " Possible C/C++ prototypes are:\n" - " pm3_device::pm3_device()\n" - " pm3_device::pm3_device(char *)\n"); + " pm3::pm3()\n" + " pm3::pm3(char *)\n"); lua_error(L);return 0; } -static int _wrap_device_console(lua_State* L) { +static int _wrap_pm3_console(lua_State* L) { int SWIG_arg = 0; - pm3_device *arg1 = (pm3_device *) 0 ; + pm3 *arg1 = (pm3 *) 0 ; char *arg2 = (char *) 0 ; int result; - SWIG_check_num_args("pm3_device::console",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pm3_device::console",1,"pm3_device *"); - if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("pm3_device::console",2,"char *"); + SWIG_check_num_args("pm3::console",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pm3::console",1,"pm3 *"); + if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("pm3::console",2,"char *"); - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_pm3_device,0))){ - SWIG_fail_ptr("device_console",1,SWIGTYPE_p_pm3_device); + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_pm3,0))){ + SWIG_fail_ptr("pm3_console",1,SWIGTYPE_p_pm3); } arg2 = (char *)lua_tostring(L, 2); - result = (int)pm3_device_console(arg1,arg2); + result = (int)pm3_console(arg1,arg2); lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; @@ -2809,19 +2809,19 @@ fail: } -static int _wrap_device_name_get(lua_State* L) { +static int _wrap_pm3_name_get(lua_State* L) { int SWIG_arg = 0; - pm3_device *arg1 = (pm3_device *) 0 ; + pm3 *arg1 = (pm3 *) 0 ; char *result = 0 ; - SWIG_check_num_args("pm3_device::name",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pm3_device::name",1,"pm3_device *"); + SWIG_check_num_args("pm3::name",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pm3::name",1,"pm3 *"); - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_pm3_device,0))){ - SWIG_fail_ptr("device_name_get",1,SWIGTYPE_p_pm3_device); + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_pm3,0))){ + SWIG_fail_ptr("pm3_name_get",1,SWIGTYPE_p_pm3); } - result = (char *)pm3_device_name_get(arg1); + result = (char *)pm3_name_get(arg1); lua_pushstring(L,(const char *)result); SWIG_arg++; return SWIG_arg; @@ -2833,54 +2833,54 @@ fail: } -static void swig_delete_device(void *obj) { -pm3_device *arg1 = (pm3_device *) obj; -delete_pm3_device(arg1); +static void swig_delete_pm3(void *obj) { +pm3 *arg1 = (pm3 *) obj; +delete_pm3(arg1); } -static int _proxy__wrap_new_device(lua_State *L) { +static int _proxy__wrap_new_pm3(lua_State *L) { assert(lua_istable(L,1)); - lua_pushcfunction(L,_wrap_new_device); + lua_pushcfunction(L,_wrap_new_pm3); assert(!lua_isnil(L,-1)); lua_replace(L,1); /* replace our table with real constructor */ lua_call(L,lua_gettop(L)-1,1); return 1; } -static swig_lua_attribute swig_device_attributes[] = { - { "name", _wrap_device_name_get, SWIG_Lua_set_immutable }, +static swig_lua_attribute swig_pm3_attributes[] = { + { "name", _wrap_pm3_name_get, SWIG_Lua_set_immutable }, {0,0,0} }; -static swig_lua_method swig_device_methods[]= { - { "console", _wrap_device_console}, +static swig_lua_method swig_pm3_methods[]= { + { "console", _wrap_pm3_console}, {0,0} }; -static swig_lua_method swig_device_meta[] = { +static swig_lua_method swig_pm3_meta[] = { {0,0} }; -static swig_lua_attribute swig_device_Sf_SwigStatic_attributes[] = { +static swig_lua_attribute swig_pm3_Sf_SwigStatic_attributes[] = { {0,0,0} }; -static swig_lua_const_info swig_device_Sf_SwigStatic_constants[]= { +static swig_lua_const_info swig_pm3_Sf_SwigStatic_constants[]= { {0,0,0,0,0,0} }; -static swig_lua_method swig_device_Sf_SwigStatic_methods[]= { +static swig_lua_method swig_pm3_Sf_SwigStatic_methods[]= { {0,0} }; -static swig_lua_class* swig_device_Sf_SwigStatic_classes[]= { +static swig_lua_class* swig_pm3_Sf_SwigStatic_classes[]= { 0 }; -static swig_lua_namespace swig_device_Sf_SwigStatic = { - "device", - swig_device_Sf_SwigStatic_methods, - swig_device_Sf_SwigStatic_attributes, - swig_device_Sf_SwigStatic_constants, - swig_device_Sf_SwigStatic_classes, +static swig_lua_namespace swig_pm3_Sf_SwigStatic = { + "pm3", + swig_pm3_Sf_SwigStatic_methods, + swig_pm3_Sf_SwigStatic_attributes, + swig_pm3_Sf_SwigStatic_constants, + swig_pm3_Sf_SwigStatic_classes, 0 }; -static swig_lua_class *swig_device_bases[] = {0}; -static const char *swig_device_base_names[] = {0}; -static swig_lua_class _wrap_class_device = { "device", "device", &SWIGTYPE_p_pm3_device,_proxy__wrap_new_device, swig_delete_device, swig_device_methods, swig_device_attributes, &swig_device_Sf_SwigStatic, swig_device_meta, swig_device_bases, swig_device_base_names }; +static swig_lua_class *swig_pm3_bases[] = {0}; +static const char *swig_pm3_base_names[] = {0}; +static swig_lua_class _wrap_class_pm3 = { "pm3", "pm3", &SWIGTYPE_p_pm3,_proxy__wrap_new_pm3, swig_delete_pm3, swig_pm3_methods, swig_pm3_attributes, &swig_pm3_Sf_SwigStatic, swig_pm3_meta, swig_pm3_bases, swig_pm3_base_names }; static swig_lua_attribute swig_SwigModule_attributes[] = { {0,0,0} @@ -2892,7 +2892,7 @@ static swig_lua_method swig_SwigModule_methods[]= { {0,0} }; static swig_lua_class* swig_SwigModule_classes[]= { -&_wrap_class_device, +&_wrap_class_pm3, 0 }; static swig_lua_namespace* swig_SwigModule_namespaces[] = { @@ -2913,16 +2913,16 @@ static swig_lua_namespace swig_SwigModule = { /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ -static swig_type_info _swigt__p_pm3_device = {"_p_pm3_device", "pm3_device *", 0, 0, (void*)&_wrap_class_device, 0}; +static swig_type_info _swigt__p_pm3 = {"_p_pm3", "pm3 *", 0, 0, (void*)&_wrap_class_pm3, 0}; static swig_type_info *swig_type_initial[] = { - &_swigt__p_pm3_device, + &_swigt__p_pm3, }; -static swig_cast_info _swigc__p_pm3_device[] = { {&_swigt__p_pm3_device, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_pm3[] = { {&_swigt__p_pm3, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { - _swigc__p_pm3_device, + _swigc__p_pm3, }; diff --git a/client/src/pm3_pywrap.c b/client/src/pm3_pywrap.c index 1e86a8798..a3a5812ff 100644 --- a/client/src/pm3_pywrap.c +++ b/client/src/pm3_pywrap.c @@ -2634,7 +2634,7 @@ SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyO /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_char swig_types[0] -#define SWIGTYPE_p_pm3_device swig_types[1] +#define SWIGTYPE_p_pm3 swig_types[1] static swig_type_info *swig_types[3]; static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) @@ -2671,9 +2671,9 @@ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0}; #include "pm3.h" #include "comms.h" -SWIGINTERN pm3_device *new_pm3_device__SWIG_0(void){ - printf("SWIG pm3_device constructor, get current pm3\n"); - pm3_device * p = pm3_device_get_current_dev(); +SWIGINTERN pm3 *new_pm3__SWIG_0(void){ + printf("SWIG pm3 constructor, get current pm3\n"); + pm3_device * p = pm3_get_current_dev(); p->script_embedded = 1; return p; } @@ -2800,18 +2800,18 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) -SWIGINTERN pm3_device *new_pm3_device__SWIG_1(char *port){ - printf("SWIG pm3_device constructor with port, open pm3\n"); +SWIGINTERN pm3 *new_pm3__SWIG_1(char *port){ + printf("SWIG pm3 constructor with port, open pm3\n"); pm3_device * p = pm3_open(port); p->script_embedded = 0; return p; } -SWIGINTERN void delete_pm3_device(pm3_device *self){ +SWIGINTERN void delete_pm3(pm3 *self){ if (self->script_embedded) { - printf("SWIG pm3_device destructor, nothing to do\n"); + printf("SWIG pm3 destructor, nothing to do\n"); } else { - printf("SWIG pm3_device destructor, close pm3\n"); - pm3_device_close(self); + printf("SWIG pm3 destructor, close pm3\n"); + pm3_close(self); } } @@ -2856,35 +2856,35 @@ SWIG_FromCharPtr(const char *cptr) #ifdef __cplusplus extern "C" { #endif -SWIGINTERN PyObject *_wrap_new_device__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { +SWIGINTERN PyObject *_wrap_new_pm3__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { PyObject *resultobj = 0; - pm3_device *result = 0 ; + pm3 *result = 0 ; if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (pm3_device *)new_pm3_device__SWIG_0(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pm3_device, SWIG_POINTER_NEW | 0 ); + result = (pm3 *)new_pm3__SWIG_0(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pm3, SWIG_POINTER_NEW | 0 ); return resultobj; fail: return NULL; } -SWIGINTERN PyObject *_wrap_new_device__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_new_pm3__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; - pm3_device *result = 0 ; + pm3 *result = 0 ; if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_device" "', argument " "1"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_pm3" "', argument " "1"" of type '" "char *""'"); } arg1 = (char *)(buf1); - result = (pm3_device *)new_pm3_device__SWIG_1(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pm3_device, SWIG_POINTER_NEW | 0 ); + result = (pm3 *)new_pm3__SWIG_1(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pm3, SWIG_POINTER_NEW | 0 ); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: @@ -2893,50 +2893,50 @@ fail: } -SWIGINTERN PyObject *_wrap_new_device(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_new_pm3(PyObject *self, PyObject *args) { Py_ssize_t argc; PyObject *argv[2] = { 0 }; - if (!(argc = SWIG_Python_UnpackTuple(args, "new_device", 0, 1, argv))) SWIG_fail; + if (!(argc = SWIG_Python_UnpackTuple(args, "new_pm3", 0, 1, argv))) SWIG_fail; --argc; if (argc == 0) { - return _wrap_new_device__SWIG_0(self, argc, argv); + return _wrap_new_pm3__SWIG_0(self, argc, argv); } if (argc == 1) { int _v; int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { - return _wrap_new_device__SWIG_1(self, argc, argv); + return _wrap_new_pm3__SWIG_1(self, argc, argv); } } fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_device'.\n" + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_pm3'.\n" " Possible C/C++ prototypes are:\n" - " pm3_device::pm3_device()\n" - " pm3_device::pm3_device(char *)\n"); + " pm3::pm3()\n" + " pm3::pm3(char *)\n"); return 0; } -SWIGINTERN PyObject *_wrap_delete_device(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_delete_pm3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - pm3_device *arg1 = (pm3_device *) 0 ; + pm3 *arg1 = (pm3 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *swig_obj[1] ; if (!args) SWIG_fail; swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_pm3_device, SWIG_POINTER_DISOWN | 0 ); + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_pm3, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_device" "', argument " "1"" of type '" "pm3_device *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_pm3" "', argument " "1"" of type '" "pm3 *""'"); } - arg1 = (pm3_device *)(argp1); - delete_pm3_device(arg1); + arg1 = (pm3 *)(argp1); + delete_pm3(arg1); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -2944,9 +2944,9 @@ fail: } -SWIGINTERN PyObject *_wrap_device_console(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_pm3_console(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - pm3_device *arg1 = (pm3_device *) 0 ; + pm3 *arg1 = (pm3 *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -2956,18 +2956,18 @@ SWIGINTERN PyObject *_wrap_device_console(PyObject *SWIGUNUSEDPARM(self), PyObje PyObject *swig_obj[2] ; int result; - if (!SWIG_Python_UnpackTuple(args, "device_console", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_pm3_device, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args, "pm3_console", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_pm3, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "device_console" "', argument " "1"" of type '" "pm3_device *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm3_console" "', argument " "1"" of type '" "pm3 *""'"); } - arg1 = (pm3_device *)(argp1); + arg1 = (pm3 *)(argp1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "device_console" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pm3_console" "', argument " "2"" of type '" "char *""'"); } arg2 = (char *)(buf2); - result = (int)pm3_device_console(arg1,arg2); + result = (int)pm3_console(arg1,arg2); resultobj = SWIG_From_int((int)(result)); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; @@ -2977,9 +2977,9 @@ fail: } -SWIGINTERN PyObject *_wrap_device_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_pm3_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - pm3_device *arg1 = (pm3_device *) 0 ; + pm3 *arg1 = (pm3 *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *swig_obj[1] ; @@ -2987,12 +2987,12 @@ SWIGINTERN PyObject *_wrap_device_name_get(PyObject *SWIGUNUSEDPARM(self), PyObj if (!args) SWIG_fail; swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_pm3_device, 0 | 0 ); + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_pm3, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "device_name_get" "', argument " "1"" of type '" "pm3_device *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm3_name_get" "', argument " "1"" of type '" "pm3 *""'"); } - arg1 = (pm3_device *)(argp1); - result = (char *)pm3_device_name_get(arg1); + arg1 = (pm3 *)(argp1); + result = (char *)pm3_name_get(arg1); resultobj = SWIG_FromCharPtr((const char *)result); return resultobj; fail: @@ -3000,25 +3000,25 @@ fail: } -SWIGINTERN PyObject *device_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *pm3_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_pm3_device, SWIG_NewClientData(obj)); + SWIG_TypeNewClientData(SWIGTYPE_p_pm3, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } -SWIGINTERN PyObject *device_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *pm3_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { return SWIG_Python_InitShadowInstance(args); } static PyMethodDef SwigMethods[] = { { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL}, - { "new_device", _wrap_new_device, METH_VARARGS, NULL}, - { "delete_device", _wrap_delete_device, METH_O, NULL}, - { "device_console", _wrap_device_console, METH_VARARGS, NULL}, - { "device_name_get", _wrap_device_name_get, METH_O, NULL}, - { "device_swigregister", device_swigregister, METH_O, NULL}, - { "device_swiginit", device_swiginit, METH_VARARGS, NULL}, + { "new_pm3", _wrap_new_pm3, METH_VARARGS, NULL}, + { "delete_pm3", _wrap_delete_pm3, METH_O, NULL}, + { "pm3_console", _wrap_pm3_console, METH_VARARGS, NULL}, + { "pm3_name_get", _wrap_pm3_name_get, METH_O, NULL}, + { "pm3_swigregister", pm3_swigregister, METH_O, NULL}, + { "pm3_swiginit", pm3_swiginit, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; @@ -3030,19 +3030,19 @@ static PyMethodDef SwigMethods_proxydocs[] = { /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_pm3_device = {"_p_pm3_device", "pm3_device *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_pm3 = {"_p_pm3", "pm3 *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_char, - &_swigt__p_pm3_device, + &_swigt__p_pm3, }; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_pm3_device[] = { {&_swigt__p_pm3_device, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_pm3[] = { {&_swigt__p_pm3, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_char, - _swigc__p_pm3_device, + _swigc__p_pm3, }; diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index cde5b4a0a..c841f9ef5 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -727,7 +727,7 @@ pm3_device* pm3_open(char *port) { return session.current_device; } -void pm3_device_close(pm3_device* dev) { +void pm3_close(pm3_device* dev) { // For now, there is no real device context: (void) dev; // Clean up the port @@ -739,17 +739,17 @@ void pm3_device_close(pm3_device* dev) { } } -int pm3_device_console(pm3_device* dev, char *Cmd) { +int pm3_console(pm3_device* dev, char *Cmd) { // For now, there is no real device context: (void) dev; return CommandReceived(Cmd); } -const char *pm3_device_name_get(pm3_device* dev) { +const char *pm3_name_get(pm3_device* dev) { return dev->conn->serial_port_name; } -pm3_device* pm3_device_get_current_dev(void) { +pm3_device* pm3_get_current_dev(void) { return session.current_device; } /* ======================================================= */