laforge has submitted this change. ( 
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(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




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: 4
Gerrit-Owner: laforge <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-MessageType: merged

Reply via email to