mirror of https://gerrit.osmocom.org/pysim
Use generic function hexstr_to_Nbytearr to convert hex string to 3/5 Bytes array
Change-Id: I1165e4928d063667f0b4dfc3437c9278e7ec7450
This commit is contained in:
parent
f394853533
commit
45fa604834
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue