just a fork

Fork of BLE_API by Bluetooth Low Energy

Revision:
816:2b4f0ef8c06e
Parent:
815:907530c64cd5
Child:
829:9072de50087b
--- a/ble/Gap.h	Tue Sep 29 09:49:22 2015 +0100
+++ b/ble/Gap.h	Tue Sep 29 09:49:22 2015 +0100
@@ -301,9 +301,11 @@
     }
 
     /**
-     * Update connection parameters while in the peripheral role.
-     * @details In the peripheral role, this will send the corresponding L2CAP request to the connected peer and wait for
-     *          the central to perform the procedure.
+     * Update connection parameters.
+     * In the central role this will initiate a Link Layer connection parameter update procedure,
+     * otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for
+     * the central to perform the procedure.
+     *
      * @param[in] handle
      *              Connection Handle
      * @param[in] params
@@ -901,6 +903,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 +972,7 @@
         disconnectionCallback(NULL),
         radioNotificationCallback(),
         onAdvertisementReport(),
+        connectionCallChain(),
         disconnectionCallChain() {
         _advPayload.clear();
         _scanResponse.clear();
@@ -979,6 +992,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 +1040,7 @@
     DisconnectionEventCallback_t     disconnectionCallback;
     RadioNotificationEventCallback_t radioNotificationCallback;
     AdvertisementReportCallback_t    onAdvertisementReport;
+    CallChain                        connectionCallChain;
     CallChain                        disconnectionCallChain;
 
 private: