close modem if the contact not found
This commit is contained in:
@@ -19,7 +19,7 @@ from pojo.serial_modem import SerialModem
|
|||||||
from logs.AppLogging import init_logger
|
from logs.AppLogging import init_logger
|
||||||
from utils.message_receiver import MessageReceiver
|
from utils.message_receiver import MessageReceiver
|
||||||
|
|
||||||
OTP_TIMEOUT = 60
|
OTP_TIMEOUT = 80
|
||||||
is_finished = False
|
is_finished = False
|
||||||
commandor = Commandor()
|
commandor = Commandor()
|
||||||
contacts = []
|
contacts = []
|
||||||
@@ -50,7 +50,6 @@ def send_command(cmd: str, ser, wait_time_in_s: int = 0) -> bytes:
|
|||||||
def create_modem_for_port(port: str) -> Union[SerialModem, None]:
|
def create_modem_for_port(port: str) -> Union[SerialModem, None]:
|
||||||
logger.info('Initializing modem... for ' + port)
|
logger.info('Initializing modem... for ' + port)
|
||||||
# Uncomment the following line to see what the modem is doing:
|
# Uncomment the following line to see what the modem is doing:
|
||||||
init_logger()
|
|
||||||
serial_modem = None
|
serial_modem = None
|
||||||
try:
|
try:
|
||||||
modem = GsmModem(port)
|
modem = GsmModem(port)
|
||||||
@@ -165,8 +164,8 @@ def read_all_the_phone_number():
|
|||||||
|
|
||||||
|
|
||||||
def start_book():
|
def start_book():
|
||||||
slot_number = 1
|
slot_number = 13
|
||||||
slot_sum = 30
|
slot_sum = 31
|
||||||
for i in range(slot_number, slot_sum + 1):
|
for i in range(slot_number, slot_sum + 1):
|
||||||
card_pool.reset()
|
card_pool.reset()
|
||||||
logger.info("will switch to " + str(i))
|
logger.info("will switch to " + str(i))
|
||||||
@@ -191,7 +190,12 @@ def start_book():
|
|||||||
if len(contact) > 0:
|
if len(contact) > 0:
|
||||||
modem.phone_number = contact[0].phone
|
modem.phone_number = contact[0].phone
|
||||||
modem.contact = contact[0]
|
modem.contact = contact[0]
|
||||||
|
else:
|
||||||
|
logger.info("contact not found for this ccid")
|
||||||
|
modem.modem.close()
|
||||||
|
continue
|
||||||
if modem.contact:
|
if modem.contact:
|
||||||
|
logger.info("contact found for this ccid")
|
||||||
commandor.start_page(modem.contact)
|
commandor.start_page(modem.contact)
|
||||||
start_to_handle_sms(modem)
|
start_to_handle_sms(modem)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
|||||||
Reference in New Issue
Block a user