diff options
-rw-r--r-- | test-cli/test/helpers/qrreader.py | 6 | ||||
-rw-r--r-- | test-cli/test_main.py | 17 |
2 files changed, 13 insertions, 10 deletions
diff --git a/test-cli/test/helpers/qrreader.py b/test-cli/test/helpers/qrreader.py index 0954a70..908c9db 100644 --- a/test-cli/test/helpers/qrreader.py +++ b/test-cli/test/helpers/qrreader.py @@ -41,11 +41,11 @@ class QRReader: for device in devices: if device.name in qrdevice_list: self.__myReader['NAME'] = device.name - print(self.__myReader['NAME']) + #print(self.__myReader['NAME']) self.__myReader['PATH'] = device.path - print(self.__myReader['PATH']) + #print(self.__myReader['PATH']) self.__myReader['PHYS'] = device.phys - print(self.__myReader['PHYS']) + #print(self.__myReader['PHYS']) def IsQR (self): return 'NAME' in self.__myReader diff --git a/test-cli/test_main.py b/test-cli/test_main.py index dacc05a..8798cb3 100644 --- a/test-cli/test_main.py +++ b/test-cli/test_main.py @@ -172,13 +172,16 @@ def main(): if alltasksok: # get barcode using the scanner loggerObj.getlogger().info("Waiting for barcode scanner") - qr = QRReader() - if qr.openQR(): - # program remains here until gets a succesful code from the scanner - if qr.readQR(): - factorycode = qr.getQRNumber() - psdbObj.set_factorycode(globalVar.g_uuid, factorycode) - qr.closeQR() + qrreceived = False + while not qrreceived: + qr = QRReader() + if qr.openQR(): + # waits 5s to receive a valid code + if qr.readQRasync(5): + qrreceived = True + factorycode = qr.getQRNumber() + psdbObj.set_factorycode(globalVar.g_uuid, factorycode) + qr.closeQR() loggerObj.getlogger().info("Python program finished") |