OSDN Git Service

Straighten out tBTA_GATT_REASON
authorChris Manton <cmanton@google.com>
Sun, 2 May 2021 16:52:25 +0000 (09:52 -0700)
committerChris Manton <cmanton@google.com>
Sun, 9 May 2021 00:58:18 +0000 (00:58 +0000)
Bug: 183374320
Test: gd/cert/run
Tag: #refactor

Change-Id: Ib66bbdbc753480bc6a69136b3bbe1d08e11730b3

bta/gatt/bta_gattc_act.cc
bta/hh/bta_hh_int.h
bta/include/bta_gatt_api.h
bta/vc/vc.cc
bta/vc/vc_test.cc

index bd54a76..76a3ce1 100644 (file)
@@ -546,7 +546,7 @@ void bta_gattc_close(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
 
   cb_data.close.client_if = p_clcb->p_rcb->client_if;
   cb_data.close.conn_id = p_clcb->bta_conn_id;
-  cb_data.close.reason = 0;
+  cb_data.close.reason = GATT_CONN_OK;
   cb_data.close.remote_bda = p_clcb->bda;
   cb_data.close.status = GATT_SUCCESS;
 
index d9e5062..a1a8df3 100644 (file)
@@ -130,9 +130,7 @@ typedef struct {
 typedef struct {
   BT_HDR_RIGID hdr;
   uint16_t conn_id;
-  tBTA_GATT_REASON reason; /* disconnect reason code, not useful when connect
-                              event is reported */
-
+  tGATT_DISCONN_REASON reason;
 } tBTA_HH_LE_CLOSE;
 
 typedef struct {
index 2aabcdc..65cf275 100644 (file)
@@ -183,8 +183,7 @@ typedef struct {
   tGATT_STATUS status;
   tGATT_IF client_if;
   RawAddress remote_bda;
-  tBTA_GATT_REASON reason; /* disconnect reason code, not useful when connect
-                              event is reported */
+  tGATT_DISCONN_REASON reason;
 } tBTA_GATTC_CLOSE;
 
 typedef struct {
index 97b8266..ee94613 100644 (file)
@@ -344,7 +344,8 @@ class VolumeControlImpl : public VolumeControl {
   }
 
   void OnGattDisconnected(uint16_t connection_id, tGATT_IF /*client_if*/,
-                          RawAddress remote_bda, tBTA_GATT_REASON /*reason*/) {
+                          RawAddress remote_bda,
+                          tGATT_DISCONN_REASON /*reason*/) {
     VolumeControlDevice* device =
         volume_control_devices_.FindByConnId(connection_id);
     if (!device) {
index 30eef87..1d45fa8 100644 (file)
@@ -344,7 +344,7 @@ class VolumeControlTest : public ::testing::Test {
         .conn_id = conn_id,
         .client_if = gatt_if,
         .remote_bda = address,
-        .reason = HCI_ERR_PEER_USER,
+        .reason = GATT_CONN_TERMINATE_PEER_USER,
     };
 
     gatt_callback(BTA_GATTC_CLOSE_EVT, (tBTA_GATTC*)&event_data);