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/BLE.h
- Revision:
- 875:25480c83e3cc
- Parent:
- 874:0607a58418ce
- Child:
- 876:f7e9b70920ad
diff -r 0607a58418ce -r 25480c83e3cc ble/BLE.h
--- a/ble/BLE.h Tue Nov 03 12:51:24 2015 +0000
+++ b/ble/BLE.h Tue Nov 03 12:51:24 2015 +0000
@@ -22,6 +22,8 @@
#include "GattServer.h"
#include "GattClient.h"
+#include "ble/FunctionPointerWithContext.h"
+
#ifdef YOTTA_CFG_MBED_OS
#include "mbed-drivers/mbed_error.h"
#else
@@ -75,7 +77,7 @@
* context where ordering is compiler specific and can't be guaranteed--it
* is safe to call BLE::init() from within main().
*
- * @param callback
+ * @param initCompleteCallback
* A callback for when initialization completes for a BLE
* instance. This is an optional parameter, if no callback is
* setup the application can still determine the status of
@@ -100,14 +102,20 @@
* function-pointer, init() can also take an <Object, member> tuple as its
* callback target.
*/
- ble_error_t init(InitializationCompleteCallback_t callback = NULL);
+ ble_error_t init(InitializationCompleteCallback_t initCompleteCallback = NULL) {
+ FunctionPointerWithContext<InitializationCompleteCallbackContext *> callback(initCompleteCallback);
+ initImplementation(callback);
+ }
/**
* An alternate declaration for init(). This one takes an <Object, member> tuple as its
* callback target.
*/
template<typename T>
- ble_error_t init(T *object, void (T::*initCompleteCallback)(InitializationCompleteCallbackContext *context));
+ ble_error_t init(T *object, void (T::*initCompleteCallback)(InitializationCompleteCallbackContext *context)) {
+ FunctionPointerWithContext<InitializationCompleteCallbackContext *> callback(object, initCompleteCallback);
+ initImplementation(callback);
+ }
/**
* @return true if initialization has completed for the underlying BLE
@@ -1413,6 +1421,9 @@
}
private:
+ ble_error_t BLE::initImplementation(FunctionPointerWithContext<InitializationCompleteCallbackContext *> callback);
+
+private:
BLE(const BLE&);
BLE &operator=(const BLE &);
