pass
def handle_get_selection_idle(state, event, params, v, vstatus):
+ global _last_card_id
# don't care right now.
###
### State logging out ..
vstatus.cur_user = ''
vstatus.cur_pin = ''
vstatus.cur_selection = ''
-
+ _last_card_id = -1
reset_idler(v, vstatus)
### State fully logged out ... reset variables
def handle_get_selection_key(state, event, params, v, vstatus):
+ global _last_card_id
key = params
if len(vstatus.cur_selection) == 0:
if key == 11:
vstatus.cur_pin = ''
vstatus.cur_user = ''
vstatus.cur_selection = ''
-
+ _last_card_id = -1
vstatus.mk.set_messages([(center('BYE!'), False, 1.5)])
reset_idler(v, vstatus, 2)
return
logging.warning('Leaving open door mode')
v.display("-YUM YUM!-")
+_last_card_id = -1
+
def handle_mifare_event(state, event, params, v, vstatus):
+ global _last_card_id
card_id = params
# Translate card_id into uid.
- if card_id == None:
+ if card_id == None or card_id == _last_card_id:
return
+ _last_card_id = card_id
+
try:
vstatus.cur_user = get_uid(card_id)
logging.info('Mapped card id to uid %s'%vstatus.cur_user)
return
def handle_mifare_add_user_event(state, event, params, v, vstatus):
- card_id = params
+ global _last_card_id
+ card_id = params
# Translate card_id into uid.
- if card_id == None:
+ if card_id == None or card_id == _last_card_id:
return
+ _last_card_id = card_id
+
try:
if get_uid(card_id) != None:
vstatus.mk.set_messages(