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 686:1962fb48d9ef, committed 2015-06-19
- Comitter:
- rgrover1
- Date:
- Fri Jun 19 15:53:03 2015 +0100
- Parent:
- 685:676b116f7be2
- Child:
- 687:85b0a8f457a1
- Commit message:
- Synchronized with git rev 692fe6d4
Author: Rohit Grover
setup Gap::onConnection()
Changed in this revision
| public/BLE.h | Show annotated file Show diff for this revision Revisions of this file |
| public/Gap.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/public/BLE.h Fri Jun 19 15:53:03 2015 +0100
+++ b/public/BLE.h Fri Jun 19 15:53:03 2015 +0100
@@ -1066,7 +1066,18 @@
gap().onTimeout(timeoutCallback);
}
- void onConnection(Gap::ConnectionEventCallback_t connectionCallback);
+ /**
+ * Setup a callback for connection events. Refer to Gap::ConnectionEventCallback_t.
+ *
+ * @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.onConnection(callback) should be replaced with
+ * ble.gap().onConnection(callback).
+ */
+ void onConnection(Gap::ConnectionEventCallback_t connectionCallback) {
+ gap().onConnection(connectionCallback);
+ }
+
/**
* Used to setup a callback for GAP disconnection.
*/
@@ -1168,12 +1179,6 @@
* transport.*/
inline void
-BLE::onConnection(Gap::ConnectionEventCallback_t connectionCallback)
-{
- gap().setOnConnection(connectionCallback);
-}
-
-inline void
BLE::onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback)
{
gap().setOnDisconnection(disconnectionCallback);
--- a/public/Gap.h Fri Jun 19 15:53:03 2015 +0100
+++ b/public/Gap.h Fri Jun 19 15:53:03 2015 +0100
@@ -255,7 +255,7 @@
* @param scanParams
* Paramters to be used while scanning for the peer.
* @return BLE_ERROR_NONE if connection establishment procedure is started
- * successfully. The onConnection callback (if set) will be invoked upon
+ * successfully. The connectionCallback (if set) will be invoked upon
* a connection event.
*/
virtual ble_error_t connect(const Address_t peerAddr,
@@ -760,7 +760,10 @@
*/
void onTimeout(TimeoutEventCallback_t callback) {timeoutCallback = callback;}
- void setOnConnection(ConnectionEventCallback_t callback) {onConnection = callback;}
+ /**
+ * Setup a callback for connection events. Refer to ConnectionEventCallback_t.
+ */
+ void onConnection(ConnectionEventCallback_t callback) {connectionCallback = callback;}
/**
* Set the application callback for disconnection events.
@@ -827,7 +830,7 @@
_scanResponse(),
state(),
timeoutCallback(NULL),
- onConnection(NULL),
+ connectionCallback(NULL),
onDisconnection(NULL),
onRadioNotification(),
onSecuritySetupInitiated(),
@@ -850,9 +853,9 @@
const Address_t ownAddr,
const ConnectionParams_t *connectionParams) {
state.connected = 1;
- if (onConnection) {
+ if (connectionCallback) {
ConnectionCallbackParams_t callbackParams(handle, role, peerAddrType, peerAddr, ownAddrType, ownAddr, connectionParams);
- onConnection(&callbackParams);
+ connectionCallback(&callbackParams);
}
}
@@ -926,7 +929,7 @@
protected:
TimeoutEventCallback_t timeoutCallback;
- ConnectionEventCallback_t onConnection;
+ ConnectionEventCallback_t connectionCallback;
DisconnectionEventCallback_t onDisconnection;
RadioNotificationEventCallback_t onRadioNotification;
SecuritySetupInitiatedCallback_t onSecuritySetupInitiated;
