Skip to content

Commit

Permalink
bluetooth: tester: audio: Add BIS stopped event BPT callback
Browse files Browse the repository at this point in the history
Add event callback to bttester for BIS stopped events. This adds a
BAP event type to the BPT API, enabling tools like Auto-PTS to verify
that a stream actually is stopped after requesting to close a BIS.

Signed-off-by: Frode van der Meeren <[email protected]>
  • Loading branch information
Frodevan committed Oct 2, 2024
1 parent 9655c2f commit 1c326c0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/bluetooth/tester/src/audio/btp/btp_bap.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,11 @@ struct btp_bap_pa_sync_req_ev {
uint8_t past_avail;
uint16_t pa_interval;
} __packed;

#define BTP_BAP_EV_BIS_STOPPED 0x8b
struct btp_bap_bis_stopped_ev {

Check notice on line 279 in tests/bluetooth/tester/src/audio/btp/btp_bap.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/bluetooth/tester/src/audio/btp/btp_bap.h:279 -#define BTP_BAP_EV_BIS_STOPPED 0x8b +#define BTP_BAP_EV_BIS_STOPPED 0x8b
bt_addr_le_t address;
uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE];
uint8_t bis_id;
uint8_t bis_stop_reason;
} __packed;
17 changes: 16 additions & 1 deletion tests/bluetooth/tester/src/audio/btp_bap_broadcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,30 @@ static void stream_started(struct bt_bap_stream *stream)
btp_send_bis_syced_ev(&broadcaster->address, broadcaster->broadcast_id, b_stream->bis_id);
}

static void btp_send_bis_stopped_ev(const bt_addr_le_t *address, uint32_t broadcast_id,
uint8_t bis_id, uint8_t reason)
{

Check notice on line 130 in tests/bluetooth/tester/src/audio/btp_bap_broadcast.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/bluetooth/tester/src/audio/btp_bap_broadcast.c:130 - uint8_t bis_id, uint8_t reason) + uint8_t bis_id, uint8_t reason)
struct btp_bap_bis_stopped_ev ev;

bt_addr_le_copy(&ev.address, address);
sys_put_le24(broadcast_id, ev.broadcast_id);
ev.bis_id = bis_id;
ev.bis_stop_reason = reason;

tester_event(BTP_SERVICE_ID_BAP, BTP_BAP_EV_BIS_STOPPED, &ev, sizeof(ev));
}

static void stream_stopped(struct bt_bap_stream *stream, uint8_t reason)
{
struct btp_bap_broadcast_stream *b_stream = stream_bap_to_broadcast(stream);

LOG_DBG("Stopped stream %p with reason 0x%02X", stream, reason);

btp_bap_audio_stream_stopped(&b_stream->audio_stream);

b_stream->bis_synced = false;
broadcaster = &remote_broadcast_sources[b_stream->source_id];

btp_send_bis_stopped_ev(&broadcaster->address, broadcaster->broadcast_id, b_stream->bis_id, reason);

Check warning on line 151 in tests/bluetooth/tester/src/audio/btp_bap_broadcast.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

tests/bluetooth/tester/src/audio/btp_bap_broadcast.c:151 line length of 108 exceeds 100 columns
}

Check notice on line 152 in tests/bluetooth/tester/src/audio/btp_bap_broadcast.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/bluetooth/tester/src/audio/btp_bap_broadcast.c:152 - btp_send_bis_stopped_ev(&broadcaster->address, broadcaster->broadcast_id, b_stream->bis_id, reason); + btp_send_bis_stopped_ev(&broadcaster->address, broadcaster->broadcast_id, b_stream->bis_id, + reason);

static void send_bis_stream_received_ev(const bt_addr_le_t *address, uint32_t broadcast_id,
Expand Down

0 comments on commit 1c326c0

Please sign in to comment.