hfp: emit HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT after sending custom message

This commit is contained in:
Matthias Ringwald 2023-05-26 15:48:38 +02:00
parent f703e17057
commit 7f8f119190
7 changed files with 31 additions and 4 deletions

View File

@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- GAP: set minimum and maximum CE length to 0
- GAP: ENABLE_EXPLICIT_DEDICATED_BONDING_DISCONNECT disables disconnect after dedicated bonding
- A2DP Sink: drop unused local seid argument in a2dp_sink_establish_stream
- HFP: emit HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT after sending custom command / unsolicited response code
- bluetooth: indicated identity address in resolved address type names
- chipset/bcm: look for PatchRAM file DEVICE_NAME...hcd
- btstack_audio: added get_samplerate function to help with audio sample rate synchronization

View File

@ -2430,6 +2430,13 @@ typedef uint8_t sm_key_t[16];
*/
#define HFP_SUBEVENT_CUSTOM_AT_COMMAND 0x28u
/**
* @format 1H1
* @param subevent_code
* @param acl_handle
* @param status 0 == OK
*/
#define HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT 0x29u
// ANCS Client

View File

@ -7219,6 +7219,25 @@ static inline const char * hfp_subevent_custom_at_command_get_command_string(con
return (const char *) &event[7];
}
/**
* @brief Get field acl_handle from event HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT
* @param event packet
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_custom_at_message_sent_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field status from event HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t hfp_subevent_custom_at_message_sent_get_status(const uint8_t * event){
return event[5];
}
#ifdef ENABLE_BLE
/**
* @brief Get field handle from event ANCS_SUBEVENT_CLIENT_CONNECTED

View File

@ -2101,7 +2101,7 @@ static int hfp_ag_send_commands(hfp_connection_t *hfp_connection){
const char * message = hfp_connection->send_custom_message;
hfp_connection->send_custom_message = NULL;
send_str_over_rfcomm(hfp_connection->rfcomm_cid, message);
hfp_emit_event(hfp_connection, HFP_SUBEVENT_COMPLETE, ERROR_CODE_SUCCESS);
hfp_emit_event(hfp_connection, HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT, ERROR_CODE_SUCCESS);
return 1;
}

View File

@ -481,7 +481,7 @@ uint8_t hfp_ag_report_extended_audio_gateway_error_result_code(hci_con_handle_t
/**
* @brief Send unsolicited result code (most likely a response to a vendor-specific command not part of standard HFP).
* @note Emits HFP_SUBEVENT_COMPLETE when result code was sent
* @note Emits HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT when result code was sent
*
* @param unsolicited_result_code to send
* @return status ERROR_CODE_SUCCESS if successful, otherwise:

View File

@ -1135,7 +1135,7 @@ static bool hfp_hf_switch_on_ok_pending(hfp_connection_t *hfp_connection, uint8_
hfp_emit_event(hfp_connection, HFP_SUBEVENT_ECHO_CANCELING_AND_NOISE_REDUCTION_DEACTIVATE, status);
break;
case HFP_CMD_CUSTOM_MESSAGE:
hfp_emit_event(hfp_connection, HFP_SUBEVENT_COMPLETE, status);
hfp_emit_event(hfp_connection, HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT, status);
break;
default:
event_emited = false;

View File

@ -548,7 +548,7 @@ int hfp_hf_in_band_ringtone_active(hci_con_handle_t acl_handle);
/**
* @brief Send AT command (most likely a vendor-specific command not part of standard HFP).
* @note Result (OK/ERROR) is reported via HFP_SUBEVENT_COMPLETE
* @note Result (OK/ERROR) is reported via HFP_SUBEVENT_CUSTOM_AT_MESSAGE_SENT
* To receive potential unsolicited result code, add ENABLE_HFP_AT_MESSAGES to get all message via HFP_SUBEVENT_AT_MESSAGE_RECEIVED
*
* @param acl_handle