summaryrefslogtreecommitdiff
path: root/test-cli/test_main.py
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-04-15 17:22:21 +0200
committerHector Fernandez <hector@iatec.biz>2020-04-15 17:22:21 +0200
commit47b65a71d5db142c73a0566f132af6eee3b0c2a9 (patch)
tree926c8198efbbe16cf535504594457a07a58d8f6a /test-cli/test_main.py
parent99d74b02c7d3ff7eea51f59a2d67651aeab1297f (diff)
downloadboard-47b65a71d5db142c73a0566f132af6eee3b0c2a9.zip
board-47b65a71d5db142c73a0566f132af6eee3b0c2a9.tar.gz
board-47b65a71d5db142c73a0566f132af6eee3b0c2a9.tar.bz2
Every 5s teh qr scanner is refreshed to detect a new devices in case it is unplugged and plugged again.
Diffstat (limited to 'test-cli/test_main.py')
-rw-r--r--test-cli/test_main.py17
1 files changed, 10 insertions, 7 deletions
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")