fork
Fork of nRF51822 by
nRF51SecurityManager.h@356:55ede9fd5279, 2015-06-19 (annotated)
- Committer:
- rgrover1
- Date:
- Fri Jun 19 15:55:37 2015 +0100
- Revision:
- 356:55ede9fd5279
- Child:
- 360:7c68c8d67e1f
Synchronized with git rev 954c08e8
Author: Rohit Grover
add support for SecurityManager
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rgrover1 | 356:55ede9fd5279 | 1 | /* mbed Microcontroller Library |
rgrover1 | 356:55ede9fd5279 | 2 | * Copyright (c) 2006-2013 ARM Limited |
rgrover1 | 356:55ede9fd5279 | 3 | * |
rgrover1 | 356:55ede9fd5279 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
rgrover1 | 356:55ede9fd5279 | 5 | * you may not use this file except in compliance with the License. |
rgrover1 | 356:55ede9fd5279 | 6 | * You may obtain a copy of the License at |
rgrover1 | 356:55ede9fd5279 | 7 | * |
rgrover1 | 356:55ede9fd5279 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
rgrover1 | 356:55ede9fd5279 | 9 | * |
rgrover1 | 356:55ede9fd5279 | 10 | * Unless required by applicable law or agreed to in writing, software |
rgrover1 | 356:55ede9fd5279 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
rgrover1 | 356:55ede9fd5279 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
rgrover1 | 356:55ede9fd5279 | 13 | * See the License for the specific language governing permissions and |
rgrover1 | 356:55ede9fd5279 | 14 | * limitations under the License. |
rgrover1 | 356:55ede9fd5279 | 15 | */ |
rgrover1 | 356:55ede9fd5279 | 16 | |
rgrover1 | 356:55ede9fd5279 | 17 | #ifndef __NRF51822_SECURITY_MANAGER_H__ |
rgrover1 | 356:55ede9fd5279 | 18 | #define __NRF51822_SECURITY_MANAGER_H__ |
rgrover1 | 356:55ede9fd5279 | 19 | |
rgrover1 | 356:55ede9fd5279 | 20 | #include <stddef.h> |
rgrover1 | 356:55ede9fd5279 | 21 | |
rgrover1 | 356:55ede9fd5279 | 22 | #include "SecurityManager.h" |
rgrover1 | 356:55ede9fd5279 | 23 | #include "btle_security.h" |
rgrover1 | 356:55ede9fd5279 | 24 | |
rgrover1 | 356:55ede9fd5279 | 25 | class nRF51SecurityManager : public SecurityManager |
rgrover1 | 356:55ede9fd5279 | 26 | { |
rgrover1 | 356:55ede9fd5279 | 27 | public: |
rgrover1 | 356:55ede9fd5279 | 28 | static nRF51SecurityManager &getInstance(); |
rgrover1 | 356:55ede9fd5279 | 29 | |
rgrover1 | 356:55ede9fd5279 | 30 | /* Functions that must be implemented from SecurityManager */ |
rgrover1 | 356:55ede9fd5279 | 31 | virtual ble_error_t init(bool enableBonding, |
rgrover1 | 356:55ede9fd5279 | 32 | bool requireMITM, |
rgrover1 | 356:55ede9fd5279 | 33 | SecurityIOCapabilities_t iocaps, |
rgrover1 | 356:55ede9fd5279 | 34 | const Passkey_t passkey) { |
rgrover1 | 356:55ede9fd5279 | 35 | return btle_initializeSecurity(enableBonding, requireMITM, iocaps, passkey); |
rgrover1 | 356:55ede9fd5279 | 36 | } |
rgrover1 | 356:55ede9fd5279 | 37 | |
rgrover1 | 356:55ede9fd5279 | 38 | virtual ble_error_t getLinkSecurity(Gap::Handle_t connectionHandle, LinkSecurityStatus_t *securityStatusP) { |
rgrover1 | 356:55ede9fd5279 | 39 | return btle_getLinkSecurity(connectionHandle, securityStatusP); |
rgrover1 | 356:55ede9fd5279 | 40 | } |
rgrover1 | 356:55ede9fd5279 | 41 | |
rgrover1 | 356:55ede9fd5279 | 42 | virtual ble_error_t purgeAllBondingState(void) { |
rgrover1 | 356:55ede9fd5279 | 43 | return btle_purgeAllBondingState(); |
rgrover1 | 356:55ede9fd5279 | 44 | } |
rgrover1 | 356:55ede9fd5279 | 45 | |
rgrover1 | 356:55ede9fd5279 | 46 | public: |
rgrover1 | 356:55ede9fd5279 | 47 | nRF51SecurityManager() { |
rgrover1 | 356:55ede9fd5279 | 48 | /* empty */ |
rgrover1 | 356:55ede9fd5279 | 49 | } |
rgrover1 | 356:55ede9fd5279 | 50 | |
rgrover1 | 356:55ede9fd5279 | 51 | private: |
rgrover1 | 356:55ede9fd5279 | 52 | nRF51SecurityManager(const nRF51SecurityManager &); |
rgrover1 | 356:55ede9fd5279 | 53 | const nRF51SecurityManager& operator=(const nRF51SecurityManager &); |
rgrover1 | 356:55ede9fd5279 | 54 | }; |
rgrover1 | 356:55ede9fd5279 | 55 | |
rgrover1 | 356:55ede9fd5279 | 56 | #endif // ifndef __NRF51822_SECURITY_MANAGER_H__ |