aboutsummaryrefslogtreecommitdiffstats
path: root/pySim
diff options
context:
space:
mode:
authorherlesupreeth <herlesupreeth@gmail.com>2020-09-18 15:32:20 +0200
committerlaforge <laforge@osmocom.org>2020-09-20 09:49:22 +0000
commit45fa604834906477645796394fd8b20873ac3d8b (patch)
tree7492a71be779b17b0164de5781e1cc002a6457ab /pySim
parentf3948535331943df6eb7d915a64a625ed984999a (diff)
Use generic function hexstr_to_Nbytearr to convert hex string to 3/5 Bytes array
Diffstat (limited to 'pySim')
-rw-r--r--pySim/utils.py4
-rw-r--r--pySim/utils_test.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/pySim/utils.py b/pySim/utils.py
index e5434a5..43e4c53 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -180,7 +180,7 @@ def dec_xplmn_w_act(fivehexbytes):
def format_xplmn_w_act(hexstr):
s = ""
- for rec_data in hexstr_to_fivebytearr(hexstr):
+ for rec_data in hexstr_to_Nbytearr(hexstr, 5):
rec_info = dec_xplmn_w_act(rec_data)
if rec_info['mcc'] == 0xFFF and rec_info['mnc'] == 0xFFF:
rec_str = "unused"
@@ -229,7 +229,7 @@ def dec_xplmn(threehexbytes):
def format_xplmn(hexstr):
s = ""
- for rec_data in hexstr_to_threebytearr(hexstr):
+ for rec_data in hexstr_to_Nbytearr(hexstr, 3):
rec_info = dec_xplmn(rec_data)
if rec_info['mcc'] == 0xFFF and rec_info['mnc'] == 0xFFF:
rec_str = "unused"
diff --git a/pySim/utils_test.py b/pySim/utils_test.py
index ff028da..8db04bd 100644
--- a/pySim/utils_test.py
+++ b/pySim/utils_test.py
@@ -12,7 +12,7 @@ class DecTestCase(unittest.TestCase):
"ffffff0002",
"ffffff0001",
]
- self.assertEqual(utils.hexstr_to_fivebytearr(input_str), expected)
+ self.assertEqual(utils.hexstr_to_Nbytearr(input_str, 5), expected)
def testDecMCCfromPLMN(self):
self.assertEqual(utils.dec_mcc_from_plmn("92f501"), 295)