add ccid to log
This commit is contained in:
@@ -199,13 +199,14 @@ def start_book():
|
|||||||
try:
|
try:
|
||||||
modem.get_ccid()
|
modem.get_ccid()
|
||||||
# find the contact with ccid
|
# find the contact with ccid
|
||||||
contact = [contact for contact in contacts if contact.ccid.replace("F", "") == modem.ccid.replace("F", "")]
|
contact = [contact for contact in contacts if
|
||||||
|
contact.ccid.replace("F", "") == modem.ccid.replace("F", "")]
|
||||||
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:
|
else:
|
||||||
logger.info("contact not found for this ccid")
|
logger.info("contact not found for this ccid:{}".format(modem.ccid))
|
||||||
error_msg = "slot({}),sim({})".format(i, current_sim_position)
|
error_msg = "slot({}):sim({}):ccid({})".format(i, current_sim_position, modem.ccid)
|
||||||
oracle_log_sender.send_contact_not_found(error_msg)
|
oracle_log_sender.send_contact_not_found(error_msg)
|
||||||
modem.modem.close()
|
modem.modem.close()
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from gsmmodem import GsmModem
|
from gsmmodem import GsmModem
|
||||||
@@ -13,14 +14,15 @@ class SerialModem():
|
|||||||
def __init__(self, modem: GsmModem, ccid: str = None):
|
def __init__(self, modem: GsmModem, ccid: str = None):
|
||||||
self.modem = modem
|
self.modem = modem
|
||||||
self.ccid = ccid
|
self.ccid = ccid
|
||||||
|
self.logger = logging.getLogger("SerialModem")
|
||||||
|
|
||||||
def get_ccid(self):
|
def get_ccid(self):
|
||||||
cmd = "AT+CCID"
|
cmd = "AT+CCID"
|
||||||
self.modem.connect("0000")
|
self.modem.connect("0000")
|
||||||
print("try to get ccid")
|
self.logger.info("try to get ccid")
|
||||||
response = self.modem.write(cmd, True)
|
response = self.modem.write(cmd, True)
|
||||||
self.ccid = response[0].split(" ")[1].replace("\"", "")
|
self.ccid = response[0].split(" ")[1].replace("\"", "")
|
||||||
print("The SIM card ccid is:" + self.ccid)
|
self.logger.info("The SIM card ccid is:" + self.ccid)
|
||||||
# print("try to get phone number")
|
# print("try to get phone number")
|
||||||
# cmd_phone_number = "AT+CPBS=ON"
|
# cmd_phone_number = "AT+CPBS=ON"
|
||||||
# openBook = self.modem.write(cmd_phone_number, True)
|
# openBook = self.modem.write(cmd_phone_number, True)
|
||||||
|
|||||||
Reference in New Issue
Block a user