23 lines
530 B
Python
23 lines
530 B
Python
from dataclasses import dataclass
|
|
|
|
from gsmmodem import GsmModem
|
|
|
|
|
|
@dataclass
|
|
class SerialModem():
|
|
ccid: str
|
|
phone_number = None
|
|
modem: GsmModem
|
|
contact = None
|
|
|
|
def __init__(self, modem: GsmModem, ccid: str = None):
|
|
self.modem = modem
|
|
self.ccid = ccid
|
|
|
|
def get_ccid(self):
|
|
cmd = "AT+CCID\r"
|
|
self.modem.connect()
|
|
response = self.modem.write(cmd, True)
|
|
self.ccid = response[0].split(" ")[1].replace("\"", "")
|
|
print("The SIM card ccid is:" + self.ccid)
|