From d07eac2383389fb867bc763ba64a83c46d864e32 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Fri, 8 May 2015 10:29:58 +0100 Subject: [PATCH] add SecurityProcedureInitiatedCallback_t --- public/BLEDevice.h | 6 +++--- public/Gap.h | 31 ++++++++++++++++--------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/public/BLEDevice.h b/public/BLEDevice.h index 1e7cf73..3642dff 100644 --- a/public/BLEDevice.h +++ b/public/BLEDevice.h @@ -333,7 +333,7 @@ public: /** * Setup a callback for when the security procedure for a link has started. */ - void onSecuritySetupStarted(Gap::HandleSpecificEvent_t callback); + void onSecurityProcedureInitiated(Gap::SecurityProcedureInitiatedCallback_t callback); /** * Setup a callback for when the security procedure for a link has @@ -768,9 +768,9 @@ BLEDevice::onRadioNotification(Gap::RadioNotificationEventCallback_t callback) } inline void -BLEDevice::onSecuritySetupStarted(Gap::HandleSpecificEvent_t callback) +BLEDevice::onSecurityProcedureInitiated(Gap::SecurityProcedureInitiatedCallback_t callback) { - transport->getGap().setOnSecuritySetupStarted(callback); + transport->getGap().setonSecurityProcedureInitiated(callback); } inline void diff --git a/public/Gap.h b/public/Gap.h index 602bab3..2e07e6a 100644 --- a/public/Gap.h +++ b/public/Gap.h @@ -111,6 +111,7 @@ public: 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. */ + typedef void (*SecurityProcedureInitiatedCallback_t)(Handle_t, bool allowBonding, bool requireMITM, SecurityIOCapabilities_t iocaps); friend class BLEDevice; private: @@ -158,7 +159,7 @@ protected: /** * To indicate that security procedure for link has started. */ - virtual void setOnSecuritySetupStarted(HandleSpecificEvent_t callback) {onSecuritySetupStarted = callback;} + virtual void setonSecurityProcedureInitiated(SecurityProcedureInitiatedCallback_t callback) {onSecurityProcedureInitiated = callback;} /** * To indicate that security procedure for link has completed. @@ -205,7 +206,7 @@ protected: onConnection(NULL), onDisconnection(NULL), onRadioNotification(), - onSecuritySetupStarted(), + onSecurityProcedureInitiated(), onSecuritySetupCompleted(), onLinkSecured(), onSecurityContextStored(), @@ -229,9 +230,9 @@ public: disconnectionCallChain.call(); } - void processSecuritySetupStartedEvent(Handle_t handle) { - if (onSecuritySetupStarted) { - onSecuritySetupStarted(handle); + void processSecurityProcedureInitiatedEvent(Handle_t handle, bool allowBonding, bool requireMITM, SecurityIOCapabilities_t iocaps) { + if (onSecurityProcedureInitiated) { + onSecurityProcedureInitiated(handle, allowBonding, requireMITM, iocaps); } } @@ -267,18 +268,18 @@ public: } protected: - GapState_t state; + GapState_t state; protected: - EventCallback_t onTimeout; - ConnectionEventCallback_t onConnection; - DisconnectionEventCallback_t onDisconnection; - RadioNotificationEventCallback_t onRadioNotification; - HandleSpecificEvent_t onSecuritySetupStarted; - HandleSpecificEvent_t onSecuritySetupCompleted; - HandleSpecificEvent_t onLinkSecured; - HandleSpecificEvent_t onSecurityContextStored; - CallChain disconnectionCallChain; + EventCallback_t onTimeout; + ConnectionEventCallback_t onConnection; + DisconnectionEventCallback_t onDisconnection; + RadioNotificationEventCallback_t onRadioNotification; + SecurityProcedureInitiatedCallback_t onSecurityProcedureInitiated; + HandleSpecificEvent_t onSecuritySetupCompleted; + HandleSpecificEvent_t onLinkSecured; + HandleSpecificEvent_t onSecurityContextStored; + CallChain disconnectionCallChain; private: /* disallow copy and assignment */