hfp: use custom_at_command_id for both roles

This commit is contained in:
Matthias Ringwald 2023-05-26 16:21:47 +02:00
parent 7f8f119190
commit 6d9a41f9b1
3 changed files with 6 additions and 4 deletions

View File

@ -1381,7 +1381,7 @@ static bool hfp_parse_byte(hfp_connection_t * hfp_connection, uint8_t byte, int
// store command id for custom command and just store rest of line
if (hfp_connection->command == HFP_CMD_CUSTOM_MESSAGE){
const hfp_custom_at_command_t * at_command = hfp_custom_command_lookup((const char *)hfp_connection->line_buffer);
hfp_connection->ag_custom_at_command_id = at_command->command_id;
hfp_connection->custom_at_command_id = at_command->command_id;
hfp_connection->parser_state = HFP_PARSER_CUSTOM_COMMAND;
return true;
}

View File

@ -641,6 +641,9 @@ typedef struct hfp_connection {
// HF: AT Command, AG: Unsolicited Result Code
const char * send_custom_message;
// HF: Unsolicited Result Code, AG: AT Command
uint16_t custom_at_command_id;
bool emit_vra_enabled_after_audio_established;
// AG only
uint8_t change_in_band_ring_tone_setting;
@ -665,7 +668,6 @@ typedef struct hfp_connection {
int send_status_of_current_calls;
int next_call_index;
uint16_t ag_custom_at_command_id;
// HF only
// HF: track command for which ok/error response need to be received

View File

@ -895,7 +895,7 @@ static void hfp_ag_emit_custom_command_event(hfp_connection_t * hfp_connection){
event[1] = 5 + line_len;
event[2] = HFP_SUBEVENT_CUSTOM_AT_COMMAND;
little_endian_store_16(event, 3, hfp_connection->acl_handle);
little_endian_store_16(event, 5, hfp_connection->ag_custom_at_command_id);
little_endian_store_16(event, 5, hfp_connection->custom_at_command_id);
memcpy(&event[7], hfp_connection->line_buffer, line_len);
(*hfp_ag_callback)(HCI_EVENT_PACKET, 0, event, 7 + line_len);
}
@ -2532,7 +2532,7 @@ static void hfp_ag_handle_rfcomm_data(hfp_connection_t * hfp_connection, uint8_t
case HFP_CMD_CUSTOM_MESSAGE:
hfp_connection->command = HFP_CMD_NONE;
hfp_parser_reset_line_buffer(hfp_connection);
log_info("Custom AT Command ID 0x%04x", hfp_connection->ag_custom_at_command_id);
log_info("Custom AT Command ID 0x%04x", hfp_connection->custom_at_command_id);
hfp_ag_emit_custom_command_event(hfp_connection);
break;
case HFP_CMD_UNKNOWN: