laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38897?usp=email )
Change subject: esim.saip: Compute number of records from efFileSize and record_len ......................................................................
esim.saip: Compute number of records from efFileSize and record_len
If we know the efFileSize and record_len, but Fcp doesn't contain the number of records, we can simply compute it.
Change-Id: I0cc8e7241e37ee23df00c2622422904e7ccdca77 --- M pySim/esim/saip/__init__.py 1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/97/38897/1
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 6707802..3490f64 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -276,12 +276,15 @@ self.shareable = fdb_dec['shareable'] if fdb_dec['file_type'] == 'working_ef': efFileSize = fileDescriptor.get('efFileSize', None) - if efFileSize: - self._file_size = self._decode_file_size(efFileSize) if fd_dec['num_of_rec']: self.nb_rec = fd_dec['num_of_rec'] if fd_dec['record_len']: self.rec_len = fd_dec['record_len'] + if efFileSize: + self._file_size = self._decode_file_size(efFileSize) + if self.rec_len and self.nb_rec == None: + # compute the number of records from file size and record length + self.nb_rec = self._file_size // self.rec_len if fdb_dec['structure'] == 'linear_fixed': self.file_type = 'LF' elif fdb_dec['structure'] == 'cyclic':