P2P: Add D-Bus FindStopped to notify P2P-FIND-STOPPED event
authorNishant Chaprana <n.chaprana@samsung.com>
Wed, 13 May 2015 12:03:48 +0000 (17:33 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 25 May 2015 15:31:09 +0000 (18:31 +0300)
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>
doc/dbus.doxygen
wpa_supplicant/dbus/dbus_new.c
wpa_supplicant/dbus/dbus_new.h
wpa_supplicant/notify.c
wpa_supplicant/notify.h
wpa_supplicant/p2p_supplicant.c

index 329e5d0..d623116 100644 (file)
@@ -1287,6 +1287,10 @@ Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations.
   </li>
 
   <li>
+    <h3>FindStopped ( )</h3>
+  </li>
+
+  <li>
     <h3>ProvisionDiscoveryRequestDisplayPin ( o : peer_object, s : pin )</h3>
   </li>
 
index 89a562c..840d105 100644 (file)
@@ -3039,6 +3039,11 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
                  END_ARGS
          }
        },
+       { "FindStopped", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
+         {
+                 END_ARGS
+         }
+       },
        { "ProvisionDiscoveryRequestDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
          {
                  { "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,
                                          const u8 *dev_addr)
 {
index d162d2b..31db8d4 100644 (file)
@@ -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,
@@ -460,6 +461,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
 wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
                                   const u8 *dev_addr)
 {
index 184a95c..4df9d90 100644 (file)
@@ -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 P2P 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)
 {
index b268332..1025ca8 100644 (file)
@@ -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,
index 7a8a46a..2ccc5ea 100644 (file)
@@ -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);
 }