[PATCH] P2P,DBUS: Getting listen freq info from found p2p peer device similar to p2p_peer <mac address> on ctrl interface.

Amit Khatri amit.khatriatsamsung.com
Fri May 29 03:16:41 PDT 2015


Signed-off-by: Amit Khatri <amit.khatri at samsung.com>
Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
Signed-off-by: Ashutosh Kaushik <k.ashutosh at samsung.com>
---
 doc/dbus.doxygen                            |  4 ++++
 wpa_supplicant/dbus/dbus_new.c              |  4 ++++
 wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 25 +++++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers_p2p.h |  4 ++++
 4 files changed, 37 insertions(+)

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index 721d3a0..61e4760 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -1634,6 +1634,10 @@ Interface implemented by objects representing P2P peer devices.
   </li>
 
   <li>
+    <h3>ListenFreq - i - (read)</h3>
+  </li>
+
+  <li>
     <h3>PrimaryDeviceType - ay - (read)</h3>
   </li>
 
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index e0f2392..e882737 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3339,6 +3339,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
 	  wpas_dbus_getter_p2p_peer_groups,
 	  NULL
 	},
+	{ "ListenFreq", WPAS_DBUS_NEW_IFACE_P2P_PEER, "i",
+	  wpas_dbus_getter_p2p_device_listen_freq,
+	  NULL
+	},
 	{ NULL, NULL, NULL, NULL, NULL }
 };
 
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index 83312a2..651f170 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -20,6 +20,7 @@
 #include "dbus_new_handlers_p2p.h"
 #include "dbus_dict_helpers.h"
 #include "p2p/p2p.h"
+#include "p2p/p2p_i.h"
 #include "common/ieee802_11_defs.h"
 #include "ap/hostapd.h"
 #include "ap/ap_config.h"
@@ -1343,6 +1344,30 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_level(DBusMessageIter *iter,
 }
 
 
+dbus_bool_t wpas_dbus_getter_p2p_device_listen_freq(DBusMessageIter *iter,
+					    DBusError *error,
+					    void *user_data)
+{
+	struct peer_handler_args *peer_args = user_data;
+	const struct p2p_device *dev;
+
+	dev  = p2p_get_device(peer_args->wpa_s->global->p2p,
+				  peer_args->p2p_device_addr);
+	if (dev == NULL) {
+		dbus_set_error(error, DBUS_ERROR_FAILED,
+			       "failed to find peer");
+		return FALSE;
+	}
+
+	if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT32,
+					      &dev->listen_freq, error)) {
+		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
 dbus_bool_t wpas_dbus_getter_p2p_peer_device_capability(DBusMessageIter *iter,
 							DBusError *error,
 							void *user_data)
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
index 6c5bc92..df42c60 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
@@ -127,6 +127,10 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_level(DBusMessageIter *iter,
 					    DBusError *error,
 					    void *user_data);
 
+dbus_bool_t wpas_dbus_getter_p2p_device_listen_freq(DBusMessageIter *iter,
+					    DBusError *error,
+					    void *user_data);
+
 dbus_bool_t wpas_dbus_getter_p2p_peer_device_capability(DBusMessageIter *iter,
 							DBusError *error,
 							void *user_data);
-- 
1.9.1




More information about the Hostap mailing list