-
Notifications
You must be signed in to change notification settings - Fork 399
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
Conversation
@szymon-czapracki could you help with failing tests? |
daaf152
to
840d1ad
Compare
31f6def
to
0dc37c5
Compare
apps/bttester/src/btp/btp_bap.h
Outdated
@@ -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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apps/bttester/src/btp_bap.c
Outdated
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apps/bttester/syscfg.yml
Outdated
@@ -110,11 +118,12 @@ syscfg.vals: | |||
MSYS_1_BLOCK_COUNT: 100 | |||
|
|||
BLE_MONITOR_RTT: 1 | |||
CONSOLE_RTT: 0 | |||
BLE_MONITOR_RTT_BUFFER_SIZE: 4096 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLE_LL -> BLE_
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0x0f
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this 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
apps/bttester/src/btp/bttester.h
Outdated
tester_init_bass(void); | ||
uint8_t | ||
tester_unregister_bass(void); | ||
#endif /* MYNEWT_VAL(BLE_ISO_BROADCASTER) */ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apps/bttester/src/btp_bap.c
Outdated
{ | ||
.opcode = BTP_BAP_BROADCAST_SINK_SETUP, | ||
.index = BTP_INDEX, | ||
.expect_len = BTP_HANDLER_LENGTH_VARIABLE, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
apps/bttester/src/btp_bap.c
Outdated
{ | ||
.opcode = BTP_BAP_BROADCAST_SINK_STOP, | ||
.index = BTP_INDEX, | ||
.expect_len = BTP_HANDLER_LENGTH_VARIABLE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apps/bttester/src/btp_bap.c
Outdated
{ | ||
int rc; | ||
|
||
rc = ble_audio_broadcast_sink_stop(0); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer ignored.
apps/bttester/src/btp_bap.c
Outdated
{ | ||
switch (event->type) { | ||
case BLE_AUDIO_EVENT_BROADCAST_ANNOUNCEMENT: | ||
console_printf("\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
0dc37c5
to
104f088
Compare
5bfc36c
to
d103710
Compare
@sjanc ping |
apps/bttester/src/btp/bttester.h
Outdated
|
||
#endif /* __BTTESTER_H__ */ | ||
#endif /* __BTTESTER_H */ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apps/bttester/src/btp_bap.c
Outdated
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++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just memcpy this
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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[]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apps/bttester/src/btp_bap.c
Outdated
#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; |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
apps/bttester/src/btp_bap.c
Outdated
{ | ||
ble_addr_t addr; | ||
const struct btp_bap_broadcast_sink_stop_cmd *cp = cmd; | ||
uint8_t broadcast_to_stop[BLE_AUDIO_BROADCAST_CODE_SIZE]; |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
apps/bttester/src/btp_bap.c
Outdated
/* 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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
d103710
to
12cf43f
Compare
12cf43f
to
5ef2315
Compare
5ef2315
to
d8c0e75
Compare
cc2b637
to
159d0ef
Compare
#define BTP_BAP_BROADCAST_SINK_STOP 0x0f | ||
struct btp_bap_broadcast_sink_stop_cmd { | ||
uint8_t addr_type; | ||
ble_addr_t address; |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apps/bttester/src/btp/btp_bap.h
Outdated
|
||
#define BTP_BAP_SET_BROADCAST_CODE 0x17 | ||
struct btp_bap_set_broadcast_code_cmd { | ||
uint8_t bd_addr_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
159d0ef
to
fb2807c
Compare
static uint8_t | ||
set_ext_advertising(const void *cmd, uint16_t cmd_len, | ||
void *rsp, uint16_t *rsp_len) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only set this in current settings and set adv_param->legacy_pdu accordingly
Also, if advertising is already enabled this may simply fail, if ext_adv is not enabled in syscfg it should also fail.
so in short:
if (cp->setting) {
current_settings |= BIT(BTP_GAP_SETTINGS_EXTENDED_ADVERTISING);
adv_param->legacy_pdu = 0;
} else {
current_settings &= ~BIT(BTP_GAP_SETTINGS_EXTENDED_ADVERTISING);
adv_param->legacy_pdu = 1;
}
``
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
fb2807c
to
8651a66
Compare
Adding BASS support in bttester
8651a66
to
f929c49
Compare
Add BASS support in bttester.