summaryrefslogtreecommitdiff
path: root/mesh/mesh.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2019-02-21 22:31:48 -0800
committerBrian Gix <brian.gix@intel.com>2019-02-28 08:54:47 -0800
commit8e0cbe9d5e3952524c15281d61db3c3a014ae52c (patch)
tree474d1f709abd9fdacab5247d3e9b7c1a15c2f779 /mesh/mesh.c
parente5ab6013e6a15f813e00e77183de03d129e3e738 (diff)
downloadbluez-8e0cbe9d5e3952524c15281d61db3c3a014ae52c.tar.gz
mesh: Implement Leave() method on Network interface
This implements D-Bus Leave() method that results in complete removal of node information from the system, including configuration files from storage directory.
Diffstat (limited to 'mesh/mesh.c')
-rw-r--r--mesh/mesh.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/mesh/mesh.c b/mesh/mesh.c
index 0f3c3c9fd..8db83b7c3 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -698,6 +698,22 @@ static struct l_dbus_message *attach_call(struct l_dbus *dbus,
return NULL;
}
+static struct l_dbus_message *leave_call(struct l_dbus *dbus,
+ struct l_dbus_message *msg,
+ void *user_data)
+{
+ uint64_t token;
+
+ l_debug("Leave");
+
+ if (!l_dbus_message_get_arguments(msg, "t", &token))
+ return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
+
+ node_remove(node_find_by_token(token));
+
+ return l_dbus_message_new_method_return(msg);
+}
+
static void setup_network_interface(struct l_dbus_interface *iface)
{
l_dbus_interface_method(iface, "Join", 0, join_network_call, "",
@@ -709,7 +725,8 @@ static void setup_network_interface(struct l_dbus_interface *iface)
"oa(ya(qa{sv}))", "ot", "node",
"configuration", "app", "token");
- /* TODO: Implement Leave method */
+ l_dbus_interface_method(iface, "Leave", 0, leave_call, "", "t",
+ "token");
}
bool mesh_dbus_init(struct l_dbus *dbus)