From 61a112e488a7686e5cc9680434c42895ef9db878 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Mon, 2 May 2016 17:50:25 -0700 Subject: [PATCH] Rewrite GATT read operations to use new style Bug: 28485365 Change-Id: I3c5918abdf79da7d6b566506ad53fa38656bcb65 --- btif/src/btif_gatt_client.cc | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/btif/src/btif_gatt_client.cc b/btif/src/btif_gatt_client.cc index aa3bab5c2..078ddbde6 100644 --- a/btif/src/btif_gatt_client.cc +++ b/btif/src/btif_gatt_client.cc @@ -86,8 +86,6 @@ typedef enum { BTIF_GATTC_OPEN, BTIF_GATTC_CLOSE, BTIF_GATTC_SEARCH_SERVICE, - BTIF_GATTC_READ_CHAR, - BTIF_GATTC_READ_CHAR_DESCR, BTIF_GATTC_WRITE_CHAR, BTIF_GATTC_WRITE_CHAR_DESCR, BTIF_GATTC_EXECUTE_WRITE, @@ -1226,14 +1224,6 @@ static void btgattc_handle_event(uint16_t event, char* p_param) break; } - case BTIF_GATTC_READ_CHAR: - BTA_GATTC_ReadCharacteristic(p_cb->conn_id, p_cb->handle, p_cb->auth_req); - break; - - case BTIF_GATTC_READ_CHAR_DESCR: - BTA_GATTC_ReadCharDescr(p_cb->conn_id, p_cb->handle, p_cb->auth_req); - break; - case BTIF_GATTC_WRITE_CHAR: BTA_GATTC_WriteCharValue(p_cb->conn_id, p_cb->handle, p_cb->write_type, p_cb->len, p_cb->value, p_cb->auth_req); @@ -1700,27 +1690,18 @@ static bt_status_t btif_gattc_get_gatt_db(int conn_id) (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL); } - -static bt_status_t btif_gattc_read_char(int conn_id, uint16_t handle, int auth_req) -{ - CHECK_BTGATT_INIT(); - btif_gattc_cb_t btif_cb; - btif_cb.conn_id = (uint16_t) conn_id; - btif_cb.handle = (uint16_t) handle; - btif_cb.auth_req = (uint8_t) auth_req; - return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_READ_CHAR, - (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL); +static bt_status_t btif_gattc_read_char(int conn_id, uint16_t handle, + int auth_req) { + CHECK_BTGATT_INIT(); + return do_in_jni_thread( + Bind(&BTA_GATTC_ReadCharacteristic, conn_id, handle, auth_req)); } -static bt_status_t btif_gattc_read_char_descr(int conn_id, uint16_t handle, int auth_req) -{ - CHECK_BTGATT_INIT(); - btif_gattc_cb_t btif_cb; - btif_cb.conn_id = (uint16_t) conn_id; - btif_cb.handle = (uint16_t) handle; - btif_cb.auth_req = (uint8_t) auth_req; - return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_READ_CHAR_DESCR, - (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL); +static bt_status_t btif_gattc_read_char_descr(int conn_id, uint16_t handle, + int auth_req) { + CHECK_BTGATT_INIT(); + return do_in_jni_thread( + Bind(&BTA_GATTC_ReadCharDescr, conn_id, handle, auth_req)); } static bt_status_t btif_gattc_write_char(int conn_id, uint16_t handle, int write_type, -- 2.11.0