From 3b6b9749b9d0a563bfd7543abef0e102156db61a Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Wed, 17 Feb 2016 16:34:01 +0100 Subject: [PATCH] hfp hf docu --- src/hfp.h | 1 + src/hfp_hf.c | 11 ++++++----- src/hfp_hf.h | 9 +++++---- test/hfp/hfp_hf_client_test.c | 4 ++-- test/pts/hfp_hf_test.c | 4 ++-- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/hfp.h b/src/hfp.h index 295a214f8..48b44efd3 100644 --- a/src/hfp.h +++ b/src/hfp.h @@ -569,6 +569,7 @@ typedef struct hfp_connection { uint8_t hf_initiate_outgoing_call; uint8_t hf_initiate_memory_dialing; uint8_t hf_initiate_redial_last_number; + int memory_id; uint8_t hf_send_clip_enable; uint8_t hf_send_chup; diff --git a/src/hfp_hf.c b/src/hfp_hf.c index 52a09ffb3..dc6c90c54 100644 --- a/src/hfp_hf.c +++ b/src/hfp_hf.c @@ -284,9 +284,9 @@ static int hfp_hf_initiate_outgoing_call_cmd(uint16_t cid){ 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]; - 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); } @@ -632,7 +632,7 @@ static void hfp_run_for_context(hfp_connection_t * context){ if (context->hf_initiate_memory_dialing){ context->hf_initiate_memory_dialing = 0; 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; } @@ -1311,12 +1311,13 @@ void hfp_hf_dial_number(bd_addr_t bd_addr, char * number){ 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_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr); connection->hf_initiate_memory_dialing = 1; - snprintf(phone_number, sizeof(phone_number), "%s", number); + connection->memory_id = memory_id; + hfp_run_for_context(connection); } diff --git a/src/hfp_hf.h b/src/hfp_hf.h index a7fefdcff..b776e5ea8 100644 --- a/src/hfp_hf.h +++ b/src/hfp_hf.h @@ -252,17 +252,18 @@ void hfp_hf_connect_calls(bd_addr_t 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 number */ void hfp_hf_dial_number(bd_addr_t bd_addr, char * number); /** - * @brief - * TODO: use int for number instead of string? + * @brief Initiate outgoing voice call using the memory dialing feature 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 diff --git a/test/hfp/hfp_hf_client_test.c b/test/hfp/hfp_hf_client_test.c index deb06f0ca..bca067813 100644 --- a/test/hfp/hfp_hf_client_test.c +++ b/test/hfp/hfp_hf_client_test.c @@ -170,11 +170,11 @@ static void user_command(char cmd){ break; case 'j': printf("Dial #1\n"); - hfp_hf_dial_memory(device_addr, (char *)"1"); + hfp_hf_dial_memory(device_addr, 1); break; case 'J': printf("Dial #99\n"); - hfp_hf_dial_memory(device_addr, (char *)"99"); + hfp_hf_dial_memory(device_addr, 99); break; case 'k': printf("Deactivate call waiting notification\n"); diff --git a/test/pts/hfp_hf_test.c b/test/pts/hfp_hf_test.c index 03f3347d7..15679c93f 100644 --- a/test/pts/hfp_hf_test.c +++ b/test/pts/hfp_hf_test.c @@ -278,12 +278,12 @@ static int stdin_process(struct data_source *ds){ case 'j': log_info("USER:\'%c\'", cmd); printf("Dial #1\n"); - hfp_hf_dial_memory(device_addr,"1"); + hfp_hf_dial_memory(device_addr,1); break; case 'J': log_info("USER:\'%c\'", cmd); printf("Dial #99\n"); - hfp_hf_dial_memory(device_addr,"99"); + hfp_hf_dial_memory(device_addr,99); break; case 'k': log_info("USER:\'%c\'", cmd);