Skip to content

Commit 64c7bf3

Browse files
olivier-le-sageanangl
authored andcommitted
bluetooth: samples: Save and restore local steps in RAS server callback
Because of the way connection callbacks work, and because bt_le_cs_step_data_parse() consumes the data in the buffer, any user callbacks called after this module's would end up losing access to the step data. To avoid this problem, we can do a simple save and restore when parsing. Signed-off-by: Olivier Lesage <[email protected]>
1 parent 58cedfe commit 64c7bf3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

subsys/bluetooth/services/ras/rrsp/ras_rd_buffer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,11 @@ static void subevent_data_available(struct bt_conn *conn,
272272
hdr->num_steps_reported = result->header.num_steps_reported;
273273

274274
if (result->step_data_buf) {
275+
struct net_buf_simple_state buf_state;
276+
277+
net_buf_simple_save(result->step_data_buf, &buf_state);
275278
bt_le_cs_step_data_parse(result->step_data_buf, process_step_data, buf);
279+
net_buf_simple_restore(result->step_data_buf, &buf_state);
276280
}
277281
}
278282

0 commit comments

Comments
 (0)