hfp hf: activate/deactivate call waiting notification

This commit is contained in:
Milanka Ringwald 2015-11-27 22:12:07 +01:00
parent 1a77991a3f
commit 2b5b557b38
4 changed files with 64 additions and 3 deletions

View File

@ -545,7 +545,9 @@ typedef struct hfp_connection {
uint8_t hf_send_clip_enable;
uint8_t hf_send_chup;
uint8_t hf_activate_call_waiting_notification;
uint8_t hf_deactivate_call_waiting_notification;
} hfp_connection_t;
// UTILS_START : TODO move to utils

View File

@ -244,6 +244,12 @@ static int hfp_hf_send_clip_enable(uint16_t cid){
return send_str_over_rfcomm(cid, buffer);
}
static int hfp_hf_set_call_waiting_notification_cmd(uint16_t cid, uint8_t activate){
char buffer[40];
sprintf(buffer, "%s=%d\r\n", HFP_ENABLE_CALL_WAITING_NOTIFICATION, activate);
return send_str_over_rfcomm(cid, buffer);
}
static int hfp_hf_initiate_outgoing_call_cmd(uint16_t cid){
char buffer[40];
sprintf(buffer, "%s%s;\r\n", HFP_CALL_PHONE_NUMBER, phone_number);
@ -495,6 +501,19 @@ static void hfp_run_for_context(hfp_connection_t * context){
done = call_setup_state_machine(context);
}
if (context->hf_deactivate_call_waiting_notification){
context->hf_deactivate_call_waiting_notification = 0;
context->ok_pending = 1;
hfp_hf_set_call_waiting_notification_cmd(context->rfcomm_cid, 0);
return;
}
if (context->hf_activate_call_waiting_notification){
context->hf_activate_call_waiting_notification = 0;
context->ok_pending = 1;
hfp_hf_set_call_waiting_notification_cmd(context->rfcomm_cid, 1);
return;
}
if (context->hf_initiate_outgoing_call){
context->hf_initiate_outgoing_call = 0;
@ -951,3 +970,21 @@ void hfp_hf_redial_last_number(bd_addr_t bd_addr){
connection->hf_initiate_redial_last_number = 1;
hfp_run_for_context(connection);
}
void hfp_hf_activate_call_waiting_notification(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
connection->hf_activate_call_waiting_notification = 1;
hfp_run_for_context(connection);
}
void hfp_hf_deactivate_call_waiting_notification(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
connection->hf_deactivate_call_waiting_notification = 1;
hfp_run_for_context(connection);
}

View File

@ -184,6 +184,17 @@ void hfp_hf_dial_memory(bd_addr_t bd_addr, char * number);
*/
void hfp_hf_redial_last_number(bd_addr_t bd_addr);
/*
* @brief
*/
void hfp_hf_activate_call_waiting_notification(bd_addr_t bd_addr);
/*
* @brief
*/
void hfp_hf_deactivate_call_waiting_notification(bd_addr_t bd_addr);
/* API_END */
#if defined __cplusplus

View File

@ -102,7 +102,7 @@ static void show_usage(void){
printf("c - disable registration status update for all AG indicators\n");
printf("C - enable registration status update for all AG indicators\n");
printf("d - Query network operator.\n");
printf("d - query network operator.\n");
printf("D - set HFP AG registration status update for individual indicators\n");
printf("e - disable reporting of the extended AG error result code\n");
@ -112,7 +112,7 @@ static void show_usage(void){
printf("F - Hangup call\n");
printf("g - query network operator name\n");
printf("G - Reject call.\n");
printf("G - reject call\n");
printf("h - enable Calling Line Identification.\n");
@ -122,6 +122,9 @@ static void show_usage(void){
printf("j - dial #1\n");
printf("J - dial #99\n");
printf("k - deactivate call waiting notification\n");
printf("K - activate call waiting notification\n");
printf("t - terminate connection\n");
printf("---\n");
@ -215,6 +218,14 @@ static int stdin_process(struct data_source *ds){
printf("Dial #99\n");
hfp_hf_dial_memory(device_addr,"#99");
break;
case 'k':
printf("Deactivate call waiting notification\n");
hfp_hf_deactivate_call_waiting_notification(device_addr);
break;
case 'K':
printf("Activate call waiting notification\n");
hfp_hf_activate_call_waiting_notification(device_addr);
break;
default:
show_usage();
break;