laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/37510?usp=email )
Change subject: pySim.esim.es8p: Add support for encoding icon in ProfileMetadata
......................................................................
pySim.esim.es8p: Add support for encoding icon in ProfileMetadata
Change-Id: I8c6a0c628f07c2a9608174457d20b8955114731a
---
M pySim/esim/es8p.py
1 file changed, 24 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/10/37510/1
diff --git a/pySim/esim/es8p.py b/pySim/esim/es8p.py
index a5c88f0..ba824d6 100644
--- a/pySim/esim/es8p.py
+++ b/pySim/esim/es8p.py
@@ -79,8 +79,20 @@
self.iccid_bin = iccid_bin
self.spn = spn
self.profile_name = profile_name
+ self.icon = None
+ self.icon_type = None
self.notifications = []
+ def set_icon(self, is_png: bool, icon_data: bytes):
+ """Set the icon that is part of the metadata."""
+ if len(icon_data) > 1024:
+ raise ValueError('Icon data must not exceed 1024 bytes')
+ self.icon = icon_data
+ if is_png:
+ self.icon_type = 1
+ else:
+ self.icon_type = 0
+
def add_notification(self, event: str, address: str):
"""Add an 'other' notification to the notification
configuration of the metadata"""
self.notifications.append((event, address))
@@ -92,6 +104,9 @@
'serviceProviderName': self.spn,
'profileName': self.profile_name,
}
+ if self.icon:
+ smr['icon'] = self.icon
+ smr['iconType'] = self.icon_type
nci = []
for n in self.notifications:
pmo = PMO(n[0])
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/37510?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I8c6a0c628f07c2a9608174457d20b8955114731a
Gerrit-Change-Number: 37510
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange