Hello,
I am working with S132 3.1.0 on a project based on FreeRTOS. Under some circunstances I set manually the value of some characteristics by using the function sd_ble_gatts_value_set(), NRF_SUCCESS is returned.
A notification of the new values is performed by a dedicated Task. A extract of the code:
if (true == p_srv->characList[idx].valueToUpdate)
{
memset(&hvx_params, 0, sizeof(hvx_params));
if (C_LGTH_STATUS_UID == p_srv->characList[idx].uuid.uuid)
{
err_code = sd_ble_gatts_value_get(conn_handle,
p_srv->charac_handle[idx].value_handle,
&att_val);
if (NRF_SUCCESS != err_code)
{
rval = ErrorE;
log_error(__LINE__, (u8_t*)"lght", rval);
}
else
{
if (att_val.len == N_ELEMENTS_LIGHTS)
{
if ((NULL != p_srv->characList[idx].charact_md.p_cccd_md) &&
(BLE_CONN_HANDLE_INVALID != conn_handle))
{
strncpy((char*)data, (char*)att_val.p_value, (size_t)att_val.len);
len = att_val.len;
hvx_params.handle = p_srv->charac_handle[idx].value_handle;
hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
hvx_params.offset = 0;
hvx_params.p_len = &len;
hvx_params.p_data = data;
err_code = sd_ble_gatts_hvx(conn_handle, &hvx_params);
Where valueToUpdate is set if the last set value of the attribute differed from the last gotten via sd_ble_gatts_value_get(). The unexpected behavior of the system is that the value obtained in:
err_code = sd_ble_gatts_value_get(conn_handle,
p_srv->charac_handle[idx].value_handle,
&att_val);
Specifically in ble_gatts_value_t att_val differs from the one set previously in sd_ble_gatts_value_set.
I do not have any additional executions of sd_ble_gatts_value_set for same attribute. What can be causing this issue?