fix one too small
[RRG-proxmark3.git] / client / src / pm3.i
blob810f5eb229cb13cd1ea120fee62626637089674e
1 %module pm3
2 %{
3 /* Include the header in the wrapper code */
4 #include "pm3.h"
5 #include "comms.h"
6 %}
8 /* Strip "pm3_" from API functions for SWIG */
9 %rename("%(strip:[pm3_])s") "";
10 %feature("immutable","1") pm3_current_dev;
12 #ifdef PYWRAP
13 #include <Python.h>
14 %typemap(default) bool passthru {
15 $1 = Py_False;
17 #endif
18 typedef struct {
19 %extend {
20 pm3() {
21 // printf("SWIG pm3 constructor, get current pm3\n");
22 pm3_device_t * p = pm3_get_current_dev();
23 p->script_embedded = 1;
24 return p;
26 pm3(char *port) {
27 // printf("SWIG pm3 constructor with port, open pm3\n");
28 pm3_device_t * p = pm3_open(port);
29 p->script_embedded = 0;
30 return p;
32 ~pm3() {
33 if ($self->script_embedded) {
34 // printf("SWIG pm3 destructor, nothing to do\n");
35 } else {
36 // printf("SWIG pm3 destructor, close pm3\n");
37 pm3_close($self);
40 int console(char *cmd, bool passthru = false);
41 char const * const name;
42 char const * const grabbed_output;
44 } pm3;
45 //%nodefaultctor device;
46 //%nodefaultdtor device;
47 /* Parse the header file to generate wrappers */