Repository: nrfconnect/sdk-nrf
Pull request #21312: bluetooth: samples: Apply callback changes of CS complete events
Author: login: ryanjh
Labels: name: manifest
name: manifest-zephyr
name: changelog-entry-required
description: Update changelog before merge. Remove label if entry is not needed or already added.
Created: 2025-04-02T11:17:22Z | Merged: 2025-04-03T10:56:44Z

The CS complete callbacks provide both status and params. In the case of errors, NULL pointer is passed to the params of callbacks.


Diff:
diff --git a/samples/bluetooth/channel_sounding_ras_initiator/src/main.c b/samples/bluetooth/channel_sounding_ras_initiator/src/main.c
index c057480a21ba..aefc9eca5397 100644
--- a/samples/bluetooth/channel_sounding_ras_initiator/src/main.c
+++ b/samples/bluetooth/channel_sounding_ras_initiator/src/main.c
@@ -328,47 +328,76 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
+	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
-	k_sem_give(&sem_remote_capabilities_obtained);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+		k_sem_give(&sem_remote_capabilities_obtained);
+	} else {
+		LOG_WRN("CS capability exchange failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config)
+static void config_create_cb(struct bt_conn *conn,
+			     uint8_t status,
+			     struct bt_conn_le_cs_config *config)
 {
-	LOG_INF("CS config creation complete. ID: %d", config->id);
-	k_sem_give(&sem_config_created);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS config creation complete. ID: %d", config->id);
+		k_sem_give(&sem_config_created);
+	} else {
+		LOG_WRN("CS config creation failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void security_enabled_cb(struct bt_conn *conn)
+static void security_enable_cb(struct bt_conn *conn, uint8_t status)
 {
-	LOG_INF("CS security enabled.");
-	k_sem_give(&sem_cs_security_enabled);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS security enabled.");
+		k_sem_give(&sem_cs_security_enabled);
+	} else {
+		LOG_WRN("CS security enable failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void procedure_enabled_cb(struct bt_conn *conn,
-				 struct bt_conn_le_cs_procedure_enable_complete *params)
+static void procedure_enable_cb(struct bt_conn *conn,
+				uint8_t status,
+				struct bt_conn_le_cs_procedure_enable_complete *params)
 {
-	if (params->state == 1) {
-		LOG_INF("CS procedures enabled:\n"
-			" - config ID: %u\n"
-			" - antenna configuration index: %u\n"
-			" - TX power: %d dbm\n"
-			" - subevent length: %u us\n"
-			" - subevents per event: %u\n"
-			" - subevent interval: %u\n"
-			" - event interval: %u\n"
-			" - procedure interval: %u\n"
-			" - procedure count: %u\n"
-			" - maximum procedure length: %u",
-			params->config_id, params->tone_antenna_config_selection,
-			params->selected_tx_power, params->subevent_len,
-			params->subevents_per_event, params->subevent_interval,
-			params->event_interval, params->procedure_interval, params->procedure_count,
-			params->max_procedure_len);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		if (params->state == 1) {
+			LOG_INF("CS procedures enabled:\n"
+				" - config ID: %u\n"
+				" - antenna configuration index: %u\n"
+				" - TX power: %d dbm\n"
+				" - subevent length: %u us\n"
+				" - subevents per event: %u\n"
+				" - subevent interval: %u\n"
+				" - event interval: %u\n"
+				" - procedure interval: %u\n"
+				" - procedure count: %u\n"
+				" - maximum procedure length: %u",
+				params->config_id, params->tone_antenna_config_selection,
+				params->selected_tx_power, params->subevent_len,
+				params->subevents_per_event, params->subevent_interval,
+				params->event_interval, params->procedure_interval,
+				params->procedure_count, params->max_procedure_len);
+		} else {
+			LOG_INF("CS procedures disabled.");
+		}
 	} else {
-		LOG_INF("CS procedures disabled.");
+		LOG_WRN("CS procedures enable failed. (HCI status 0x%02x)", status);
 	}
 }
 
@@ -432,10 +461,10 @@ BT_CONN_CB_DEFINE(conn_cb) = {
 	.disconnected = disconnected_cb,
 	.le_param_req = le_param_req,
 	.security_changed = security_changed,
-	.le_cs_remote_capabilities_available = remote_capabilities_cb,
-	.le_cs_config_created = config_created_cb,
-	.le_cs_security_enabled = security_enabled_cb,
-	.le_cs_procedure_enabled = procedure_enabled_cb,
+	.le_cs_read_remote_capabilities_complete = remote_capabilities_cb,
+	.le_cs_config_complete = config_create_cb,
+	.le_cs_security_enable_complete = security_enable_cb,
+	.le_cs_procedure_enable_complete = procedure_enable_cb,
 	.le_cs_subevent_data_available = subevent_result_cb,
 };
 
diff --git a/samples/bluetooth/channel_sounding_ras_reflector/src/main.c b/samples/bluetooth/channel_sounding_ras_reflector/src/main.c
index 902845ad0def..3f74945a1dd0 100644
--- a/samples/bluetooth/channel_sounding_ras_reflector/src/main.c
+++ b/samples/bluetooth/channel_sounding_ras_reflector/src/main.c
@@ -65,43 +65,68 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
 	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+	} else {
+		LOG_WRN("CS capability exchange failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config)
+static void config_create_cb(struct bt_conn *conn,
+			      uint8_t status,
+			      struct bt_conn_le_cs_config *config)
 {
 	ARG_UNUSED(conn);
-	LOG_INF("CS config creation complete. ID: %d", config->id);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS config creation complete. ID: %d", config->id);
+	} else {
+		LOG_WRN("CS config creation failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void security_enabled_cb(struct bt_conn *conn)
+static void security_enable_cb(struct bt_conn *conn, uint8_t status)
 {
 	ARG_UNUSED(conn);
-	LOG_INF("CS security enabled.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS security enabled.");
+	} else {
+		LOG_WRN("CS security enable failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void procedure_enabled_cb(struct bt_conn *conn,
-				 struct bt_conn_le_cs_procedure_enable_complete *params)
+static void procedure_enable_cb(struct bt_conn *conn,
+				uint8_t status,
+				struct bt_conn_le_cs_procedure_enable_complete *params)
 {
 	ARG_UNUSED(conn);
-	if (params->state == 1) {
-		LOG_INF("CS procedures enabled.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		if (params->state == 1) {
+			LOG_INF("CS procedures enabled.");
+		} else {
+			LOG_INF("CS procedures disabled.");
+		}
 	} else {
-		LOG_INF("CS procedures disabled.");
+		LOG_WRN("CS procedures enable failed. (HCI status 0x%02x)", status);
 	}
 }
 
 BT_CONN_CB_DEFINE(conn_cb) = {
 	.connected = connected_cb,
 	.disconnected = disconnected_cb,
-	.le_cs_remote_capabilities_available = remote_capabilities_cb,
-	.le_cs_config_created = config_created_cb,
-	.le_cs_security_enabled = security_enabled_cb,
-	.le_cs_procedure_enabled = procedure_enabled_cb,
+	.le_cs_read_remote_capabilities_complete = remote_capabilities_cb,
+	.le_cs_config_complete = config_create_cb,
+	.le_cs_security_enable_complete = security_enable_cb,
+	.le_cs_procedure_enable_complete = procedure_enable_cb,
 };
 
 int main(void)
diff --git a/subsys/bluetooth/services/ras/rrsp/ras_rd_buffer.c b/subsys/bluetooth/services/ras/rrsp/ras_rd_buffer.c
index c7332c37bfae..ee38000a9c43 100644
--- a/subsys/bluetooth/services/ras/rrsp/ras_rd_buffer.c
+++ b/subsys/bluetooth/services/ras/rrsp/ras_rd_buffer.c
@@ -150,15 +150,18 @@ static struct ras_rd_buffer *rd_buffer_alloc(struct bt_conn *conn, uint16_t rang
 	return NULL;
 }
 
-static void cs_procedure_enabled(struct bt_conn *conn,
-				 struct bt_conn_le_cs_procedure_enable_complete *params)
+static void cs_procedure_enable(struct bt_conn *conn,
+				uint8_t status,
+				struct bt_conn_le_cs_procedure_enable_complete *params)
 {
 	uint8_t conn_index = bt_conn_index(conn);
 
 	__ASSERT_NO_MSG(conn_index < ARRAY_SIZE(tx_power_cache));
 
-	tx_power_cache[conn_index] = params->selected_tx_power;
-	drop_procedure_counter[conn_index] = DROP_PROCEDURE_COUNTER_EMPTY;
+	if (status == BT_HCI_ERR_SUCCESS) {
+		tx_power_cache[conn_index] = params->selected_tx_power;
+		drop_procedure_counter[conn_index] = DROP_PROCEDURE_COUNTER_EMPTY;
+	}
 }
 
 static bool process_step_data(struct bt_le_cs_subevent_step *step, void *user_data)
@@ -302,7 +305,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
 }
 
 BT_CONN_CB_DEFINE(conn_callbacks) = {
-	.le_cs_procedure_enabled = cs_procedure_enabled,
+	.le_cs_procedure_enable_complete = cs_procedure_enable,
 	.le_cs_subevent_data_available = subevent_data_available,
 	.disconnected = disconnected,
 };
diff --git a/west.yml b/west.yml
index d18ce96ff932..91583b6cf59d 100644
--- a/west.yml
+++ b/west.yml
@@ -65,7 +65,7 @@ manifest:
     # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html
     - name: zephyr
       repo-path: sdk-zephyr
-      revision: f55a8067736a905992ef47d164c87443879b273c
+      revision: e6ab653d822c1e8a12859b887c8f0d4dfb163e99
       import:
         # In addition to the zephyr repository itself, NCS also
         # imports the contents of zephyr/west.yml at the above


Reviews:
user: login: ivaniushkov
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T07:38:32Z
user: login: olivier-le-sage
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T07:56:18Z
user: login: olivier-le-sage
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T08:02:27Z
user: login: olivier-le-sage
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T08:08:23Z
user: login: rlubos
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T08:17:21Z
user: login: ryanjh
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T08:17:38Z
user: login: olivier-le-sage
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T09:03:43Z

Review comments:
diff_hunk: @@ -328,47 +328,76 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
+	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
-	k_sem_give(&sem_remote_capabilities_obtained);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+		k_sem_give(&sem_remote_capabilities_obtained);
+	} else {
+		LOG_ERR("CS capability exchange failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config)
+static void config_create_cb(struct bt_conn *conn,
+			     uint8_t status,
+			     struct bt_conn_le_cs_config *config)
 {
-	LOG_INF("CS config creation complete. ID: %d", config->id);
-	k_sem_give(&sem_config_created);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS config creation complete. ID: %d", config->id);
+		k_sem_give(&sem_config_created);
+	} else {
+		LOG_ERR("CS config creation failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void security_enabled_cb(struct bt_conn *conn)
+static void security_enable_cb(struct bt_conn *conn, uint8_t status)
 {
-	LOG_INF("CS security enabled.");
-	k_sem_give(&sem_cs_security_enabled);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS security enabled.");
+		k_sem_give(&sem_cs_security_enabled);
+	} else {
+		LOG_ERR("CS security enable failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void procedure_enabled_cb(struct bt_conn *conn,
-				 struct bt_conn_le_cs_procedure_enable_complete *params)
+static void procedure_enable_cb(struct bt_conn *conn,
+				uint8_t status,
+				struct bt_conn_le_cs_procedure_enable_complete *params)
 {
-	if (params->state == 1) {
-		LOG_INF("CS procedures enabled:\n"
-			" - config ID: %u\n"
-			" - antenna configuration index: %u\n"
-			" - TX power: %d dbm\n"
-			" - subevent length: %u us\n"
-			" - subevents per event: %u\n"
-			" - subevent interval: %u\n"
-			" - event interval: %u\n"
-			" - procedure interval: %u\n"
-			" - procedure count: %u\n"
-			" - maximum procedure length: %u",
-			params->config_id, params->tone_antenna_config_selection,
-			params->selected_tx_power, params->subevent_len,
-			params->subevents_per_event, params->subevent_interval,
-			params->event_interval, params->procedure_interval, params->procedure_count,
-			params->max_procedure_len);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		if (params->state == 1) {
+			LOG_INF("CS procedures enabled:\n"
+				" - config ID: %u\n"
+				" - antenna configuration index: %u\n"
+				" - TX power: %d dbm\n"
+				" - subevent length: %u us\n"
+				" - subevents per event: %u\n"
+				" - subevent interval: %u\n"
+				" - event interval: %u\n"
+				" - procedure interval: %u\n"
+				" - procedure count: %u\n"
+				" - maximum procedure length: %u",
+				params->config_id, params->tone_antenna_config_selection,
+				params->selected_tx_power, params->subevent_len,
+				params->subevents_per_event, params->subevent_interval,
+				params->event_interval, params->procedure_interval,
+				params->procedure_count, params->max_procedure_len);
+		} else {
+			LOG_INF("CS procedures disabled.");
+		}
 	} else {
-		LOG_INF("CS procedures disabled.");
+		LOG_ERR("CS procedures enable failed. (HCI status 0x%02x)", status);
path: samples/bluetooth/channel_sounding_ras_initiator/src/main.c
user: login: olivier-le-sage
body: ```suggestion
		LOG_WRN("CS procedures enable failed. (HCI status 0x%02x)", status);
```

I think LOG_WRN is more appropriate. I've seen LOG_ERR use more for fatal errors and big problems
created_at: 2025-04-03T07:56:17Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,15 +150,21 @@ static struct ras_rd_buffer *rd_buffer_alloc(struct bt_conn *conn, uint16_t rang
 	return NULL;
 }
 
-static void cs_procedure_enabled(struct bt_conn *conn,
-				 struct bt_conn_le_cs_procedure_enable_complete *params)
+static void cs_procedure_enable(struct bt_conn *conn,
+				uint8_t status,
+				struct bt_conn_le_cs_procedure_enable_complete *params)
 {
 	uint8_t conn_index = bt_conn_index(conn);
 
 	__ASSERT_NO_MSG(conn_index < ARRAY_SIZE(tx_power_cache));
 
-	tx_power_cache[conn_index] = params->selected_tx_power;
-	drop_procedure_counter[conn_index] = DROP_PROCEDURE_COUNTER_EMPTY;
+	if (status == BT_HCI_ERR_SUCCESS) {
+		tx_power_cache[conn_index] = params->selected_tx_power;
+		drop_procedure_counter[conn_index] = DROP_PROCEDURE_COUNTER_EMPTY;
+	} else {
+		LOG_ERR("CS procedures enable failed. (HCI status 0x%02x)", status);
path: subsys/bluetooth/services/ras/rrsp/ras_rd_buffer.c
user: login: olivier-le-sage
body: ```suggestion
		LOG_WRN("CS procedures enable failed. (HCI status 0x%02x)", status);
```
created_at: 2025-04-03T08:02:00Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,43 +65,68 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
 	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+	} else {
+		LOG_ERR("CS capability exchange failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config)
+static void config_create_cb(struct bt_conn *conn,
+			      uint8_t status,
+			      struct bt_conn_le_cs_config *config)
 {
 	ARG_UNUSED(conn);
-	LOG_INF("CS config creation complete. ID: %d", config->id);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS config creation complete. ID: %d", config->id);
+	} else {
+		LOG_ERR("CS config creation failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void security_enabled_cb(struct bt_conn *conn)
+static void security_enable_cb(struct bt_conn *conn, uint8_t status)
 {
 	ARG_UNUSED(conn);
-	LOG_INF("CS security enabled.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS security enabled.");
+	} else {
+		LOG_ERR("CS security enable failed. (HCI status 0x%02x)", status);
path: samples/bluetooth/channel_sounding_ras_reflector/src/main.c
user: login: olivier-le-sage
body: ```suggestion
		LOG_WRN("CS security enable failed. (HCI status 0x%02x)", status);
```
created_at: 2025-04-03T08:02:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,43 +65,68 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
 	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+	} else {
+		LOG_ERR("CS capability exchange failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config)
+static void config_create_cb(struct bt_conn *conn,
+			      uint8_t status,
+			      struct bt_conn_le_cs_config *config)
 {
 	ARG_UNUSED(conn);
-	LOG_INF("CS config creation complete. ID: %d", config->id);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS config creation complete. ID: %d", config->id);
+	} else {
+		LOG_ERR("CS config creation failed. (HCI status 0x%02x)", status);
path: samples/bluetooth/channel_sounding_ras_reflector/src/main.c
user: login: olivier-le-sage
body: ```suggestion
		LOG_WRN("CS config creation failed. (HCI status 0x%02x)", status);
```
created_at: 2025-04-03T08:02:02Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,43 +65,68 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
 	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+	} else {
+		LOG_ERR("CS capability exchange failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config)
+static void config_create_cb(struct bt_conn *conn,
+			      uint8_t status,
+			      struct bt_conn_le_cs_config *config)
 {
 	ARG_UNUSED(conn);
-	LOG_INF("CS config creation complete. ID: %d", config->id);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS config creation complete. ID: %d", config->id);
+	} else {
+		LOG_ERR("CS config creation failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void security_enabled_cb(struct bt_conn *conn)
+static void security_enable_cb(struct bt_conn *conn, uint8_t status)
 {
 	ARG_UNUSED(conn);
-	LOG_INF("CS security enabled.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS security enabled.");
+	} else {
+		LOG_ERR("CS security enable failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void procedure_enabled_cb(struct bt_conn *conn,
-				 struct bt_conn_le_cs_procedure_enable_complete *params)
+static void procedure_enable_cb(struct bt_conn *conn,
+				uint8_t status,
+				struct bt_conn_le_cs_procedure_enable_complete *params)
 {
 	ARG_UNUSED(conn);
-	if (params->state == 1) {
-		LOG_INF("CS procedures enabled.");
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		if (params->state == 1) {
+			LOG_INF("CS procedures enabled.");
+		} else {
+			LOG_INF("CS procedures disabled.");
+		}
 	} else {
-		LOG_INF("CS procedures disabled.");
+		LOG_ERR("CS procedures enable failed. (HCI status 0x%02x)", status);
path: samples/bluetooth/channel_sounding_ras_reflector/src/main.c
user: login: olivier-le-sage
body: ```suggestion
		LOG_WRN("CS procedures enable failed. (HCI status 0x%02x)", status);
```
created_at: 2025-04-03T08:02:10Z
author_association: CONTRIBUTOR
diff_hunk: @@ -328,47 +328,76 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
+	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
-	k_sem_give(&sem_remote_capabilities_obtained);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+		k_sem_give(&sem_remote_capabilities_obtained);
+	} else {
+		LOG_ERR("CS capability exchange failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config)
+static void config_create_cb(struct bt_conn *conn,
+			     uint8_t status,
+			     struct bt_conn_le_cs_config *config)
 {
-	LOG_INF("CS config creation complete. ID: %d", config->id);
-	k_sem_give(&sem_config_created);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS config creation complete. ID: %d", config->id);
+		k_sem_give(&sem_config_created);
+	} else {
+		LOG_ERR("CS config creation failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void security_enabled_cb(struct bt_conn *conn)
+static void security_enable_cb(struct bt_conn *conn, uint8_t status)
 {
-	LOG_INF("CS security enabled.");
-	k_sem_give(&sem_cs_security_enabled);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS security enabled.");
+		k_sem_give(&sem_cs_security_enabled);
+	} else {
+		LOG_ERR("CS security enable failed. (HCI status 0x%02x)", status);
path: samples/bluetooth/channel_sounding_ras_initiator/src/main.c
user: login: olivier-le-sage
body: ```suggestion
		LOG_WRN("CS security enable failed. (HCI status 0x%02x)", status);
```
created_at: 2025-04-03T08:02:15Z
author_association: CONTRIBUTOR
diff_hunk: @@ -328,47 +328,76 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
+	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
-	k_sem_give(&sem_remote_capabilities_obtained);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+		k_sem_give(&sem_remote_capabilities_obtained);
+	} else {
+		LOG_ERR("CS capability exchange failed. (HCI status 0x%02x)", status);
+	}
 }
 
-static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config)
+static void config_create_cb(struct bt_conn *conn,
+			     uint8_t status,
+			     struct bt_conn_le_cs_config *config)
 {
-	LOG_INF("CS config creation complete. ID: %d", config->id);
-	k_sem_give(&sem_config_created);
+	ARG_UNUSED(conn);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS config creation complete. ID: %d", config->id);
+		k_sem_give(&sem_config_created);
+	} else {
+		LOG_ERR("CS config creation failed. (HCI status 0x%02x)", status);
path: samples/bluetooth/channel_sounding_ras_initiator/src/main.c
user: login: olivier-le-sage
body: ```suggestion
		LOG_WRN("CS config creation failed. (HCI status 0x%02x)", status);
```
created_at: 2025-04-03T08:02:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -328,47 +328,76 @@ static void disconnected_cb(struct bt_conn *conn, uint8_t reason)
 	sys_reboot(SYS_REBOOT_COLD);
 }
 
-static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params)
+static void remote_capabilities_cb(struct bt_conn *conn,
+				   uint8_t status,
+				   struct bt_conn_le_cs_capabilities *params)
 {
+	ARG_UNUSED(conn);
 	ARG_UNUSED(params);
-	LOG_INF("CS capability exchange completed.");
-	k_sem_give(&sem_remote_capabilities_obtained);
+
+	if (status == BT_HCI_ERR_SUCCESS) {
+		LOG_INF("CS capability exchange completed.");
+		k_sem_give(&sem_remote_capabilities_obtained);
+	} else {
+		LOG_ERR("CS capability exchange failed. (HCI status 0x%02x)", status);
path: samples/bluetooth/channel_sounding_ras_initiator/src/main.c
user: login: olivier-le-sage
body: ```suggestion
		LOG_WRN("CS capability exchange failed. (HCI status 0x%02x)", status);
```
created_at: 2025-04-03T08:02:17Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,15 +150,21 @@ static struct ras_rd_buffer *rd_buffer_alloc(struct bt_conn *conn, uint16_t rang
 	return NULL;
 }
 
-static void cs_procedure_enabled(struct bt_conn *conn,
-				 struct bt_conn_le_cs_procedure_enable_complete *params)
+static void cs_procedure_enable(struct bt_conn *conn,
+				uint8_t status,
+				struct bt_conn_le_cs_procedure_enable_complete *params)
 {
 	uint8_t conn_index = bt_conn_index(conn);
 
 	__ASSERT_NO_MSG(conn_index < ARRAY_SIZE(tx_power_cache));
 
-	tx_power_cache[conn_index] = params->selected_tx_power;
-	drop_procedure_counter[conn_index] = DROP_PROCEDURE_COUNTER_EMPTY;
+	if (status == BT_HCI_ERR_SUCCESS) {
+		tx_power_cache[conn_index] = params->selected_tx_power;
+		drop_procedure_counter[conn_index] = DROP_PROCEDURE_COUNTER_EMPTY;
+	} else {
path: subsys/bluetooth/services/ras/rrsp/ras_rd_buffer.c
user: login: olivier-le-sage
body: I think it would make sense to remove the else-clause here actually. This callback is registered in addition to the app's, so in case of failure this would be logged multiple times
created_at: 2025-04-03T08:08:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -150,15 +150,21 @@ static struct ras_rd_buffer *rd_buffer_alloc(struct bt_conn *conn, uint16_t rang
 	return NULL;
 }
 
-static void cs_procedure_enabled(struct bt_conn *conn,
-				 struct bt_conn_le_cs_procedure_enable_complete *params)
+static void cs_procedure_enable(struct bt_conn *conn,
+				uint8_t status,
+				struct bt_conn_le_cs_procedure_enable_complete *params)
 {
 	uint8_t conn_index = bt_conn_index(conn);
 
 	__ASSERT_NO_MSG(conn_index < ARRAY_SIZE(tx_power_cache));
 
-	tx_power_cache[conn_index] = params->selected_tx_power;
-	drop_procedure_counter[conn_index] = DROP_PROCEDURE_COUNTER_EMPTY;
+	if (status == BT_HCI_ERR_SUCCESS) {
+		tx_power_cache[conn_index] = params->selected_tx_power;
+		drop_procedure_counter[conn_index] = DROP_PROCEDURE_COUNTER_EMPTY;
+	} else {
+		LOG_ERR("CS procedures enable failed. (HCI status 0x%02x)", status);
path: subsys/bluetooth/services/ras/rrsp/ras_rd_buffer.c
user: login: ryanjh
body: removed else-clause.
created_at: 2025-04-03T08:17:38Z
author_association: CONTRIBUTOR

PR comments:
user: login: NordicBuilder
created_at: 2025-04-02T11:54:15Z
body: ## CI Information

<sup>_To view the history of this post, clich the 'edited' button above_</sup>
Build number: 7
### Inputs:
#### Sources:
hal_nordic: PR head: [8cdcc33c6e5c7618ca4e77ff19a0eab557cc4bd5](https://github.com/zephyrproject-rtos/hal_nordic/commit/8cdcc33c6e5c7618ca4e77ff19a0eab557cc4bd5)
sdk-nrf: PR head: [4eb8c2052706aa78167ee3c39d1654240bd2d098](https://github.com/nrfconnect/sdk-nrf/pull/21312/commits/4eb8c2052706aa78167ee3c39d1654240bd2d098)
zephyr: PR head: [e6ab653d822c1e8a12859b887c8f0d4dfb163e99](https://github.com/nrfconnect/sdk-zephyr/commit/e6ab653d822c1e8a12859b887c8f0d4dfb163e99)
<details><summary> more details</summary>

hal_nordic:
> PR head: [8cdcc33c6e5c7618ca4e77ff19a0eab557cc4bd5](https://github.com/zephyrproject-rtos/hal_nordic/commit/8cdcc33c6e5c7618ca4e77ff19a0eab557cc4bd5)
> merge base: [7440d573d36953b80cb6fb6438b147acb21bf753](https://github.com/zephyrproject-rtos/hal_nordic/commit/7440d573d36953b80cb6fb6438b147acb21bf753)
> [Diff](https://github.com/zephyrproject-rtos/hal_nordic/compare/7440d573d36953b80cb6fb6438b147acb21bf753..8cdcc33c6e5c7618ca4e77ff19a0eab557cc4bd5)

sdk-nrf:
> PR head: [4eb8c2052706aa78167ee3c39d1654240bd2d098](https://github.com/nrfconnect/sdk-nrf/pull/21312/commits/4eb8c2052706aa78167ee3c39d1654240bd2d098)
> merge base: [d9c0c0fd8ba98e1d8bf2643f2c6a2422506ad16b](https://github.com/nrfconnect/sdk-nrf/commit/d9c0c0fd8ba98e1d8bf2643f2c6a2422506ad16b)
> target head (main): [1e2a4672d46f1c9355e60db3c724efda2dcbb97e](https://github.com/nrfconnect/sdk-nrf/commit/1e2a4672d46f1c9355e60db3c724efda2dcbb97e)
> [Diff](https://github.com/nrfconnect/sdk-nrf/compare/d9c0c0fd8ba98e1d8bf2643f2c6a2422506ad16b..4eb8c2052706aa78167ee3c39d1654240bd2d098)

zephyr:
> PR head: [e6ab653d822c1e8a12859b887c8f0d4dfb163e99](https://github.com/nrfconnect/sdk-zephyr/commit/e6ab653d822c1e8a12859b887c8f0d4dfb163e99)
> merge base: [f55a8067736a905992ef47d164c87443879b273c](https://github.com/nrfconnect/sdk-zephyr/commit/f55a8067736a905992ef47d164c87443879b273c)
> [Diff](https://github.com/nrfconnect/sdk-zephyr/compare/f55a8067736a905992ef47d164c87443879b273c..e6ab653d822c1e8a12859b887c8f0d4dfb163e99)
</details>

#### Github labels
| Enabled | Name | Description |
| -- | -- | -- |
|| ci-disabled | _Disable the ci execution_ | 
|| ci-all-test | _Run all of ci, no test spec filtering will be done_ | 
|| ci-force-downstream | _Force execution of downstream even if twister fails_ | 
|| ci-run-twister | _Force run twister_ | 
|| ci-run-zephyr-twister | _Force run zephyr twister_ | 

<details><summary> List of changed files detected by CI (16)</summary>

```
modules
│  ├── hal
│  │  ├── nordic
│  │  │  ├── nrfx
│  │  │  │  ├── drivers
│  │  │  │  │  ├── include
│  │  │  │  │  │  │ nrfx_twim.h
│  │  │  │  │  ├── src
│  │  │  │  │  │  │ nrfx_twim.c
samples
│  ├── bluetooth
│  │  ├── channel_sounding_ras_initiator
│  │  │  ├── src
│  │  │  │  │ main.c
│  │  ├── channel_sounding_ras_reflector
│  │  │  ├── src
│  │  │  │  │ main.c
subsys
│  ├── bluetooth
│  │  ├── services
│  │  │  ├── ras
│  │  │  │  ├── rrsp
│  │  │  │  │  │ ras_rd_buffer.c
west.yml
zephyr
│  ├── include
│  │  ├── zephyr
│  │  │  ├── bluetooth
│  │  │  │  │ conn.h
│  ├── samples
│  │  ├── bluetooth
│  │  │  ├── channel_sounding
│  │  │  │  ├── src
│  │  │  │  │  ├── connected_cs_initiator.c
│  │  │  │  │  │ connected_cs_reflector.c
│  ├── subsys
│  │  ├── bluetooth
│  │  │  ├── host
│  │  │  │  ├── conn.c
│  │  │  │  ├── conn_internal.h
│  │  │  │  ├── cs.c
│  │  │  │  ├── shell
│  │  │  │  │  │ bt.c
│  ├── tests
│  │  ├── bluetooth
│  │  │  ├── host
│  │  │  │  ├── cs
│  │  │  │  │  ├── mocks
│  │  │  │  │  │  ├── conn.c
│  │  │  │  │  │  │ conn.h
│  │ west.yml
```
</details>

### Outputs:

#### Toolchain
Version: 7dbe0e2658
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:7dbe0e2658_8bf7ca4353

#### Test Spec & Results: :white_check_mark: Success; :x: Failure; :orange_circle: Queued; :yellow_circle: Progress; :white_medium_square: Skipped; :warning: Quarantine
- :white_medium_square: Toolchain - Skipped: existing toolchain is used
- :white_check_mark: Build twister
   - sdk-nrf test count: 1270
   - sdk-zephyr test count: 799
- :white_check_mark: Integration tests
   - :white_check_mark: test-sdk-audio
   - :white_check_mark: desktop52_verification
   - :white_check_mark: test_ble_nrf_config
   - :white_check_mark: test-fw-nrfconnect-ble_samples
   - :white_check_mark: test-fw-nrfconnect-chip
   - :white_check_mark: test-fw-nrfconnect-nfc
   - :white_check_mark: test-fw-nrfconnect-nrf-iot_thingy91
   - :white_check_mark: test-sdk-find-my
   - :white_check_mark: test-low-level
   - :white_check_mark: test-sdk-dfu

<details><summary>Disabled integration tests</summary>

- 
   - doc-internal
   - test-fw-nrfconnect-apps
   - test-fw-nrfconnect-ble_mesh
   - test-fw-nrfconnect-boot
   - test-fw-nrfconnect-fem
   - test-fw-nrfconnect-nrf-iot_cloud
   - test-fw-nrfconnect-nrf-iot_libmodem-nrf
   - test-fw-nrfconnect-nrf-iot_lwm2m
   - test-fw-nrfconnect-nrf-iot_mosh
   - test-fw-nrfconnect-nrf-iot_positioning
   - test-fw-nrfconnect-nrf-iot_samples
   - test-fw-nrfconnect-nrf-iot_serial_lte_modem
   - test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
   - test-fw-nrfconnect-nrf_crypto
   - test-fw-nrfconnect-proprietary_esb
   - test-fw-nrfconnect-ps
   - test-fw-nrfconnect-rpc
   - test-fw-nrfconnect-rs
   - test-fw-nrfconnect-tfm
   - test-fw-nrfconnect-thread
   - test-sdk-mcuboot
   - test-sdk-pmic-samples
   - test-sdk-wifi
   - test-secdom-samples-public
</details>



*Note: This message is automatically posted and updated by the CI*
author_association: CONTRIBUTOR
user: login: NordicBuilder
created_at: 2025-04-02T12:57:09Z
body: The following west manifest projects have changed revision in this Pull Request:

| Name | Old Revision | New Revision | Diff |
| ---- | ------------ | ------------ |------|
| zephyr | https://github.com/nrfconnect/sdk-zephyr/commit/f55a8067736a905992ef47d164c87443879b273c | https://github.com/nrfconnect/sdk-zephyr/commit/e6ab653d822c1e8a12859b887c8f0d4dfb163e99 (`main`)| [nrfconnect/sdk-zephyr@f55a8067..e6ab653d](https://github.com/nrfconnect/sdk-zephyr/compare/f55a8067736a905992ef47d164c87443879b273c..e6ab653d822c1e8a12859b887c8f0d4dfb163e99) |

✅ **All manifest checks OK**

*Note: This message is automatically posted and updated by the Manifest GitHub Action.* 
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-02T12:58:59Z
body: You can find the documentation preview for this PR [here](https://ncsdoc.z6.web.core.windows.net/PR-21312/).

author_association: NONE
user: login: rlubos
created_at: 2025-04-03T08:06:19Z
body: @ryanjh Please rebase
author_association: CONTRIBUTOR