add ccid to log

This commit is contained in:
2022-03-25 14:16:06 +01:00
parent 3cae7159aa
commit 6f58c95aae
2 changed files with 8 additions and 5 deletions
+4 -2
View File
@@ -1,3 +1,4 @@
import logging
from dataclasses import dataclass
from gsmmodem import GsmModem
@@ -13,14 +14,15 @@ class SerialModem():
def __init__(self, modem: GsmModem, ccid: str = None):
self.modem = modem
self.ccid = ccid
self.logger = logging.getLogger("SerialModem")
def get_ccid(self):
cmd = "AT+CCID"
self.modem.connect("0000")
print("try to get ccid")
self.logger.info("try to get ccid")
response = self.modem.write(cmd, True)
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")
# cmd_phone_number = "AT+CPBS=ON"
# openBook = self.modem.write(cmd_phone_number, True)