neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/41917?usp=email )


Change subject: improve Imsi,Iccid.get_values_from_pes()
......................................................................

improve Imsi,Iccid.get_values_from_pes()

Change-Id: I40c888e81fc3172d5abbd5fc49029e5f7cf720ab
---
M pySim/esim/saip/personalization.py
1 file changed, 7 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/17/41917/1

diff --git a/pySim/esim/saip/personalization.py 
b/pySim/esim/saip/personalization.py
index 00b8f49..4b865a2 100644
--- a/pySim/esim/saip/personalization.py
+++ b/pySim/esim/saip/personalization.py
@@ -393,9 +393,9 @@
         yield iccid

         for pe in pes.get_pes_for_type('mf'):
-            iccid_pe = pe.decoded.get('ef-iccid', None)
-            if iccid_pe:
-                yield dec_iccid(b2h(file_tuples_content_as_bytes(iccid_pe)))
+            iccid_f = pe.files.get('ef-iccid', None)
+            if iccid_f is not None:
+                yield dec_iccid(b2h(iccid_f.body))

 class Imsi(DecimalParam):
     """Configurable IMSI. Expects value to be a string of digits. 
Automatically sets the ACC to
@@ -420,9 +420,10 @@
     @classmethod
     def get_values_from_pes(cls, pes: ProfileElementSequence):
         for pe in pes.get_pes_for_type('usim'):
-            imsi_pe = pe.decoded.get('ef-imsi', None)
-            if imsi_pe:
-                yield dec_imsi(b2h(file_tuples_content_as_bytes(imsi_pe)))
+            imsi_f = pe.files.get('ef-imsi', None)
+            acc_f = pe.files.get('ef-acc', None)
+            if imsi_f:
+                yield dec_imsi(b2h(imsi_f.body))

 class SmspTpScAddr(ConfigurableParameter):
     """Configurable SMSC (SMS Service Centre) TP-SC-ADDR. Expects to be a 
phone number in national or

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41917?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I40c888e81fc3172d5abbd5fc49029e5f7cf720ab
Gerrit-Change-Number: 41917
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>

Reply via email to