aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Khatri <amit.khatri@samsung.com>2015-05-28 12:19:46 (GMT)
committerJouni Malinen <j@w1.fi>2015-05-29 18:28:26 (GMT)
commitdc1a341dec54c28c3351ee7edab9ccaf7b68861f (patch)
treef033c63f0d13349f5e704b40053eb4249bb868df
parentf572ae809a64f3920b9f032d67f5a729b7e1efea (diff)
downloadhostap-dc1a341dec54c28c3351ee7edab9ccaf7b68861f.zip
hostap-dc1a341dec54c28c3351ee7edab9ccaf7b68861f.tar.gz
hostap-dc1a341dec54c28c3351ee7edab9ccaf7b68861f.tar.bz2
P2P: Add manufacturer info into D-Bus peer interface
Allow the Manufacturer information for a found P2P peer device to be fetched through the D-Bus interface similarly to p2p_peer <mac address> on ctrl interface. Signed-off-by: Amit Khatri <amit.khatri@samsung.com> Signed-off-by: Rahul Jain <rahul.jain@samsung.com> Signed-off-by: Ashutosh Kaushik <k.ashutosh@samsung.com>
-rw-r--r--doc/dbus.doxygen4
-rw-r--r--wpa_supplicant/dbus/dbus_new.c4
-rw-r--r--wpa_supplicant/dbus/dbus_new_handlers_p2p.c37
-rw-r--r--wpa_supplicant/dbus/dbus_new_handlers_p2p.h4
4 files changed, 49 insertions, 0 deletions
diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index 0566f0e..032d595 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -1638,6 +1638,10 @@ Interface implemented by objects representing P2P peer devices.
</li>
<li>
+ <h3>Manufacturer - s - (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 30c45c2..6382d77 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3307,6 +3307,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
wpas_dbus_getter_p2p_peer_device_name,
NULL
},
+ { "Manufacturer", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s",
+ wpas_dbus_getter_p2p_peer_manufacturer,
+ NULL
+ },
{ "PrimaryDeviceType", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
wpas_dbus_getter_p2p_peer_primary_device_type,
NULL
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index e3e2378..c8dd67b 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -1251,6 +1251,43 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_device_name(DBusMessageIter *iter,
}
+dbus_bool_t wpas_dbus_getter_p2p_peer_manufacturer(DBusMessageIter *iter,
+ DBusError *error,
+ void *user_data)
+{
+ struct peer_handler_args *peer_args = user_data;
+ const struct p2p_peer_info *info;
+ char *tmp;
+
+ if (!wpa_dbus_p2p_check_enabled(peer_args->wpa_s, NULL, NULL, error))
+ return FALSE;
+
+ /* get the peer info */
+ info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
+ peer_args->p2p_device_addr, 0);
+ if (info == NULL) {
+ dbus_set_error(error, DBUS_ERROR_FAILED, "failed to find peer");
+ return FALSE;
+ }
+
+ tmp = os_strdup(info->manufacturer);
+ if (!tmp) {
+ dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
+ return FALSE;
+ }
+
+ if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING, &tmp,
+ error)) {
+ dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
+ os_free(tmp);
+ return FALSE;
+ }
+
+ os_free(tmp);
+ return TRUE;
+}
+
+
dbus_bool_t wpas_dbus_getter_p2p_peer_primary_device_type(
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 fe4b9dc..a84fc4a 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
@@ -115,6 +115,10 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_device_name(DBusMessageIter *iter,
DBusError *error,
void *user_data);
+dbus_bool_t wpas_dbus_getter_p2p_peer_manufacturer(DBusMessageIter *iter,
+ DBusError *error,
+ void *user_data);
+
dbus_bool_t wpas_dbus_getter_p2p_peer_primary_device_type(
DBusMessageIter *iter, DBusError *error, void *user_data);