[PATCH] P2P: Added FindStopped to notify P2P-FIND-STOPPED event

Nishant Chaprana n.chaprana
Wed May 13 05:03:48 PDT 2015


<EP-4F32A6DFECFE428589A80CA666AED0A4>
Description: This patch adds notification mechanism of P2P-FIND-STOPPED
event on fi.w1.wpa_supplicant1.Interface.P2PDevice interface.

Signed-off-by: Nishant Chaprana <n.chaprana at samsung.com>
---
 wpa_supplicant/dbus/dbus_new.c  | 29 +++++++++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new.h  |  1 +
 wpa_supplicant/notify.c         |  7 +++++++
 wpa_supplicant/notify.h         |  1 +
 wpa_supplicant/p2p_supplicant.c |  1 +
 5 files changed, 39 insertions(+)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 89a562c..9a49bc2 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3395,6 +3395,35 @@ static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
 
 
 /**
+ * wpas_dbus_signal_p2p_find_stopped - send find stopped signal
+ * @wpa_s: %wpa_supplicant network interface data
+ *
+ * Notify listeners about scan stopped
+ */
+void wpas_dbus_signal_p2p_find_stopped(struct wpa_supplicant *wpa_s)
+{
+	struct wpas_dbus_priv *iface;
+	DBusMessage *msg;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the control interface is not turned on */
+	if (iface == NULL)
+		return;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+				WPAS_DBUS_NEW_IFACE_P2PDEVICE,
+				"FindStopped");
+	if (msg == NULL)
+		return;
+
+	dbus_connection_send(iface->con, msg, NULL);
+
+	dbus_message_unref(msg);
+}
+
+
+/**
  * wpas_dbus_signal_peer_found - Send a peer found signal
  * @wpa_s: %wpa_supplicant network interface data
  * @dev: peer device object
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index d162d2b..a051d74 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -168,6 +168,7 @@ void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global);
 void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global);
 
 int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr);
+void wpas_dbus_signal_p2p_find_stopped(struct wpa_supplicant *wpa_s);
 void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
 					   const u8 *dev_addr);
 int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 184a95c..86d12d8 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -520,6 +520,13 @@ void wpas_notify_resume(struct wpa_global *global)
 
 #ifdef CONFIG_P2P
 
+void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
+{
+	/* Notify find has stopped*/
+	wpas_dbus_signal_p2p_find_stopped(wpa_s);
+}
+
+
 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
 				  const u8 *dev_addr, int new_device)
 {
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index b268332..1025ca8 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -84,6 +84,7 @@ void wpas_notify_resume(struct wpa_global *global);
 void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
 				const u8 *mac_addr, int authorized,
 				const u8 *p2p_dev_addr);
+void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s);
 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
 				  const u8 *dev_addr, int new_device);
 void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index def959f..34d763d 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -2248,6 +2248,7 @@ static void wpas_find_stopped(void *ctx)
 {
 	struct wpa_supplicant *wpa_s = ctx;
 	wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_FIND_STOPPED);
+	wpas_notify_p2p_find_stopped(wpa_s);
 }
 
 
-- 
1.9.1




More information about the Hostap mailing list