Merge pull request #14602 from paul-szczepanek-arm/conf

Deprecate indications event onConfirmationReceived
pull/13791/head
Martin Kojtal 2021-05-03 09:55:08 +02:00 committed by GitHub
commit dace32aef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 21 deletions

View File

@ -122,8 +122,9 @@ public:
} }
/** /**
* Function invoked when the server has sent data to a client as * Function invoked when the server has sent data to a client. For
* part of a notification/indication. * 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 * @note params has a temporary scope and should be copied by the
* application if needed later * application if needed later
@ -188,12 +189,13 @@ public:
} }
/** /**
* Function invoked when an ACK has been received for an * Event not used.
* indication sent to the client.
* *
* @note params has a temporary scope and should be copied by the * @note params has a temporary scope and should be copied by the
* application if needed later * 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 &params) { virtual void onConfirmationReceived(const GattConfirmationReceivedCallbackParams &params) {
(void)params; (void)params;
} }
@ -274,7 +276,7 @@ public:
* Event handler that handles subscription to characteristic updates, * Event handler that handles subscription to characteristic updates,
* unsubscription from characteristic updates and notification confirmation. * unsubscription from characteristic updates and notification confirmation.
* *
* @see onUpdatesEnabled() onUpdateDisabled() onConfirmationReceived() * @see onUpdatesEnabled() onUpdateDisabled()
*/ */
typedef FunctionPointerWithContext<GattAttribute::Handle_t> EventCallback_t; typedef FunctionPointerWithContext<GattAttribute::Handle_t> EventCallback_t;
@ -705,7 +707,8 @@ public:
* @param[in] callback Event handler being registered. * @param[in] callback Event handler being registered.
*/ */
MBED_DEPRECATED_SINCE("mbed-os-6.3.0", "Individual callback-registering functions have" 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); void onConfirmationReceived(EventCallback_t callback);
#if !defined(DOXYGEN_ONLY) #if !defined(DOXYGEN_ONLY)

View File

@ -1767,21 +1767,6 @@ void GattServer::handleEvent(
updatesDisabledCallback(attributeHandle); updatesDisabledCallback(attributeHandle);
} }
break; 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: case GattServerEvents::GATT_EVENT_DATA_SENT:
tr_debug("Data sent for attribute %d on connection %d", attributeHandle, connHandle); tr_debug("Data sent for attribute %d on connection %d", attributeHandle, connHandle);

View File

@ -63,6 +63,8 @@ public:
/** /**
* Response received from Characteristic Value Indication message. * 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, GATT_EVENT_CONFIRMATION_RECEIVED = 5,