linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 01/11] android/gatt: Add helper for getting device by conn_id
@ 2014-03-27 21:12 Marcin Kraglak
  2014-03-27 21:13 ` [PATCHv2 02/11] android/gatt: Add helper to get client by id Marcin Kraglak
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Marcin Kraglak @ 2014-03-27 21:12 UTC (permalink / raw)
  To: linux-bluetooth

It will look for cgatt_device by conn_id.
---
 android/gatt.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 81bfdc0..7a3db27 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -713,6 +713,17 @@ static struct gatt_device *find_device(bdaddr_t *addr)
 	return NULL;
 }
 
+static struct gatt_device *find_device_by_conn_id(int32_t conn_id)
+{
+	struct gatt_device *dev;
+
+	dev = queue_find(conn_list, match_dev_by_conn_id, INT_TO_PTR(conn_id));
+	if (dev)
+		return dev;
+
+	return NULL;
+}
+
 static void handle_client_connect(const void *buf, uint16_t len)
 {
 	const struct hal_cmd_gatt_client_connect *cmd = buf;
@@ -850,8 +861,7 @@ static void handle_client_disconnect(const void *buf, uint16_t len)
 
 	ba2str((bdaddr_t *)&cmd->bdaddr, addr);
 
-	dev = queue_find(conn_list, match_dev_by_conn_id,
-						INT_TO_PTR(cmd->conn_id));
+	dev = find_device_by_conn_id(cmd->conn_id);
 	if (!dev) {
 		error("gatt: dev %s with conn_id=%d not found",
 							addr, cmd->conn_id);
@@ -916,8 +926,7 @@ static void handle_client_search_service(const void *buf, uint16_t len)
 
 	DBG("");
 
-	dev = queue_find(conn_list, match_dev_by_conn_id,
-						INT_TO_PTR(cmd->conn_id));
+	dev = find_device_by_conn_id(cmd->conn_id);
 	if (!dev) {
 		error("gatt: dev with conn_id=%d not found", cmd->conn_id);
 		status = HAL_STATUS_FAILED;
@@ -1040,8 +1049,7 @@ static bool find_service(int32_t conn_id, struct element_id *service_id,
 	struct gatt_device *device;
 	struct service *service;
 
-	device = queue_find(conn_list, match_dev_by_conn_id,
-							INT_TO_PTR(conn_id));
+	device = find_device_by_conn_id(conn_id);
 	if (!device) {
 		error("gatt: conn_id=%d not found", conn_id);
 		return false;
-- 
1.8.3.1


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

end of thread, other threads:[~2014-03-27 22:50 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 21:12 [PATCHv2 01/11] android/gatt: Add helper for getting device by conn_id Marcin Kraglak
2014-03-27 21:13 ` [PATCHv2 02/11] android/gatt: Add helper to get client by id Marcin Kraglak
2014-03-27 21:49   ` Szymon Janc
2014-03-27 21:13 ` [PATCHv2 03/11] android/gatt: Service error when client cannot be created Marcin Kraglak
2014-03-27 21:46   ` Szymon Janc
2014-03-27 21:13 ` [PATCHv2 04/11] android/gatt: Add initial implementation of get_included_service Marcin Kraglak
2014-03-27 21:57   ` Szymon Janc
2014-03-27 21:13 ` [PATCHv2 05/11] android/gatt: Add get_included_data struct and callback Marcin Kraglak
2014-03-27 21:13 ` [PATCHv2 06/11] android/gatt: Add implementation of get_included_cb Marcin Kraglak
2014-03-27 22:04   ` Szymon Janc
2014-03-27 21:13 ` [PATCHv2 07/11] android/gatt: Add notifications list to gatt_client Marcin Kraglak
2014-03-27 22:10   ` Szymon Janc
2014-03-27 21:13 ` [PATCHv2 08/11] android/gatt: Add initial implementation of register_for_notification Marcin Kraglak
2014-03-27 22:20   ` Szymon Janc
2014-03-27 21:13 ` [PATCHv2 09/11] android/gatt: Add client_register_for_notif_cb function Marcin Kraglak
2014-03-27 22:25   ` Szymon Janc
2014-03-27 21:13 ` [PATCHv2 10/11] android/gatt: Add handler for ATT_OP_HANDLE_NOTIFY and ATT_OP_HANDLE_IND Marcin Kraglak
2014-03-27 22:32   ` Szymon Janc
2014-03-27 21:13 ` [PATCHv2 11/11] android/gatt: Add deregister_for_notification implementation Marcin Kraglak
2014-03-27 22:50   ` Szymon Janc
2014-03-27 21:33 ` [PATCHv2 01/11] android/gatt: Add helper for getting device by conn_id Szymon Janc

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