[PATCH] Add factory reset




---
 introspection/mm-modem.xml |   11 +++++++++++
 src/mm-modem.c             |   25 +++++++++++++++++++++++++
 src/mm-modem.h             |   10 ++++++++++
 3 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/introspection/mm-modem.xml b/introspection/mm-modem.xml
index da7635b..f1fad1b 100644
--- a/introspection/mm-modem.xml
+++ b/introspection/mm-modem.xml
@@ -81,6 +81,17 @@
       </arg>
     </method>
 
+    <method name="FactoryReset">
+      <tp:docstring>
+    Reset the modem to as close to factory state as possible.
+      </tp:docstring>
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_modem_factory_reset"/>
+      <arg name="code" type="s" direction="in">
+    Carrier-supplied code required to reset the modem.  Ignored if not required.
+      </arg>
+    </method>
+
     <property name="Device" type="s" access="read">
       <tp:docstring>
  The modem port to use for IP configuration and traffic.
diff --git a/src/mm-modem.c b/src/mm-modem.c
index 35e3b07..7f5ac3a 100644
--- a/src/mm-modem.c
+++ b/src/mm-modem.c
@@ -28,6 +28,7 @@ static void impl_modem_connect (MMModem *modem, const char *number, DBusGMethodI
 static void impl_modem_disconnect (MMModem *modem, DBusGMethodInvocation *context);
 static void impl_modem_get_ip4_config (MMModem *modem, DBusGMethodInvocation *context);
 static void impl_modem_get_info (MMModem *modem, DBusGMethodInvocation *context);
+static void impl_modem_factory_reset (MMModem *modem, const char *code, DBusGMethodInvocation *context);
 
 #include "mm-modem-glue.h"
 
@@ -474,6 +475,30 @@ impl_modem_get_info (MMModem *modem,
     mm_modem_get_info (modem, info_call_done, context);
 }
 
+static void
+impl_modem_factory_reset(MMModem *modem,
+                         const char *code,
+                         DBusGMethodInvocation *context)
+{
+    mm_modem_factory_reset(modem, code, async_call_done, context);
+}
+
+void 
+mm_modem_factory_reset(MMModem *self,
+                       const char *code,
+                       MMModemFn callback,
+                       gpointer user_data)
+{
+    g_return_if_fail (MM_IS_MODEM (self));
+    g_return_if_fail (callback != NULL);
+    g_return_if_fail (code != NULL);
+
+    if (MM_MODEM_GET_INTERFACE (self)->factory_reset)
+        MM_MODEM_GET_INTERFACE (self)->factory_reset (self, code, callback, user_data);
+    else
+        async_op_not_supported (self, callback, user_data);
+}
+
 /*****************************************************************************/
 
 void
diff --git a/src/mm-modem.h b/src/mm-modem.h
index 6eeb4de..4b14d37 100644
--- a/src/mm-modem.h
+++ b/src/mm-modem.h
@@ -184,6 +184,11 @@ struct _MMModem {
                               MMAuthRequest *req,
                               GError **error);
 
+    void (*factory_reset) (MMModem *self,
+                           const char *code,
+                           MMModemFn callback,
+                           gpointer user_data);
+
     /* Signals */
     void (*state_changed) (MMModem *self,
                            MMModemState new_state,
@@ -242,6 +247,11 @@ void mm_modem_set_charset (MMModem *self,
                            MMModemFn callback,
                            gpointer user_data);
 
+void mm_modem_factory_reset(MMModem *self,
+                            const char *code,
+                            MMModemFn callback,
+                            gpointer user_data);
+
 gboolean mm_modem_get_valid (MMModem *self);
 
 char *mm_modem_get_device (MMModem *self);
-- 
1.7.0.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]