test

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nRF5xSecurityManager.h Source File

nRF5xSecurityManager.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef __NRF51822_SECURITY_MANAGER_H__
00018 #define __NRF51822_SECURITY_MANAGER_H__
00019 
00020 #include <stddef.h>
00021 
00022 #include "ble/SecurityManager.h"
00023 #include "btle_security.h"
00024 
00025 class nRF5xSecurityManager : public SecurityManager
00026 {
00027 public:
00028     static nRF5xSecurityManager &getInstance();
00029 
00030     /* Functions that must be implemented from SecurityManager */
00031     virtual ble_error_t init(bool                     enableBonding,
00032                              bool                     requireMITM,
00033                              SecurityIOCapabilities_t iocaps,
00034                              const Passkey_t          passkey) {
00035         return btle_initializeSecurity(enableBonding, requireMITM, iocaps, passkey);
00036     }
00037 
00038     virtual ble_error_t getLinkSecurity(Gap::Handle_t connectionHandle, LinkSecurityStatus_t *securityStatusP) {
00039         return btle_getLinkSecurity(connectionHandle, securityStatusP);
00040     }
00041 
00042     virtual ble_error_t purgeAllBondingState(void) {
00043         return btle_purgeAllBondingState();
00044     }
00045 
00046 public:
00047     nRF5xSecurityManager() {
00048         /* empty */
00049     }
00050 
00051 private:
00052     nRF5xSecurityManager(const nRF5xSecurityManager &);
00053     const nRF5xSecurityManager& operator=(const nRF5xSecurityManager &);
00054 };
00055 
00056 #endif // ifndef __NRF51822_SECURITY_MANAGER_H__