add wait for sms py

This commit is contained in:
2022-03-23 14:34:17 +01:00
parent 840d66c59d
commit 3593a15904
4 changed files with 146 additions and 5 deletions
+6 -3
View File
@@ -20,7 +20,7 @@ from pojo.serial_modem import SerialModem
from utils.excel_reader import ExcelHelper
from utils.message_receiver import MessageReceiver
OTP_TIMEOUT = 600
OTP_TIMEOUT = 120
is_finished = False
commandor = CommandorPage()
thread_event = None
@@ -97,7 +97,7 @@ def handle_sms(sms):
params.oracle_log_sender.send_sms_reception_log(sms.number, sms.text)
if date == str(datetime.date.today()):
logger.info("this sms is for today")
if "rendez-vous" in sms.text:
if "rendez-vous" in sms.text or "appointment" in sms.text:
logger.info("try to extract the otp")
pattern = r'\d{6,8}'
# if re.match(pattern, sms.text):
@@ -105,7 +105,9 @@ def handle_sms(sms):
otp = match.group(0)
logger.info("otp is " + otp)
global thread_event
global commandor
commandor.otp_value = otp
logger.info("will set thread event")
thread_event.set()
# commandor.send_otp(otp)
# wait for the sms for 20 seconds
@@ -154,13 +156,14 @@ def start_listen():
def on_ready_for_otp(e: Event, commandor: CommandorPage):
print("on_ready_for_otp() called.")
global thread_event
thread_event = e
def start_book():
slot_number = 1
slot_sum = 22
slot_sum = 2
for i in reversed(range(slot_number, slot_sum + 1)):
card_pool.reset()
logger.info("will switch to " + str(i))