linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 10/10] mesh: Remove cmd_scan
Date: Fri,  8 Dec 2017 08:52:56 -0200	[thread overview]
Message-ID: <20171208105256.18635-10-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20171208105256.18635-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

cmd_scan is only used internally by discover-unprovisioned.
---
 mesh/main.c | 45 ++++++++++++++++-----------------------------
 1 file changed, 16 insertions(+), 29 deletions(-)

diff --git a/mesh/main.c b/mesh/main.c
index 4b9d65d6f..9360481f8 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -1398,32 +1398,6 @@ static void cmd_power(int argc, char *argv[])
 	g_free(str);
 }
 
-static void cmd_scan(int argc, char *argv[])
-{
-	dbus_bool_t enable;
-	const char *method;
-
-	if (parse_argument_on_off(argc, argv, &enable) == FALSE)
-		return;
-
-	if (check_default_ctrl() == FALSE)
-		return;
-
-	if (enable == TRUE) {
-		method = "StartDiscovery";
-	} else {
-		method = "StopDiscovery";
-	}
-
-	if (g_dbus_proxy_method_call(default_ctrl->proxy, method,
-				NULL, start_discovery_reply,
-				GUINT_TO_POINTER(enable), NULL) == FALSE) {
-		bt_shell_printf("Failed to %s discovery\n",
-					enable == TRUE ? "start" : "stop");
-		return;
-	}
-}
-
 static void append_variant(DBusMessageIter *iter, int type, void *val)
 {
 	DBusMessageIter value;
@@ -1617,19 +1591,32 @@ commit:
 	set_scan_filter_commit();
 }
 
-static void cmd_scan_unprovisioned_devices(int argc, char *argv[])
+static void cmd_scan_unprovisioned(int argc, char *argv[])
 {
 	dbus_bool_t enable;
 	char *filters[] = { MESH_PROV_SVC_UUID, NULL };
+	const char *method;
 
 	if (parse_argument_on_off(argc, argv, &enable) == FALSE)
 		return;
 
+	if (check_default_ctrl() == FALSE)
+		return;
+
 	if (enable == TRUE) {
 		discover_mesh = false;
 		set_scan_filter_uuids(filters);
+		method = "StartDiscovery";
+	} else {
+		method = "StopDiscovery";
+	}
+
+	if (g_dbus_proxy_method_call(default_ctrl->proxy, method,
+				NULL, start_discovery_reply,
+				GUINT_TO_POINTER(enable), NULL) == FALSE) {
+		bt_shell_printf("Failed to %s discovery\n",
+					enable == TRUE ? "start" : "stop");
 	}
-	cmd_scan(argc, argv);
 }
 
 static void cmd_info(int argc, char *argv[])
@@ -1912,7 +1899,7 @@ static const struct bt_shell_menu main_menu = {
 	{ "info",         "[dev]",    cmd_info, "Device information"},
 	{ "connect",      "[net_idx] [dst]", cmd_connect,
 				"Connect to mesh network or node on network"},
-	{ "discover-unprovisioned", "<on/off>", cmd_scan_unprovisioned_devices,
+	{ "discover-unprovisioned", "<on/off>", cmd_scan_unprovisioned,
 					"Look for devices to provision" },
 	{ "provision",    "<uuid>",   cmd_start_prov, "Initiate provisioning"},
 	{ "power",        "<on/off>", cmd_power, "Set controller power" },
-- 
2.13.6


  parent reply	other threads:[~2017-12-08 10:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08 10:52 [PATCH v2 01/10] shared/shell: Omit menu command if there are no submenus Luiz Augusto von Dentz
2017-12-08 10:52 ` [PATCH v2 02/10] shared/shell: Don't remove command from arguments Luiz Augusto von Dentz
2017-12-08 10:52 ` [PATCH v2 03/10] mesh: Make meshctl use bt_shell helpers Luiz Augusto von Dentz
2017-12-08 10:52 ` [PATCH v2 04/10] tools/obexctl: Use " Luiz Augusto von Dentz
2017-12-08 10:52 ` [PATCH v2 05/10] tools/bluetooth-player: " Luiz Augusto von Dentz
2017-12-08 10:52 ` [PATCH v2 06/10] tools/bluetooth-player: Fix arg format for search command Luiz Augusto von Dentz
2017-12-08 10:52 ` [PATCH v2 07/10] client: Fix arguments of set-filter-clear Luiz Augusto von Dentz
2017-12-08 10:52 ` [PATCH v2 08/10] shell: Add bt_shell_opt Luiz Augusto von Dentz
2017-12-08 10:52 ` [PATCH v2 09/10] mesh: Rework set_scan_filter_uuids parameters Luiz Augusto von Dentz
2017-12-08 10:52 ` Luiz Augusto von Dentz [this message]
2017-12-08 11:10 ` [PATCH v2 01/10] shared/shell: Omit menu command if there are no submenus Johan Hedberg

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=20171208105256.18635-10-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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).