hfp: add send dtmf code

This commit is contained in:
Milanka Ringwald 2015-11-25 14:59:08 +01:00
parent ff8878fd58
commit 88a6898515
4 changed files with 20 additions and 6 deletions

View File

@ -643,6 +643,7 @@ extern "C" {
#define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER 0x0D
#define HFP_SUBEVENT_REDIAL_LAST_NUMBER 0x0E
#define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG 0x0F
#define HFP_SUBEVENT_TRANSMIT_DTMF_CODES 0x10
// ANCS Client

View File

@ -206,7 +206,7 @@ void hfp_emit_event(hfp_callback_t callback, uint8_t event_subtype, uint8_t valu
void hfp_emit_string_event(hfp_callback_t callback, uint8_t event_subtype, const char * value){
if (!callback) return;
uint8_t event[24];
uint8_t event[40];
event[0] = HCI_EVENT_HFP_META;
event[1] = sizeof(event) - 2;
event[2] = event_subtype;

View File

@ -216,7 +216,7 @@ static int hfp_ag_send_clip(uint16_t cid){
return send_str_over_rfcomm(cid, buffer);
}
static int hfp_ag_send_phone_number_for_voice_tag(uint16_t cid){
static int hfp_ag_send_phone_number_for_voice_tag_cmd(uint16_t cid){
char buffer[50];
sprintf(buffer, "\r\n%s:%s\r\n", HFP_PHONE_NUMBER_FOR_VOICE_TAG, clip_number);
return send_str_over_rfcomm(cid, buffer);
@ -1281,7 +1281,7 @@ static void hfp_run_for_context(hfp_connection_t *context){
context->send_phone_number_for_voice_tag = 0;
context->command = HFP_CMD_NONE;
context->ok_pending = 1;
hfp_ag_send_phone_number_for_voice_tag(context->rfcomm_cid);
hfp_ag_send_phone_number_for_voice_tag_cmd(context->rfcomm_cid);
return;
}
@ -1336,11 +1336,16 @@ static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_
hfp_parse(context, packet[pos], 0);
}
switch(context->command){
case HFP_CMD_TRANSMIT_DTMF_CODES:
context->command = HFP_CMD_NONE;
hfp_emit_string_event(hfp_callback, HFP_SUBEVENT_TRANSMIT_DTMF_CODES, (const char *) &context->line_buffer[0]);
break;
case HFP_CMD_HF_REQUEST_PHONE_NUMBER:
context->command = HFP_CMD_NONE;
hfp_emit_event(hfp_callback, HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG, 0);
break;
case HFP_CMD_TURN_OFF_EC_AND_NR:
context->command = HFP_CMD_NONE;
if (get_bit(hfp_supported_features, HFP_AGSF_EC_NR_FUNCTION)){
context->ok_pending = 1;
hfp_supported_features = store_bit(hfp_supported_features, HFP_AGSF_EC_NR_FUNCTION, context->ag_echo_and_noise_reduction);
@ -1755,5 +1760,8 @@ void hfp_ag_reject_phone_number_for_voice_tag(bd_addr_t bd_addr){
connection->send_error = 1;
}
void hfp_ag_send_dtmf_code_done(bd_addr_t bd_addr){
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
connection->ok_pending = 1;
}

View File

@ -259,7 +259,12 @@ void hfp_ag_send_phone_number_for_voice_tag(bd_addr_t bd_addr, const char * numb
/*
* @brief
*/
void hfp_ag_reject_phone_number_for_voice_tag(bd_addr_t bd_addr);
void hfp_ag_reject_phone_number_for_voice_tag(bd_addr_t bd_addr);
/*
* @brief
*/
void hfp_ag_send_dtmf_code_done(bd_addr_t bd_addr);
/* API_END */