laforge submitted this change.
esim.saip.File: Suppress encoding attributes that are like template
The point of the SAIP template mechanism is to reduce the size of the
encoded profile. Therefore, our encoder in the to_fileDescriptor()
method should suppress generating attributes if their value is identical
to that of the template (if any).
Change-Id: I337ee6c7e882ec711bece17b7a0def9da36b0ad7
---
M pySim/esim/saip/__init__.py
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 40ef4ce..94df453 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -216,13 +216,13 @@
fdb_dec = {}
pefi = {}
spfi = 0
- if self.fid:
+ if self.fid and self.fid != self.template.fid:
fileDescriptor['fileID'] = self.fid.to_bytes(2, 'big')
- if self.sfi:
+ if self.sfi and self.sfi != self.template.sfi:
fileDescriptor['shortEFID'] = bytes([self.sfi])
if self.df_name:
fileDescriptor['dfName'] = self.df_name
- if self.arr:
+ if self.arr and self.arr != self.template.arr.to_bytes(1):
fileDescriptor['securityAttributesReferenced'] = self.arr
if self.file_type in ['LF', 'CY']:
fdb_dec['file_type'] = 'working_ef'
To view, visit change 38908. To unsubscribe, or for help writing mail filters, visit settings.