-
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
Modify functions that manipulate adv payload #153
Conversation
Modify the functions addData() and updateData() to correctly update the payload information for a specified AD type if that type was already present in the payload. For addData() if the AD type is not found, it is added to the payload. In contrast, in updateData() if the AD type is not found an error is returned. Documentation was updated accordingly.
byteIndex += (currentADV->len + 1); /* Advance by len+1; '+1' is needed to span the len field itself. */ | ||
if (field) { | ||
// Field type already exist, either add to field or replace | ||
return updateField(advDataType, payload, len, field); |
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.
It doesn't do what is expected if AD type is INCOMPLETE_LIST_16BIT_SERVICE_IDS,
COMPLETE_LIST_16BIT_SERVICE_IDS, INCOMPLETE_LIST_32BIT_SERVICE_IDS,
COMPLETE_LIST_32BIT_SERVICE_IDS, INCOMPLETE_LIST_128BIT_SERVICE_IDS,
COMPLETE_LIST_128BIT_SERVICE_IDS or LIST_128BIT_SOLICITATION_IDS.
It will not update the field, it will append the new data at the end of the existing one.
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.
I have added the comments to document this.
Looks good to me. |
* advertising buffer to overflow. BLE_ERROR_NONE is returned | ||
* on success. | ||
* | ||
* @note When the specified AD type is INCOMPLETE_LIST_16BIT_SERVICE_IDS, |
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 will always feel weird for me. There is no way to update a list of services UUIDS. The only way is to memorize all the fields, cleanup the whole structure fill the structure with the previous fields except the one to update then add the new one. It is a lot of work.
let's resolve this over a chat. writing comments on github is slow. |
Accumulate and update advertising payload now differ in their implementations. Accumulate updates the previous value, if it is UUID then the previously added values are kept and the new one is simple appended. In contrast, update replaces the previous value in all cases.
@pan- I have modified the pull request as per your comments. |
Modify functions that manipulate adv payload
Modify the functions addData() and updateData() to correctly update the payload
information for a specified AD type if that type was already present in the
payload. For addData() if the AD type is not found, it is added to the payload.
In contrast, in updateData() if the AD type is not found an error is returned.
Documentation was updated accordingly.
@rgrover @pan- @LiyouZhou