[PATCH] DBus : Add Reconnect command to Dbus Interface.

MAYANK HAARIT mayank.h
Fri Jun 12 04:27:19 PDT 2015


Signed-off-by: Mayank Haarit <mayank.h at samsung.com>
Signed-off-by: Purushottam Kushwaha <p.kushwaha at samsung.com>
---
 doc/dbus.doxygen                        |   11 +++++++++++
 wpa_supplicant/dbus/dbus_new.c          |    6 ++++++
 wpa_supplicant/dbus/dbus_new_handlers.c |   20 ++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |    3 +++
 4 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index 6a6e91a..90cc9d7 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -305,6 +305,17 @@ fi.w1.wpa_supplicant1.CreateInterface.
 	  <dd>Interface is not connected to any network.</dd>
 	</dl>
       </li>
+	
+      <li> 
+        <h3>Reconnect ( ) --> nothing</h3>
+        <p>Attempt reconnection and connect if in disconnected state.</p>
+        <h4>Possible errors</h4>
+        <dl> 
+          <dt>fi.w1.wpa_supplicant1.InterfaceDisabled</dt>
+          <dd>The interface is disabled.</dd>
+        </dl>
+      </li>
+
 
       <li>
 	<h3>AddBlob ( s : name, ay : data ) --> nothing</h3>
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index fb674d4..3aa08df 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -2552,6 +2552,12 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
 		  END_ARGS
 	  }
 	},
+	{ "Reconnect", WPAS_DBUS_NEW_IFACE_INTERFACE,
+          (WPADBusMethodHandler) wpas_dbus_handler_reconnect,
+          {    
+                  END_ARGS
+          }    
+        },
 	{ "RemoveNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE,
 	  (WPADBusMethodHandler) wpas_dbus_handler_remove_network,
 	  {
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 97db9a8..b32f8d6 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -1599,6 +1599,26 @@ DBusMessage * wpas_dbus_handler_reattach(DBusMessage *message,
 				      "This interface is not connected");
 }
 
+/**
+ * wpas_dbus_handler_reconnect - Reconnect
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: wpa_supplicant structure for a network interface
+ * Returns: InterfaceDisabled DBus error message if disabled
+ * or NULL otherwise.
+ *
+ * Handler function for "Reconnect" method call of network interface.
+ */
+DBusMessage * wpas_dbus_handler_reconnect(DBusMessage *message,
+		struct wpa_supplicant *wpa_s)
+{       
+	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
+		return dbus_message_new_error(message, WPAS_DBUS_ERROR_IFACE_DISABLED,
+				"This interface is disabled");
+	} 
+	else if (wpa_s->disconnected)
+		wpas_request_connection(wpa_s);
+	return NULL;
+}
 
 /**
  * wpas_dbus_handler_remove_network - Remove a configured network
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index 9afdc05..23f2659 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -107,6 +107,9 @@ DBusMessage * wpas_dbus_handler_reassociate(DBusMessage *message,
 DBusMessage * wpas_dbus_handler_reattach(DBusMessage *message,
 					 struct wpa_supplicant *wpa_s);
 
+DBusMessage * wpas_dbus_handler_reconnect(DBusMessage *message,
+					    struct wpa_supplicant *wpa_s);
+
 DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
 					       struct wpa_supplicant *wpa_s);
 
-- 
1.7.0.4



More information about the Hostap mailing list