[PATCHv2] Dbus: Sending peer device information in DeviceFound event.
Nishant Chaprana
n.chaprana at samsung.com
Thu Jun 16 22:07:40 PDT 2016
This sends appends peer device information in DeviceFound event.
Now the signature of DeviceFound will be changed to "oa{sv}" from "o".
This change is required because in case there are large number of peers
in the range of own device, then applications which have registered
DeviceFound event will call GetAll for peer properties and Supplicant
will get busy processing large number of found peers and GetAll from Applicaitons.
This is similar to CTRL interface P2P-DEVICE-FOUND event which contains peer
information in it. This will enable all applications to extract peer information
from event itself and it would not be required to make extra dbus call for peer property
which would be creating extra load over supplicant as well on applicaiton.
Signed-off-by: Nishant Chaprana <n.chaprana at samsung.com>
---
doc/dbus.doxygen | 12 +++++++++++-
wpa_supplicant/dbus/dbus_new.c | 15 ++++++++++-----
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index 28ee371..71bd038 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -1628,7 +1628,17 @@ Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations.
<ul>
<li>
- <h3>DeviceFound ( o : path )</h3>
+ <h3>DeviceFound ( o : path, a{sv} : properties )</h3>
+ <p>A new peer device has been found.</p>
+ <h4>Arguments</h4>
+ <dl>
+ <dt>o : path</dt>
+ <dd>A D-Bus path to an object representing the found peer device.</dd>
+ </dl>
+ <dl>
+ <dt>a{sv} : properties</dt>
+ <dd>A dictionary containing properties of found peer device.</dd>
+ </dl>
</li>
<li>
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 0263b2c..87df427 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3349,6 +3349,7 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
{ "DeviceFound", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
{
{ "path", "o", ARG_OUT },
+ { "properties", "a{sv}", ARG_OUT },
END_ARGS
}
},
@@ -3800,12 +3801,13 @@ static const struct wpa_dbus_signal_desc wpas_dbus_p2p_peer_signals[] = {
* In case of peer objects, it would be emitted by either
* the "interface object" or by "peer objects"
* @sig_name: signal name - DeviceFound
+ * @properties: determines if add second argument with object properties
*
- * Notify listeners about event related with newly found p2p peer device
+ * Notify listeners about event related with p2p peer device
*/
static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
const u8 *dev_addr, const char *interface,
- const char *sig_name)
+ const char *sig_name, int properties)
{
struct wpas_dbus_priv *iface;
DBusMessage *msg;
@@ -3833,7 +3835,10 @@ static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
dbus_message_iter_init_append(msg, &iter);
path = peer_obj_path;
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &path))
+ &path) ||
+ (properties && !wpa_dbus_get_object_properties(
+ iface, peer_obj_path, WPAS_DBUS_NEW_IFACE_P2P_PEER,
+ &iter)))
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
else
dbus_connection_send(iface->con, msg, NULL);
@@ -3854,7 +3859,7 @@ void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
{
wpas_dbus_signal_peer(wpa_s, dev_addr,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "DeviceFound");
+ "DeviceFound", TRUE);
}
/**
@@ -3869,7 +3874,7 @@ void wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
{
wpas_dbus_signal_peer(wpa_s, dev_addr,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "DeviceLost");
+ "DeviceLost", FALSE);
}
/**
--
1.9.1
More information about the Hostap
mailing list