hfp: fixed hfp test

This commit is contained in:
Milanka Ringwald 2015-08-28 09:47:40 +02:00
parent d86bb74349
commit 4bc5b29fb0
3 changed files with 20 additions and 10 deletions

View File

@ -702,7 +702,7 @@ void process_command(hfp_connection_t * context){
}
if (strncmp((char *)context->line_buffer+offset, HFP_CONFIRM_COMMON_CODEC, strlen(HFP_CONFIRM_COMMON_CODEC)) == 0){
if (isHandsFree){
if (!isHandsFree){
context->command = HFP_CMD_HF_CONFIRMED_CODEC;
} else {
context->command = HFP_CMD_AG_SUGGESTED_CODEC;

View File

@ -491,9 +491,19 @@ static void hfp_run_for_context(hfp_connection_t * context){
break;
}
if (context->suggested_codec){
context->codec_confirmed = 1;
context->wait_ok = 1;
hfp_hf_cmd_confirm_codec(context->rfcomm_cid, context->suggested_codec);
if (hfp_hf_supports_codec(context->suggested_codec)){
context->codec_confirmed = context->suggested_codec;
context->wait_ok = 1;
hfp_hf_cmd_confirm_codec(context->rfcomm_cid, context->suggested_codec);
} else {
context->notify_ag_on_new_codecs = 1;
context->wait_ok = 1;
context->codec_confirmed = 0;
context->suggested_codec = 0;
context->negotiated_codec = 0;
hfp_hf_cmd_notify_on_codecs(context->rfcomm_cid);
}
break;
}

View File

@ -283,12 +283,12 @@ TEST_GROUP(HandsfreeClient){
};
// TEST(HandsfreeClient, HFCodecsConnectionEstablished){
// setup_hfp_service_level_connection(default_slc_setup, default_slc_setup_size);
// for (int i = 0; i < cc_tests_size; i++){
// setup_hfp_codecs_connection_state_machine(hfp_cc_tests[i].test, hfp_cc_tests[i].len);
// }
// }
TEST(HandsfreeClient, HFCodecsConnectionEstablished){
setup_hfp_service_level_connection(default_slc_setup, default_slc_setup_size);
for (int i = 0; i < cc_tests_size; i++){
setup_hfp_codecs_connection_state_machine(hfp_cc_tests[i].test, hfp_cc_tests[i].len);
}
}
TEST(HandsfreeClient, HFCodecChange){
setup_hfp_service_level_connection(default_slc_setup, default_slc_setup_size);