From 6d66af653fc355697c7a53f420ffaecdcc2ade9f Mon Sep 17 00:00:00 2001 From: Supreeth Herle Date: Thu, 19 Mar 2020 12:49:16 +0100 Subject: Move parsing of MSISDN to generic Card class Change-Id: I5b726bc0dc8c8e5eb42f209b1fe0f35a46ac91be --- pySim-read.py | 10 ++++------ pySim/cards.py | 7 +++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pySim-read.py b/pySim-read.py index 1e1d39a..c2e63a0 100755 --- a/pySim-read.py +++ b/pySim-read.py @@ -200,13 +200,11 @@ if __name__ == '__main__': # EF.MSISDN try: - # print(scc.record_size(['3f00', '7f10', '6f40'])) - (res, sw) = scc.read_record(['3f00', '7f10', '6f40'], 1) + (res, sw) = card.read_msisdn() if sw == '9000': - res_dec = dec_msisdn(res) - if res_dec is not None: - # (npi, ton, msisdn) = res_dec - print("MSISDN (NPI=%d ToN=%d): %s" % res_dec) + # (npi, ton, msisdn) = res + if res is not None: + print("MSISDN (NPI=%d ToN=%d): %s" % res) else: print("MSISDN: Not available") else: diff --git a/pySim/cards.py b/pySim/cards.py index 8081f87..d27092d 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -181,6 +181,13 @@ class Card(object): else: return (None, sw) + def read_msisdn(self): + (res, sw) = self._scc.read_record(EF['MSISDN'], 1) + if sw == '9000': + return (dec_msisdn(res), sw) + else: + return (None, sw) + # Read the (full) AID for either ISIM or USIM application def read_aid(self, isim = False): -- cgit v1.2.3