From 45fa604834906477645796394fd8b20873ac3d8b Mon Sep 17 00:00:00 2001 From: herlesupreeth Date: Fri, 18 Sep 2020 15:32:20 +0200 Subject: [PATCH] Use generic function hexstr_to_Nbytearr to convert hex string to 3/5 Bytes array Change-Id: I1165e4928d063667f0b4dfc3437c9278e7ec7450 --- pySim/utils.py | 4 ++-- pySim/utils_test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pySim/utils.py b/pySim/utils.py index e5434a5a..43e4c535 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 ff028dad..8db04bdd 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)