Hello, I looked through the forum and tried some examples but it did not work for me.
My aim is to write cccd from peripherals side (Softdevice used S110).
As the result, my code is:
uint32_t attr_flags = BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS | BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS;
uint16_t attr_len = GATT_SERVER_ATTR_MAX_SIZE;
uint16_t sys_data[GATT_SERVER_ATTR_MAX_SIZE];
uint32_t err_code = sd_ble_gatts_sys_attr_get(conn_handle,(u8 *)sys_data,&attr_len,attr_flags);
if (err_code == NRF_SUCCESS){
sys_data[2]=0;
sys_data[attr_len/sizeof(uint16_t)-1]=CRC16((u8 *)sys_data, attr_len-2);
err_code=sd_ble_gatts_sys_attr_set(conn_handle, (uint8_t*) sys_data, attr_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS | BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS);
}
}
Read while Notification enabled (handle 0x0016) 1600020001002300020000004E37
Changed to disabled: 1600020000002300020000009D70
But next time after I ran sd_ble_gatts_sys_attr_get
the content stayed unchanged. No errors were returned.
So the question is how to change the attribte or what prevents it from change?