Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended attribute length handling to support dynamic length. #31

Merged
merged 2 commits into from
Feb 26, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion public/GattAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ class GattAttribute {
*/
/**************************************************************************/
GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t initialLen = 0, uint16_t maxLen = 0) :
_uuid(uuid), _valuePtr(valuePtr), _initialLen(initialLen), _lenMax(maxLen), _handle() {
_uuid(uuid), _valuePtr(valuePtr), _initialLen(initialLen), _lenMax(maxLen), _len(initialLen), _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 getInitialLength(void) const {return _initialLen;}
uint16_t getMaxLength(void) const {return _lenMax; }
uint16_t *getLengthPtr(void) {return &_len; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be a const accessor
consider: uint16_t *getLengthPtr(void) const {return &_len;}

void setHandle(Handle_t id) {_handle = id; }
uint8_t *getValuePtr(void) {return _valuePtr; }

Expand All @@ -63,6 +65,7 @@ class GattAttribute {
uint8_t *_valuePtr;
uint16_t _initialLen; /* Initial length of the value */
uint16_t _lenMax; /* Maximum length of the value */
uint16_t _len; /* Current length of the value */
Handle_t _handle;

private:
Expand Down