hfp hf docu

This commit is contained in:
Milanka Ringwald 2016-02-17 16:34:01 +01:00
parent 6fb5238a50
commit 3b6b9749b9
5 changed files with 16 additions and 13 deletions

View File

@ -569,6 +569,7 @@ typedef struct hfp_connection {
uint8_t hf_initiate_outgoing_call; uint8_t hf_initiate_outgoing_call;
uint8_t hf_initiate_memory_dialing; uint8_t hf_initiate_memory_dialing;
uint8_t hf_initiate_redial_last_number; uint8_t hf_initiate_redial_last_number;
int memory_id;
uint8_t hf_send_clip_enable; uint8_t hf_send_clip_enable;
uint8_t hf_send_chup; uint8_t hf_send_chup;

View File

@ -284,9 +284,9 @@ static int hfp_hf_initiate_outgoing_call_cmd(uint16_t cid){
return send_str_over_rfcomm(cid, buffer); return send_str_over_rfcomm(cid, buffer);
} }
static int hfp_hf_send_memory_dial_cmd(uint16_t cid){ static int hfp_hf_send_memory_dial_cmd(uint16_t cid, int memory_id){
char buffer[40]; char buffer[40];
sprintf(buffer, "%s>%s;\r\n", HFP_CALL_PHONE_NUMBER, phone_number); sprintf(buffer, "%s>%d;\r\n", HFP_CALL_PHONE_NUMBER, memory_id);
return send_str_over_rfcomm(cid, buffer); return send_str_over_rfcomm(cid, buffer);
} }
@ -632,7 +632,7 @@ static void hfp_run_for_context(hfp_connection_t * context){
if (context->hf_initiate_memory_dialing){ if (context->hf_initiate_memory_dialing){
context->hf_initiate_memory_dialing = 0; context->hf_initiate_memory_dialing = 0;
context->ok_pending = 1; context->ok_pending = 1;
hfp_hf_send_memory_dial_cmd(context->rfcomm_cid); hfp_hf_send_memory_dial_cmd(context->rfcomm_cid, context->memory_id);
return; return;
} }
@ -1311,12 +1311,13 @@ void hfp_hf_dial_number(bd_addr_t bd_addr, char * number){
hfp_run_for_context(connection); hfp_run_for_context(connection);
} }
void hfp_hf_dial_memory(bd_addr_t bd_addr, char * number){ void hfp_hf_dial_memory(bd_addr_t bd_addr, int memory_id){
hfp_hf_establish_service_level_connection(bd_addr); hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr); hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
connection->hf_initiate_memory_dialing = 1; connection->hf_initiate_memory_dialing = 1;
snprintf(phone_number, sizeof(phone_number), "%s", number); connection->memory_id = memory_id;
hfp_run_for_context(connection); hfp_run_for_context(connection);
} }

View File

@ -252,17 +252,18 @@ void hfp_hf_connect_calls(bd_addr_t addr);
void hfp_hf_terminate_call(bd_addr_t bd_addr); void hfp_hf_terminate_call(bd_addr_t bd_addr);
/** /**
* @brief * @brief Initiate outgoing voice call by providing the destination phone number to the AG.
* @param bd_addr Bluetooth address of the AG * @param bd_addr Bluetooth address of the AG
* @param number
*/ */
void hfp_hf_dial_number(bd_addr_t bd_addr, char * number); void hfp_hf_dial_number(bd_addr_t bd_addr, char * number);
/** /**
* @brief * @brief Initiate outgoing voice call using the memory dialing feature of the AG.
* TODO: use int for number instead of string?
* @param bd_addr Bluetooth address of the AG * @param bd_addr Bluetooth address of the AG
* @param memory_id
*/ */
void hfp_hf_dial_memory(bd_addr_t bd_addr, char * number); void hfp_hf_dial_memory(bd_addr_t bd_addr, int memory_id);
/** /**
* @brief * @brief

View File

@ -170,11 +170,11 @@ static void user_command(char cmd){
break; break;
case 'j': case 'j':
printf("Dial #1\n"); printf("Dial #1\n");
hfp_hf_dial_memory(device_addr, (char *)"1"); hfp_hf_dial_memory(device_addr, 1);
break; break;
case 'J': case 'J':
printf("Dial #99\n"); printf("Dial #99\n");
hfp_hf_dial_memory(device_addr, (char *)"99"); hfp_hf_dial_memory(device_addr, 99);
break; break;
case 'k': case 'k':
printf("Deactivate call waiting notification\n"); printf("Deactivate call waiting notification\n");

View File

@ -278,12 +278,12 @@ static int stdin_process(struct data_source *ds){
case 'j': case 'j':
log_info("USER:\'%c\'", cmd); log_info("USER:\'%c\'", cmd);
printf("Dial #1\n"); printf("Dial #1\n");
hfp_hf_dial_memory(device_addr,"1"); hfp_hf_dial_memory(device_addr,1);
break; break;
case 'J': case 'J':
log_info("USER:\'%c\'", cmd); log_info("USER:\'%c\'", cmd);
printf("Dial #99\n"); printf("Dial #99\n");
hfp_hf_dial_memory(device_addr,"99"); hfp_hf_dial_memory(device_addr,99);
break; break;
case 'k': case 'k':
log_info("USER:\'%c\'", cmd); log_info("USER:\'%c\'", cmd);