Merge branch 'master' into ble-api-cleanup

This commit is contained in:
Matthias Ringwald 2015-11-29 21:14:34 +01:00
commit a5bdcda89a
5 changed files with 34 additions and 33 deletions

View File

@ -540,9 +540,8 @@ typedef struct hfp_connection {
uint8_t send_phone_number_for_voice_tag;
uint8_t send_ag_status_indicators;
uint8_t send_response_and_hold_active;
uint8_t send_response_and_hold_status;
uint8_t send_response_and_hold_status; // 0 - don't send. BRTH:0 == 1, ..
// AG only
uint8_t change_in_band_ring_tone_setting;
uint8_t ag_ring;

View File

@ -984,12 +984,12 @@ static hfp_connection_t * hfp_ag_connection_for_call_state(hfp_call_state_t call
return NULL;
}
static void hfp_ag_send_response_and_hold_state(void){
static void hfp_ag_send_response_and_hold_state(hfp_response_and_hold_state_t state){
linked_list_iterator_t it;
linked_list_iterator_init(&it, hfp_get_connections());
while (linked_list_iterator_has_next(&it)){
hfp_connection_t * connection = (hfp_connection_t *)linked_list_iterator_next(&it);
connection->send_response_and_hold_status = 1;
connection->send_response_and_hold_status = state + 1;
}
}
@ -1092,6 +1092,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
printf("AG: joining held call with active call\n");
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_NO_CALLS_HELD);
hfp_ag_transfer_callheld_state();
hfp_emit_event(hfp_callback, HFP_SUBEVENT_CONFERENCE_CALL, 0);
break;
default:
break;
@ -1133,7 +1134,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
hfp_ag_response_and_hold_active = 1;
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD;
hfp_ag_send_response_and_hold_state();
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
// as with regualr call
hfp_ag_set_call_state(HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT);
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
@ -1158,7 +1159,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
hfp_ag_response_and_hold_active = 1;
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD;
hfp_ag_send_response_and_hold_state();
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
// as with regualr call
hfp_ag_set_call_state(HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT);
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
@ -1178,8 +1179,9 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_HF:
if (!hfp_ag_response_and_hold_active) break;
if (hfp_ag_response_and_hold_state != HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD) break;
hfp_ag_response_and_hold_active = 0;
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_HELD_INCOMING_ACCEPTED;
hfp_ag_send_response_and_hold_state();
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
printf("Held Call accepted and active\n");
break;
@ -1187,8 +1189,9 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_HF:
if (!hfp_ag_response_and_hold_active) break;
if (hfp_ag_response_and_hold_state != HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD) break;
hfp_ag_response_and_hold_active = 0;
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_HELD_INCOMING_REJECTED;
hfp_ag_send_response_and_hold_state();
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
// from terminate by ag
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
hfp_ag_trigger_terminate_call();
@ -1272,7 +1275,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
if (hfp_ag_response_and_hold_active) {
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_HELD_INCOMING_REJECTED;
hfp_ag_send_response_and_hold_state();
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
}
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
@ -1395,14 +1398,9 @@ static void hfp_run_for_context(hfp_connection_t *context){
// note: before update AG indicators and ok_pending
if (context->send_response_and_hold_status){
int status = context->send_response_and_hold_status - 1;
context->send_response_and_hold_status = 0;
hfp_ag_set_response_and_hold(context->rfcomm_cid, hfp_ag_response_and_hold_state);
return;
}
if (context->send_response_and_hold_active){
context->send_response_and_hold_active = 0;
hfp_ag_set_response_and_hold(context->rfcomm_cid, 0);
hfp_ag_set_response_and_hold(context->rfcomm_cid, status);
return;
}
@ -1534,7 +1532,7 @@ static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_
switch(context->command){
case HFP_CMD_RESPONSE_AND_HOLD_QUERY:
if (hfp_ag_response_and_hold_active){
context->send_response_and_hold_active = 1;
context->send_response_and_hold_status = HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD + 1;
}
context->ok_pending = 1;
break;

View File

@ -1336,7 +1336,7 @@ void hfp_hf_activate_calling_line_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_calling_line_notification = 1;
connection->hf_activate_calling_line_notification = 1;
hfp_run_for_context(connection);
}
@ -1359,7 +1359,7 @@ void hfp_hf_activate_echo_canceling_and_noise_reduction(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_echo_canceling_and_noise_reduction = 1;
connection->hf_activate_echo_canceling_and_noise_reduction = 1;
hfp_run_for_context(connection);
}

View File

@ -161,22 +161,22 @@ TEST(HFPParser, HFP_HF_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES){
CHECK_EQUAL(0, strcmp("3", (char*)context.remote_call_services[4].name));
}
TEST(HFPParser, HFP_HF_GENERIC_STATUS_INDICATOR){
sprintf(packet, "\r\n%s:0,1,2,3,4\r\n\r\nOK\r\n", HFP_GENERIC_STATUS_INDICATOR);
//context.command = HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS;
context.state = HFP_W4_RETRIEVE_GENERIC_STATUS_INDICATORS;
// TEST(HFPParser, HFP_HF_GENERIC_STATUS_INDICATOR){
// sprintf(packet, "\r\n%s:0,1,2,3,4\r\n\r\nOK\r\n", HFP_GENERIC_STATUS_INDICATOR);
// //context.command = HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS;
// context.state = HFP_W4_RETRIEVE_GENERIC_STATUS_INDICATORS;
for (pos = 0; pos < strlen(packet); pos++){
hfp_parse(&context, packet[pos], 1);
}
// for (pos = 0; pos < strlen(packet); pos++){
// hfp_parse(&context, packet[pos], 1);
// }
CHECK_EQUAL(HFP_CMD_OK, context.command);
CHECK_EQUAL(5, context.generic_status_indicators_nr);
// CHECK_EQUAL(HFP_CMD_OK, context.command);
// CHECK_EQUAL(5, context.generic_status_indicators_nr);
for (pos = 0; pos < context.generic_status_indicators_nr; pos++){
CHECK_EQUAL(pos, context.generic_status_indicators[pos].uuid);
}
}
// for (pos = 0; pos < context.generic_status_indicators_nr; pos++){
// CHECK_EQUAL(pos, context.generic_status_indicators[pos].uuid);
// }
// }
TEST(HFPParser, HFP_HF_GENERIC_STATUS_INDICATOR_STATE){
sprintf(packet, "\r\n%s:0,1\r\n\r\nOK\r\n", HFP_GENERIC_STATUS_INDICATOR);

View File

@ -288,6 +288,10 @@ uint16_t hci_get_sco_voice_setting(){
return 0x40;
}
int hci_remote_eSCO_supported(hci_con_handle_t handle){
return 0;
}
void inject_rfcomm_command_to_hf(uint8_t * data, int len){
if (memcmp((char*)data, "AT", 2) == 0) return;