Parcourir la source

dbus: Add new interface property to get mesh group

Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
Saurav Babu il y a 7 ans
Parent
commit
cdf2501494

+ 4 - 0
doc/dbus.doxygen

@@ -2264,6 +2264,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

+ 5 - 0
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 }
 };

+ 33 - 0
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 */

+ 1 - 0
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);