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: BLE_PowerBank_HeyFaradey
Fork of BLE_API by
Diff: public/Gap.h
- Revision:
- 453:c8f73026ee16
- Parent:
- 452:73b096a7f481
- Child:
- 514:1fa338281798
diff -r 73b096a7f481 -r c8f73026ee16 public/Gap.h
--- a/public/Gap.h Fri Jun 19 15:51:57 2015 +0100
+++ b/public/Gap.h Fri Jun 19 15:51:57 2015 +0100
@@ -92,6 +92,34 @@
};
typedef FunctionPointerWithContext<const AdvertisementCallbackParams_t *> AdvertisementReportCallback_t;
+ struct ConnectionCallbackParams_t {
+ Handle_t handle;
+ Role_t role;
+ AddressType_t peerAddrType;
+ Address_t peerAddr;
+ AddressType_t ownAddrType;
+ Address_t ownAddr;
+ const ConnectionParams_t *connectionParams;
+
+ ConnectionCallbackParams_t(Handle_t handleIn,
+ Role_t roleIn,
+ AddressType_t peerAddrTypeIn,
+ const uint8_t *peerAddrIn,
+ AddressType_t ownAddrTypeIn,
+ const uint8_t *ownAddrIn,
+ const ConnectionParams_t *connectionParamsIn) :
+ handle(handleIn),
+ role(roleIn),
+ peerAddrType(peerAddrTypeIn),
+ peerAddr(),
+ ownAddrType(ownAddrTypeIn),
+ ownAddr(),
+ connectionParams(connectionParamsIn) {
+ memcpy(peerAddr, peerAddrIn, ADDR_LEN);
+ memcpy(ownAddr, ownAddrIn, ADDR_LEN);
+ }
+ };
+
enum SecurityMode_t {
SECURITY_MODE_NO_ACCESS,
SECURITY_MODE_ENCRYPTION_OPEN_LINK, /**< require no protection, open link. */
@@ -157,10 +185,7 @@
}
typedef void (*EventCallback_t)(void);
- typedef void (*ConnectionEventCallback_t)(Handle_t,
- AddressType_t peerAddrType, const Address_t peerAddr,
- AddressType_t ownAddrType, const Address_t ownAddr,
- const ConnectionParams_t *);
+ typedef void (*ConnectionEventCallback_t)(const ConnectionCallbackParams_t *params);
typedef void (*HandleSpecificEvent_t)(Handle_t handle);
typedef void (*DisconnectionEventCallback_t)(Handle_t, DisconnectionReason_t);
typedef void (*RadioNotificationEventCallback_t) (bool radio_active); /* gets passed true for ACTIVE; false for INACTIVE. */
@@ -310,14 +335,16 @@
public:
void processConnectionEvent(Handle_t handle,
+ Role_t role,
AddressType_t peerAddrType,
const Address_t peerAddr,
AddressType_t ownAddrType,
const Address_t ownAddr,
- const ConnectionParams_t *params) {
+ const ConnectionParams_t *connectionParams) {
state.connected = 1;
if (onConnection) {
- onConnection(handle, peerAddrType, peerAddr, ownAddrType, ownAddr, params);
+ ConnectionCallbackParams_t callbackParams(handle, role, peerAddrType, peerAddr, ownAddrType, ownAddr, connectionParams);
+ onConnection(&callbackParams);
}
}
