High level Bluetooth Low Energy API and radio abstraction layer
Fork of BLE_API by
Diff: public/GattServer.h
- Revision:
- 693:2f28bf2dd443
- Parent:
- 691:02b4a4b632e1
- Child:
- 694:02882efc6e88
--- a/public/GattServer.h Fri Jun 19 15:53:04 2015 +0100 +++ b/public/GattServer.h Fri Jun 19 15:53:04 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;