diff options
author | Chris Manton <cmanton@google.com> | 2021-05-13 23:23:51 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-05-13 23:23:51 +0000 |
commit | 4cd67aca18a5bd1f3d20492d03809c5d5fbdc14b (patch) | |
tree | ec5d7025284413b91c72d082618638b427e5d29e /bta | |
parent | ceb79438dc94d4c0f055a8c6ea692be5cff25582 (diff) | |
parent | e4bf83024b3ebfd8aae0da92e79c7842c72d7471 (diff) | |
download | bt-4cd67aca18a5bd1f3d20492d03809c5d5fbdc14b.tar.gz |
Streamline bta_gattc_op_cmpl am: c2a4232547 am: e22576be64 am: e4bf83024b
Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1700656
Change-Id: Ie365635c5ad02111e9e2c3d15bb91e8d2127ae83
Diffstat (limited to 'bta')
-rw-r--r-- | bta/gatt/bta_gattc_act.cc | 29 | ||||
-rw-r--r-- | bta/gatt/bta_gattc_int.h | 2 |
2 files changed, 18 insertions, 13 deletions
diff --git a/bta/gatt/bta_gattc_act.cc b/bta/gatt/bta_gattc_act.cc index e5564a1a1..800e6e255 100644 --- a/bta/gatt/bta_gattc_act.cc +++ b/bta/gatt/bta_gattc_act.cc @@ -962,26 +962,31 @@ static void bta_gattc_cfg_mtu_cmpl(tBTA_GATTC_CLCB* p_clcb, /** operation completed */ void bta_gattc_op_cmpl(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) { - uint8_t op = (uint8_t)p_data->op_cmpl.op_code; - uint8_t mapped_op = 0; - - VLOG(1) << __func__ << ": op:" << +op; - - if (op == GATTC_OPTYPE_INDICATION || op == GATTC_OPTYPE_NOTIFICATION) { - LOG(ERROR) << "unexpected operation, ignored"; + if (p_clcb->p_q_cmd == NULL) { + LOG_ERROR("No pending command gatt client command"); return; } - if (op < GATTC_OPTYPE_READ) return; + const tGATTC_OPTYPE op = p_data->op_cmpl.op_code; + switch (op) { + case GATTC_OPTYPE_READ: + case GATTC_OPTYPE_WRITE: + case GATTC_OPTYPE_EXE_WRITE: + case GATTC_OPTYPE_CONFIG: + break; - if (p_clcb->p_q_cmd == NULL) { - LOG(ERROR) << "No pending command"; - return; + case GATTC_OPTYPE_NONE: + case GATTC_OPTYPE_DISCOVERY: + case GATTC_OPTYPE_NOTIFICATION: + case GATTC_OPTYPE_INDICATION: + default: + LOG(ERROR) << "unexpected operation, ignored"; + return; } if (p_clcb->p_q_cmd->hdr.event != bta_gattc_opcode_to_int_evt[op - GATTC_OPTYPE_READ]) { - mapped_op = + uint8_t mapped_op = p_clcb->p_q_cmd->hdr.event - BTA_GATTC_API_READ_EVT + GATTC_OPTYPE_READ; if (mapped_op > GATTC_OPTYPE_INDICATION) mapped_op = 0; diff --git a/bta/gatt/bta_gattc_int.h b/bta/gatt/bta_gattc_int.h index 108b0e84d..bfde5aba7 100644 --- a/bta/gatt/bta_gattc_int.h +++ b/bta/gatt/bta_gattc_int.h @@ -135,7 +135,7 @@ typedef struct { typedef struct { BT_HDR_RIGID hdr; - uint8_t op_code; + tGATTC_OPTYPE op_code; tGATT_STATUS status; tGATT_CL_COMPLETE* p_cmpl; } tBTA_GATTC_OP_CMPL; |