cards: add update method for EF:PLMNsel to Card class

The Card class offers update methods for various EF, but for
PLMNsel there is no update method available yet. Lets add one.

Change-Id: I832f7bef70c92dc101b94ad871b6cafaa626e134
Related: SYS#4245
This commit is contained in:
Philipp Maier 2018-07-11 23:23:40 +02:00
parent ac9dde683f
commit 5bf42600d4
1 changed files with 6 additions and 0 deletions

View File

@ -83,6 +83,12 @@ class Card(object):
data, sw = self._scc.update_binary(EF['HPLMNwAcT'], content + 'ffffff0000' * (size/5-1))
return sw
def update_plmnsel(self, mcc, mnc):
data = self._scc.read_binary(EF['PLMNsel'], length=None, offset=0)
size = len(data[0])/2
hplmn = enc_plmn(mcc, mnc)
self._scc.update_binary(EF['PLMNsel'], hplmn + 'ff' * (size-3))
def update_smsp(self, smsp):
data, sw = self._scc.update_record(EF['SMSP'], 1, rpad(smsp, 84))
return sw