pass on username to nfc socket when opening and closing door

This commit is contained in:
Simon Pirkelmann 2021-08-23 21:05:42 +02:00
parent 2ccec6fe32
commit 14c783b2c1

View File

@ -92,15 +92,15 @@ class DoorHandle:
if self.nfc_sock is not None: if self.nfc_sock is not None:
self.nfc_sock.send(b'rld\n') self.nfc_sock.send(b'rld\n')
def open_door(self): def open_door(self, user=b''):
if self.nfc_sock is not None: if self.nfc_sock is not None:
self.nfc_sock.send(b'open\n') self.nfc_sock.send(b'open ' + user + b'\n')
else: else:
raise Exception("No connection to NFC socket. Cannot close door!") raise Exception("No connection to NFC socket. Cannot close door!")
def close_door(self): def close_door(self, user=b''):
if self.nfc_sock is not None: if self.nfc_sock is not None:
self.nfc_sock.send(b'close\n') self.nfc_sock.send(b'close ' + user + b'\n')
else: else:
raise Exception("No connection to NFC socket. Cannot close door!") raise Exception("No connection to NFC socket. Cannot close door!")