mirror of
https://github.com/brmlab/brmdoor_libnfc.git
synced 2025-06-08 00:24:00 +02:00
Initial commit
This commit is contained in:
commit
cafd967ed6
6 changed files with 74 additions and 0 deletions
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
.*.swp
|
||||||
|
*.so
|
||||||
|
*.o
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
brmdoor_nfc_wrap.cxx
|
||||||
|
brmdoor_nfc.py
|
||||||
|
|
20
Makefile
Normal file
20
Makefile
Normal 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
14
brmdoor_nfc.cpp
Normal 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
15
brmdoor_nfc.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class NFCDevice
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
NFCDevice();
|
||||||
|
|
||||||
|
~NFCDevice() {}
|
||||||
|
|
||||||
|
std::string scanUID();
|
||||||
|
};
|
12
brmdoor_nfc.i
Normal file
12
brmdoor_nfc.i
Normal 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
5
runme.py
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
from brmdoor_nfc import NFCDevice
|
||||||
|
|
||||||
|
nfc = NFCDevice()
|
||||||
|
print nfc.scanUID()
|
Loading…
Add table
Add a link
Reference in a new issue