dbus: Export the peer's device address as a property

This could be useful in some cases.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2014-03-21 13:48:07 +02:00 committed by Jouni Malinen
parent 442adfde3d
commit c6f356f85b
3 changed files with 29 additions and 0 deletions

View file

@ -3274,6 +3274,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
wpas_dbus_getter_p2p_peer_ies,
NULL
},
{ "DeviceAddress", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
wpas_dbus_getter_p2p_peer_device_address,
NULL
},
{ NULL, NULL, NULL, NULL, NULL }
};

View file

@ -1487,6 +1487,27 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_ies(DBusMessageIter *iter,
}
dbus_bool_t wpas_dbus_getter_p2p_peer_device_address(DBusMessageIter *iter,
DBusError *error,
void *user_data)
{
struct peer_handler_args *peer_args = user_data;
const struct p2p_peer_info *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;
}
return wpas_dbus_simple_array_property_getter(
iter, DBUS_TYPE_BYTE, (char *) peer_args->p2p_device_addr,
ETH_ALEN, error);
}
/**
* wpas_dbus_getter_persistent_groups - Get array of persistent group objects
* @iter: Pointer to incoming dbus message iter

View file

@ -147,6 +147,10 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_ies(DBusMessageIter *iter,
DBusError *error,
void *user_data);
dbus_bool_t wpas_dbus_getter_p2p_peer_device_address(DBusMessageIter *iter,
DBusError *error,
void *user_data);
/*
* P2P Group properties
*/