From d7f60628c5a2de104185b37339fe958488182922 Mon Sep 17 00:00:00 2001 From: adabreuti <76965454+adabreuti@users.noreply.github.com> Date: Wed, 29 Jun 2022 17:21:03 -0500 Subject: [PATCH] Update BLE manager to use indications (#20113) --- src/platform/cc13x2_26x2/BLEManagerImpl.cpp | 21 +-------------------- src/platform/cc13x2_26x2/chipOBleProfile.c | 4 ++-- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/platform/cc13x2_26x2/BLEManagerImpl.cpp b/src/platform/cc13x2_26x2/BLEManagerImpl.cpp index 2ff590a6628995..096d10e3198271 100644 --- a/src/platform/cc13x2_26x2/BLEManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/BLEManagerImpl.cpp @@ -873,10 +873,6 @@ void BLEManagerImpl::ProcessEvtHdrMsg(QueuedEvt_t * pMsg) case BLEManagerIMPL_CHIPOBLE_TX_IND_EVT: { uint8_t dataLen = ((CHIPoBLEIndEvt_t *) (pMsg->pData))->len; - uint16_t i = 0; - void * connHandle; - ConnRec_t * activeConnObj = NULL; - ChipDeviceEvent event; CHIPoBLEProfile_SetParameter(CHIPOBLEPROFILE_TX_CHAR, dataLen, (void *) (((CHIPoBLEIndEvt_t *) (pMsg->pData))->pData), BLEManagerImpl::sSelfEntity); @@ -885,21 +881,6 @@ void BLEManagerImpl::ProcessEvtHdrMsg(QueuedEvt_t * pMsg) ICall_free((void *) (((CHIPoBLEIndEvt_t *) (pMsg->pData))->pData)); - // Find active connection - for (i = 0; i < MAX_NUM_BLE_CONNS; i++) - { - if (sInstance.connList[i].connHandle != 0xffff) - { - activeConnObj = &sInstance.connList[i]; - } - } - - connHandle = (void *) &activeConnObj->connHandle; - - event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; - event.CHIPoBLEIndicateConfirm.ConId = connHandle; - PlatformMgr().PostEventOrDie(&event); - dealloc = TRUE; } break; @@ -967,7 +948,7 @@ void BLEManagerImpl::ProcessEvtHdrMsg(QueuedEvt_t * pMsg) CHIPoBLEProfile_GetParameter(CHIPOBLEPROFILE_CCCWrite, &cccValue, 1); // Check whether it is a sub/unsub event. 0x1 = Notifications enabled, 0x2 = Indications enabled - if (cccValue & 1) + if (cccValue & 0x2) { // Post event to CHIP BLEMGR_LOG("BLEMGR: BLE Process Application Message: CHIPOBLE_CHAR_CHANGE_EVT, Subscrbe"); diff --git a/src/platform/cc13x2_26x2/chipOBleProfile.c b/src/platform/cc13x2_26x2/chipOBleProfile.c index a653d0f525a654..fb8cf72b93ac53 100644 --- a/src/platform/cc13x2_26x2/chipOBleProfile.c +++ b/src/platform/cc13x2_26x2/chipOBleProfile.c @@ -63,7 +63,7 @@ const uint8 chipOBleProfileRxCharUUID[ATT_UUID_SIZE] = { static const gattAttrType_t chipoBleProfile = { ATT_BT_UUID_SIZE, chipOBleServUUID }; // CHIPoBLE Tx Characteristic Properties -static uint8_t chipOBleProfileTxCharProps = GATT_PROP_READ | GATT_PROP_NOTIFY; +static uint8_t chipOBleProfileTxCharProps = GATT_PROP_READ | GATT_PROP_INDICATE; // CHIPoBLE Tx Characteristic Value static uint8_t chipOBleProfileTxCharVal[CHIPOBLEPROFILE_CHAR_LEN] = { 0x00 }; @@ -362,7 +362,7 @@ static bStatus_t CHIPoBLEProfile_WriteAttrCB(uint16_t connHandle, gattAttribute_ notifyApp = CHIPOBLEPROFILE_CCCWrite; - status = GATTServApp_ProcessCCCWriteReq(connHandle, pAttr, pValue, len, offset, GATT_CLIENT_CFG_NOTIFY); + status = GATTServApp_ProcessCCCWriteReq(connHandle, pAttr, pValue, len, offset, GATT_CLIENT_CFG_INDICATE); } else {