hfp: check for custom commands in both roles

This commit is contained in:
Matthias Ringwald 2023-05-26 21:15:38 +02:00
parent 892f58a83a
commit 04cf3dd4b6

View File

@ -1194,8 +1194,8 @@ static hfp_command_entry_t hfp_hf_command_table[] = {
static const hfp_custom_at_command_t *
hfp_custom_command_lookup(bool isHandsFree, const char *text) {
btstack_linked_list_iterator_t it;
btstack_linked_list_t * custom_commands = isHandsFree ? &hfp_custom_commands_hf : &hfp_custom_commands_ag;
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, custom_commands);
while (btstack_linked_list_iterator_has_next(&it)) {
hfp_custom_at_command_t *at_command = (hfp_custom_at_command_t *) btstack_linked_list_iterator_next(&it);
@ -1210,11 +1210,9 @@ hfp_custom_command_lookup(bool isHandsFree, const char *text) {
static hfp_command_t parse_command(const char * line_buffer, int isHandsFree){
// check for custom commands, AG only
if (isHandsFree == 0) {
const hfp_custom_at_command_t * custom_at_command = hfp_custom_command_lookup(isHandsFree, line_buffer);
if (custom_at_command != NULL){
return HFP_CMD_CUSTOM_MESSAGE;
}
const hfp_custom_at_command_t * custom_at_command = hfp_custom_command_lookup(isHandsFree, line_buffer);
if (custom_at_command != NULL){
return HFP_CMD_CUSTOM_MESSAGE;
}
// table lookup based on role