add "LE Device Address" 0x1B to advertising data types
Fork of BLE_API by
Revision 1011:317d3b25018e, committed 2015-12-02
- Comitter:
- rgrover1
- Date:
- Wed Dec 02 12:57:28 2015 +0000
- Parent:
- 1010:54d83fdfb9ce
- Child:
- 1012:373c20c87fcd
- Commit message:
- Synchronized with git rev 87aeff34
Author: Andres Amaya Garcia
Allow GattAttributes to have fixed length
Previously the concepts of initLength and lenth were clearly separated.
However, this was at the cost of registering all characteristics in the
SoftDevice as having variable length. Clearly, this is not the desired
behaviour. Therefore, an additional field '_hasVariableLen' is added to the
GattAttribute to address the problem. Also, the GattAttribute and
GattCharacteristic constructors have been modified to take a boolean that
sets '_hasVariableLen'.
Changed in this revision
ble/GattAttribute.h | Show annotated file Show diff for this revision Revisions of this file |
ble/GattCharacteristic.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ble/GattAttribute.h Wed Dec 02 12:57:28 2015 +0000 +++ b/ble/GattAttribute.h Wed Dec 02 12:57:28 2015 +0000 @@ -37,6 +37,8 @@ * The length in bytes of this attribute's value. * @param[in] maxLen * The max length in bytes of this attribute's value. + * @param[in] hasVariableLen + * Whether the attribute's value length changes overtime. * * @section EXAMPLE * @@ -47,25 +49,27 @@ * * @endcode */ - GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t len = 0, uint16_t maxLen = 0) : - _uuid(uuid), _valuePtr(valuePtr), _lenMax(maxLen), _len(len), _handle() { + GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t len = 0, uint16_t maxLen = 0, bool hasVariableLen = true) : + _uuid(uuid), _valuePtr(valuePtr), _lenMax(maxLen), _len(len), _hasVariableLen(hasVariableLen), _handle() { /* Empty */ } public: - Handle_t getHandle(void) const {return _handle; } - const UUID &getUUID(void) const {return _uuid; } - uint16_t getLength(void) const {return _len; } - uint16_t getMaxLength(void) const {return _lenMax; } - uint16_t *getLengthPtr(void) {return &_len; } - void setHandle(Handle_t id) {_handle = id; } - uint8_t *getValuePtr(void) {return _valuePtr; } + Handle_t getHandle(void) const {return _handle; } + const UUID &getUUID(void) const {return _uuid; } + uint16_t getLength(void) const {return _len; } + uint16_t getMaxLength(void) const {return _lenMax; } + uint16_t *getLengthPtr(void) {return &_len; } + void setHandle(Handle_t id) {_handle = id; } + uint8_t *getValuePtr(void) {return _valuePtr; } + bool hasVariableLength(void) const {return _hasVariableLen;} private: - UUID _uuid; /* Characteristic UUID. */ + UUID _uuid; /* Characteristic UUID. */ uint8_t *_valuePtr; - uint16_t _lenMax; /* Maximum length of the value. */ - uint16_t _len; /* Current length of the value. */ + uint16_t _lenMax; /* Maximum length of the value. */ + uint16_t _len; /* Current length of the value. */ + bool _hasVariableLen; Handle_t _handle; private:
--- a/ble/GattCharacteristic.h Wed Dec 02 12:57:28 2015 +0000 +++ b/ble/GattCharacteristic.h Wed Dec 02 12:57:28 2015 +0000 @@ -311,6 +311,8 @@ * The length in bytes of this characteristic's value. * @param[in] maxLen * The max length in bytes of this characteristic's value. + * @param[in] hasVariableLen + * Whether the attribute's value length changes overtime. * @param[in] props * The 8-bit field containing the characteristic's properties. * @param[in] descriptors @@ -332,8 +334,9 @@ uint16_t maxLen = 0, uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE, GattAttribute *descriptors[] = NULL, - unsigned numDescriptors = 0) : - _valueAttribute(uuid, valuePtr, len, maxLen), + unsigned numDescriptors = 0, + bool hasVariableLen = true) : + _valueAttribute(uuid, valuePtr, len, maxLen, hasVariableLen), _properties(props), _requiredSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK), _descriptors(descriptors),