fka mod

Fork of BLE_API by Bluetooth Low Energy

Revision:
1131:692ddf04fc42
Parent:
1129:85ee56c4f469
Child:
1135:22aada733dbd
--- a/ble/SecurityManager.h	Tue Jan 12 19:47:52 2016 +0000
+++ b/ble/SecurityManager.h	Wed Apr 06 19:13:46 2016 +0100
@@ -20,7 +20,6 @@
 #include <stdint.h>
 
 #include "Gap.h"
-#include "CallChainOfFunctionPointersWithContext.h"
 
 class SecurityManager {
 public:
@@ -83,9 +82,6 @@
     typedef void (*LinkSecuredCallback_t)(Gap::Handle_t handle, SecurityMode_t securityMode);
     typedef void (*PasskeyDisplayCallback_t)(Gap::Handle_t handle, const Passkey_t passkey);
 
-    typedef FunctionPointerWithContext<const SecurityManager *> SecurityManagerShutdownCallback_t;
-    typedef CallChainOfFunctionPointersWithContext<const SecurityManager *> SecurityManagerShutdownCallbackChain_t;
-
     /*
      * The following functions are meant to be overridden in the platform-specific sub-class.
      */
@@ -124,7 +120,7 @@
      * @param[in]  connectionHandle   Handle to identify the connection.
      * @param[out] securityStatusP    Security status.
      *
-     * @return BLE_ERROR_NONE or appropriate error code indicating the failure reason.
+     * @return BLE_SUCCESS or appropriate error code indicating the failure reason.
      */
     virtual ble_error_t getLinkSecurity(Gap::Handle_t connectionHandle, LinkSecurityStatus_t *securityStatusP) {
         /* Avoid compiler warnings about unused variables. */
@@ -135,23 +131,6 @@
     }
 
     /**
-     * Set the security mode on a connection. Useful for elevating the security mode
-     * once certain conditions are met, e.g., a particular service is found.
-     *
-     * @param[in]  connectionHandle   Handle to identify the connection.
-     * @param[in]  securityMode       Requested security mode.
-     *
-     * @return BLE_ERROR_NONE or appropriate error code indicating the failure reason.
-     */
-    virtual ble_error_t setLinkSecurity(Gap::Handle_t connectionHandle, SecurityMode_t securityMode) {
-        /* Avoid compiler warnings about unused variables. */
-        (void)connectionHandle;
-        (void)securityMode;
-
-        return BLE_ERROR_NOT_IMPLEMENTED;
-    }
-
-    /**
      * Delete all peer device context and all related bonding information from
      * the database within the security manager.
      *
@@ -163,63 +142,9 @@
         return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if security is supported. */
     }
 
-    /**
-     * Get a list of addresses from all peers in the bond table.
-     *
-     * @param[in/out]   addresses
-     *                  (on input) addresses.capacity contains the maximum
-     *                  number of addresses to be returned.
-     *                  (on output) The populated table with copies of the
-     *                  addresses in the implementation's whitelist.
-     *
-     * @retval BLE_ERROR_NONE             On success, else an error code indicating reason for failure.
-     * @retval BLE_ERROR_INVALID_STATE    If the API is called without module initialization or
-     *                                    application registration.
-     *
-     * @experimental
-     */
-    virtual ble_error_t getAddressesFromBondTable(Gap::Whitelist_t &addresses) const {
-        /* Avoid compiler warnings about unused variables */
-        (void) addresses;
-
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if security is supported. */
-    }
-
     /* Event callback handlers. */
 public:
     /**
-     * Setup a callback to be invoked to notify the user application that the
-     * SecurityManager instance is about to shutdown (possibly as a result of a call
-     * to BLE::shutdown()).
-     *
-     * @Note: It is possible to chain together multiple onShutdown callbacks
-     * (potentially from different modules of an application) to be notified
-     * before the SecurityManager is shutdown.
-     *
-     * @Note: It is also possible to set up a callback into a member function of
-     * some object.
-     *
-     * @Note It is possible to unregister a callback using onShutdown().detach(callback)
-     */
-    void onShutdown(const SecurityManagerShutdownCallback_t& callback) {
-        shutdownCallChain.add(callback);
-    }
-    template <typename T>
-    void onShutdown(T *objPtr, void (T::*memberPtr)(void)) {
-        shutdownCallChain.add(objPtr, memberPtr);
-    }
-
-    /**
-     * @brief provide access to the callchain of shutdown event callbacks
-     * It is possible to register callbacks using onShutdown().add(callback);
-     * It is possible to unregister callbacks using onShutdown().detach(callback)
-     * @return The shutdown event callbacks chain
-     */
-    SecurityManagerShutdownCallbackChain_t& onShutdown() {
-        return shutdownCallChain;
-    }
-
-    /**
      * To indicate that a security procedure for the link has started.
      */
     virtual void onSecuritySetupInitiated(SecuritySetupInitiatedCallback_t callback) {securitySetupInitiatedCallback = callback;}
@@ -289,43 +214,12 @@
         /* empty */
     }
 
-public:
-    /**
-     * Notify all registered onShutdown callbacks that the SecurityManager is
-     * about to be shutdown and clear all SecurityManager state of the
-     * associated object.
-     *
-     * This function is meant to be overridden in the platform-specific
-     * sub-class. Nevertheless, the sub-class is only expected to reset its
-     * state and not the data held in SecurityManager members. This shall be
-     * achieved by a call to SecurityManager::reset() from the sub-class'
-     * reset() implementation.
-     *
-     * @return BLE_ERROR_NONE on success.
-     */
-    virtual ble_error_t reset(void) {
-        /* Notify that the instance is about to shutdown */
-        shutdownCallChain.call(this);
-        shutdownCallChain.clear();
-
-        securitySetupInitiatedCallback = NULL;
-        securitySetupCompletedCallback = NULL;
-        linkSecuredCallback            = NULL;
-        securityContextStoredCallback  = NULL;
-        passkeyDisplayCallback         = NULL;
-
-        return BLE_ERROR_NONE;
-    }
-
 protected:
     SecuritySetupInitiatedCallback_t securitySetupInitiatedCallback;
     SecuritySetupCompletedCallback_t securitySetupCompletedCallback;
     LinkSecuredCallback_t            linkSecuredCallback;
     HandleSpecificEvent_t            securityContextStoredCallback;
     PasskeyDisplayCallback_t         passkeyDisplayCallback;
-
-private:
-    SecurityManagerShutdownCallbackChain_t shutdownCallChain;
 };
 
 #endif /*__SECURITY_MANAGER_H__*/
\ No newline at end of file