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: LinkNode_SimpleChatwithSerial
Fork of BLE_API by
Diff: ble/Gap.h
- Revision:
- 800:3bf180b7a3a5
- Parent:
- 786:d6d7087d8377
- Child:
- 802:94f23e2ff37e
--- a/ble/Gap.h Tue Sep 29 09:47:50 2015 +0100
+++ b/ble/Gap.h Tue Sep 29 09:47:50 2015 +0100
@@ -901,6 +901,16 @@
void onDisconnection(DisconnectionEventCallback_t callback) {disconnectionCallback = callback;}
/**
+ * Append to a chain of callbacks to be invoked upon connection; these
+ * callbacks receive no context and are therefore different from the
+ * connectionCallback callback.
+ * @param callback
+ * function pointer to be invoked upon connection; receives no context.
+ */
+ template<typename T>
+ void addToConnectionCallChain(T *tptr, void (T::*mptr)(void)) {connectionCallChain.add(tptr, mptr);}
+
+ /**
* Append to a chain of callbacks to be invoked upon disconnection; these
* callbacks receive no context and are therefore different from the
* disconnectionCallback callback.
@@ -960,6 +970,7 @@
disconnectionCallback(NULL),
radioNotificationCallback(),
onAdvertisementReport(),
+ connectionCallChain(),
disconnectionCallChain() {
_advPayload.clear();
_scanResponse.clear();
@@ -979,6 +990,7 @@
ConnectionCallbackParams_t callbackParams(handle, role, peerAddrType, peerAddr, ownAddrType, ownAddr, connectionParams);
connectionCallback(&callbackParams);
}
+ connectionCallChain.call();
}
void processDisconnectionEvent(Handle_t handle, DisconnectionReason_t reason) {
@@ -1026,6 +1038,7 @@
DisconnectionEventCallback_t disconnectionCallback;
RadioNotificationEventCallback_t radioNotificationCallback;
AdvertisementReportCallback_t onAdvertisementReport;
+ CallChain connectionCallChain;
CallChain disconnectionCallChain;
private:
