Skip to content

Commit 3247bd2

Browse files
olivier-le-sagerlubos
authored andcommitted
samples: improve handling for the case where all subevents are aborted
In case every subevent in the CS procedure was aborted, it would happen that the sample would try to parse the local steps anyway. An error message was printed in this case as there were no local steps to parse. Signed-off-by: Olivier Lesage <[email protected]>
1 parent 56ff177 commit 3247bd2

File tree

1 file changed

+12
-0
lines changed
  • samples/bluetooth/channel_sounding_ras_initiator/src

1 file changed

+12
-0
lines changed

samples/bluetooth/channel_sounding_ras_initiator/src/main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,18 @@ static void ranging_data_cb(struct bt_conn *conn, uint16_t ranging_counter, int
165165

166166
LOG_DBG("Ranging data received for ranging counter %d", ranging_counter);
167167

168+
if (latest_local_steps.len == 0) {
169+
LOG_WRN("All subevents in ranging counter %u were aborted",
170+
most_recent_local_ranging_counter);
171+
net_buf_simple_reset(&latest_local_steps);
172+
k_sem_give(&sem_local_steps);
173+
174+
if (!(ras_feature_bits & RAS_FEAT_REALTIME_RD)) {
175+
net_buf_simple_reset(&latest_peer_steps);
176+
}
177+
return;
178+
}
179+
168180
/* This struct is static to avoid putting it on the stack (it's very large) */
169181
static cs_de_report_t cs_de_report;
170182

0 commit comments

Comments
 (0)