From: Jakub Pawlowski Date: Thu, 5 May 2016 17:17:02 +0000 (-0700) Subject: Rewrite btif_gatts_stop_service to new style X-Git-Tag: android-x86-8.1-r1~196^2~67^2~174^2~407 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7ce14cc65ea3796da3e12811e7bc07b529a2f9fa;p=android-x86%2Fsystem-bt.git Rewrite btif_gatts_stop_service to new style Bug: 28485365 Change-Id: I79aaaa57139dca373fdf7c0424353cd5de0cb48f --- diff --git a/btif/src/btif_gatt_server.cc b/btif/src/btif_gatt_server.cc index efde755aa..bf32e662c 100644 --- a/btif/src/btif_gatt_server.cc +++ b/btif/src/btif_gatt_server.cc @@ -76,9 +76,7 @@ typedef enum { BTIF_GATTS_ADD_INCLUDED_SERVICE, BTIF_GATTS_ADD_CHARACTERISTIC, BTIF_GATTS_ADD_DESCRIPTOR, - BTIF_GATTS_START_SERVICE, - BTIF_GATTS_STOP_SERVICE, - BTIF_GATTS_DELETE_SERVICE + BTIF_GATTS_START_SERVICE } btif_gatts_event_t; /************************************************************************************ @@ -483,14 +481,6 @@ static void btgatts_handle_event(uint16_t event, char* p_param) BTA_GATTS_StartService(p_cb->srvc_handle, p_cb->transport); break; - case BTIF_GATTS_STOP_SERVICE: - BTA_GATTS_StopService(p_cb->srvc_handle); - break; - - case BTIF_GATTS_DELETE_SERVICE: - BTA_GATTS_DeleteService(p_cb->srvc_handle); - break; - default: LOG_ERROR(LOG_TAG, "%s: Unknown event (%d)!", __FUNCTION__, event); break; @@ -609,21 +599,13 @@ static bt_status_t btif_gatts_start_service(int server_if, int service_handle, i static bt_status_t btif_gatts_stop_service(int server_if, int service_handle) { CHECK_BTGATT_INIT(); - btif_gatts_cb_t btif_cb; - btif_cb.server_if = (uint8_t) server_if; - btif_cb.srvc_handle = (uint16_t) service_handle; - return btif_transfer_context(btgatts_handle_event, BTIF_GATTS_STOP_SERVICE, - (char*) &btif_cb, sizeof(btif_gatts_cb_t), NULL); + return do_in_jni_thread(Bind(&BTA_GATTS_StopService, service_handle)); } static bt_status_t btif_gatts_delete_service(int server_if, int service_handle) { CHECK_BTGATT_INIT(); - btif_gatts_cb_t btif_cb; - btif_cb.server_if = (uint8_t) server_if; - btif_cb.srvc_handle = (uint16_t) service_handle; - return btif_transfer_context(btgatts_handle_event, BTIF_GATTS_DELETE_SERVICE, - (char*) &btif_cb, sizeof(btif_gatts_cb_t), NULL); + return do_in_jni_thread(Bind(&BTA_GATTS_DeleteService, service_handle)); } static bt_status_t btif_gatts_send_indication(int server_if,