From cdf2501494eff1a5b425911340db59d73e1d566a Mon Sep 17 00:00:00 2001 From: Saurav Babu Date: Tue, 18 Jul 2017 12:37:57 +0530 Subject: [PATCH] dbus: Add new interface property to get mesh group Signed-off-by: Saurav Babu --- doc/dbus.doxygen | 4 +++ wpa_supplicant/dbus/dbus_new.c | 5 ++++ wpa_supplicant/dbus/dbus_new_handlers.c | 33 +++++++++++++++++++++++++ wpa_supplicant/dbus/dbus_new_handlers.h | 1 + 4 files changed, 43 insertions(+) diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index 55857a7d2..2ca40ae9b 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -2264,6 +2264,10 @@ Interface for performing mesh operations.
  • MeshPeers - aay - (read)

  • + +
  • +

    MeshGroup - ay - (read)

    +
  • \subsection dbus_mesh_signals Signals diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 3127142a3..8115f7721 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -3489,6 +3489,11 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = { NULL, NULL }, + { "MeshGroup", WPAS_DBUS_NEW_IFACE_MESH, "ay", + wpas_dbus_getter_mesh_group, + NULL, + NULL + }, #endif /* CONFIG_MESH */ { NULL, NULL, NULL, NULL, NULL, NULL } }; diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index a763bc938..564c868ea 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -4805,6 +4805,7 @@ DBusMessage * wpas_dbus_handler_vendor_elem_remove(DBusMessage *message, #ifdef CONFIG_MESH + /** * wpas_dbus_getter_mesh_peers - Get connected mesh peers * @iter: Pointer to incoming dbus message iter @@ -4865,4 +4866,36 @@ dbus_bool_t wpas_dbus_getter_mesh_peers( return TRUE; } + + +/** + * wpas_dbus_getter_mesh_group - Get mesh group + * @iter: Pointer to incoming dbus message iter + * @error: Location to store error on failure + * @user_data: Function specific data + * Returns: TRUE on success, FALSE on failure + * + * Getter for "MeshGroup" property. + */ +dbus_bool_t wpas_dbus_getter_mesh_group( + const struct wpa_dbus_property_desc *property_desc, + DBusMessageIter *iter, DBusError *error, void *user_data) +{ + struct wpa_supplicant *wpa_s = user_data; + struct wpa_ssid *ssid = wpa_s->current_ssid; + + if (!wpa_s->ifmsh || !ssid) + return FALSE; + + if (!wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE, + (char *) ssid->ssid, + ssid->ssid_len, error)) { + dbus_set_error(error, DBUS_ERROR_FAILED, + "%s: error constructing reply", __func__); + return FALSE; + } + + return TRUE; +} + #endif /* CONFIG_MESH */ diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h index 09c641182..26652ad3d 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.h +++ b/wpa_supplicant/dbus/dbus_new_handlers.h @@ -209,6 +209,7 @@ DECLARE_ACCESSOR(wpas_dbus_getter_wps_device_device_type); DECLARE_ACCESSOR(wpas_dbus_setter_wps_device_device_type); DECLARE_ACCESSOR(wpas_dbus_getter_mesh_peers); +DECLARE_ACCESSOR(wpas_dbus_getter_mesh_group); DBusMessage * wpas_dbus_handler_tdls_discover(DBusMessage *message, struct wpa_supplicant *wpa_s);