mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 01:27:41 +00:00
provide subscriber number, support joining calls by AG
This commit is contained in:
parent
7df18b41eb
commit
4f32727bc1
@ -259,6 +259,7 @@ typedef enum {
|
||||
HFP_AG_OUTGOING_CALL_RINGING,
|
||||
HFP_AG_OUTGOING_CALL_ESTABLISHED,
|
||||
HFP_AG_OUTGOING_REDIAL_INITIATED,
|
||||
HFP_AG_HELD_CALL_JOINED_BY_AG,
|
||||
HFP_AG_TERMINATE_CALL_BY_AG,
|
||||
HFP_AG_TERMINATE_CALL_BY_HF,
|
||||
HFP_AG_CALL_DROPPED,
|
||||
|
23
src/hfp_ag.c
23
src/hfp_ag.c
@ -1042,6 +1042,25 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case HFP_AG_HELD_CALL_JOINED_BY_AG:
|
||||
switch (hfp_ag_call_state){
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
switch (hfp_ag_callheld_state){
|
||||
case HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED:
|
||||
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();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF:
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
@ -1678,6 +1697,10 @@ void hfp_ag_answer_incoming_call(void){
|
||||
hfp_ag_call_sm(HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG, NULL);
|
||||
}
|
||||
|
||||
void hfp_ag_join_held_call(void){
|
||||
hfp_ag_call_sm(HFP_AG_HELD_CALL_JOINED_BY_AG, NULL);
|
||||
}
|
||||
|
||||
void hfp_ag_terminate_call(void){
|
||||
hfp_ag_call_sm(HFP_AG_TERMINATE_CALL_BY_AG, NULL);
|
||||
}
|
||||
|
@ -212,7 +212,12 @@ void hfp_ag_call_dropped(void);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_ag_answer_incoming_call(void);
|
||||
void hfp_ag_answer_incoming_call(void);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_ag_join_held_call(void);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
|
@ -79,11 +79,13 @@ static uint16_t handle = -1;
|
||||
static int memory_1_enabled = 1;
|
||||
static int last_number_exists = 1;
|
||||
|
||||
static int current_call_info_available = 0;
|
||||
static int current_call_index = 0;
|
||||
static hfp_enhanced_call_dir_t current_call_dir;
|
||||
static int current_call_exists_a = 0;
|
||||
static int current_call_exists_b = 0;
|
||||
static hfp_enhanced_call_status_t current_call_status;
|
||||
static hfp_enhanced_call_mpty_t current_call_mpty = HFP_ENHANCED_CALL_MPTY_NOT_A_CONFERENCE_CALL;
|
||||
static char * current_call_number = NULL;
|
||||
|
||||
|
||||
static int ag_indicators_nr = 7;
|
||||
static hfp_ag_indicator_t ag_indicators[] = {
|
||||
@ -172,7 +174,7 @@ static void show_usage(void){
|
||||
printf("S - Set microphone gain to 15 (maximum)\n");
|
||||
|
||||
printf("t - terminate connection\n");
|
||||
|
||||
printf("u - join held call\n");
|
||||
printf("---\n");
|
||||
printf("Ctrl-c - exit\n");
|
||||
printf("---\n");
|
||||
@ -209,19 +211,17 @@ static int stdin_process(struct data_source *ds){
|
||||
break;
|
||||
case 'c':
|
||||
printf("Simulate incoming call from 1234567\n");
|
||||
current_call_info_available = 1;
|
||||
current_call_exists_a = 1;
|
||||
current_call_dir = HFP_ENHANCED_CALL_DIR_INCOMING;
|
||||
current_call_status = HFP_ENHANCED_CALL_STATUS_INCOMING;
|
||||
current_call_number = "1234567";
|
||||
hfp_ag_set_clip(129, "1234567");
|
||||
hfp_ag_incoming_call();
|
||||
break;
|
||||
case 'm':
|
||||
printf("Simulate incoming call from 7654321\n");
|
||||
current_call_info_available = 1;
|
||||
current_call_exists_b = 1;
|
||||
current_call_dir = HFP_ENHANCED_CALL_DIR_INCOMING;
|
||||
current_call_status = HFP_ENHANCED_CALL_STATUS_INCOMING;
|
||||
current_call_number = "7654321";
|
||||
hfp_ag_set_clip(129, "7654321");
|
||||
hfp_ag_incoming_call();
|
||||
break;
|
||||
@ -240,7 +240,6 @@ static int stdin_process(struct data_source *ds){
|
||||
break;
|
||||
case 'E':
|
||||
printf("Reject call on AG\n");
|
||||
current_call_info_available = 0;
|
||||
hfp_ag_terminate_call();
|
||||
break;
|
||||
case 'f':
|
||||
@ -346,6 +345,13 @@ static int stdin_process(struct data_source *ds){
|
||||
case 't':
|
||||
printf("Terminate HCI connection.\n");
|
||||
gap_disconnect(handle);
|
||||
break;
|
||||
case 'u':
|
||||
printf("Join held call\n");
|
||||
current_call_mpty = HFP_ENHANCED_CALL_MPTY_CONFERENCE_CALL;
|
||||
current_call_status = HFP_ENHANCED_CALL_STATUS_ACTIVE;
|
||||
hfp_ag_join_held_call();
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
break;
|
||||
@ -429,10 +435,17 @@ static void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
hfp_ag_send_dtmf_code_done(device_addr);
|
||||
break;
|
||||
case HFP_SUBEVENT_TRANSMIT_STATUS_OF_CURRENT_CALL:
|
||||
if (current_call_info_available){
|
||||
current_call_info_available = 0;
|
||||
if (current_call_index == 0 && current_call_exists_a){
|
||||
hfp_ag_send_current_call_status(device_addr, 1, current_call_dir, current_call_status,
|
||||
HFP_ENHANCED_CALL_MODE_VOICE, current_call_mpty, 129, current_call_number);
|
||||
HFP_ENHANCED_CALL_MODE_VOICE, current_call_mpty, 129, "1234567");
|
||||
current_call_index = 1;
|
||||
break;
|
||||
}
|
||||
if (current_call_index == 1 && current_call_exists_b){
|
||||
hfp_ag_send_current_call_status(device_addr, 2, current_call_dir, current_call_status,
|
||||
HFP_ENHANCED_CALL_MODE_VOICE, current_call_mpty, 129, "7654321");
|
||||
current_call_index = 2;
|
||||
break;
|
||||
}
|
||||
hfp_ag_send_current_call_status_done(device_addr);
|
||||
break;
|
||||
@ -442,6 +455,10 @@ static void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
}
|
||||
}
|
||||
|
||||
static hfp_phone_number_t subscriber_number = {
|
||||
129, "225577"
|
||||
};
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
// init L2CAP
|
||||
@ -452,7 +469,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
ag_indicators, ag_indicators_nr,
|
||||
hf_indicators, hf_indicators_nr,
|
||||
call_hold_services, call_hold_services_nr);
|
||||
|
||||
hfp_ag_set_subcriber_number_information(&subscriber_number, 1);
|
||||
hfp_ag_register_packet_handler(packet_handler);
|
||||
|
||||
sdp_init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user