From e32fe4d3774225fd48f1f1e3905c4057fe5ad7a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Lowas-Rzechonek?= Date: Fri, 28 Jun 2019 10:27:34 +0200 Subject: [PATCH] mesh: Register D-Bus management interface When application Attach()es itself, start exposing both Node1 and Management1 D-Bus interfaces. Change-Id: I2a94441cce59cee62e219ee40b07d6f3124290df Signed-off-by: Anupam Roy --- mesh/node.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mesh/node.c b/mesh/node.c index b1f1c73..3f5c580 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -246,9 +246,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); @@ -421,6 +426,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) @@ -1012,7 +1018,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; @@ -1034,6 +1044,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.7.4