Move parsing of HPLMNAcT to generic Card class

Change-Id: I46c863c118dcbef89455c34289ed25e5a342f35b
This commit is contained in:
Supreeth Herle 2020-03-19 12:44:11 +01:00
parent 1757b263bf
commit a850a47981
2 changed files with 9 additions and 2 deletions

View File

@ -183,9 +183,9 @@ if __name__ == '__main__':
# EF.HPLMNAcT
try:
(res, sw) = scc.read_binary(EF['HPLMNAcT'])
(res, sw) = card.read_hplmn_act()
if sw == '9000':
print("HPLMNAcT:\n%s" % (format_xplmn_w_act(res)))
print("HPLMNAcT:\n%s" % (res))
else:
print("HPLMNAcT: Can't read, response code = %s" % (sw,))
except Exception as e:

View File

@ -66,6 +66,13 @@ class Card(object):
data, sw = self._scc.update_binary(EF['ACC'], lpad(acc, 4))
return sw
def read_hplmn_act(self):
(res, sw) = self._scc.read_binary(EF['HPLMNAcT'])
if sw == '9000':
return (format_xplmn_w_act(res), sw)
else:
return (None, sw)
def update_hplmn_act(self, mcc, mnc, access_tech='FFFF'):
"""
Update Home PLMN with access technology bit-field