[PATCH 1/2] iface-modem: add mm_iface_modem_get_unlock_retries helper

Ben Chan benchan at chromium.org
Mon Sep 18 16:10:56 UTC 2017


This patch adds a mm_iface_modem_get_unlock_retries helper for getting
the current MMUnlockRetries value of a MMIfaceModem object, which later
allows us to partially update (e.g. a specific MMModemLock) the
MMUnlockRetries value of a MMIfaceModem object.
---
 src/mm-iface-modem.c | 21 +++++++++++++++++++++
 src/mm-iface-modem.h |  2 ++
 2 files changed, 23 insertions(+)

diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index e21d5aeb..cc4d6991 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -2926,6 +2926,27 @@ set_lock_status (MMIfaceModem *self,
     }
 }
 
+MMUnlockRetries *
+mm_iface_modem_get_unlock_retries (MMIfaceModem *self)
+{
+    MmGdbusModem *skeleton = NULL;
+    MMUnlockRetries *unlock_retries;
+
+    g_object_get (self,
+                  MM_IFACE_MODEM_DBUS_SKELETON, &skeleton,
+                  NULL);
+    if (skeleton) {
+        GVariant *dictionary;
+
+        dictionary = mm_gdbus_modem_get_unlock_retries (skeleton);
+        unlock_retries = mm_unlock_retries_new_from_dictionary (dictionary);
+        g_object_unref (skeleton);
+    } else
+        unlock_retries = mm_unlock_retries_new ();
+
+    return unlock_retries;
+}
+
 void
 mm_iface_modem_update_unlock_retries (MMIfaceModem *self,
                                       MMUnlockRetries *unlock_retries)
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index af039b3b..1a154b48 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -414,6 +414,8 @@ MMModemLock mm_iface_modem_update_lock_info_finish (MMIfaceModem *self,
                                                     GAsyncResult *res,
                                                     GError **error);
 
+MMUnlockRetries *mm_iface_modem_get_unlock_retries (MMIfaceModem *self);
+
 void mm_iface_modem_update_unlock_retries (MMIfaceModem *self,
                                            MMUnlockRetries *unlock_retries);
 
-- 
2.14.1.690.gbb1197296e-goog



More information about the ModemManager-devel mailing list