[PATCH 1/3] android/client: Add support for client->listen

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

 



---
 android/client/if-gatt.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index 250472a..f421421 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -576,6 +576,13 @@ static void gattc_read_remote_rssi_cb(int client_if, bt_bdaddr_t *bda, int rssi,
 			client_if, bt_bdaddr_t2str(bda, buf), rssi, status);
 }
 
+/* Callback invoked in response to listen */
+static void gattc_listen_cb(int status, int client_if)
+{
+	haltest_info("%s: client_if=%d status=%d\n", __func__, client_if,
+								status);
+}
+
 static const btgatt_client_callbacks_t btgatt_client_callbacks = {
 	.register_client_cb = gattc_register_client_cb,
 	.scan_result_cb = gattc_scan_result_cb,
@@ -593,7 +600,8 @@ static const btgatt_client_callbacks_t btgatt_client_callbacks = {
 	.read_descriptor_cb = gattc_read_descriptor_cb,
 	.write_descriptor_cb = gattc_write_descriptor_cb,
 	.execute_write_cb = gattc_execute_write_cb,
-	.read_remote_rssi_cb = gattc_read_remote_rssi_cb
+	.read_remote_rssi_cb = gattc_read_remote_rssi_cb,
+	.listen_cb = gattc_listen_cb,
 };
 
 /* BT-GATT Server callbacks */
@@ -922,6 +930,27 @@ static void disconnect_p(int argc, const char **argv)
 	EXEC(if_gatt->client->disconnect, client_if, &bd_addr, conn_id);
 }
 
+/* listen */
+
+/* Same completion as unregister for now, start stop is not auto completed */
+#define listen_c unregister_client_c
+
+static void listen_p(int argc, const char **argv)
+{
+	int client_if;
+	int start = 1;
+
+	RETURN_IF_NULL(if_gatt);
+
+	VERIFY_CLIENT_IF(2, client_if);
+
+	/* start */
+	if (argc >= 4)
+		start = atoi(argv[3]);
+
+	EXEC(if_gatt->client->listen, client_if, start);
+}
+
 /* refresh */
 
 static void refresh_c(int argc, const char **argv, enum_func *enum_func,
@@ -1405,6 +1434,7 @@ static struct method client_methods[] = {
 	STD_METHODCH(get_device_type, "<addr>"),
 	STD_METHODCH(test_command,
 			"<cmd> <addr> <uuid> [u1] [u2] [u3] [u4] [u5]"),
+	STD_METHODCH(listen, "<client_if> [1|0]"),
 	END_METHOD
 };
 
-- 
1.8.4

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