-
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
Add support for PACS autopts tests #1747
Conversation
e786abb
to
fbc0e03
Compare
42dba4f
to
ce67d2d
Compare
@sjanc @KKopyscinski FYI |
apps/bttester/src/btp_pacs.c
Outdated
{ | ||
int rc; | ||
struct set_avail_cb_data *avail_data = | ||
(struct set_avail_cb_data *) arg; |
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.
it shouldn't be needed to cast void*
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_pacs.c
Outdated
cb_data.snk_ctxts = BLE_AUDIO_CONTEXT_TYPE_MEDIA; | ||
cb_data.src_ctxts = BLE_AUDIO_CONTEXT_TYPE_MEDIA; | ||
|
||
ble_gap_conn_foreach_handle(set_available, (void *)&cb_data); |
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.
same here
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_pacs.c
Outdated
} | ||
|
||
static uint8_t | ||
pacs_set_available_contexts() |
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.
functions with no params should be foo(void)
apps/bttester/src/btp_pacs.c
Outdated
rc = ble_audio_codec_register(&snk_codec_params, NULL); | ||
if (rc) { | ||
return BTP_STATUS_FAILED; | ||
} |
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.
hmm missing breaks in all cases?
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 breaks.
apps/bttester/src/btp_pacs.c
Outdated
}, | ||
{ | ||
.opcode = BTP_PACS_UPDATE_CHARACTERISTIC, | ||
.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.
pacs_update_characteristic_cmd is 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.
Done
apps/bttester/src/btp_pacs.c
Outdated
}, | ||
{ | ||
.opcode = BTP_PACS_SET_AVAILABLE_CONTEXTS, | ||
.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.
those seems to be also fixed size (with no params)
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
873ff56
to
cae7b62
Compare
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.
in general all command handlers should validate correctness if parameters even if don't make use of it (than comment why), also double check command parameters since it doesn't match what is defined in doc/btp_pacs.txt
apps/bttester/src/btp_pacs.c
Outdated
tester_set_bit(rp->data, BTP_PACS_SET_AVAILABLE_CONTEXTS); | ||
tester_set_bit(rp->data, BTP_PACS_SET_SUPPORTED_CONTEXTS); | ||
|
||
*rsp_len = sizeof(*rp) + 2; |
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.
+1 if there is only 1 octet used
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
#define BTP_PACS_CHARACTERISTIC_SOURCE_AUDIO_LOCATIONS 0x04 | ||
#define BTP_PACS_CHARACTERISTIC_AVAILABLE_AUDIO_CONTEXTS 0x05 | ||
|
||
struct btp_pacs_read_supported_commands_rp { |
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.
define those right after opcode (so that opcode, cmd struct and rsp stuct are in one place)
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
#define BTP_PACS_UPDATE_CHARACTERISTIC 0x02 | ||
#define BTP_PACS_SET_LOCATION 0x03 | ||
#define BTP_PACS_SET_AVAILABLE_CONTEXTS 0x04 | ||
#define BTP_PACS_SET_SUPPORTED_CONTEXTS 0x05 |
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.
cmd struct seems to be missing for 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
static uint8_t | ||
pacs_set_available_contexts(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.
why command parameters 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.
They are no longer ignored, we now check if this originated from set_available, or update_characteristic. If this is aftermath of update_characteristic we update with hardcoded values, otherwise we use command parameters.
apps/bttester/src/btp_pacs.c
Outdated
/* octet 0 */ | ||
tester_set_bit(rp->data, BTP_PACS_READ_SUPPORTED_COMMANDS); | ||
tester_set_bit(rp->data, BTP_PACS_UPDATE_CHARACTERISTIC); | ||
tester_set_bit(rp->data, BTP_PACS_SET_LOCATION); |
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 command seems to be missing in handlers?
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_pacs.c
Outdated
}, | ||
{ | ||
.opcode = BTP_PACS_SET_SUPPORTED_CONTEXTS, | ||
.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.
Opcode 0x05: Set Supported Audio Contexts
Controller Index: <controller id>
Command parameters: Sink Contexts (2 octet)
Source Contexts (2 octets)
Response parameters: <None>
this is not variable length
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 to fixed size.
948ef0f
to
8230311
Compare
8230311
to
2404288
Compare
2404288
to
42ee0b3
Compare
42ee0b3
to
0e8edf8
Compare
66040b3
to
bf67ed3
Compare
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.
LGTM
@sjanc if OK with you we could merge it |
@sjanc ping |
apps/bttester/src/btp/btp_pacs.h
Outdated
} __packed; | ||
|
||
#define BTP_PACS_UPDATE_CHARACTERISTIC 0x02 | ||
struct pacs_update_characteristic_cmd { |
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.
those structs name should have bap_ prefix
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_pacs.c
Outdated
const struct pacs_set_available_contexts_cmd *avail = cmd; | ||
|
||
/* If this originated from pacs_update_characteristic - we update with unspecified */ | ||
if (avail->sink_contexts == BTP_PACS_CHARACTERISTIC_AVAILABLE_AUDIO_CONTEXTS) { |
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.
those are le16, should be converted to host order before read
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
bf67ed3
to
964b659
Compare
7fa7cb8
to
73a293f
Compare
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.
looks good in general, some nitpick regarding naming and endiannes
apps/bttester/src/btp_pacs.c
Outdated
void *rsp, uint16_t *rsp_len) | ||
{ | ||
struct set_avail_cb_data cb_data; | ||
const struct btp_pacs_set_available_contexts_cmd *avail = cmd; |
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.
typically we just name this *cp = cmd
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
5bb6d7d
to
e1617a5
Compare
fffb86a
to
607cfef
Compare
This commit adds support for Published Audio Capabilities Service in bttester application.
607cfef
to
394630d
Compare
Add support for Published Audio Capabilities Service in bttester application.