remove printf

This commit is contained in:
Milanka Ringwald 2016-06-29 12:05:02 +02:00
parent ae4aa2b6a5
commit 60ebb071aa
3 changed files with 41 additions and 42 deletions

View File

@ -319,7 +319,6 @@ static hfp_connection_t * provide_hfp_connection_context_for_bd_addr(bd_addr_t b
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
if (hfp_connection) return hfp_connection;
hfp_connection = create_hfp_connection_context();
printf("created hfp_connection for address %s\n", bd_addr_to_str(bd_addr));
memcpy(hfp_connection->remote_addr, bd_addr, 6);
return hfp_connection;
}

View File

@ -1130,7 +1130,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL);
hfp_ag_set_callsetup_indicator();
hfp_ag_trigger_incoming_call();
printf("AG rings\n");
log_info("AG rings");
break;
default:
break;
@ -1142,7 +1142,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL);
hfp_ag_set_callsetup_indicator();
hfp_ag_trigger_incoming_call();
printf("AG call waiting\n");
log_info("AG call waiting");
break;
default:
break;
@ -1159,7 +1159,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_call_indicator();
hfp_ag_set_callsetup_indicator();
hfp_ag_ag_accept_call();
printf("AG answers call, accept call by GSM\n");
log_info("AG answers call, accept call by GSM");
break;
default:
break;
@ -1168,7 +1168,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
switch (hfp_gsm_callsetup_status()){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
printf("AG: current call is placed on hold, incoming call gets active\n");
log_info("AG: current call is placed on hold, incoming call gets active");
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG);
hfp_ag_set_callsetup_indicator();
hfp_ag_set_callheld_indicator();
@ -1187,7 +1187,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
switch (hfp_gsm_callheld_status()){
case HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED:
printf("AG: joining held call with active call\n");
log_info("AG: joining held call with active call");
hfp_gsm_handle_event(HFP_AG_HELD_CALL_JOINED_BY_AG);
hfp_ag_set_callheld_indicator();
hfp_ag_transfer_callheld_state();
@ -1211,7 +1211,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_callsetup_indicator();
hfp_ag_set_call_indicator();
hfp_ag_hf_accept_call(hfp_connection);
printf("HF answers call, accept call by GSM\n");
log_info("HF answers call, accept call by GSM");
hfp_emit_simple_event(hfp_callback, HFP_SUBEVENT_CALL_ANSWERED);
break;
default:
@ -1236,7 +1236,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_call_indicator();
hfp_ag_set_callsetup_indicator();
hfp_ag_ag_accept_call();
printf("AG response and hold - hold by AG\n");
log_info("AG response and hold - hold by AG");
break;
default:
break;
@ -1260,7 +1260,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_call_indicator();
hfp_ag_set_callsetup_indicator();
hfp_ag_hf_accept_call(hfp_connection);
printf("AG response and hold - hold by HF\n");
log_info("AG response and hold - hold by HF");
break;
default:
break;
@ -1279,7 +1279,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
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_response_and_hold_state);
printf("Held Call accepted and active\n");
log_info("Held Call accepted and active");
break;
case HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_AG:
@ -1304,14 +1304,14 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_callsetup_indicator();
hfp_ag_transfer_callsetup_state();
hfp_ag_trigger_reject_call();
printf("HF Rejected Incoming call, AG terminate call\n");
log_info("HF Rejected Incoming call, AG terminate call");
break;
case HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_DIALING_STATE:
case HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_ALERTING_STATE:
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_HF);
hfp_ag_set_callsetup_indicator();
hfp_ag_transfer_callsetup_state();
printf("AG terminate outgoing call process\n");
log_info("AG terminate outgoing call process");
default:
break;
}
@ -1321,7 +1321,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_call_indicator();
hfp_ag_transfer_call_state();
hfp_connection->call_state = HFP_CALL_IDLE;
printf("AG terminate call\n");
log_info("AG terminate call");
break;
}
break;
@ -1334,7 +1334,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_AG);
hfp_ag_set_callsetup_indicator();
hfp_ag_trigger_reject_call();
printf("AG Rejected Incoming call, AG terminate call\n");
log_info("AG Rejected Incoming call, AG terminate call");
break;
default:
break;
@ -1344,7 +1344,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_callsetup_indicator();
hfp_ag_set_call_indicator();
hfp_ag_trigger_terminate_call();
printf("AG terminate call\n");
log_info("AG terminate call");
break;
default:
break;
@ -1356,12 +1356,12 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
switch (hfp_gsm_callsetup_status()){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
hfp_ag_stop_ringing();
printf("Incoming call interrupted\n");
log_info("Incoming call interrupted");
break;
case HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_DIALING_STATE:
case HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_ALERTING_STATE:
printf("Outgoing call interrupted\n");
printf("AG notify call dropped\n");
log_info("Outgoing call interrupted\n");
log_info("AG notify call dropped\n");
break;
default:
break;
@ -1380,7 +1380,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_callsetup_indicator();
hfp_ag_set_call_indicator();
hfp_ag_trigger_terminate_call();
printf("AG notify call dropped\n");
log_info("AG notify call dropped");
break;
default:
break;
@ -1412,14 +1412,14 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_gsm_handle_event(HFP_AG_OUTGOING_REDIAL_INITIATED);
hfp_connection->call_state = HFP_CALL_OUTGOING_INITIATED;
printf("\nRedial last number");
log_info("Redial last number");
char * last_dialed_number = hfp_gsm_last_dialed_number();
if (strlen(last_dialed_number) > 0){
printf("\nLast number exists: accept call");
log_info("Last number exists: accept call");
hfp_emit_string_event(hfp_callback, HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER, last_dialed_number);
} else {
printf("\nLast number missing: reject call");
log_info("log_infoLast number missing: reject call");
hfp_ag_outgoing_call_rejected();
}
break;
@ -1457,7 +1457,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
// put current call on hold if active
if (put_call_on_hold){
printf("AG putting current call on hold for new outgoing call\n");
log_info("AG putting current call on hold for new outgoing calllog_info");
hfp_ag_set_callheld_indicator();
indicator_index = get_ag_indicator_index_for_name("callheld");
hfp_ag_transfer_ag_indicators_status_cmd(hfp_connection->rfcomm_cid, &hfp_ag_indicators[indicator_index]);
@ -1510,7 +1510,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_ag_set_callsetup_indicator();
hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
hfp_connection->call_state = HFP_CALL_ACTIVE;
printf("AG: Call Waiting, User Busy\n");
log_info("AG: Call Waiting, User Busy");
break;
case HFP_AG_CALL_HOLD_RELEASE_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL:{
@ -1524,11 +1524,11 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
}
if (call_setup_in_progress){
printf("AG: Call Dropped, Accept new call\n");
log_info("AG: Call Dropped, Accept new call");
hfp_ag_set_callsetup_indicator();
hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
} else {
printf("AG: Call Dropped, Resume held call\n");
log_info("AG: Call Dropped, Resume held call");
}
if (call_held){
hfp_ag_set_callheld_indicator();
@ -1546,11 +1546,11 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_gsm_handle_event_with_call_index(HFP_AG_CALL_HOLD_PARK_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL, hfp_connection->call_index);
if (call_setup_in_progress){
printf("AG: Call on Hold, Accept new call\n");
log_info("AG: Call on Hold, Accept new call");
hfp_ag_set_callsetup_indicator();
hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
} else {
printf("AG: Swap calls\n");
log_info("AG: Swap calls");
}
hfp_ag_set_callheld_indicator();
@ -1563,7 +1563,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
case HFP_AG_CALL_HOLD_ADD_HELD_CALL:
// Adds a held call to the conversation.
if (hfp_gsm_callheld_status() != HFP_CALLHELD_STATUS_NO_CALLS_HELD){
printf("AG: Join 3-way-call\n");
log_info("AG: Join 3-way-call");
hfp_gsm_handle_event(HFP_AG_CALL_HOLD_ADD_HELD_CALL);
hfp_ag_set_callheld_indicator();
hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
@ -1574,7 +1574,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
case HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS:
// Connects the two calls and disconnects the subscriber from both calls (Explicit Call Transfer)
hfp_gsm_handle_event(HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS);
printf("AG: Transfer call -> Connect two calls and disconnect\n");
log_info("AG: Transfer call -> Connect two calls and disconnect");
hfp_ag_set_call_indicator();
hfp_ag_set_callheld_indicator();
hfp_connection->ag_indicators_status_update_bitmap = store_bit(hfp_connection->ag_indicators_status_update_bitmap, call_indicator_index, 1);
@ -1609,7 +1609,7 @@ static void hfp_ag_send_call_status(hfp_connection_t * hfp_connection, int call_
offset += snprintf(buffer+offset, sizeof(buffer)-offset, ", \"%s\",%u", number, type);
}
snprintf(buffer+offset, sizeof(buffer)-offset, "\r\n");
printf("hfp_ag_send_current_call_status 000 index %d, dir %d, status %d, mode %d, mpty %d, type %d, number %s\n", idx, dir, status,
log_info("hfp_ag_send_current_call_status 000 index %d, dir %d, status %d, mode %d, mpty %d, type %d, number %s", idx, dir, status,
mode, mpty, type, number);
send_str_over_rfcomm(hfp_connection->rfcomm_cid, buffer);
}
@ -1815,7 +1815,7 @@ static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_
break;
case HFP_CMD_RESPONSE_AND_HOLD_COMMAND:
value = atoi((char *)&hfp_connection->line_buffer[0]);
printf("HF Response and Hold: %u\n", value);
log_info("HF Response and Hold: %u", value);
switch(value){
case HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD:
hfp_ag_call_sm(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF, hfp_connection);
@ -1846,17 +1846,17 @@ static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_
hfp_connection->send_error = 1;
return;
}
printf("HF Indicator 'enhanced security' set to %u\n", value);
log_info("HF Indicator 'enhanced security' set to %u", value);
break;
case 2: // battery level
if (value > 100){
hfp_connection->send_error = 1;
return;
}
printf("HF Indicator 'battery' set to %u\n", value);
log_info("HF Indicator 'battery' set to %u", value);
break;
default:
printf("HF Indicator unknown set to %u\n", value);
log_info("HF Indicator unknown set to %u", value);
break;
}
hfp_connection->ok_pending = 1;
@ -1893,14 +1893,14 @@ static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_
if (get_bit(hfp_supported_features, HFP_AGSF_EC_NR_FUNCTION)){
hfp_connection->ok_pending = 1;
hfp_supported_features = store_bit(hfp_supported_features, HFP_AGSF_EC_NR_FUNCTION, hfp_connection->ag_echo_and_noise_reduction);
printf("AG: EC/NR = %u\n", hfp_connection->ag_echo_and_noise_reduction);
log_info("AG: EC/NR = %u", hfp_connection->ag_echo_and_noise_reduction);
} else {
hfp_connection->send_error = 1;
}
break;
case HFP_CMD_CALL_ANSWERED:
hfp_connection->command = HFP_CMD_NONE;
printf("HFP: ATA\n");
log_info("HFP: ATA");
hfp_ag_call_sm(HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF, hfp_connection);
break;
case HFP_CMD_HANG_UP_CALL:
@ -1972,12 +1972,12 @@ static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_
case HFP_CMD_SET_SPEAKER_GAIN:
hfp_connection->command = HFP_CMD_NONE;
hfp_connection->ok_pending = 1;
printf("HF speaker gain = %u\n", hfp_connection->speaker_gain);
log_info("HF speaker gain = %u", hfp_connection->speaker_gain);
break;
case HFP_CMD_SET_MICROPHONE_GAIN:
hfp_connection->command = HFP_CMD_NONE;
hfp_connection->ok_pending = 1;
printf("HF microphone gain = %u\n", hfp_connection->microphone_gain);
log_info("HF microphone gain = %u", hfp_connection->microphone_gain);
break;
default:
break;
@ -2243,7 +2243,7 @@ void hfp_ag_activate_voice_recognition(bd_addr_t bd_addr, int activate){
hfp_connection_t * hfp_connection = get_hfp_connection_context_for_bd_addr(bd_addr);
if (!get_bit(hfp_connection->remote_supported_features, HFP_HFSF_VOICE_RECOGNITION_FUNCTION)) {
printf("AG cannot acivate voice recognition - not supported by HF\n");
log_info("AG cannot acivate voice recognition - not supported by HF");
return;
}

View File

@ -801,7 +801,7 @@ static void hfp_run_for_context(hfp_connection_t * hfp_connection){
sprintf(buffer, "AT%s=%u,%u\r\n", HFP_TRANSFER_HF_INDICATOR_STATUS, hfp_indicators[i], hfp_indicators_value[i]);
send_str_over_rfcomm(hfp_connection->rfcomm_cid, buffer);
} else {
printf("Not sending HF indicator %u as it is disabled\n", hfp_indicators[i]);
log_info("Not sending HF indicator %u as it is disabled", hfp_indicators[i]);
}
return;
}
@ -921,7 +921,7 @@ static void hfp_hf_switch_on_ok(hfp_connection_t *hfp_connection){
switch (hfp_connection->hf_query_operator_state){
case HFP_HF_QUERY_OPERATOR_W4_SET_FORMAT_OK:
printf("Format set, querying name\n");
// printf("Format set, querying name\n");
hfp_connection->hf_query_operator_state = HFP_HF_QUERY_OPERATOR_SEND_QUERY;
break;
case HPF_HF_QUERY_OPERATOR_W4_RESULT: