Loading poolpay/card/Pirc522CardReader.py +4 −3 Original line number Diff line number Diff line Loading @@ -37,10 +37,11 @@ class Pirc522CardReader(CardReader): print("Reading block 10: " + str(self._reader.read(10))) def on_card_presented(self, handle_card: Callable[[CardReader], None]) -> None: # TODO Do all this repeatedly in a background thread # TODO This only works if the interrupt pin (pin_irq) is correctly initialized # TODO Run this in a background thread while True: # This only works if the interrupt pin (pin_irq) is correctly initialized self._reader.wait_for_tag() # TODO Call handle method handle_card(self) def on_card_removed(self, handle_removal: Callable[[CardReader], None]) -> None: # TODO Implement Loading poolpay/card/__main__.py +6 −0 Original line number Diff line number Diff line Loading @@ -14,10 +14,16 @@ DEFAULT_READER = "pirc522" def action_id(reader: CardReader) -> None: def _read_and_print_id(): card_id = reader.read_id() print("Card ID (base 10)", card_id) print("Card ID (base 16)", hex(card_id)) try: reader.on_card_presented(lambda _: _read_and_print_id()) except NotImplementedError: _read_and_print_id() ACTIONS = {"id": action_id} Loading Loading
poolpay/card/Pirc522CardReader.py +4 −3 Original line number Diff line number Diff line Loading @@ -37,10 +37,11 @@ class Pirc522CardReader(CardReader): print("Reading block 10: " + str(self._reader.read(10))) def on_card_presented(self, handle_card: Callable[[CardReader], None]) -> None: # TODO Do all this repeatedly in a background thread # TODO This only works if the interrupt pin (pin_irq) is correctly initialized # TODO Run this in a background thread while True: # This only works if the interrupt pin (pin_irq) is correctly initialized self._reader.wait_for_tag() # TODO Call handle method handle_card(self) def on_card_removed(self, handle_removal: Callable[[CardReader], None]) -> None: # TODO Implement Loading
poolpay/card/__main__.py +6 −0 Original line number Diff line number Diff line Loading @@ -14,10 +14,16 @@ DEFAULT_READER = "pirc522" def action_id(reader: CardReader) -> None: def _read_and_print_id(): card_id = reader.read_id() print("Card ID (base 10)", card_id) print("Card ID (base 16)", hex(card_id)) try: reader.on_card_presented(lambda _: _read_and_print_id()) except NotImplementedError: _read_and_print_id() ACTIONS = {"id": action_id} Loading