abc

Fork of BLE_API by Bluetooth Low Energy

Revision:
360:7d37e1adef33
Parent:
355:58a4b9423365
Child:
373:7d8982606ef0
diff -r 611485c370f5 -r 7d37e1adef33 public/GattCharacteristic.h
--- 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;