Skip to content

Commit

Permalink
Move connect to separate method
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdijk committed Apr 2, 2023
1 parent 87e5285 commit 14f199d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/py_acr122u/nfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ def instantiate_reader():
reader = readers[0]
c = reader.createConnection()

return reader, c

def connect(self):
"""connect to the card
only works if a card is on the reader"""
try:
c.connect()
self.connection.connect()
except:
raise error.NoCommunication(
"The reader has been deleted and no communication is now possible. Smartcard error code : 0x7FEFFF97"
"\nHint: try to connect a card to the reader")

return reader, c

def command(self, mode, arguments=None):
"""send a payload to the reader
Expand Down

0 comments on commit 14f199d

Please sign in to comment.