Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BASS support for bttester. #1813

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szymon-czapracki
Copy link
Contributor

@szymon-czapracki szymon-czapracki commented Jul 29, 2024

Add BASS support in bttester.

@rymanluk
Copy link
Contributor

rymanluk commented Aug 1, 2024

@szymon-czapracki could you help with failing tests?

@@ -83,12 +83,27 @@ struct bap_bap_broadcast_source_stop_cmd {
uint8_t broadcast_id[3];
} __packed;

#define BTP_BAP_BROADCAST_SINK_SETUP 0x0a
#define BTP_BAP_BROADCAST_SINK_SETUP 0xa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would stick to 0x0a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

console_printf("Source Add:\nsource_id=%u\n", action->source_add.source_id);
if (action->source_add.out_source_id_to_swap == NULL) {
return 0;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -110,11 +118,12 @@ syscfg.vals:
MSYS_1_BLOCK_COUNT: 100

BLE_MONITOR_RTT: 1
CONSOLE_RTT: 0
BLE_MONITOR_RTT_BUFFER_SIZE: 4096
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want this configuration to be delivered inside BASS test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@@ -286,6 +286,9 @@ struct ble_svc_audio_bass_operation {
/** Number of subgroups */
uint8_t num_subgroups;

/** BIS Synchronisation of subgroups */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could split it to small patches which address different problems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer present in current patch set.

@@ -39,4 +39,7 @@ syscfg.vals:
BLE_MULTI_ADV_INSTANCES: 5
BLE_PERIODIC_ADV: 1
BLE_PERIODIC_ADV_SYNC_TRANSFER: 1
BLE_VERSION: 51
BLE_PERIODIC_ADV_SYNC_BIGINFO_REPORTS: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjanc how to handle that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should enable all (non-experimental) features in default netcore image, so this is fine but should be in separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer in current patch set.

@@ -39,4 +39,7 @@ syscfg.vals:
BLE_MULTI_ADV_INSTANCES: 5
BLE_PERIODIC_ADV: 1
BLE_PERIODIC_ADV_SYNC_TRANSFER: 1
BLE_VERSION: 51
BLE_PERIODIC_ADV_SYNC_BIGINFO_REPORTS: 1
BLE_LL_ISO_BROADCASTER: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLE_LL -> BLE_

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

memcpy(operation.add_source.adv_addr.val, &data[offset], 6);
offset += 6;
operation.add_source.adv_sid = data[offset++];
if (operation.add_source.adv_sid < 0 ||
operation.add_source.adv_sid > 0xF) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0x0f

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

operation.add_source.adv_addr.type = data[offset++];
if (operation.add_source.adv_addr.type < 0 ||
operation.add_source.adv_addr.type > 3) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use magic number

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@sjanc sjanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and build failure is actual typo in code affected, it just happen that CI was never building it (and now it was pulled into bttester build), should be fixed in separate PR

tester_init_bass(void);
uint8_t
tester_unregister_bass(void);
#endif /* MYNEWT_VAL(BLE_ISO_BROADCASTER) */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this #endif looks odd, some rebase misclick?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

broadcast_code_set(const void *cmd, uint16_t cmd_len, void *rsp,
uint16_t *rsp_len)
{
return BTP_STATUS_SUCCESS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why those have no implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
.opcode = BTP_BAP_BROADCAST_SINK_SETUP,
.index = BTP_INDEX,
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTP defines this as fixed size

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed - sink setup has 0 size.

{
.opcode = BTP_BAP_BROADCAST_SINK_STOP,
.index = BTP_INDEX,
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
int rc;

rc = ble_audio_broadcast_sink_stop(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why all BTP params are ignored?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer ignored.

{
switch (event->type) {
case BLE_AUDIO_EVENT_BROADCAST_ANNOUNCEMENT:
console_printf("\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover - removed.

@@ -2000,6 +2001,44 @@ set_filter_accept_list(const void *cmd, uint16_t cmd_len,
return BTP_STATUS_SUCCESS;
}

#if MYNEWT_VAL(BLE_EXT_ADV)
static uint8_t
set_ext_advertising(const void *cmd, uint16_t cmd_len,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not valid implementation of this command. From BTP spec: "This command is used to enable/disable Extended Advertising when Start/Stop Advertising is used."

So it should be used to tune if advertising is using legacy or ext_adv PDUs, not to start advertising

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -39,4 +39,7 @@ syscfg.vals:
BLE_MULTI_ADV_INSTANCES: 5
BLE_PERIODIC_ADV: 1
BLE_PERIODIC_ADV_SYNC_TRANSFER: 1
BLE_VERSION: 51
BLE_PERIODIC_ADV_SYNC_BIGINFO_REPORTS: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should enable all (non-experimental) features in default netcore image, so this is fine but should be in separate PR

@github-actions github-actions bot added size/M Medium PR and removed host labels Aug 23, 2024
@szymon-czapracki szymon-czapracki force-pushed the bass_bttester branch 5 times, most recently from 5bfc36c to d103710 Compare August 27, 2024 13:19
@szymon-czapracki szymon-czapracki changed the title BASS bttester & various fixes BASS support for bttester. Aug 29, 2024
@szymon-czapracki
Copy link
Contributor Author

@sjanc ping


#endif /* __BTTESTER_H__ */
#endif /* __BTTESTER_H */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thi is closing BTTESTER_H

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

sinks[sink_num].bd_addr_type = cp->bd_addr_type;
sinks[sink_num].source_id = cp->source_id;

for (i = 0; i < BLE_AUDIO_BROADCAST_CODE_SIZE; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just memcpy this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

int i;
const struct btp_bap_set_broadcast_code_cmd *cp = cmd;

sinks[sink_num].addr = cp->addr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should reject if sink_num is too big, now it will write pass sinks[]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

#include "audio/ble_audio.h"
#include "host/ble_iso.h"

#define BROADCAST_ADV_INSTANCE 1

static struct ble_audio_big_subgroup big_subgroup;

static struct broadcast_sink {
uint8_t bd_addr_type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ble_addr_t already has type in it...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

{
ble_addr_t addr;
const struct btp_bap_broadcast_sink_stop_cmd *cp = cmd;
uint8_t broadcast_to_stop[BLE_AUDIO_BROADCAST_CODE_SIZE];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to be unused...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

/* Figure out address to use while scanning. */
rc = ble_hs_id_infer_auto(0, &own_addr_type);
if (rc != 0) {
console_printf("determining own address type failed (%d)", rc);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console_printf doesn add any additional context like function name, you should probably make those less generic (or include func maybe?)

same for other messages, include function name or make them less generic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added func to make this less generic.

#define BTP_BAP_BROADCAST_SINK_STOP 0x0f
struct btp_bap_broadcast_sink_stop_cmd {
uint8_t addr_type;
ble_addr_t address;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ble_addr_t already has address type...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


#define BTP_BAP_SET_BROADCAST_CODE 0x17
struct btp_bap_set_broadcast_code_cmd {
uint8_t bd_addr_type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Adding BASS support in bttester
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Large PR size/M Medium PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants