Skip to content

Commit

Permalink
cards.py: Add generic function to read EF binary to card class
Browse files Browse the repository at this point in the history
This is a generic function applicable for reading EFs which doesnt require further processing
such as GID1, GID2 etc while decoding and also to avoid code duplication.

Change-Id: If3d8fdddb26f9776c89fd442d1d95b83e0d1476b
  • Loading branch information
herlesupreeth committed Apr 1, 2020
1 parent c7f2f74 commit d21349a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pySim/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ def update_spn(self, name, hplmn_disp=False, oplmn_disp=False):
data, sw = self._scc.update_binary(EF['SPN'], rpad(content, 32))
return sw

def read_binary(self, ef, length=None, offset=0):
ef_path = ef in EF and EF[ef] or ef
return self._scc.read_binary(ef_path, length, offset)

def read_gid1(self):
(res, sw) = self._scc.read_binary(EF['GID1'])
if sw == '9000':
Expand Down

0 comments on commit d21349a

Please sign in to comment.