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/.

herlesupreeth gerrit-no-reply at lists.osmocom.org
Mon Mar 30 08:52:44 UTC 2020


herlesupreeth has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/65/17665/1

diff --git a/pySim-read.py b/pySim-read.py
index a18cc77..b84be29 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 fe4ecb8..06753c3 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -201,6 +201,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: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200330/ebe263b5/attachment.htm>


More information about the gerrit-log mailing list