[PATCHv1 13/47] android/gatt: Add support for new API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

In new Android API client_if parameter is removed.
---
 android/gatt.c     | 14 ++++++++------
 android/hal-gatt.c |  8 ++++++++
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index b3dd6d3..5a531d9 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -1730,15 +1730,17 @@ static void handle_client_scan(const void *buf, uint16_t len)
 {
 	const struct hal_cmd_gatt_client_scan *cmd = buf;
 	uint8_t status;
-	void *registered;
 
 	DBG("new state %d", cmd->start);
 
-	registered = find_app_by_id(cmd->client_if);
-	if (!registered) {
-		error("gatt: Client not registered");
-		status = HAL_STATUS_FAILED;
-		goto reply;
+	if (cmd->client_if != 0) {
+		void *registered = find_app_by_id(cmd->client_if);
+
+		if (!registered) {
+			error("gatt: Client not registered");
+			status = HAL_STATUS_FAILED;
+			goto reply;
+		}
 	}
 
 	/* Turn off scan */
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index c563fe9..d0e9184 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -595,14 +595,22 @@ static bt_status_t unregister_client(int client_if)
 					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
+#if ANDROID_VERSION > PLATFORM_VER(4, 4, 4)
+static bt_status_t scan(bool start)
+#else
 static bt_status_t scan(int client_if, bool start)
+#endif
 {
 	struct hal_cmd_gatt_client_scan cmd;
 
 	if (!interface_ready())
 		return BT_STATUS_NOT_READY;
 
+#if ANDROID_VERSION > PLATFORM_VER(4, 4, 4)
+	cmd.client_if = 0;
+#else
 	cmd.client_if = client_if;
+#endif
 	cmd.start = start;
 
 	return hal_ipc_cmd(HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_SCAN,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux