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.
Fork of BLE_API by
Revision 693:2f28bf2dd443, committed 2015-06-19
- Comitter:
- rgrover1
- Date:
- Fri Jun 19 15:53:04 2015 +0100
- Parent:
- 692:44ebea6c9d8e
- Child:
- 694:02882efc6e88
- Commit message:
- Synchronized with git rev 87c8c48d
Author: Rohit Grover
fix GattServer::onUpdatesEnabled()
Changed in this revision
| public/BLE.h | Show annotated file Show diff for this revision Revisions of this file |
| public/GattServer.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/public/BLE.h Fri Jun 19 15:53:04 2015 +0100
+++ b/public/BLE.h Fri Jun 19 15:53:04 2015 +0100
@@ -1192,7 +1192,19 @@
ble_error_t onDataRead(void (*callback)(const GattReadCallbackParams *eventDataP));
template <typename T> ble_error_t onDataRead(T * objPtr, void (T::*memberPtr)(const GattReadCallbackParams *context));
- void onUpdatesEnabled(GattServer::EventCallback_t callback);
+ /**
+ * Setup a callback for when notifications/indications are enabled for a
+ * characteristic on the local GattServer.
+ *
+ * @note: This API is now *deprecated* and will be dropped in the future.
+ * You should use the parallel API from GattServer directly. A former call
+ * to ble.onUpdatesEnabled(...) should be replaced with
+ * ble.gattServer().onUpdatesEnabled(...).
+ */
+ void onUpdatesEnabled(GattServer::EventCallback_t callback) {
+ gattServer().onUpdatesEnabled(callback);
+ }
+
void onUpdatesDisabled(GattServer::EventCallback_t callback);
void onConfirmationReceived(GattServer::EventCallback_t callback);
@@ -1299,12 +1311,6 @@
}
inline void
-BLE::onUpdatesEnabled(GattServer::EventCallback_t callback)
-{
- transport->getGattServer().setOnUpdatesEnabled(callback);
-}
-
-inline void
BLE::onUpdatesDisabled(GattServer::EventCallback_t callback)
{
transport->getGattServer().setOnUpdatesDisabled(callback);
--- 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;
