-
Notifications
You must be signed in to change notification settings - Fork 75
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
Conversation
@@ -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; } |
There was a problem hiding this comment.
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;}
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() |
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. |
would you consider adding an accessor to get the current length? (not as a pointer) |
Yes. I will add the accessor. |
As far as I can see, there is no need for the _initialLen data member and the getInitialLength accessor. |
Extended attribute length handling to support dynamic length.
Added support for attributes with dynamic lengths. This is necessary to support some non-standard characteristics.