Hi, I am trying to add a notification charactersitics on client, I am able to add one of them, but when i try to add another one sd_ble_gattc_write(), result is always NRF_ERROR_BUSY. I am calling this cccd_configure() with same conn_handle, respective configuration handles handle_cccd, enable is true.
For the first time cccd_configure() returns success but the second time it returns NRF_ERROR_BUSY. I am not sure why this would happen, i am just enabling the descriptors. Any work around or suggestion would be helpful please.
static uint32_t cccd_configure(uint16_t conn_handle, uint16_t handle_cccd, bool enable) {
uint8_t buf[BLE_CCCD_VALUE_LEN];
buf[0] = enable ? BLE_GATT_HVX_NOTIFICATION : 0;
buf[1] = 0;
const ble_gattc_write_params_t write_params = {
.write_op = BLE_GATT_OP_WRITE_REQ,
.flags = BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE,
.handle = handle_cccd,
.offset = 0,
.len = sizeof(buf),
.p_value = buf
};
return sd_ble_gattc_write(conn_handle, &write_params);
}