Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: 3ffdc8246d
...
compare: 6b3f750a3d
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 07, 2013
Domhnall Walsh Small fixes on running system 6b3f750
Showing with 15 additions and 14 deletions.
  1. +1 −0  userdb.py
  2. +14 −14 wiegand_test.py
View
1  userdb.py
@@ -2,6 +2,7 @@
from sqlalchemy import Column, Date, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref, sessionmaker
+import argparse
Base = declarative_base()
View
28 wiegand_test.py
@@ -11,7 +11,7 @@ class RFidReader(object):
GPIO_PIN_DOOR_RELEASE = 23
GPIO_PIN_SOLENOID = 24
- def __init__():
+ def __init__(self):
# Use the Broadcom numbering scheme
GPIO.setmode(GPIO.BCM)
@@ -28,7 +28,7 @@ def __init__():
self.awaiting_bit = True
self.open_door = False
- def run(testfn):
+ def run(self, testfn):
# Now, here we go. The trick here is to detect the pulses and the gaps
# as we're polling the whole damned time.
while True:
@@ -39,42 +39,42 @@ def run(testfn):
door_release_pressed = not GPIO.input(self.GPIO_PIN_DOOR_RELEASE)
if door_release_pressed:
print "Door release pressed"
- open_door = True
+ self.open_door = True
# If we're not waiting for a bit (i.e. waiting for both lines to
# go low) and both lines go low, then mark us as ready to read a
# bit
- if not awaiting_bit:
+ if not self.awaiting_bit:
if not d0 and not d1:
- awaiting_bit = True
+ self.awaiting_bit = True
continue
# If we get to here, it's assumed we're expecting a bit.
if d0 != d1: # Sure sign we have a bit...
if d1:
- number_string = number_string + "1"
+ self.number_string = self.number_string + "1"
else:
- number_string = number_string + "0"
- awaiting_bit = False
+ self.number_string = self.number_string + "0"
+ self.awaiting_bit = False
- if len(number_string) == 26:
+ if len(self.number_string) == 26:
# First and last bits are checksum bits, ignoring for now.
# TODO: use them to check that the number is valid
- key_number = int(number_string[1:-1], 2)
+ key_number = int(self.number_string[1:-1], 2)
print "Read tag: %d" % key_number
if testfn(key_number):
print "Key accepted"
- open_door = True
+ self.open_door = True
else:
print "Key not accepted"
- number_string = ""
+ self.number_string = ""
- if open_door:
+ if self.open_door:
GPIO.output(self.GPIO_PIN_SOLENOID, False)
sleep(2)
GPIO.output(self.GPIO_PIN_SOLENOID, True)
- open_door = False
+ self.open_door = False
reader = RFidReader()
db = UserDB()

No commit comments for this range

Something went wrong with that request. Please try again.