implement hfp_ag_set_signal_strength

This commit is contained in:
Matthias Ringwald 2015-11-19 22:08:20 +01:00
parent 47850ba16e
commit 15cadb4796
3 changed files with 35 additions and 7 deletions

View File

@ -1058,13 +1058,10 @@ void hfp_ag_place_a_call_with_phone_number(void){
// }
}
/*
* @breif
*/
void hfp_ag_set_registration_status(int status){
int indicator_index = get_ag_indicator_index_for_name("service");
static void hfp_ag_set_ag_indicator(const char * name, int value){
int indicator_index = get_ag_indicator_index_for_name(name);
if (indicator_index < 0) return;
hfp_ag_indicators[indicator_index].status = status;
hfp_ag_indicators[indicator_index].status = value;
linked_list_iterator_t it;
linked_list_iterator_init(&it, hfp_get_connections());
@ -1075,3 +1072,18 @@ void hfp_ag_set_registration_status(int status){
}
}
/*
* @brief
*/
void hfp_ag_set_registration_status(int status){
hfp_ag_set_ag_indicator("service", status);
}
/*
* @brief
*/
void hfp_ag_set_signal_strength(int strength){
hfp_ag_set_ag_indicator("signal", strength);
}

View File

@ -201,10 +201,15 @@ void hfp_ag_audio_connection_transfer_towards_ag(bd_addr_t bd_addr);
void hfp_ag_place_a_call_with_phone_number(void);
/*
* @breif
* @brief
*/
void hfp_ag_set_registration_status(int status);
/*
* @brief
*/
void hfp_ag_set_signal_strength(int strength);
/* API_END */
#if defined __cplusplus

View File

@ -129,6 +129,9 @@ static void show_usage(void){
printf("f - Disable cellular network\n");
printf("F - Enable cellular network\n");
printf("g - Set signal strength to 0\n");
printf("G - Set signal strength to 5\n");
printf("t - terminate connection\n");
printf("---\n");
@ -189,6 +192,14 @@ static int stdin_process(struct data_source *ds){
printf("Enable cellular network\n");
hfp_ag_set_registration_status(1);
break;
case 'g':
printf("Set signal strength to 0\n");
hfp_ag_set_signal_strength(0);
break;
case 'G':
printf("Set signal strength to 5\n");
hfp_ag_set_signal_strength(5);
break;
case 'r':
printf("Disable in-band ring tone\n");
hfp_ag_set_use_in_band_ring_tone(0);