High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Thu Nov 26 12:52:33 2015 +0000
Parent:
953:f6eb43f524b2
Child:
955:9228741f4c19
Commit message:
Synchronized with git rev b9cde859
Author: Vincent Coubard
Improve management of onConnection callback chain

Changed in this revision

ble/Gap.h Show annotated file Show diff for this revision Revisions of this file
--- a/ble/Gap.h	Thu Nov 26 12:52:33 2015 +0000
+++ b/ble/Gap.h	Thu Nov 26 12:52:33 2015 +0000
@@ -143,7 +143,9 @@
     typedef FunctionPointerWithContext<TimeoutSource_t> TimeoutEventCallback_t;
     typedef CallChainOfFunctionPointersWithContext<TimeoutSource_t> TimeoutEventCallbackChain_t;
 
-    typedef void (*ConnectionEventCallback_t)(const ConnectionCallbackParams_t *params);
+    typedef FunctionPointerWithContext<const ConnectionCallbackParams_t *> ConnectionEventCallback_t;
+    typedef CallChainOfFunctionPointersWithContext<const ConnectionCallbackParams_t *> ConnectionEventCallbackChain_t;
+
     typedef void (*DisconnectionEventCallback_t)(const DisconnectionCallbackParams_t *params);
     typedef FunctionPointerWithContext<bool> RadioNotificationEventCallback_t;
 
@@ -910,6 +912,10 @@
     template<typename T>
     void onConnection(T *tptr, void (T::*mptr)(const ConnectionCallbackParams_t*)) {connectionCallChain.add(tptr, mptr);}
 
+    ConnectionEventCallbackChain_t& onconnection() { 
+        return connectionCallChain;
+    }
+
     /**
      * Append to a chain of callbacks to be invoked upon GAP disconnection.
      */
@@ -1027,7 +1033,7 @@
     TimeoutEventCallbackChain_t           timeoutCallbackChain;
     RadioNotificationEventCallback_t radioNotificationCallback;
     AdvertisementReportCallback_t    onAdvertisementReport;
-    CallChainOfFunctionPointersWithContext<const ConnectionCallbackParams_t*>    connectionCallChain;
+    ConnectionEventCallbackChain_t connectionCallChain;
     CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t*> disconnectionCallChain;
 
 private: