test
Fork of nRF51822 by
btle/btle_security.h@362:6fa0d4d555f6, 2015-07-02 (annotated)
- Committer:
- rgrover1
- Date:
- Thu Jul 02 09:08:44 2015 +0100
- Revision:
- 362:6fa0d4d555f6
- Parent:
- 361:d2405f5a4853
- Child:
- 370:295f76db798e
Synchronized with git rev 2716309c
Author: Rohit Grover
Release 0.4.0
=============
This is a major release which introduces the GATT Client functionality. It
aligns with release 0.4.0 of BLE_API.
Enhancements
~~~~~~~~~~~~
* Introduce GattClient. This includes functionality for service-discovery,
connections, and attribute-reads and writes. You'll find a demo program for
LEDBlinker on the mbed.org Bluetooth team page to use the new APIs. Some of
the GATT client functionality hasn't been implemented yet, but the APIs have
been added.
* We've added an implementation for the abstract base class for
SecurityManager. All security related APIs have been moved into that.
* There has been a major cleanup of APIs under BLE. APIs have now been
categorized as belonging to Gap, GattServer, GattClient, or SecurityManager.
There are accessors to get references for Gap, GattServer, GattClient, and
SecurityManager. A former call to ble.setAddress(...) is now expected to be
achieved with ble.gap().setAddress(...).
* We've cleaned up our APIs, and this has resulted in dropping some APIs like
BLE::reset().
* We've also dropped GattServer::initializeGattDatabase(). THis was added at
some point to support controllers where a commit point was needed to
indicate when the application had finished constructing the GATT database.
This API would get called internally before Gap::startAdvertising(). We now
expect the underlying port to do the equivalent of initializeGattDatabase()
implicitly upon Gap::startAdvertising().
* We've added a version of Gap::disconnect() which takes a connection handle.
The previous API (which did not take a connection handle) has been
deprecated; it will still work for situations where there's only a single
active connection. We hold on to that API to allow existing code to migrate
to the new API.
Bugfixes
~~~~~~~~
* None.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rgrover1 | 134:df7e7964a9c3 | 1 | /* mbed Microcontroller Library |
rgrover1 | 134:df7e7964a9c3 | 2 | * Copyright (c) 2006-2013 ARM Limited |
rgrover1 | 134:df7e7964a9c3 | 3 | * |
rgrover1 | 134:df7e7964a9c3 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
rgrover1 | 134:df7e7964a9c3 | 5 | * you may not use this file except in compliance with the License. |
rgrover1 | 134:df7e7964a9c3 | 6 | * You may obtain a copy of the License at |
rgrover1 | 134:df7e7964a9c3 | 7 | * |
rgrover1 | 134:df7e7964a9c3 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
rgrover1 | 134:df7e7964a9c3 | 9 | * |
rgrover1 | 134:df7e7964a9c3 | 10 | * Unless required by applicable law or agreed to in writing, software |
rgrover1 | 134:df7e7964a9c3 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
rgrover1 | 134:df7e7964a9c3 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
rgrover1 | 134:df7e7964a9c3 | 13 | * See the License for the specific language governing permissions and |
rgrover1 | 134:df7e7964a9c3 | 14 | * limitations under the License. |
rgrover1 | 134:df7e7964a9c3 | 15 | */ |
rgrover1 | 134:df7e7964a9c3 | 16 | |
rgrover1 | 134:df7e7964a9c3 | 17 | #ifndef _BTLE_SECURITY_H_ |
rgrover1 | 134:df7e7964a9c3 | 18 | #define _BTLE_SECURITY_H_ |
rgrover1 | 134:df7e7964a9c3 | 19 | |
rgrover1 | 362:6fa0d4d555f6 | 20 | #include "ble/Gap.h" |
rgrover1 | 362:6fa0d4d555f6 | 21 | #include "ble/SecurityManager.h" |
rgrover1 | 149:f6a9caa8c565 | 22 | |
rgrover1 | 134:df7e7964a9c3 | 23 | /** |
rgrover1 | 134:df7e7964a9c3 | 24 | * Enable Nordic's Device Manager, which brings in functionality from the |
rgrover1 | 134:df7e7964a9c3 | 25 | * stack's Security Manager. The Security Manager implements the actual |
rgrover1 | 134:df7e7964a9c3 | 26 | * cryptographic algorithms and protocol exchanges that allow two devices to |
rgrover1 | 134:df7e7964a9c3 | 27 | * securely exchange data and privately detect each other. |
rgrover1 | 134:df7e7964a9c3 | 28 | * |
rgrover1 | 150:44c40836c82f | 29 | * @param[in] enableBonding Allow for bonding. |
rgrover1 | 150:44c40836c82f | 30 | * @param[in] requireMITM Require protection for man-in-the-middle attacks. |
rgrover1 | 150:44c40836c82f | 31 | * @param[in] iocaps To specify IO capabilities of this peripheral, |
rgrover1 | 150:44c40836c82f | 32 | * such as availability of a display or keyboard to |
rgrover1 | 150:44c40836c82f | 33 | * support out-of-band exchanges of security data. |
rgrover1 | 150:44c40836c82f | 34 | * @param[in] passkey To specify a static passkey. |
rgrover1 | 150:44c40836c82f | 35 | * |
rgrover1 | 134:df7e7964a9c3 | 36 | * @return BLE_ERROR_NONE on success. |
rgrover1 | 134:df7e7964a9c3 | 37 | */ |
rgrover1 | 362:6fa0d4d555f6 | 38 | ble_error_t btle_initializeSecurity(bool enableBonding = true, |
rgrover1 | 362:6fa0d4d555f6 | 39 | bool requireMITM = true, |
rgrover1 | 362:6fa0d4d555f6 | 40 | SecurityManager::SecurityIOCapabilities_t iocaps = SecurityManager::IO_CAPS_NONE, |
rgrover1 | 362:6fa0d4d555f6 | 41 | const SecurityManager::Passkey_t passkey = NULL); |
rgrover1 | 134:df7e7964a9c3 | 42 | |
rgrover1 | 137:aafab7b0a8bd | 43 | /** |
rgrover1 | 138:750eca573e18 | 44 | * Get the security status of a link. |
rgrover1 | 138:750eca573e18 | 45 | * |
rgrover1 | 138:750eca573e18 | 46 | * @param[in] connectionHandle |
rgrover1 | 138:750eca573e18 | 47 | * Handle to identify the connection. |
rgrover1 | 138:750eca573e18 | 48 | * @param[out] securityStatusP |
rgrover1 | 138:750eca573e18 | 49 | * security status. |
rgrover1 | 138:750eca573e18 | 50 | * |
rgrover1 | 138:750eca573e18 | 51 | * @return BLE_SUCCESS Or appropriate error code indicating reason for failure. |
rgrover1 | 138:750eca573e18 | 52 | */ |
rgrover1 | 362:6fa0d4d555f6 | 53 | ble_error_t btle_getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP); |
rgrover1 | 138:750eca573e18 | 54 | |
rgrover1 | 138:750eca573e18 | 55 | /** |
rgrover1 | 137:aafab7b0a8bd | 56 | * Function for deleting all peer device context and all related bonding |
rgrover1 | 137:aafab7b0a8bd | 57 | * information from the database. |
rgrover1 | 137:aafab7b0a8bd | 58 | * |
rgrover1 | 137:aafab7b0a8bd | 59 | * @retval BLE_ERROR_NONE On success, else an error code indicating reason for failure. |
rgrover1 | 137:aafab7b0a8bd | 60 | * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization and/or |
rgrover1 | 137:aafab7b0a8bd | 61 | * application registration. |
rgrover1 | 137:aafab7b0a8bd | 62 | */ |
rgrover1 | 140:3a5282e3f30c | 63 | ble_error_t btle_purgeAllBondingState(void); |
rgrover1 | 137:aafab7b0a8bd | 64 | |
rgrover1 | 134:df7e7964a9c3 | 65 | #endif /* _BTLE_SECURITY_H_ */ |