Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UCC
UCC Snack Machine Server Code
Commits
33c571c7
Commit
33c571c7
authored
Mar 02, 2015
by
Mitchell Pomery
Committed by
Mark Tearle
Mar 02, 2015
Browse files
MIFARE Reader only triggers once unless a new card is used
parent
bebd1393
Changes
1
Hide whitespace changes
Inline
Side-by-side
VendServer/VendServer.py
View file @
33c571c7
...
...
@@ -390,6 +390,7 @@ def handle_getting_pin_idle(state, event, params, v, vstatus):
pass
def
handle_get_selection_idle
(
state
,
event
,
params
,
v
,
vstatus
):
global
_last_card_id
# don't care right now.
###
### State logging out ..
...
...
@@ -405,7 +406,7 @@ def handle_get_selection_idle(state, event, params, v, vstatus):
vstatus
.
cur_user
=
''
vstatus
.
cur_pin
=
''
vstatus
.
cur_selection
=
''
_last_card_id
=
-
1
reset_idler
(
v
,
vstatus
)
### State fully logged out ... reset variables
...
...
@@ -427,13 +428,14 @@ def handle_get_selection_idle(state, event, params, v, vstatus):
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
...
...
@@ -842,12 +844,17 @@ def handle_door_event(state, event, params, v, vstatus):
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
)
...
...
@@ -885,12 +892,15 @@ def handle_mifare_event(state, event, params, v, vstatus):
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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment