commit cafd967ed6be61ed41cea71510b2b9994bdea66c Author: Ondrej Mikle Date: Sat Jul 19 01:08:30 2014 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9d0b7e --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.*.swp +*.so +*.o +*.pyc + +brmdoor_nfc_wrap.cxx +brmdoor_nfc.py + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3227b3f --- /dev/null +++ b/Makefile @@ -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) diff --git a/brmdoor_nfc.cpp b/brmdoor_nfc.cpp new file mode 100644 index 0000000..1f4eb93 --- /dev/null +++ b/brmdoor_nfc.cpp @@ -0,0 +1,14 @@ +#include + +#include "brmdoor_nfc.h" + +using namespace std; + +NFCDevice::NFCDevice() +{ +} + +std::string NFCDevice::scanUID() +{ + return "1234"; +} diff --git a/brmdoor_nfc.h b/brmdoor_nfc.h new file mode 100644 index 0000000..a1fbd6a --- /dev/null +++ b/brmdoor_nfc.h @@ -0,0 +1,15 @@ +#pragma once + +#include + +class NFCDevice +{ + +public: + + NFCDevice(); + + ~NFCDevice() {} + + std::string scanUID(); +}; diff --git a/brmdoor_nfc.i b/brmdoor_nfc.i new file mode 100644 index 0000000..f89e475 --- /dev/null +++ b/brmdoor_nfc.i @@ -0,0 +1,12 @@ +/* File : example.i */ +%module brmdoor_nfc + +%{ +#include "brmdoor_nfc.h" +%} + +%include std_string.i + +%include "brmdoor_nfc.h" + + diff --git a/runme.py b/runme.py new file mode 100755 index 0000000..d317839 --- /dev/null +++ b/runme.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +from brmdoor_nfc import NFCDevice + +nfc = NFCDevice() +print nfc.scanUID()