att_db_util: Add API to specify next attribute handle. #647
+12
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our BTLE usage requires our peripheral to enable / disable certain GATT services at runtime and inform the host device via sending a Notify to the Service Changed characteristic. We are using
att_db_util
to re-construct the ATT table as needed.Our ATT table layout is:
{GAP attributes, HID attributes, Custom service attributes}
Depending on what is enabled or disabled, this layout can change to
{GAP attributes, Custom service attributes}
, or{GAP attributes, HID attributes}
.Currently,
att_db_util
appends all services with an incrementing sequence of handles. This means when we change our layout, the handles associated with the HID and Custom services' attributes change. We have found that not all BTLE hosts respect the Service Changed feature in the way we would like. Therefore, we would like to ensure our services always start at a certain handle value.I have added a extra method to the API to allow the
att_db_next_handle
to be moved ahead. This method enables us to ensure specific services always have the same handle:Additionally, this method allows users to "reserve" handle space for future expansion.
e.g. I could start Custom service 1 at handle 0x100 and Custom service 2 at 0x200. The handle range between 0x100-0x200 can be reserved for future attributes for Custom service 1, without changing the handle values for Custom service 2.