Browse Source

WPS: Add WPS Cancel method over D-Bus interface

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
Nishant Chaprana 10 years ago
parent
commit
87d3c62835

+ 4 - 0
doc/dbus.doxygen

@@ -877,6 +877,10 @@ Interface for performing WPS (Wi-Fi Simple Config) operations.
 	  <dd>Invalid entries were found in the passed argument.</dd>
 	</dl>
       </li>
+      <li>
+	<h3>Cancel ( nothing ) --> nothing</h3>
+	<p>Cancel ongoing WPS operation.</p>
+      </li>
     </ul>
 
 \subsection dbus_wps_properties Properties

+ 6 - 0
wpa_supplicant/dbus/dbus_new.c

@@ -2583,6 +2583,12 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
 		  END_ARGS
 	  }
 	},
+	{ "Cancel", WPAS_DBUS_NEW_IFACE_WPS,
+	  (WPADBusMethodHandler) wpas_dbus_handler_wps_cancel,
+	  {
+		  END_ARGS
+	  }
+	},
 #endif /* CONFIG_WPS */
 #ifdef CONFIG_P2P
 	{ "Find", WPAS_DBUS_NEW_IFACE_P2PDEVICE,

+ 3 - 0
wpa_supplicant/dbus/dbus_new_handlers.h

@@ -291,6 +291,9 @@ dbus_bool_t wpas_dbus_setter_network_properties(DBusMessageIter *iter,
 DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
 					  struct wpa_supplicant *wpa_s);
 
+DBusMessage * wpas_dbus_handler_wps_cancel(DBusMessage *message,
+					   struct wpa_supplicant *wpa_s);
+
 dbus_bool_t wpas_dbus_getter_process_credentials(DBusMessageIter *iter,
 	DBusError *error, void *user_data);
 

+ 20 - 0
wpa_supplicant/dbus/dbus_new_handlers_wps.c

@@ -319,6 +319,26 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
 }
 
 
+/**
+ * wpas_dbus_handler_wps_cancel - Cancel ongoing WPS configuration
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: %wpa_supplicant data structure
+ * Returns: NULL on success or DBus error on failure
+ *
+ * Handler for "Cancel" method call. Returns NULL if WPS cancel successfull
+ * or DBus error on WPS cancel failure
+ */
+DBusMessage * wpas_dbus_handler_wps_cancel(DBusMessage *message,
+					   struct wpa_supplicant *wpa_s)
+{
+	if (wpas_wps_cancel(wpa_s))
+		return wpas_dbus_error_unknown_error(message,
+						     "WPS cancel failed");
+
+	return NULL;
+}
+
+
 /**
  * wpas_dbus_getter_process_credentials - Check if credentials are processed
  * @message: Pointer to incoming dbus message