Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/3] android/client: Add support for client->listen
@ 2014-04-14  8:58 Lukasz Rymanowski
  2014-04-14  8:58 ` [PATCH 2/3] android/bluetooth: Expose gap api to set advertising Lukasz Rymanowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lukasz Rymanowski @ 2014-04-14  8:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: szymon.janc, Lukasz Rymanowski

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-14  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-14  8:58 [PATCH 1/3] android/client: Add support for client->listen Lukasz Rymanowski
2014-04-14  8:58 ` [PATCH 2/3] android/bluetooth: Expose gap api to set advertising Lukasz Rymanowski
2014-04-14  8:58 ` [PATCH 3/3] android/gatt: Add support for client->listen Lukasz Rymanowski
2014-04-14  9:58 ` [PATCH 1/3] android/client: " Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox