Move reading of ePDG Id to generic USIM class
Change-Id: I716acb994430db3d4e56fea072f8dc2cebeaba84
diff --git a/pySim-read.py b/pySim-read.py
index 2ca0557..a4f15f8 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -267,12 +267,12 @@
#EF.ePDGId - Home ePDG Identifier
try:
- (res, sw) = card.read_binary(EF_USIM_ADF_map['ePDGId'])
- if sw == '9000':
- content = dec_epdgid(res)
- print("ePDGId:\n%s" % (len(content) and content or '\tNot available\n',))
- else:
- print("ePDGId: Can't read, response code = %s" % (sw,))
+ if card.file_exists(EF_USIM_ADF_map['ePDGId']):
+ (res, sw) = card.read_epdgid()
+ if sw == '9000':
+ print("ePDGId:\n%s" % (len(res) and res or '\tNot available\n',))
+ else:
+ print("ePDGId: Can't read, response code = %s" % (sw,))
except Exception as e:
print("ePDGId: Can't read file -- " + str(e))
diff --git a/pySim/cards.py b/pySim/cards.py
index f2a3d2a..f2f79e4 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -264,6 +264,13 @@
data, sw = self._scc.update_binary(EF_USIM_ADF_map['EHPLMN'], ehplmn)
return sw
+ def read_epdgid(self):
+ (res, sw) = self._scc.read_binary(EF_USIM_ADF_map['ePDGId'])
+ if sw == '9000':
+ return (dec_epdgid(res), sw)
+ else:
+ return (None, sw)
+
def update_epdgid(self, epdgid):
epdgid_tlv = enc_epdgid(epdgid)
data, sw = self._scc.update_binary(
diff --git a/pysim-testdata/Fairwaves-SIM.ok b/pysim-testdata/Fairwaves-SIM.ok
index 6dd839c..e6fcfe3 100644
--- a/pysim-testdata/Fairwaves-SIM.ok
+++ b/pysim-testdata/Fairwaves-SIM.ok
@@ -116,6 +116,5 @@
Service 64 - VGCS security
Service 65 - VBS security
-ePDGId: Can't read file -- SW match failed! Expected 9000 and got 6a82.
Done !
diff --git a/pysim-testdata/Wavemobile-SIM.ok b/pysim-testdata/Wavemobile-SIM.ok
index 010a228..6cb4e2b 100644
--- a/pysim-testdata/Wavemobile-SIM.ok
+++ b/pysim-testdata/Wavemobile-SIM.ok
@@ -132,6 +132,5 @@
Service 53 - Extension 8
Service 55 - MMS User Connectivity Parameters
-ePDGId: Can't read file -- SW match failed! Expected 9000 and got 6a82.
Done !
diff --git a/pysim-testdata/sysmoUSIM-SJS1.ok b/pysim-testdata/sysmoUSIM-SJS1.ok
index da1a1f6..95f6967 100644
--- a/pysim-testdata/sysmoUSIM-SJS1.ok
+++ b/pysim-testdata/sysmoUSIM-SJS1.ok
@@ -140,6 +140,5 @@
Service 53 - Extension 8
Service 55 - MMS User Connectivity Parameters
-ePDGId: Can't read file -- SW match failed! Expected 9000 and got 6a82.
Done !