[PATCH BlueZ 2/2] mesh: Register D-Bus management interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When application Attach()es itself, start exposing both Node1 and
Management1 D-Bus interfaces.
---
 mesh/node.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index 45383b7d5..a2ac747a1 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -259,9 +259,14 @@ static void free_node_resources(void *data)
 	if (node->disc_watch)
 		l_dbus_remove_watch(dbus_get_bus(), node->disc_watch);
 
-	if (node->path)
+	if (node->path) {
 		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
 							MESH_NODE_INTERFACE);
+
+		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
+					       MESH_MANAGEMENT_INTERFACE);
+	}
+
 	l_free(node->path);
 
 	l_free(node);
@@ -434,6 +439,7 @@ void node_cleanup_all(void)
 {
 	l_queue_destroy(nodes, cleanup_node);
 	l_dbus_unregister_interface(dbus_get_bus(), MESH_NODE_INTERFACE);
+	l_dbus_unregister_interface(dbus_get_bus(), MESH_MANAGEMENT_INTERFACE);
 }
 
 bool node_is_provisioned(struct mesh_node *node)
@@ -1024,7 +1030,11 @@ static bool register_node_object(struct mesh_node *node)
 								"%s", uuid);
 
 	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
-					MESH_NODE_INTERFACE, node))
+						MESH_NODE_INTERFACE, node))
+		return false;
+
+	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
+					MESH_MANAGEMENT_INTERFACE, node))
 		return false;
 
 	return true;
@@ -1046,6 +1056,9 @@ static void app_disc_cb(struct l_dbus *bus, void *user_data)
 	if (node->path) {
 		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
 							MESH_NODE_INTERFACE);
+
+		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
+						MESH_MANAGEMENT_INTERFACE);
 		l_free(node->app_path);
 		node->app_path = NULL;
 	}
-- 
2.19.1




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux