From b61fc6b639ec332cb8265beacdcd226598b92a3f Mon Sep 17 00:00:00 2001 From: Paul Szczepanek Date: Wed, 28 Apr 2021 13:55:44 +0100 Subject: [PATCH] Deprecate indications event onConfirmationReceived --- connectivity/FEATURE_BLE/include/ble/GattServer.h | 15 +++++++++------ .../source/cordio/source/GattServerImpl.cpp | 15 --------------- .../FEATURE_BLE/source/generic/GattServerEvents.h | 2 ++ 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/connectivity/FEATURE_BLE/include/ble/GattServer.h b/connectivity/FEATURE_BLE/include/ble/GattServer.h index 682911159e..6b7335d8f3 100644 --- a/connectivity/FEATURE_BLE/include/ble/GattServer.h +++ b/connectivity/FEATURE_BLE/include/ble/GattServer.h @@ -122,8 +122,9 @@ public: } /** - * Function invoked when the server has sent data to a client as - * part of a notification/indication. + * Function invoked when the server has sent data to a client. For + * notifications this is triggered when data is sent, for indications + * it's only triggered when the confirmation has been received. * * @note params has a temporary scope and should be copied by the * application if needed later @@ -188,12 +189,13 @@ public: } /** - * Function invoked when an ACK has been received for an - * indication sent to the client. + * Event not used. * * @note params has a temporary scope and should be copied by the * application if needed later */ + MBED_DEPRECATED_SINCE("mbed-os-6.11.0", "This event is never triggered. Indication triggers onDataSent" + "when confirmation is received.") virtual void onConfirmationReceived(const GattConfirmationReceivedCallbackParams ¶ms) { (void)params; } @@ -274,7 +276,7 @@ public: * Event handler that handles subscription to characteristic updates, * unsubscription from characteristic updates and notification confirmation. * - * @see onUpdatesEnabled() onUpdateDisabled() onConfirmationReceived() + * @see onUpdatesEnabled() onUpdateDisabled() */ typedef FunctionPointerWithContext EventCallback_t; @@ -705,7 +707,8 @@ public: * @param[in] callback Event handler being registered. */ MBED_DEPRECATED_SINCE("mbed-os-6.3.0", "Individual callback-registering functions have" - "been replaced by GattServer::setEventHandler. Use that function instead.") + "been replaced by an event handler. Indication confirmation triggers" + "GattServer::onDataSent event instead.") void onConfirmationReceived(EventCallback_t callback); #if !defined(DOXYGEN_ONLY) diff --git a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp index 3dff4e0096..78134bdb1c 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp @@ -1767,21 +1767,6 @@ void GattServer::handleEvent( updatesDisabledCallback(attributeHandle); } break; - case GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED: - tr_debug("Confirmation received for attribute %d on connection %d", attributeHandle, connHandle); - if(eventHandler) { - GattConfirmationReceivedCallbackParams params({ - .connHandle = connHandle, - .attHandle = attributeHandle - }); - eventHandler->onConfirmationReceived(params); - } - - // Execute deprecated callback - if (confirmationReceivedCallback) { - confirmationReceivedCallback(attributeHandle); - } - break; case GattServerEvents::GATT_EVENT_DATA_SENT: tr_debug("Data sent for attribute %d on connection %d", attributeHandle, connHandle); diff --git a/connectivity/FEATURE_BLE/source/generic/GattServerEvents.h b/connectivity/FEATURE_BLE/source/generic/GattServerEvents.h index aff507e3a6..d323f1ee79 100644 --- a/connectivity/FEATURE_BLE/source/generic/GattServerEvents.h +++ b/connectivity/FEATURE_BLE/source/generic/GattServerEvents.h @@ -63,6 +63,8 @@ public: /** * Response received from Characteristic Value Indication message. + * @deprecated This event is never used. Indications use GATT_EVENT_DATA_SENT + * only after confirmation is received. */ GATT_EVENT_CONFIRMATION_RECEIVED = 5,