linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Inga Stotland <inga.stotland@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: brian.gix@intel.com, johan.hedberg@gmail.com,
	luiz.dentz@gmail.com, Inga Stotland <inga.stotland@intel.com>
Subject: [PATCH BlueZ 3/3] mesh: Implement Leave() method on Network interface
Date: Tue, 19 Feb 2019 21:53:20 -0800	[thread overview]
Message-ID: <20190220055320.2333-4-inga.stotland@intel.com> (raw)
In-Reply-To: <20190220055320.2333-1-inga.stotland@intel.com>

This implements D-Bus Leave() method that results in complete removal
of node information from the system, including configuration files
from storage directory.
---
 mesh/mesh.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

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)
-- 
2.17.2


      parent reply	other threads:[~2019-02-20  5:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20  5:53 [PATCH BlueZ 0/3] mesh: Implement Leave() method Inga Stotland
2019-02-20  5:53 ` [PATCH BlueZ 1/3] mesh: Re-arrange node cleanup functions Inga Stotland
2019-02-20  5:53 ` [PATCH BlueZ 2/3] mesh: Cleanup storage save and remove procedures Inga Stotland
2019-02-20  5:53 ` Inga Stotland [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190220055320.2333-4-inga.stotland@intel.com \
    --to=inga.stotland@intel.com \
    --cc=brian.gix@intel.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).