Initial commit

This commit is contained in:
Ondrej Mikle 2014-07-19 01:08:30 +02:00
commit cafd967ed6
6 changed files with 74 additions and 0 deletions

8
.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
.*.swp
*.so
*.o
*.pyc
brmdoor_nfc_wrap.cxx
brmdoor_nfc.py

20
Makefile Normal file
View file

@ -0,0 +1,20 @@
CXXFLAGS = -Wall -g -I /usr/include/python2.6/ -fPIC
OBJECTS = brmdoor_nfc.o brmdoor_nfc_wrap.o
PY_MODULE = _brmdoor_nfc.so
all: $(PY_MODULE)
$(PY_MODULE): $(OBJECTS)
g++ -shared -o $@ $(OBJECTS)
brmdoor_nfc.o: brmdoor_nfc.cpp brmdoor_nfc.h
g++ -c $(CXXFLAGS) brmdoor_nfc.cpp
brmdoor_nfc_wrap.o: brmdoor_nfc_wrap.cxx
g++ -c $(CXXFLAGS) $<
brmdoor_nfc_wrap.cxx: brmdoor_nfc.i
swig -python -c++ $<
clean:
rm -f $(OBJECTS) $(PY_MODULE)

14
brmdoor_nfc.cpp Normal file
View file

@ -0,0 +1,14 @@
#include <string>
#include "brmdoor_nfc.h"
using namespace std;
NFCDevice::NFCDevice()
{
}
std::string NFCDevice::scanUID()
{
return "1234";
}

15
brmdoor_nfc.h Normal file
View file

@ -0,0 +1,15 @@
#pragma once
#include <string>
class NFCDevice
{
public:
NFCDevice();
~NFCDevice() {}
std::string scanUID();
};

12
brmdoor_nfc.i Normal file
View file

@ -0,0 +1,12 @@
/* File : example.i */
%module brmdoor_nfc
%{
#include "brmdoor_nfc.h"
%}
%include std_string.i
%include "brmdoor_nfc.h"

5
runme.py Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env python
from brmdoor_nfc import NFCDevice
nfc = NFCDevice()
print nfc.scanUID()