I'm calling ble_bondmngr_bonded_centrals_store in response to BLE_GAP_EVT_DISCONNECTED as is the case in plenty of sample code, but when ble_bondmngr_bonded_centrals_store calls the following:
uint16_t sys_attr_size = SYS_ATTR_BUFFER_MAX_LEN;
err_code = sd_ble_gatts_sys_attr_get(m_conn_handle,
m_central.sys_attr.sys_attr,
&sys_attr_size);
this is returning error_code 0xC which I believe is:
NRF_ERROR_DATA_SIZE (NRF_ERROR_BASE_NUM + 12) ///< Data size exceeds limit
So, question is SYS_ATTR_BUFFER_MAX_LEN wrong then ? The actual value is 0x14.
The odd thing is that I don't know how something bigger would have been set because the only place it could be set is in this function.
static uint32_t central_sys_attr_set(central_t * p_central) { uint8_t * p_sys_attr;
if (m_central.sys_attr.sys_attr_size != 0)
{
if (m_central.sys_attr.sys_attr_size > SYS_ATTR_BUFFER_MAX_LEN)
{
return NRF_ERROR_INTERNAL;
}
p_sys_attr = m_central.sys_attr.sys_attr;
}
else
{
p_sys_attr = NULL;
}
return sd_ble_gatts_sys_attr_set(m_conn_handle, p_sys_attr, m_central.sys_attr.sys_attr_size);
}
so the other possibility is that sd_ble_gatts_sys_attr_set was never called, or it was called with NULL, which happens in several places. So I can see code paths where this was never set, so should the ble_bondmngr_bonded_centrals_store function be expecting that and handle it gracefully ?