\r
class MIFAREClient:\r
def __init__(self):\r
- self.port = Serial('/dev/ttyS2', baudrate = 19200)\r
+ self.port = Serial('/dev/ttyS0', baudrate = 19200)\r
self.reader = MIFAREReader(self.port)\r
self.reader.set_led(red = False, green = True)\r
self.reader.beep(100)\r
\r
- def get_card(self):\r
+ def get_card_id(self):\r
self.reader.set_led(red = True, green = False)\r
try:\r
card_id, capacity = self.reader.select_card()\r
self.reader.beep(100)\r
return card_id\r
\r
+ def get_card_uid(self):\r
+ card_id = self.get_card_id()\r
+ if card_id == None:\r
+ return None\r
+ else:\r
+ return get_uid(card_id)\r
+ \r
def add_card(self, uid):\r
self.reader.set_led(red = True, green = False)\r
for attempt in range(5):\r
except MIFAREException:\r
pass\r
else:\r
- set_card_id(card_id, uid)\r
+ set_card_id(uid, card_id)\r
self.reader.set_led(red = False, green = True)\r
return True\r
self.reader.set_led(red = False, green = True)\r
- return False
\ No newline at end of file
+ return False\r