mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-04 06:39:53 +00:00
implement hfp_ag_set_registration_status
This commit is contained in:
parent
9348a338e2
commit
47850ba16e
40
src/hfp_ag.c
40
src/hfp_ag.c
@ -105,6 +105,16 @@ static hfp_ag_indicator_t * get_ag_indicator_for_name(const char * name){
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int get_ag_indicator_index_for_name(const char * name){
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < hfp_ag_indicators_nr; i++){
|
||||||
|
if (strcmp(hfp_ag_indicators[i].name, name) == 0){
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void set_hfp_ag_indicators(hfp_ag_indicator_t * indicators, int indicator_nr){
|
void set_hfp_ag_indicators(hfp_ag_indicator_t * indicators, int indicator_nr){
|
||||||
memcpy(hfp_ag_indicators, indicators, indicator_nr * sizeof(hfp_ag_indicator_t));
|
memcpy(hfp_ag_indicators, indicators, indicator_nr * sizeof(hfp_ag_indicator_t));
|
||||||
hfp_ag_indicators_nr = indicator_nr;
|
hfp_ag_indicators_nr = indicator_nr;
|
||||||
@ -798,6 +808,19 @@ static void hfp_run_for_context(hfp_connection_t *context){
|
|||||||
done = hfp_ag_run_for_context_service_level_connection_queries(context);
|
done = hfp_ag_run_for_context_service_level_connection_queries(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update AG indicators
|
||||||
|
if (context->ag_indicators_status_update_bitmap){
|
||||||
|
int i;
|
||||||
|
for (i=0;i<context->ag_indicators_nr;i++){
|
||||||
|
if (get_bit(context->ag_indicators_status_update_bitmap, i)){
|
||||||
|
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, i, 0);
|
||||||
|
hfp_ag_transfer_ag_indicators_status_cmd(context->rfcomm_cid, &hfp_ag_indicators[i]);
|
||||||
|
done = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!done){
|
if (!done){
|
||||||
done = incoming_call_state_machine(context);
|
done = incoming_call_state_machine(context);
|
||||||
}
|
}
|
||||||
@ -1035,3 +1058,20 @@ 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");
|
||||||
|
if (indicator_index < 0) return;
|
||||||
|
hfp_ag_indicators[indicator_index].status = status;
|
||||||
|
|
||||||
|
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->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, indicator_index, 1);
|
||||||
|
hfp_run_for_context(connection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -154,6 +154,9 @@ void hfp_ag_transfer_callheld_status(bd_addr_t bd_addr, hfp_callheld_status_t st
|
|||||||
*/
|
*/
|
||||||
void hfp_ag_negotiate_codecs(bd_addr_t bd_addr);
|
void hfp_ag_negotiate_codecs(bd_addr_t bd_addr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*/
|
||||||
void hfp_ag_establish_audio_connection(bd_addr_t bd_addr);
|
void hfp_ag_establish_audio_connection(bd_addr_t bd_addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,6 +200,11 @@ void hfp_ag_audio_connection_transfer_towards_ag(bd_addr_t bd_addr);
|
|||||||
*/
|
*/
|
||||||
void hfp_ag_place_a_call_with_phone_number(void);
|
void hfp_ag_place_a_call_with_phone_number(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @breif
|
||||||
|
*/
|
||||||
|
void hfp_ag_set_registration_status(int status);
|
||||||
|
|
||||||
/* API_END */
|
/* API_END */
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
|
@ -126,6 +126,8 @@ static void show_usage(void){
|
|||||||
printf("r - disable in-band ring tone\n");
|
printf("r - disable in-band ring tone\n");
|
||||||
printf("R - enable in-band ring tone\n");
|
printf("R - enable in-band ring tone\n");
|
||||||
|
|
||||||
|
printf("f - Disable cellular network\n");
|
||||||
|
printf("F - Enable cellular network\n");
|
||||||
|
|
||||||
printf("t - terminate connection\n");
|
printf("t - terminate connection\n");
|
||||||
|
|
||||||
@ -179,6 +181,14 @@ static int stdin_process(struct data_source *ds){
|
|||||||
printf("Answer call on AG\n");
|
printf("Answer call on AG\n");
|
||||||
hfp_ag_answer_incoming_call();
|
hfp_ag_answer_incoming_call();
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
printf("Disable cellular network\n");
|
||||||
|
hfp_ag_set_registration_status(0);
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
printf("Enable cellular network\n");
|
||||||
|
hfp_ag_set_registration_status(1);
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
printf("Disable in-band ring tone\n");
|
printf("Disable in-band ring tone\n");
|
||||||
hfp_ag_set_use_in_band_ring_tone(0);
|
hfp_ag_set_use_in_band_ring_tone(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user