Diff between 80ca53ae3f514125d64663150c5dbf424cd095f4 and f01f3a2daecddd86c163a7dc6880367d178c885b

Changed Files

File Additions Deletions Status
android/bluetooth.c +32 -31 modified

Full Patch

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 8f66dd1..3e2e547 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -999,6 +999,38 @@ static void clear_device_found(gpointer data, gpointer user_data)
 	dev->found = false;
 }
 
+static uint8_t get_adapter_discovering_type(void)
+{
+	uint8_t type;
+
+	if (adapter.current_settings & MGMT_SETTING_BREDR)
+		type = SCAN_TYPE_BREDR;
+	else
+		type = 0;
+
+	if (adapter.current_settings & MGMT_SETTING_LE)
+		type |= SCAN_TYPE_LE;
+
+	return type;
+}
+
+static bool start_discovery(uint8_t type)
+{
+	struct mgmt_cp_start_discovery cp;
+
+	cp.type = get_adapter_discovering_type() & type;
+
+	DBG("type=0x%x", cp.type);
+
+	if (mgmt_send(mgmt_if, MGMT_OP_START_DISCOVERY, adapter.index,
+				sizeof(cp), &cp, NULL, NULL, NULL) > 0)
+		return true;
+
+	error("Failed to start discovery");
+
+	return false;
+}
+
 static void mgmt_discovering_event(uint16_t index, uint16_t length,
 					const void *param, void *user_data)
 {
@@ -2452,37 +2484,6 @@ static void get_adapter_properties(void)
 	get_adapter_discoverable_timeout();
 }
 
-static uint8_t get_adapter_discovering_type(void)
-{
-	uint8_t type;
-
-	if (adapter.current_settings & MGMT_SETTING_BREDR)
-		type = SCAN_TYPE_BREDR;
-	else
-		type = 0;
-
-	if (adapter.current_settings & MGMT_SETTING_LE)
-		type |= SCAN_TYPE_LE;
-
-	return type;
-}
-
-static bool start_discovery(uint8_t type)
-{
-	struct mgmt_cp_start_discovery cp;
-
-	cp.type = get_adapter_discovering_type() & type;
-
-	DBG("type=0x%x", cp.type);
-
-	if (mgmt_send(mgmt_if, MGMT_OP_START_DISCOVERY, adapter.index,
-					sizeof(cp), &cp, NULL, NULL, NULL) > 0)
-		return true;
-
-	error("Failed to start discovery");
-	return false;
-}
-
 static void cancel_pending_confirm_name(gpointer data, gpointer user_data)
 {
 	struct device *dev = data;