textual
[RRG-proxmark3.git] / client / src / pm3.i
blobdc47563b2ed12f849d691f48d803fc96b75a4701
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;
11 typedef struct {
12 %extend {
13 pm3() {
14 // printf("SWIG pm3 constructor, get current pm3\n");
15 pm3_device * p = pm3_get_current_dev();
16 p->script_embedded = 1;
17 return p;
19 pm3(char *port) {
20 // printf("SWIG pm3 constructor with port, open pm3\n");
21 pm3_device * p = pm3_open(port);
22 p->script_embedded = 0;
23 return p;
25 ~pm3() {
26 if ($self->script_embedded) {
27 // printf("SWIG pm3 destructor, nothing to do\n");
28 } else {
29 // printf("SWIG pm3 destructor, close pm3\n");
30 pm3_close($self);
33 int console(char *cmd);
34 char const * const name;
36 } pm3;
37 //%nodefaultctor device;
38 //%nodefaultdtor device;
39 /* Parse the header file to generate wrappers */