[7/7] dbus: Add new interface property to get Mesh Group

Message ID 1500361677-25313-8-git-send-email-saurav.babu@samsung.com
State Accepted
Headers show

Commit Message

Saurav Babu July 18, 2017, 7:07 a.m.
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
---
 doc/dbus.doxygen                        |  4 ++++
 wpa_supplicant/dbus/dbus_new.c          |  5 +++++
 wpa_supplicant/dbus/dbus_new_handlers.c | 31 +++++++++++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |  1 +
 4 files changed, 41 insertions(+)

Patch

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index f532fa2..0333377 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -2263,6 +2263,10 @@  Interface for performing Mesh operations.
   <li>
     <h3>MeshPeers - aay - (read)</h3>
   </li>
+
+  <li>
+    <h3>MeshGroup - ay - (read)</h3>
+  </li>
 </ul>
 
 \subsection dbus_mesh_signals Signals
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 90069fd..a6c92ee 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3479,6 +3479,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
 	{ 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 2ccc730..2cb2e45 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -4867,4 +4867,35 @@  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
+ *
+ * Setter for "MeshPeers" 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;
+
+	if (wpa_s->ifmsh) {
+		ssid = wpa_s->current_ssid;
+		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
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index 09c6411..26652ad 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);