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

Conversation

jeremybrodt
Copy link
Contributor

Added support for attributes with dynamic lengths. This is necessary to support some non-standard characteristics.

@@ -55,6 +55,7 @@ class GattAttribute {
const UUID &getUUID(void) const {return _uuid; }
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;}

@rgrover
Copy link
Contributor

rgrover commented Feb 20, 2015

What you're doing here is fine; but I'd also like to see the _len field updated. This should be done during calls to BLEDevice::updateCharacteristicValue, or even when the characteristic is updated from a remote client.

An alternative would be to determine the length using BLEDevice::readCharacteristicValue()

@jeremybrodt
Copy link
Contributor Author

In our BLE_API implementation, this functionality exists in updateCharacteristicValue. Similar to how the stacks uses the getValuePtr to update the value, getLengthPtr is used to update the length. How this should be done for the Nordic implementation, I don't know as I am unfamiliar with that stack.

Using readCharacteristicValue will not work. That only allows the application to know the size. What we are trying to do with this functionality is to communicate to the host what the current size is.

@rgrover
Copy link
Contributor

rgrover commented Feb 23, 2015

would you consider adding an accessor to get the current length? (not as a pointer)
Otherwise, I'm happy for this to go ahead.

@jeremybrodt
Copy link
Contributor Author

Yes. I will add the accessor.

@jeremybrodt
Copy link
Contributor Author

As far as I can see, there is no need for the _initialLen data member and the getInitialLength accessor.

rgrover added a commit that referenced this pull request Feb 26, 2015
Extended attribute length handling to support dynamic length.
@rgrover rgrover merged commit 2fa352d into ARMmbed:master Feb 26, 2015
@jeremybrodt jeremybrodt deleted the attlen branch February 26, 2015 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants