How do you change a BLE attribute size at runtime?
Characteristics with a variable length are useful because you do not need to expose additional data that is not relevant. cyBle_gattDB is an array of the CYBLE_GATTS_DB_T structure, which defines the handle, permissions, container size (maximum length), and full (16-bit) or partial (128-bit) UUID.
The attribute size can be changed by writing the cyBle_gattDB array as follows, after CYBLE_EVT_STACK_ON:
where X is the length of the attribute.
- The attribute size can be decreased but cannot increase beyond the default size set in the BLE Component.
- The actual length of an attribute can be retrieved by using the following macro:
CYBLE_GATT_DB_ATTR_GET_ATTR_GEN_LEN (Handle – 1u);