Change in pysim[master]: Move parsing of MSISDN to generic Card class

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Apr 1 09:40:25 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/17665 )

Change subject: Move parsing of MSISDN to generic Card class
......................................................................

Move parsing of MSISDN to generic Card class

Change-Id: I5b726bc0dc8c8e5eb42f209b1fe0f35a46ac91be
---
M pySim-read.py
M pySim/cards.py
2 files changed, 11 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



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 @@
 
 	# 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 @@
 		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):
 

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/17665
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I5b726bc0dc8c8e5eb42f209b1fe0f35a46ac91be
Gerrit-Change-Number: 17665
Gerrit-PatchSet: 2
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200401/e09937c1/attachment.htm>


More information about the gerrit-log mailing list