BLE_API_Tiny_BLE
Fork of BLE_API by
Revision 360:7d37e1adef33, committed 2015-05-08
- Comitter:
- rgrover1
- Date:
- Fri May 08 15:35:47 2015 +0100
- Parent:
- 359:611485c370f5
- Child:
- 361:9686f5c882fa
- Commit message:
- Synchronized with git rev 8eba398f
Author: Rohit Grover
move SecurityMode_t within Gap
Changed in this revision
public/Gap.h | Show annotated file Show diff for this revision Revisions of this file |
public/GattCharacteristic.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/public/Gap.h Fri May 08 15:35:47 2015 +0100 +++ b/public/Gap.h Fri May 08 15:35:47 2015 +0100 @@ -64,6 +64,14 @@ uint16_t connectionSupervisionTimeout; /**< Connection Supervision Timeout in 10 ms units, see @ref BLE_GAP_CP_LIMITS.*/ } ConnectionParams_t; + enum SecurityMode_t { + SECURITY_MODE_ENCRYPTION_OPEN_LINK = 0x00, /**< Set security mode to require no protection, open link. */ + SECURITY_MODE_ENCRYPTION_NO_MITM = 0x01, /**< Set security mode to require encryption, but no MITM protection. */ + SECURITY_MODE_ENCRYPTION_WITH_MITM = 0x02, /**< Set security mode to require encryption and MITM protection. */ + SECURITY_MODE_SIGNED_NO_MITM = 0x04, /**< Set security mode to require signing or encryption, but no MITM protection. */ + SECURITY_MODE_SIGNED_WITH_MITM = 0x08, /**< Set security mode to require signing or encryption, and MITM protection. */ + }; + /** * @brief Defines possible security status/states. *
--- a/public/GattCharacteristic.h Fri May 08 15:35:47 2015 +0100 +++ b/public/GattCharacteristic.h Fri May 08 15:35:47 2015 +0100 @@ -17,6 +17,7 @@ #ifndef __GATT_CHARACTERISTIC_H__ #define __GATT_CHARACTERISTIC_H__ +#include "Gap.h" #include "GattAttribute.h" #include "GattCharacteristicCallbackParams.h" #include "FunctionPointerWithContext.h" @@ -290,14 +291,6 @@ uint16_t gatt_nsdesc; /**< Namespace description from Bluetooth Assigned Numbers, normally '0', see @ref BLE_GATT_CPF_NAMESPACES. */ } presentation_format_t; - enum SecurityMode_t { - SECURITY_MODE_ENCRYPTION_OPEN_LINK = 0x00, /**< Set security mode to require no protection, open link. */ - SECURITY_MODE_ENCRYPTION_NO_MITM = 0x01, /**< Set security mode to require encryption, but no MITM protection. */ - SECURITY_MODE_ENCRYPTION_WITH_MITM = 0x02, /**< Set security mode to require encryption and MITM protection. */ - SECURITY_MODE_SIGNED_NO_MITM = 0x04, /**< Set security mode to require signing or encryption, but no MITM protection. */ - SECURITY_MODE_SIGNED_WITH_MITM = 0x08, /**< Set security mode to require signing or encryption, and MITM protection. */ - }; - /** * @brief Creates a new GattCharacteristic using the specified 16-bit * UUID, value length, and properties @@ -354,7 +347,7 @@ * * @param securityMode Can be one of encryption or signing, with or without protection for MITM (man in the middle attacks). */ - void requireSecurity(SecurityMode_t securityMode) { + void requireSecurity(Gap::SecurityMode_t securityMode) { _requiredSecurity = securityMode; } @@ -429,7 +422,7 @@ const GattAttribute& getValueAttribute() const {return _valueAttribute; } GattAttribute::Handle_t getValueHandle(void) const {return getValueAttribute().getHandle();} uint8_t getProperties(void) const {return _properties; } - SecurityMode_t getRequiredSecurity() const {return _requiredSecurity; } + Gap::SecurityMode_t getRequiredSecurity() const {return _requiredSecurity; } uint8_t getDescriptorCount(void) const {return _descriptorCount; } bool isReadAuthorizationEnabled() const {return enabledReadAuthorization; } bool isWriteAuthorizationEnabled() const {return enabledWriteAuthorization; } @@ -443,11 +436,11 @@ } private: - GattAttribute _valueAttribute; - uint8_t _properties; - SecurityMode_t _requiredSecurity; - GattAttribute **_descriptors; - uint8_t _descriptorCount; + GattAttribute _valueAttribute; + uint8_t _properties; + Gap::SecurityMode_t _requiredSecurity; + GattAttribute **_descriptors; + uint8_t _descriptorCount; bool enabledReadAuthorization; bool enabledWriteAuthorization;