laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38895?usp=email )
Change subject: esim.saip: Fix parsing/generating fillPattern + repeatPattern ...................................................................... esim.saip: Fix parsing/generating fillPattern + repeatPattern So far we only thought of default filling coming from a template. However, filling can happen from the Fcp, and we need to properly parse and [re-]encode that information. Change-Id: Iff339cbe841112a01c9c617f43b0e69df2521b51 Related: OS#6643 --- M pySim/esim/saip/__init__.py 1 file changed, 13 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/95/38895/1 diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 658810a..3c46ef8 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -116,6 +116,8 @@ self.high_update: bool = False self.shareable: bool = True self.df_name = None + self.fill_pattern = None + self.fill_pattern_repeat = False # apply some defaults from profile if self.template: self.from_template(self.template) @@ -174,8 +176,6 @@ self.fid = template.fid self.sfi = template.sfi self.arr = template.arr - #self.default_val = template.default_val - #self.default_val_repeat = template.default_val_repeat if hasattr(template, 'rec_len'): self.rec_len = template.rec_len else: @@ -234,14 +234,11 @@ fileDescriptor['fileDescriptor'] = build_construct(FileDescriptor._construct, fd_dict) if self.high_update: pefi['specialFileInformation'] = b'\x80' # TS 102 222 Table 5 - try: - if self.template and self.template.default_val_repeat: - pefi['repeatPattern'] = self.template.expand_default_value_pattern() - elif self.template and self.template.default_val: - pefi['fillPattern'] = self.template.expand_default_value_pattern() - except ValueError: - # ignore this here as without a file or record length we cannot do this - pass + if self.fill_pattern: + if not self.fill_pattern_repeat: + pefi['fillPattern'] = self.fill_pattern + else: + pefi['repeatPattern'] = self.fill_pattern if len(pefi.keys()): # TODO: When overwriting the default "proprietaryEFInfo" for a template EF for which a # default fill or repeat pattern is defined; it is hence recommended to provide the @@ -292,11 +289,13 @@ specialFileInformation = pefi.get('specialFileInformation', None) if specialFileInformation: if specialFileInformation[0] & 0x80: - self.hihgi_update = True + self.high_update = True if 'repeatPattern' in pefi: - self.repeat_pattern = pefi['repeatPattern'] - if 'defaultPattern' in pefi: - self.repeat_pattern = pefi['defaultPattern'] + self.fill_pattern = pefi['repeatPattern'] + self.fill_pattern_repeat = True + if 'fillPattern' in pefi: + self.fill_pattern = pefi['fillPattern'] + self.fill_pattern_repeat = False elif fdb_dec['file_type'] == 'df': # only set it, if an earlier call to from_template() didn't alrady set it, as # the template can differentiate between MF, DF and ADF (unlike FDB) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38895?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Iff339cbe841112a01c9c617f43b0e69df2521b51 Gerrit-Change-Number: 38895 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <lafo...@osmocom.org>