Browse Source

P2P: Add D-Bus FindStopped to notify P2P-FIND-STOPPED event

Add D-Bus notification mechanism of P2P-FIND-STOPPED event on
fi.w1.wpa_supplicant1.Interface.P2PDevice interface.

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

+ 4 - 0
doc/dbus.doxygen

@@ -1286,6 +1286,10 @@ Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations.
     <h3>DeviceLost ( o : path )</h3>
     <h3>DeviceLost ( o : path )</h3>
   </li>
   </li>
 
 
+  <li>
+    <h3>FindStopped ( )</h3>
+  </li>
+
   <li>
   <li>
     <h3>ProvisionDiscoveryRequestDisplayPin ( o : peer_object, s : pin )</h3>
     <h3>ProvisionDiscoveryRequestDisplayPin ( o : peer_object, s : pin )</h3>
   </li>
   </li>

+ 34 - 0
wpa_supplicant/dbus/dbus_new.c

@@ -3039,6 +3039,11 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
 		  END_ARGS
 		  END_ARGS
 	  }
 	  }
 	},
 	},
+	{ "FindStopped", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
+	  {
+		  END_ARGS
+	  }
+	},
 	{ "ProvisionDiscoveryRequestDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
 	{ "ProvisionDiscoveryRequestDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
 	  {
 	  {
 		  { "peer_object", "o", ARG_OUT },
 		  { "peer_object", "o", ARG_OUT },
@@ -3530,6 +3535,35 @@ int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
 }
 }
 
 
 
 
+/**
+ * wpas_dbus_signal_p2p_find_stopped - Send P2P Find stopped signal
+ * @wpa_s: %wpa_supplicant network interface data
+ *
+ * Notify listeners about P2P Find 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 || !wpa_s->dbus_new_path)
+		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);
+}
+
+
 void wpas_dbus_signal_peer_groups_changed(struct wpa_supplicant *wpa_s,
 void wpas_dbus_signal_peer_groups_changed(struct wpa_supplicant *wpa_s,
 					  const u8 *dev_addr)
 					  const u8 *dev_addr)
 {
 {

+ 6 - 0
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);
 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);
 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,
 void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
 					   const u8 *dev_addr);
 					   const u8 *dev_addr);
 int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
 int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
@@ -459,6 +460,11 @@ wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
 {
 {
 }
 }
 
 
+static inline void
+wpas_dbus_signal_p2p_find_stopped(struct wpa_supplicant *wpa_s)
+{
+}
+
 static inline void
 static inline void
 wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
 wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
 				   const u8 *dev_addr)
 				   const u8 *dev_addr)

+ 7 - 0
wpa_supplicant/notify.c

@@ -520,6 +520,13 @@ void wpas_notify_resume(struct wpa_global *global)
 
 
 #ifdef CONFIG_P2P
 #ifdef CONFIG_P2P
 
 
+void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
+{
+	/* Notify P2P find has stopped */
+	wpas_dbus_signal_p2p_find_stopped(wpa_s);
+}
+
+
 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
 				  const u8 *dev_addr, int new_device)
 				  const u8 *dev_addr, int new_device)
 {
 {

+ 1 - 0
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,
 void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
 				const u8 *mac_addr, int authorized,
 				const u8 *mac_addr, int authorized,
 				const u8 *p2p_dev_addr);
 				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,
 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
 				  const u8 *dev_addr, int new_device);
 				  const u8 *dev_addr, int new_device);
 void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
 void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,

+ 1 - 0
wpa_supplicant/p2p_supplicant.c

@@ -2248,6 +2248,7 @@ static void wpas_find_stopped(void *ctx)
 {
 {
 	struct wpa_supplicant *wpa_s = ctx;
 	struct wpa_supplicant *wpa_s = ctx;
 	wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_FIND_STOPPED);
 	wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_FIND_STOPPED);
+	wpas_notify_p2p_find_stopped(wpa_s);
 }
 }