diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2020-05-12 16:27:12 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2020-05-22 14:43:15 +0200 |
commit | 5c2cc66de5fcf354616c6d3bb024d17bf8075a69 (patch) | |
tree | 56a20bb7097bee381a4755349fb9a0809cc823dc | |
parent | cd3d6268a619b9533c26dfe068defeac3e00d094 (diff) |
cards: add methods to help erasing of file contents
Resetting the contents of a file before re-writing it with parameters
might be helpful when implementing the currently empty erase() methods
of the various card implementations. Lets add two methods, one for
resetting a binary file and one for resetting a specific record in a
record oriented file
Change-Id: I3c3a4ef3d3f358404af307a68a20b7059f1a9e8d
-rw-r--r-- | pySim/cards.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pySim/cards.py b/pySim/cards.py index 1c0add0..73b0763 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -248,6 +248,16 @@ class Card(object): return None + # Erase the contents of a file + def erase_binary(self, ef): + len = self._scc.binary_size(ef) + self._scc.update_binary(ef, "ff" * len, offset=0, verify=True) + + # Erase the contents of a single record + def erase_record(self, ef, rec_no): + len = self._scc.record_size(ef) + self._scc.update_record(ef, rec_no, "ff" * len, force_len=False, verify=True) + class _MagicSimBase(Card): """ |