shared/hfp: Add dial support
PATCH 1/6 shared/hfp: Add dial support
If no number, NULL or empry string, is passed to hfp_hf_dial() this will try to call the last dialed phone number using AT+BLDN.
If the phone number starts with '>' and is followed by a number nnn…, up to 10 digits, it will call the phone number in memory entry nnn….
Else it will performed a voice call to the number provided.
--- src/shared/hfp.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++-- src/shared/hfp.h | 3 +++ 2 files changed, 60 insertions(+), 2 deletions(-)
src/shared/hfp.c +57 -2
@@ -102,6 +102,7 @@ struct hfp_hf {uint8_t battchg;struct queue *calls; +char *dialing_number; };struct cmd_handler {
@@ -1388,6 +1389,11 @@ void hfp_hf_unref(struct hfp_hf *hfp)queue_destroy (hfp->calls, remove_call_cb); hfp->calls =NULL ; +if (hfp->dialing_number) { +free (hfp->dialing_number); + hfp->dialing_number =NULL ; + } +if (!hfp->in_disconnect) {free (hfp);return ;
@@ -1622,7 +1628,8 @@ static struct hf_call *call_new(struct hfp_hf *hfp, unsigned int id, call = new0(struct hf_call, 1); call->id = id; call->status = status; - call->line_id = number; +if (number) + call->line_id =strdup (number); call->hfp = hfp;queue_push_tail (hfp->calls, call);
@@ -1807,7 +1814,11 @@ static void ciev_callsetup_cb(uint8_t val, void *user_data)DBG (hfp,"hf: No new call index available" );return ; } -call_new (hfp, id, status,NULL ); +call_new (hfp, id, status, hfp->dialing_number); +if (hfp->dialing_number) { +free (hfp->dialing_number); + hfp->dialing_number =NULL ; + }break ; } }
@@ -2421,6 +2432,50 @@ const char *hfp_hf_call_get_number(struct hfp_hf *hfp, uint id)return call->line_id; } +bool hfp_hf_dial (struct hfp_hf *hfp,const char *number, +hfp_response_func_t resp_cb, +void *user_data) +{ +const char *c; +int count =0 ; + +DBG (hfp,"" ); + +if (!hfp) +return false; + +if (number ==NULL ||strlen (number) ==0 ) +return hfp_hf_send_command (hfp, resp_cb, user_data, +"AT+BLDN" ); + +if (number[0 ] =='>' ) { +for (c = number +1 ; *c !='\0' ; c++) { +if (!(*c >='0' && *c <='9' )) +return false; + count++; + } +if (count <1 || count >10 ) +return false; + }else { +for (c = number; *c !='\0' ; c++) { +if (!(*c >='0' && *c <='9' ) && + !(*c >='A' && *c <='D' ) && + *c !='#' && *c !='*' && + *c !='+' && *c !=',' ) +return false; + count++; + } +if (count <1 || count >80 ) +return false; + } + +if (hfp->dialing_number) +free (hfp->dialing_number); + hfp->dialing_number =strdup (number); + +return hfp_hf_send_command (hfp, resp_cb, user_data,"ATD%s;" , number); +} +bool hfp_hf_call_answer (struct hfp_hf *hfp,uint id,hfp_response_func_t resp_cb,void *user_data)
src/shared/hfp.h +3 -0
@@ -237,6 +237,9 @@ bool hfp_hf_session(struct hfp_hf *hfp);const char *hfp_hf_call_get_number (struct hfp_hf *hfp,uint id); +bool hfp_hf_dial (struct hfp_hf *hfp,const char *number, +hfp_response_func_t resp_cb, +void *user_data);bool hfp_hf_call_answer (struct hfp_hf *hfp,uint id,hfp_response_func_t resp_cb,void *user_data);
Signature · 1 line
2.43.0
PATCH 2/6 unit/test-hfp: Add dial tests for HF
This add the following tests:
- /HFP/HF/OCL/BV-01-C
Initiate a call placed to the last number
- /HFP/HF/OCL/BV-02-C
Handling ERROR response to a call placed to last number
- /HFP/HF/OCM/BV-01-C
Initiate a request to place a call with a memory location
- /HFP/HF/OCM/BV-02-C
Handling ERROR response to a call placed to an empty memory location
- /HFP/HF/OCN/BV-01-C
HF places a call with a phone number
--- unit/test-hfp.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+)
unit/test-hfp.c +166 -0
@@ -739,13 +739,62 @@ static void hf_cmd_complete(enum hfp_result res, enum hfp_error cme_err, g_assert_cmpint(res, ==, HFP_RESULT_OK); } +static void hf_cmd_error (enum hfp_result res,enum hfp_error cme_err, +void *user_data) +{ + g_assert_cmpint(res, ==, HFP_RESULT_ERROR); +} +static void hf_session_ready_cb (enum hfp_result res,enum hfp_error cme_err,void *user_data) {struct context *context = user_data; +const char *test_name = context->data->test_name; g_assert_cmpint(res, ==, HFP_RESULT_OK); context->session.completed = true; + +if (g_str_equal (test_name,"/HFP/HF/OCL/BV-01-C" )) { +bool ret; + +if (tester_use_debug ()) +tester_debug ("calling last dialed number" ); + ret =hfp_hf_dial (context->hfp_hf,"" , hf_cmd_complete, + context); +g_assert (ret); + }else if (g_str_equal (test_name,"/HFP/HF/OCL/BV-02-C" )) { +bool ret; + +if (tester_use_debug ()) +tester_debug ("calling last dialed number" ); + ret =hfp_hf_dial (context->hfp_hf,"" , hf_cmd_error, + context); +g_assert (ret); + }else if (g_str_equal (test_name,"/HFP/HF/OCM/BV-01-C" )) { +bool ret; + +if (tester_use_debug ()) +tester_debug ("calling memory 1" ); + ret =hfp_hf_dial (context->hfp_hf,">1" , hf_cmd_complete, + context); +g_assert (ret); + }else if (g_str_equal (test_name,"/HFP/HF/OCM/BV-02-C" )) { +bool ret; + +if (tester_use_debug ()) +tester_debug ("calling memory 1" ); + ret =hfp_hf_dial (context->hfp_hf,">1" , hf_cmd_error, + context); +g_assert (ret); + }else if (g_str_equal (test_name,"/HFP/HF/OCN/BV-01-C" )) { +bool ret; + +if (tester_use_debug ()) +tester_debug ("calling number" ); + ret =hfp_hf_dial (context->hfp_hf,"1234567" , hf_cmd_complete, + context); +g_assert (ret); + } } static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val,
@@ -836,6 +885,27 @@ static void hf_call_added(uint id, enum hfp_call_status status, g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) { g_assert_cmpint(id, ==, 1); g_assert_cmpint(status, ==, CALL_STATUS_INCOMING); + } else if (g_str_equal(test_name, "/HFP/HF/OCL/BV-01-C")) { +const char *number; + + g_assert_cmpint(id, ==, 1); + g_assert_cmpint(status, ==, CALL_STATUS_DIALING); + number =hfp_hf_call_get_number (context->hfp_hf, id); +g_assert_null (number); + } else if (g_str_equal(test_name, "/HFP/HF/OCM/BV-01-C")) { +const char *number; + + g_assert_cmpint(id, ==, 1); + g_assert_cmpint(status, ==, CALL_STATUS_DIALING); + number =hfp_hf_call_get_number (context->hfp_hf, id); + g_assert_cmpstr(number, ==, ">1"); + } else if (g_str_equal(test_name, "/HFP/HF/OCN/BV-01-C")) { +const char *number; + + g_assert_cmpint(id, ==, 1); + g_assert_cmpint(status, ==, CALL_STATUS_DIALING); + number =hfp_hf_call_get_number (context->hfp_hf, id); + g_assert_cmpstr(number, ==, "1234567"); } else if (g_str_equal(test_name, "/HFP/HF/TCA/BV-04-C")) {bool ret;
@@ -917,6 +987,39 @@ static void hf_call_status_updated(uint id, enum hfp_call_status status,if (tester_use_debug ())tester_debug ("Error: unexpected update" );tester_test_failed (); + }else if (g_str_equal (test_name,"/HFP/HF/OCL/BV-01-C" )) { +const char *number; + + g_assert_cmpint(id, ==, 1); +if (context->session.step ==0 ) + g_assert_cmpint(status, ==, CALL_STATUS_ALERTING); +else + g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE); + number =hfp_hf_call_get_number (context->hfp_hf, id); +g_assert_null (number); + context->session.step++; + }else if (g_str_equal (test_name,"/HFP/HF/OCM/BV-01-C" )) { +const char *number; + + g_assert_cmpint(id, ==, 1); +if (context->session.step ==0 ) + g_assert_cmpint(status, ==, CALL_STATUS_ALERTING); +else + g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE); + number =hfp_hf_call_get_number (context->hfp_hf, id); + g_assert_cmpstr(number, ==, ">1"); + context->session.step++; + }else if (g_str_equal (test_name,"/HFP/HF/OCN/BV-01-C" )) { +const char *number; + + g_assert_cmpint(id, ==, 1); +if (context->session.step ==0 ) + g_assert_cmpint(status, ==, CALL_STATUS_ALERTING); +else + g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE); + number =hfp_hf_call_get_number (context->hfp_hf, id); + g_assert_cmpstr(number, ==, "1234567"); + context->session.step++; }else if (g_str_equal (test_name,"/HFP/HF/TCA/BV-01-C" )) {const char *number;bool ret;
@@ -1231,6 +1334,69 @@ int main(int argc, char *argv[]) '3', ',', '0', '\r', '\n'), data_end()); +/* Initiate a call placed to the last number - HF */ +define_hf_test ("/HFP/HF/OCL/BV-01-C" , test_hf_session, +NULL , test_hf_session_done, +MINIMAL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'2' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'3' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); + +/* Handling ERROR response to a call placed to last number - HF */ +define_hf_test ("/HFP/HF/OCL/BV-02-C" , test_hf_session, +NULL , test_hf_session_done, +MINIMAL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +raw_pdu ('\r' ,'\n' ,'E' ,'R' ,'R' ,'O' ,'R' ), +frg_pdu ('\r' ,'\n' ), +data_end ()); + +/* Initiate a request to place a call with a memory location - HF */ +define_hf_test ("/HFP/HF/OCM/BV-01-C" , test_hf_session, +NULL , test_hf_session_done, +MINIMAL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'2' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'3' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); + +/* Handling ERROR response to a call placed to an empty memory +* location - HF +*/ +define_hf_test ("/HFP/HF/OCM/BV-02-C" , test_hf_session, +NULL , test_hf_session_done, +MINIMAL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +raw_pdu ('\r' ,'\n' ,'E' ,'R' ,'R' ,'O' ,'R' ), +frg_pdu ('\r' ,'\n' ), +data_end ()); + +/* HF places a call with a phone number - HF */ +define_hf_test ("/HFP/HF/OCN/BV-01-C" , test_hf_session, +NULL , test_hf_session_done, +MINIMAL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'2' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'3' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); +/* Transfer Signal Strength Indication - HF */ define_hf_test("/HFP/HF/PSI/BV-01-C", test_hf_session, NULL, test_hf_session_done,
Signature · 1 line
2.43.0
PATCH 3/6 shared/hfp: Add in-band ring tone setting support
In reply to Frédéric Danis--- src/shared/hfp.c | 16 ++++++++++++++++ src/shared/hfp.h | 1 + 2 files changed, 17 insertions(+)
src/shared/hfp.c +16 -0
@@ -1752,6 +1752,20 @@ static bool call_active_match(const void *data, const void *match_data)return (call->status ==CALL_STATUS_ACTIVE ); } +static void bsir_cb (struct hfp_context *context,void *user_data) +{ +struct hfp_hf *hfp = user_data; +unsigned int val; + +DBG (hfp,"" ); + +if (!hfp_context_get_number (context, &val)) +return ; + +if (hfp->callbacks && hfp->callbacks->update_inband_ring) + hfp->callbacks->update_inband_ring (!!val, hfp->callbacks_data); +} +static void ciev_callsetup_cb (uint8_t val,void *user_data) {struct hfp_hf *hfp = user_data;
@@ -2083,6 +2097,8 @@ static void slc_cmer_resp(enum hfp_result result, enum hfp_error cme_err, }/* Register unsolicited results handlers */ +if (hfp->features &HFP_AG_FEAT_IN_BAND_RING_TONE ) +hfp_hf_register (hfp, bsir_cb,"+BSIR" , hfp,NULL );hfp_hf_register (hfp, ciev_cb,"+CIEV" , hfp,NULL );hfp_hf_register (hfp, clip_cb,"+CLIP" , hfp,NULL );hfp_hf_register (hfp, cops_cb,"+COPS" , hfp,NULL );
src/shared/hfp.h +1 -0
@@ -201,6 +201,7 @@ struct hfp_hf_callbacks {void (*update_indicator)(enum hfp_indicator indicator,uint32_t val,void *user_data);void (*update_operator)(const char *operator_name,void *user_data); +void (*update_inband_ring)(bool enabled,void *user_data);void (*call_added)(uint id,enum hfp_call_status status,void *user_data);
Signature · 1 line
2.43.0
PATCH 4/6 unit/test-hfp: Add Answer Incoming Call with In-Band Ring tests for HF
In reply to Frédéric DanisThis add the following tests:
- /HFP/HF/ICA/BV-01-C
Verify the incoming call is answered from HF, in-band ring tone.
- /HFP/HF/ICA/BV-02-C
Verify that the AG can change its in-band ring tone setting.
- /HFP/HF/ICA/BV-03-C
Verify that the HF alerts of an incoming call using the local ring signal regardless of the presence of the in-band ring tone.
- /HFP/HF/ICA/BV-04-C-full
duplicate of /HFP/HF/ICA/BV-04-C test with full SLC setup.
/HFP/HF/ICA/BV-05-C (Verify that the HF alerts an incoming call using a locally generated alert signal and can answer an incoming call in the AG when the AG does not use an in-band ring tone as an alert mechanism for the HF and the IUT allows an Audio Connection to be present) is similar to /HFP/HF/TCA/BV-02-C/HFP/HF/ICA/BV-04-C-full for the HF side.
--- unit/test-hfp.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 188 insertions(+), 2 deletions(-)
unit/test-hfp.c +188 -2
@@ -733,6 +733,37 @@ static void test_hf_robustness(gconstpointer data)frg_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), \ raw_pdu('\r', '\n', 'O', 'K', '\r', '\n') +#define FULL_SLC_SESSION (service, call, callsetup, callheld) \ + raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', ':', \ + ' ', '1', '6', '3', '8', '3', '\r', '\n'), \ + frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \ + raw_pdu('\r', '\n', '+', 'C', 'I', 'N', 'D', ':', ' ', \ + '(', '\"', 's', 'e', 'r', 'v', 'i', 'c', 'e', '\"', ',', \ + '(', '0', ',', '1', ')', ')', ',', \ + '(', '\"', 'c', 'a', 'l', 'l', '\"', ',', '(', '0', ',', \ + '1', ')', ')', ',', \ + '(', '\"', 'c', 'a', 'l', 'l', 's', 'e', 't', 'u', 'p', \ + '\"', ',', '(', '0', '-', '3', ')', ')', ',', \ + '(', '\"', 'c', 'a', 'l', 'l', 'h', 'e', 'l', 'd', '\"', \ + ',', '(', '0', '-', '2', ')', ')', ',', \ + '(', '\"', 's', 'i', 'g', 'n', 'a', 'l', '\"', ',', '(', \ + '0', '-', '5', ')', ')', ',', \ + '(', '\"', 'r', 'o', 'a', 'm', '\"', ',', '(', '0', ',', \ + '1', ')', ')', ',', \ + '(', '\"', 'b', 'a', 't', 't', 'c', 'h', 'g', '\"', ',', \ + '(', '0', '-', '5', ')', ')', ',', '\r', '\n'), \ + frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \ + raw_pdu('\r', '\n', '+', 'C', 'I', 'N', 'D', ':', ' ', service, ',', \ + call, ',', callsetup, ',', callheld, ',', '5', ',', '0', \ + ',', '5', '\r', '\n'), \ + frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \ + raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \ + raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \ + raw_pdu('\r', '\n', '+', 'C', 'O', 'P', 'S', ':', ' ', '0', ',', \ + '0', ',', '\"', 'T', 'E', 'S', 'T', '\"', '\r', '\n'), \ + frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \ + raw_pdu('\r', '\n', 'O', 'K', '\r', '\n') +static void hf_cmd_complete (enum hfp_result res,enum hfp_error cme_err,void *user_data) {
@@ -856,6 +887,25 @@ static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val, } } +static void hf_update_inband_ring (bool enabled,void *user_data) +{ +struct context *context = user_data; +const char *test_name = context->data->test_name; + +if (tester_use_debug ()) +tester_debug ("in-band ring updated: %u" , enabled); + +if (g_str_equal (test_name,"/HFP/HF/ICA/BV-01-C" )) + g_assert_cmpint(enabled, ==, true); +else if (g_str_equal (test_name,"/HFP/HF/ICA/BV-02-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C-full" )) + g_assert_cmpint(enabled, ==, !!context->session.step); +else if (g_str_equal (test_name,"/HFP/HF/ICA/BV-03-C" )) { + g_assert_cmpint(enabled, ==, !!context->session.step); + context->session.step++; + } +} +static void hf_update_operator (const char *operator_name,void *user_data) {struct context *context = user_data;
@@ -878,7 +928,11 @@ static void hf_call_added(uint id, enum hfp_call_status status,tester_debug ("call %d added: status %u" , id, status); if (g_str_equal(test_name, "/HFP/HF/CLI/BV-01-C") || + g_str_equal(test_name, "/HFP/HF/ICA/BV-01-C") || + g_str_equal(test_name, "/HFP/HF/ICA/BV-02-C") || + g_str_equal(test_name, "/HFP/HF/ICA/BV-03-C") || g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C") || + g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C-full") || g_str_equal(test_name, "/HFP/HF/ICA/BV-06-C") || g_str_equal(test_name, "/HFP/HF/ICR/BV-01-C") || g_str_equal(test_name, "/HFP/HF/TCA/BV-01-C") ||
@@ -937,7 +991,11 @@ static void hf_call_line_id_updated(uint id, const char *number, str =hfp_hf_call_get_number (context->hfp_hf, id); g_assert_cmpstr(number, ==, str); -if (g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C" ) || +if (g_str_equal (test_name,"/HFP/HF/ICA/BV-01-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-02-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-03-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C-full" ) ||g_str_equal (test_name,"/HFP/HF/TCA/BV-01-C" ) ||g_str_equal (test_name,"/HFP/HF/TCA/BV-02-C" )) {bool ret;
@@ -974,7 +1032,10 @@ static void hf_call_status_updated(uint id, enum hfp_call_status status,if (tester_use_debug ())tester_debug ("call %d updated: status %u" , id, status); -if (g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C" ) || +if (g_str_equal (test_name,"/HFP/HF/ICA/BV-01-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-03-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C-full" ) ||g_str_equal (test_name,"/HFP/HF/ICA/BV-06-C" ) ||g_str_equal (test_name,"/HFP/HF/TCA/BV-02-C" )) {const char *number;
@@ -983,6 +1044,25 @@ static void hf_call_status_updated(uint id, enum hfp_call_status status, g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE); number =hfp_hf_call_get_number (context->hfp_hf, id); g_assert_cmpstr(number, ==, "1234567"); + }else if (g_str_equal (test_name,"/HFP/HF/ICA/BV-02-C" )) { +const char *number; +bool ret; + + g_assert_cmpint(id, ==, 1); + g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE); + number =hfp_hf_call_get_number (context->hfp_hf, id); + g_assert_cmpstr(number, ==, "1234567"); + + context->session.step++; + +if (context->session.step ==1 ) { +if (tester_use_debug ()) +tester_debug ("call %d: ending call" , id); + ret =hfp_hf_call_hangup (context->hfp_hf, id, + hf_cmd_complete, + context); +g_assert (ret); + } }else if (g_str_equal (test_name,"/HFP/HF/ICR/BV-01-C" )) {if (tester_use_debug ())tester_debug ("Error: unexpected update" );
@@ -1041,6 +1121,7 @@ static struct hfp_hf_callbacks hf_session_callbacks = { .session_ready = hf_session_ready_cb, .update_indicator = hf_update_indicator, .update_operator = hf_update_operator, + .update_inband_ring = hf_update_inband_ring, .call_added = hf_call_added, .call_removed = hf_call_removed, .call_status_updated = hf_call_status_updated,
@@ -1264,6 +1345,87 @@ int main(int argc, char *argv[]) ',', '1', '2', '9', ',', ',', '\r', '\n'), data_end()); +/* Incoming call, in-band ring - HF */ +define_hf_test ("/HFP/HF/ICA/BV-01-C" , test_hf_session, +NULL , test_hf_session_done, +FULL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +frg_pdu ('\r' ,'\n' ,'+' ,'B' ,'S' ,'I' ,'R' ,':' ,' ' , +'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'R' ,'I' ,'N' ,'G' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'L' ,'I' ,'P' ,':' , +'\"' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'\"' , +',' ,'1' ,'2' ,'9' ,',' ,',' ,'\r' ,'\n' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); + +/* Answer incoming call and accept in-band setting change - HF */ +define_hf_test ("/HFP/HF/ICA/BV-02-C" , test_hf_session, +NULL , test_hf_session_done, +FULL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +frg_pdu ('\r' ,'\n' ,'+' ,'B' ,'S' ,'I' ,'R' ,':' ,' ' , +'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'R' ,'I' ,'N' ,'G' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'L' ,'I' ,'P' ,':' , +'\"' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'\"' , +',' ,'1' ,'2' ,'9' ,',' ,',' ,'\r' ,'\n' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'B' ,'S' ,'I' ,'R' ,':' ,' ' , +'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'R' ,'I' ,'N' ,'G' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'L' ,'I' ,'P' ,':' , +'\"' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'\"' , +',' ,'1' ,'2' ,'9' ,',' ,',' ,'\r' ,'\n' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); + +/* Answer incoming call on HF with ring muting - HF */ +define_hf_test ("/HFP/HF/ICA/BV-03-C" , test_hf_session, +NULL , test_hf_session_done, +FULL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +frg_pdu ('\r' ,'\n' ,'+' ,'B' ,'S' ,'I' ,'R' ,':' ,' ' , +'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'B' ,'S' ,'I' ,'R' ,':' ,' ' , +'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'R' ,'I' ,'N' ,'G' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'L' ,'I' ,'P' ,':' , +'\"' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'\"' , +',' ,'1' ,'2' ,'9' ,',' ,',' ,'\r' ,'\n' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); +/* Answer Incoming call on HF, no in-band ring - HF */ define_hf_test("/HFP/HF/ICA/BV-04-C", test_hf_session, NULL, test_hf_session_done,
@@ -1283,6 +1445,30 @@ int main(int argc, char *argv[]) '2', ',', '0', '\r', '\n'), data_end()); +/* Answer Incoming call on HF, no in-band ring, full SLC setup - HF +* idem for /HFP/HF/ICA/BV-05-C Audio Connection + answer incoming +* call from HF with locally generated alert +*/ +define_hf_test ("/HFP/HF/ICA/BV-04-C-full" , test_hf_session, +NULL , test_hf_session_done, +FULL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +frg_pdu ('\r' ,'\n' ,'+' ,'B' ,'S' ,'I' ,'R' ,':' ,' ' , +'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'R' ,'I' ,'N' ,'G' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'L' ,'I' ,'P' ,':' , +'\"' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'\"' , +',' ,'1' ,'2' ,'9' ,',' ,',' ,'\r' ,'\n' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); +/* Answer Incoming call on AG, no in-band ring - HF */ define_hf_test("/HFP/HF/ICA/BV-06-C", test_hf_session, NULL, test_hf_session_done,
Signature · 1 line
2.43.0
PATCH 5/6 unit/test-hfp: Add incoming call prior to connection test
In reply to Frédéric DanisThis add the following test:
- /HFP/HF/ICA/BV-07-C
Verify that HF can connect to an AG that is receiving an in-coming call.
--- unit/test-hfp.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
unit/test-hfp.c +28 -1
@@ -849,7 +849,10 @@ static void hf_update_indicator(enum hfp_indicator indicator, uint32_t val, g_assert_cmpint(val, ==, 0);break ;case HFP_INDICATOR_CALLSETUP : - g_assert_cmpint(val, ==, 0); +if (g_str_equal (test_name,"/HFP/HF/ICA/BV-07-C" )) + g_assert_cmpint(val, ==, 1); +else + g_assert_cmpint(val, ==, 0);break ;case HFP_INDICATOR_CALLHELD : g_assert_cmpint(val, ==, 0);
@@ -934,6 +937,7 @@ static void hf_call_added(uint id, enum hfp_call_status status,g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C" ) ||g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C-full" ) ||g_str_equal (test_name,"/HFP/HF/ICA/BV-06-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-07-C" ) ||g_str_equal (test_name,"/HFP/HF/ICR/BV-01-C" ) ||g_str_equal (test_name,"/HFP/HF/TCA/BV-01-C" ) || g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) {
@@ -996,6 +1000,7 @@ static void hf_call_line_id_updated(uint id, const char *number,g_str_equal (test_name,"/HFP/HF/ICA/BV-03-C" ) ||g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C" ) ||g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C-full" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-07-C" ) ||g_str_equal (test_name,"/HFP/HF/TCA/BV-01-C" ) || g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) { bool ret;
@@ -1037,6 +1042,7 @@ static void hf_call_status_updated(uint id, enum hfp_call_status status,g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C" ) ||g_str_equal (test_name,"/HFP/HF/ICA/BV-04-C-full" ) ||g_str_equal (test_name,"/HFP/HF/ICA/BV-06-C" ) || +g_str_equal (test_name,"/HFP/HF/ICA/BV-07-C" ) || g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) { const char *number;
@@ -1491,6 +1497,27 @@ int main(int argc, char *argv[]) '2', ',', '0', '\r', '\n'), data_end()); +/* Answer Incoming call on AG prior to connection, no in-band +* ring - HF +*/ +define_hf_test ("/HFP/HF/ICA/BV-07-C" , test_hf_session, +NULL , test_hf_session_done, +MINIMAL_SLC_SESSION ('1' ,'0' ,'1' ,'0' ), +frg_pdu ('\r' ,'\n' ,'R' ,'I' ,'N' ,'G' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'L' ,'I' ,'P' ,':' , +'\"' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'\"' , +',' ,'1' ,'2' ,'9' ,',' ,',' ,',' ,'\"' ,'A' , +'i' ,'n' ,'c' ,'o' ,'m' ,'i' ,'n' ,'g' ,'c' , +'a' ,'l' ,'l' ,'\"' ,'\r' ,'\n' ), +raw_pdu ('\r' ,'\n' ,'O' ,'K' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'2' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); +/* Initiate rejection of incoming call - HF */ define_hf_test("/HFP/HF/ICR/BV-01-C", test_hf_session, NULL, test_hf_session_done,
Signature · 1 line
2.43.0
PATCH 6/6 unit/test-hfp: Add incoming call interrupted test
In reply to Frédéric DanisThis add the following test:
- /HFP/HF/CIT/BV-01-C
Verify that HF responds as expected when a normal incoming call process is interrupted from the remote party.
--- unit/test-hfp.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
unit/test-hfp.c +16 -1
@@ -930,7 +930,8 @@ static void hf_call_added(uint id, enum hfp_call_status status,if (tester_use_debug ())tester_debug ("call %d added: status %u" , id, status); - if (g_str_equal(test_name, "/HFP/HF/CLI/BV-01-C") || + if (g_str_equal(test_name, "/HFP/HF/CIT/BV-01-C") || + g_str_equal(test_name, "/HFP/HF/CLI/BV-01-C") || g_str_equal(test_name, "/HFP/HF/ICA/BV-01-C") || g_str_equal(test_name, "/HFP/HF/ICA/BV-02-C") || g_str_equal(test_name, "/HFP/HF/ICA/BV-03-C") ||
@@ -1339,6 +1340,20 @@ int main(int argc, char *argv[])MINIMAL_SLC_SESSION ('0' ,'0' ,'0' ,'0' ), data_end()); +/* Incoming call interrupted - HF */ +define_hf_test ("/HFP/HF/CIT/BV-01-C" , test_hf_session, +NULL , test_hf_session_done, +MINIMAL_SLC_SESSION ('1' ,'0' ,'0' ,'0' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'1' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'R' ,'I' ,'N' ,'G' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'L' ,'I' ,'P' ,':' , +'\"' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'\"' , +',' ,'1' ,'2' ,'9' ,',' ,',' ,'\r' ,'\n' ), +frg_pdu ('\r' ,'\n' ,'+' ,'C' ,'I' ,'E' ,'V' ,':' ,' ' , +'3' ,',' ,'0' ,'\r' ,'\n' ), +data_end ()); +/* Calling Line Identification - HF */ define_hf_test("/HFP/HF/CLI/BV-01-C", test_hf_session, NULL, test_hf_session_done,
Signature · 1 line
2.43.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1007578
---Test result---
Test Summary:
CheckPatch PENDING 0.28 seconds GitLint PENDING 0.40 seconds BuildEll PASS 20.64 seconds BluezMake PASS 2607.64 seconds MakeCheck PASS 20.42 seconds MakeDistcheck PASS 185.43 seconds CheckValgrind PASS 236.93 seconds CheckSmatch PASS 308.63 seconds bluezmakeextell PASS 128.56 seconds IncrementalBuild PENDING 0.30 seconds ScanBuild PASS 922.76 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth