When the number of CCCD's exceeds BLE_STORE_MAX_CCCDS, ble_store_delete_cccd(...) and ble_store_write_cccd(...) will return error codes from the BLE_HS_E... range, such as BLE_HS_ENOENT, BLE_HS_ENOMEM, and BLE_HS_ENOTSUP (dependent on the code in store_status_cb).
When an attempt is made to write to the descriptor, these error codes are then directly returned from ble_gatts_clt_cfg_access(...). This causes them to be returned by the stack as the corresponding unrelated attribute errors. This causes strange unexpected attribute access errors such as BLE_ATT_ERR_INSUFFICIENT_AUTHEN, BLE_ATT_ERR_REQ_NOT_SUPPORTED, and BLE_ATT_ERR_INSUFFICIENT_AUTHOR when an overflow occurs.
These unexpected errors can cause some strange follow-up behavior: For example, returning BLE_ATT_ERR_INSUFFICIENT_AUTHEN when connected to an iOS device causes that iOS device to re-attempt pairing, regardless of whether the current connection is already bonded and encrypted.
ble_gatts_clt_cfg_access(...) should probably check for a non-zero return code and return e.g. BLE_ATT_ERR_INSUFFICIENT_RES in that case.
When the number of CCCD's exceeds
BLE_STORE_MAX_CCCDS
,ble_store_delete_cccd(...)
andble_store_write_cccd(...)
will return error codes from theBLE_HS_E...
range, such asBLE_HS_ENOENT
,BLE_HS_ENOMEM
, andBLE_HS_ENOTSUP
(dependent on the code instore_status_cb
).When an attempt is made to write to the descriptor, these error codes are then directly returned from
ble_gatts_clt_cfg_access(...)
. This causes them to be returned by the stack as the corresponding unrelated attribute errors. This causes strange unexpected attribute access errors such asBLE_ATT_ERR_INSUFFICIENT_AUTHEN
,BLE_ATT_ERR_REQ_NOT_SUPPORTED
, andBLE_ATT_ERR_INSUFFICIENT_AUTHOR
when an overflow occurs.These unexpected errors can cause some strange follow-up behavior: For example, returning
BLE_ATT_ERR_INSUFFICIENT_AUTHEN
when connected to an iOS device causes that iOS device to re-attempt pairing, regardless of whether the current connection is already bonded and encrypted.ble_gatts_clt_cfg_access(...)
should probably check for a non-zero return code and return e.g.BLE_ATT_ERR_INSUFFICIENT_RES
in that case.