Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate BLE_ANCS_SDAPI_IRC ... more
Diff: public/GattServer.h
- Revision:
- 550:35b3962903af
- Parent:
- 548:623e4c0f0b6e
- Child:
- 551:d79a7933a6d1
--- a/public/GattServer.h Fri Jun 19 15:52:09 2015 +0100 +++ b/public/GattServer.h Fri Jun 19 15:52:10 2015 +0100 @@ -37,7 +37,7 @@ dataSentCallChain(), dataWrittenCallChain(), onDataRead(), - onUpdatesEnabled(NULL), + updatesEnabledCallback(NULL), onUpdatesDisabled(NULL), onConfirmationReceived(NULL) { /* empty */ @@ -205,7 +205,13 @@ onDataRead.add(objPtr, memberPtr); return BLE_ERROR_NONE; } - void setOnUpdatesEnabled(EventCallback_t callback) {onUpdatesEnabled = callback;} + + /** + * Setup a callback for when notifications/indications are enabled for a + * characteristic on the local GattServer. + */ + void onUpdatesEnabled(EventCallback_t callback) {updatesEnabledCallback = callback;} + void setOnUpdatesDisabled(EventCallback_t callback) {onUpdatesDisabled = callback;} void setOnConfirmationReceived(EventCallback_t callback) {onConfirmationReceived = callback;} @@ -225,8 +231,8 @@ void handleEvent(GattServerEvents::gattEvent_e type, GattAttribute::Handle_t charHandle) { switch (type) { case GattServerEvents::GATT_EVENT_UPDATES_ENABLED: - if (onUpdatesEnabled) { - onUpdatesEnabled(charHandle); + if (updatesEnabledCallback) { + updatesEnabledCallback(charHandle); } break; case GattServerEvents::GATT_EVENT_UPDATES_DISABLED: @@ -258,7 +264,7 @@ CallChainOfFunctionPointersWithContext<unsigned> dataSentCallChain; CallChainOfFunctionPointersWithContext<const GattWriteCallbackParams *> dataWrittenCallChain; CallChainOfFunctionPointersWithContext<const GattReadCallbackParams *> onDataRead; - EventCallback_t onUpdatesEnabled; + EventCallback_t updatesEnabledCallback; EventCallback_t onUpdatesDisabled; EventCallback_t onConfirmationReceived;