mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-21 03:40:47 +00:00
Merge branch 'master' into ble-api-cleanup
This commit is contained in:
commit
667ec0681a
@ -732,10 +732,10 @@ static hfp_command_t parse_command(const char * line_buffer, int isHandsFree){
|
||||
if (strncmp(line_buffer+strlen(HFP_RESPONSE_AND_HOLD)+offset, "?", 1) == 0){
|
||||
return HFP_CMD_RESPONSE_AND_HOLD_QUERY;
|
||||
}
|
||||
|
||||
if (strncmp(line_buffer+strlen(HFP_RESPONSE_AND_HOLD)+offset, "=", 1) == 0){
|
||||
return HFP_CMD_RESPONSE_AND_HOLD_COMMAND;
|
||||
}
|
||||
return HFP_CMD_RESPONSE_AND_HOLD_STATUS;
|
||||
}
|
||||
|
||||
if (strncmp(line_buffer+offset, HFP_INDICATOR, strlen(HFP_INDICATOR)) == 0){
|
||||
@ -771,7 +771,7 @@ static hfp_command_t parse_command(const char * line_buffer, int isHandsFree){
|
||||
if (strncmp(line_buffer+strlen(HFP_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES)+offset, "=?", 2) == 0){
|
||||
return HFP_CMD_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES;
|
||||
}
|
||||
if (strncmp(line_buffer+strlen(HFP_GENERIC_STATUS_INDICATOR)+offset, "=", 1) == 0){
|
||||
if (strncmp(line_buffer+strlen(HFP_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES)+offset, "=", 1) == 0){
|
||||
return HFP_CMD_CALL_HOLD;
|
||||
}
|
||||
|
||||
@ -779,8 +779,9 @@ static hfp_command_t parse_command(const char * line_buffer, int isHandsFree){
|
||||
}
|
||||
|
||||
if (strncmp(line_buffer+offset, HFP_GENERIC_STATUS_INDICATOR, strlen(HFP_GENERIC_STATUS_INDICATOR)) == 0){
|
||||
if (isHandsFree) return HFP_CMD_UNKNOWN;
|
||||
|
||||
if (isHandsFree) {
|
||||
return HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS;
|
||||
}
|
||||
if (strncmp(line_buffer+strlen(HFP_GENERIC_STATUS_INDICATOR)+offset, "=?", 2) == 0){
|
||||
return HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS;
|
||||
}
|
||||
@ -827,12 +828,12 @@ static hfp_command_t parse_command(const char * line_buffer, int isHandsFree){
|
||||
}
|
||||
|
||||
if (strncmp(line_buffer+offset, "AT+", 3) == 0){
|
||||
printf(" process unknown HF command %s \n", line_buffer);
|
||||
log_info("process unknown HF command %s \n", line_buffer);
|
||||
return HFP_CMD_UNKNOWN;
|
||||
}
|
||||
|
||||
if (strncmp(line_buffer+offset, "+", 1) == 0){
|
||||
printf(" process unknown AG command %s \n", line_buffer);
|
||||
log_info(" process unknown AG command %s \n", line_buffer);
|
||||
return HFP_CMD_UNKNOWN;
|
||||
}
|
||||
|
||||
@ -1066,6 +1067,76 @@ void hfp_parse(hfp_connection_t * context, uint8_t byte, int isHandsFree){
|
||||
static void parse_sequence(hfp_connection_t * context){
|
||||
int value;
|
||||
switch (context->command){
|
||||
case HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS:
|
||||
value = atoi((char *)&context->line_buffer[0]);
|
||||
int i;
|
||||
switch (context->parser_item_index){
|
||||
case 0:
|
||||
for (i=0;i<context->generic_status_indicators_nr;i++){
|
||||
if (context->generic_status_indicators[i].uuid == value){
|
||||
context->parser_indicator_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (context->parser_indicator_index <0) break;
|
||||
context->generic_status_indicators[context->parser_indicator_index].state = value;
|
||||
log_info("HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS set indicator at index %u, to %u\n",
|
||||
context->parser_item_index, value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
context->parser_item_index++;
|
||||
break;
|
||||
|
||||
case HFP_CMD_GET_SUBSCRIBER_NUMBER_INFORMATION:
|
||||
switch(context->parser_item_index){
|
||||
case 0:
|
||||
strncpy(context->bnip_number, (char *)context->line_buffer, sizeof(context->bnip_number));
|
||||
context->bnip_number[sizeof(context->bnip_number)-1] = 0;
|
||||
break;
|
||||
case 1:
|
||||
value = atoi((char *)&context->line_buffer[0]);
|
||||
context->bnip_type = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
context->parser_item_index++;
|
||||
break;
|
||||
case HFP_CMD_LIST_CURRENT_CALLS:
|
||||
switch(context->parser_item_index){
|
||||
case 0:
|
||||
value = atoi((char *)&context->line_buffer[0]);
|
||||
context->clcc_idx = value;
|
||||
break;
|
||||
case 1:
|
||||
value = atoi((char *)&context->line_buffer[0]);
|
||||
context->clcc_dir = value;
|
||||
break;
|
||||
case 2:
|
||||
value = atoi((char *)&context->line_buffer[0]);
|
||||
context->clcc_status = value;
|
||||
break;
|
||||
case 3:
|
||||
value = atoi((char *)&context->line_buffer[0]);
|
||||
context->clcc_mpty = value;
|
||||
break;
|
||||
case 4:
|
||||
strncpy(context->bnip_number, (char *)context->line_buffer, sizeof(context->bnip_number));
|
||||
context->bnip_number[sizeof(context->bnip_number)-1] = 0;
|
||||
break;
|
||||
case 5:
|
||||
value = atoi((char *)&context->line_buffer[0]);
|
||||
context->bnip_type = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
context->parser_item_index++;
|
||||
break;
|
||||
case HFP_CMD_SET_MICROPHONE_GAIN:
|
||||
value = atoi((char *)&context->line_buffer[0]);
|
||||
context->microphone_gain = value;
|
||||
|
@ -164,6 +164,7 @@ typedef enum {
|
||||
HFP_CMD_LIST_GENERIC_STATUS_INDICATORS,
|
||||
HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS,
|
||||
HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS_STATE,
|
||||
HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS,
|
||||
|
||||
HFP_CMD_TRANSFER_AG_INDICATOR_STATUS,
|
||||
|
||||
@ -195,6 +196,7 @@ typedef enum {
|
||||
HFP_CMD_LIST_CURRENT_CALLS,
|
||||
HFP_CMD_RESPONSE_AND_HOLD_QUERY,
|
||||
HFP_CMD_RESPONSE_AND_HOLD_COMMAND,
|
||||
HFP_CMD_RESPONSE_AND_HOLD_STATUS,
|
||||
HFP_CMD_HF_INDICATOR_STATUS
|
||||
} hfp_command_t;
|
||||
|
||||
@ -481,17 +483,20 @@ typedef struct hfp_connection {
|
||||
// TODO: rename into hf_codecs_nr
|
||||
int remote_codecs_nr;
|
||||
uint16_t remote_codecs[HFP_MAX_INDICATOR_DESC_SIZE];
|
||||
|
||||
int ag_indicators_nr;
|
||||
hfp_ag_indicator_t ag_indicators[HFP_MAX_INDICATOR_DESC_SIZE];
|
||||
uint32_t ag_indicators_status_update_bitmap;
|
||||
uint8_t enable_status_update_for_ag_indicators;
|
||||
|
||||
int remote_call_services_nr;
|
||||
hfp_call_service_t remote_call_services[HFP_MAX_INDICATOR_DESC_SIZE];
|
||||
|
||||
// TODO: use bitmap.
|
||||
int generic_status_indicators_nr;
|
||||
uint32_t generic_status_update_bitmap;
|
||||
hfp_generic_status_indicator_t generic_status_indicators[HFP_MAX_INDICATOR_DESC_SIZE];
|
||||
uint8_t enable_status_update_for_ag_indicators;
|
||||
|
||||
uint32_t ag_indicators_status_update_bitmap;
|
||||
hfp_network_opearator_t network_operator;
|
||||
|
||||
// Retrieved during service level connection establishment, not used yet
|
||||
@ -563,8 +568,15 @@ typedef struct hfp_connection {
|
||||
uint8_t hf_send_chld_2;
|
||||
uint8_t hf_send_chld_3;
|
||||
uint8_t hf_send_chld_4;
|
||||
uint8_t hf_send_chld_x;
|
||||
uint8_t hf_send_chld_x_index;
|
||||
char hf_send_dtmf_code;
|
||||
uint8_t hf_send_binp;
|
||||
uint8_t hf_send_clcc;
|
||||
uint8_t hf_send_rrh;
|
||||
char hf_send_rrh_command;
|
||||
uint8_t hf_send_cnum;
|
||||
|
||||
uint8_t hf_activate_call_waiting_notification;
|
||||
uint8_t hf_deactivate_call_waiting_notification;
|
||||
|
||||
@ -575,6 +587,13 @@ typedef struct hfp_connection {
|
||||
uint8_t hf_activate_voice_recognition_notification;
|
||||
uint8_t hf_deactivate_voice_recognition_notification;
|
||||
|
||||
uint8_t clcc_idx;
|
||||
uint8_t clcc_dir;
|
||||
uint8_t clcc_status;
|
||||
uint8_t clcc_mode;
|
||||
uint8_t clcc_mpty;
|
||||
|
||||
// also used for CLCC if set
|
||||
uint8_t bnip_type; // 0 == not set
|
||||
char bnip_number[25]; //
|
||||
|
||||
|
@ -69,7 +69,11 @@ static uint8_t hfp_codecs[HFP_MAX_NUM_CODECS];
|
||||
|
||||
static uint8_t hfp_indicators_nr = 0;
|
||||
static uint8_t hfp_indicators[HFP_MAX_NUM_HF_INDICATORS];
|
||||
static uint8_t hfp_indicators_status;
|
||||
static uint32_t hfp_indicators_value[HFP_MAX_NUM_HF_INDICATORS];
|
||||
static uint16_t hfp_indicators_status;
|
||||
|
||||
static uint8_t hfp_hf_speaker_gain = 9;
|
||||
static uint8_t hfp_hf_microphone_gain = 9;
|
||||
|
||||
static hfp_callback_t hfp_callback;
|
||||
|
||||
@ -316,6 +320,12 @@ static int hfp_hf_send_binp(uint16_t cid){
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_send_clcc(uint16_t cid){
|
||||
char buffer[20];
|
||||
sprintf(buffer, "AT%s\r\n", HFP_LIST_CURRENT_CALLS);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static void hfp_emit_ag_indicator_event(hfp_callback_t callback, int status, hfp_ag_indicator_t indicator){
|
||||
if (!callback) return;
|
||||
uint8_t event[6+HFP_MAX_INDICATOR_DESC_SIZE+1];
|
||||
@ -676,6 +686,13 @@ static void hfp_run_for_context(hfp_connection_t * context){
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_send_chld_x){
|
||||
context->hf_send_chld_x = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_send_chld(context->rfcomm_cid, context->hf_send_chld_x_index);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_send_dtmf_code){
|
||||
char code = context->hf_send_dtmf_code;
|
||||
context->hf_send_dtmf_code = 0;
|
||||
@ -691,6 +708,60 @@ static void hfp_run_for_context(hfp_connection_t * context){
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_send_clcc){
|
||||
context->hf_send_clcc = 0;
|
||||
context->ok_pending = 1;
|
||||
hfp_hf_send_clcc(context->rfcomm_cid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_send_rrh){
|
||||
context->hf_send_rrh = 0;
|
||||
char buffer[20];
|
||||
switch (context->hf_send_rrh_command){
|
||||
case '?':
|
||||
sprintf(buffer, "AT%s?\r\n", HFP_RESPONSE_AND_HOLD);
|
||||
send_str_over_rfcomm(context->rfcomm_cid, buffer);
|
||||
return;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
sprintf(buffer, "AT%s=%c\r\n", HFP_RESPONSE_AND_HOLD, context->hf_send_rrh_command);
|
||||
send_str_over_rfcomm(context->rfcomm_cid, buffer);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->hf_send_cnum){
|
||||
context->hf_send_cnum = 0;
|
||||
char buffer[20];
|
||||
sprintf(buffer, "AT%s\r\n", HFP_SUBSCRIBER_NUMBER_INFORMATION);
|
||||
send_str_over_rfcomm(context->rfcomm_cid, buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
// update HF indicators
|
||||
if (context->generic_status_update_bitmap){
|
||||
int i;
|
||||
for (i=0;i<hfp_indicators_nr;i++){
|
||||
if (get_bit(context->generic_status_update_bitmap, i)){
|
||||
if (context->generic_status_indicators[i].state){
|
||||
context->ok_pending = 1;
|
||||
context->generic_status_update_bitmap = store_bit(context->generic_status_update_bitmap, i, 0);
|
||||
char buffer[30];
|
||||
sprintf(buffer, "AT%s=%u,%u\r\n", HFP_TRANSFER_HF_INDICATOR_STATUS, hfp_indicators[i], hfp_indicators_value[i]);
|
||||
send_str_over_rfcomm(context->rfcomm_cid, buffer);
|
||||
} else {
|
||||
printf("Not sending HF indicator %u as it is disabled\n", hfp_indicators[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (done) return;
|
||||
// deal with disconnect
|
||||
switch (context->state){
|
||||
@ -720,6 +791,19 @@ static void hfp_ag_slc_established(hfp_connection_t * context){
|
||||
context->state = HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED;
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED, 0);
|
||||
hfp_init_link_settings(context);
|
||||
// restore volume settings
|
||||
context->speaker_gain = hfp_hf_speaker_gain;
|
||||
context->send_speaker_gain = 1;
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_SPEAKER_VOLUME, hfp_hf_speaker_gain);
|
||||
context->microphone_gain = hfp_hf_microphone_gain;
|
||||
context->send_microphone_gain = 1;
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_MICROPHONE_VOLUME, hfp_hf_microphone_gain);
|
||||
// enable all indicators
|
||||
int i;
|
||||
for (i=0;i<hfp_indicators_nr;i++){
|
||||
context->generic_status_indicators[i].uuid = hfp_indicators[i];
|
||||
context->generic_status_indicators[i].state = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void hfp_hf_switch_on_ok(hfp_connection_t *context){
|
||||
@ -836,20 +920,38 @@ static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8
|
||||
if (!context) return;
|
||||
|
||||
packet[size] = 0;
|
||||
int pos, i;
|
||||
int pos, i, value;
|
||||
//printf("\nHF received: %s", packet+2);
|
||||
for (pos = 0; pos < size ; pos++){
|
||||
hfp_parse(context, packet[pos], 1);
|
||||
}
|
||||
|
||||
switch (context->command){
|
||||
case HFP_CMD_GET_SUBSCRIBER_NUMBER_INFORMATION:
|
||||
context->command = HFP_CMD_NONE;
|
||||
printf("Subscriber Number: number %s, type %u\n", context->bnip_number, context->bnip_type);
|
||||
break;
|
||||
case HFP_CMD_RESPONSE_AND_HOLD_STATUS:
|
||||
context->command = HFP_CMD_NONE;
|
||||
printf("Response and Hold status: %s\n", context->line_buffer);
|
||||
break;
|
||||
case HFP_CMD_LIST_CURRENT_CALLS:
|
||||
context->command = HFP_CMD_NONE;
|
||||
printf("Enhanced Call Status: idx %u, dir %u, status %u, mpty %u, number %s, type %u\n",
|
||||
context->clcc_idx, context->clcc_dir, context->clcc_status, context->clcc_mpty,
|
||||
context->bnip_number, context->bnip_type);
|
||||
break;
|
||||
case HFP_CMD_SET_SPEAKER_GAIN:
|
||||
context->command = HFP_CMD_NONE;
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_SPEAKER_VOLUME, atoi((char*)context->line_buffer));
|
||||
value = atoi((char*)context->line_buffer);
|
||||
hfp_hf_speaker_gain = value;
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_SPEAKER_VOLUME, value);
|
||||
break;
|
||||
case HFP_CMD_SET_MICROPHONE_GAIN:
|
||||
context->command = HFP_CMD_NONE;
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_MICROPHONE_VOLUME, atoi((char*)context->line_buffer));
|
||||
value = atoi((char*)context->line_buffer);
|
||||
hfp_hf_microphone_gain = value;
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_MICROPHONE_VOLUME, value);
|
||||
break;
|
||||
case HFP_CMD_AG_SENT_PHONE_NUMBER:
|
||||
context->command = HFP_CMD_NONE;
|
||||
@ -1162,10 +1264,29 @@ void hfp_hf_connect_calls(bd_addr_t addr){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_connect_calls(bd_addr_t addr);
|
||||
void hfp_hf_release_call_with_index(bd_addr_t addr, int index){
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
|
||||
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS ||
|
||||
hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
|
||||
connection->hf_send_chld_x = 1;
|
||||
connection->hf_send_chld_x_index = 10 + index;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
}
|
||||
|
||||
void hfp_hf_private_consultation_with_call(bd_addr_t addr, int index){
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
|
||||
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS ||
|
||||
hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
|
||||
connection->hf_send_chld_x = 1;
|
||||
connection->hf_send_chld_x_index = 20 + index;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
}
|
||||
|
||||
void hfp_hf_dial_number(bd_addr_t bd_addr, char * number){
|
||||
hfp_hf_establish_service_level_connection(bd_addr);
|
||||
@ -1321,3 +1442,91 @@ void hfp_hf_request_phone_number_for_voice_tag(bd_addr_t addr){
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_query_current_call_status(bd_addr_t addr){
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
connection->hf_send_clcc = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_rrh_query_status(bd_addr_t addr){
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
connection->hf_send_rrh = 1;
|
||||
connection->hf_send_rrh_command = '?';
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_rrh_hold_call(bd_addr_t addr){
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
connection->hf_send_rrh = 1;
|
||||
connection->hf_send_rrh_command = '0';
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_rrh_accept_held_call(bd_addr_t addr){
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
connection->hf_send_rrh = 1;
|
||||
connection->hf_send_rrh_command = '1';
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_rrh_reject_held_call(bd_addr_t addr)
|
||||
{
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
connection->hf_send_rrh = 1;
|
||||
connection->hf_send_rrh_command = '2';
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_query_subscriber_number(bd_addr_t addr)
|
||||
{
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
connection->hf_send_cnum = 1;
|
||||
hfp_run_for_context(connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_set_hf_indicator(bd_addr_t addr, int assigned_number, int value){
|
||||
hfp_hf_establish_service_level_connection(addr);
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(addr);
|
||||
// find index for assigned number
|
||||
int i;
|
||||
for (i = 0; i < hfp_indicators_nr ; i++){
|
||||
if (hfp_indicators[i] == assigned_number){
|
||||
// set value
|
||||
hfp_indicators_value[i] = value;
|
||||
// mark for update
|
||||
connection->generic_status_update_bitmap |= (1<<i);
|
||||
// send update
|
||||
hfp_run_for_context(connection);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,51 @@ void hfp_hf_send_dtmf_code(bd_addr_t bd_addr, char code);
|
||||
*/
|
||||
void hfp_hf_request_phone_number_for_voice_tag(bd_addr_t addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_query_current_call_status(bd_addr_t addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_release_call_with_index(bd_addr_t addr, int index);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_private_consultation_with_call(bd_addr_t addr, int index);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_rrh_query_status(bd_addr_t addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_rrh_hold_call(bd_addr_t addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_rrh_accept_held_call(bd_addr_t addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_rrh_reject_held_call(bd_addr_t addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_query_subscriber_number(bd_addr_t addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_set_hf_indicator(bd_addr_t addr, int assigned_number, int value);
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
|
@ -103,7 +103,7 @@ static void show_usage(void){
|
||||
printf("C - enable registration status update for all AG indicators\n");
|
||||
|
||||
printf("d - query network operator.\n");
|
||||
printf("D - set HFP AG registration status update for individual indicators\n");
|
||||
printf("D - set HFP AG registration status update for individual indicators (IIA)\n");
|
||||
|
||||
printf("e - disable reporting of the extended AG error result code\n");
|
||||
printf("E - enable reporting of the extended AG error result code\n");
|
||||
@ -144,15 +144,28 @@ static void show_usage(void){
|
||||
|
||||
printf("t - terminate connection\n");
|
||||
|
||||
printf("u - send 'user busy' (Three-Way Call 0)\n");
|
||||
printf("U - end active call and accept other call' (Three-Way Call 1)\n");
|
||||
printf("v - Swap active call and hold/waiting call (Three-Way Call 2)\n");
|
||||
printf("V - Join held call (Three-Way Call 3)\n");
|
||||
printf("w - Connect calls (Three-Way Call 4)\n");
|
||||
printf("u - send 'user busy' (TWC 0)\n");
|
||||
printf("U - end active call and accept other call' (TWC 1)\n");
|
||||
printf("v - Swap active call and hold/waiting call (TWC 2)\n");
|
||||
printf("V - Join held call (TWC 3)\n");
|
||||
printf("w - Connect calls (TWC 4)\n");
|
||||
printf("W - redial\n");
|
||||
|
||||
printf("0123456789#*-+ - send DTMF dial tones\n");
|
||||
|
||||
printf("x - request phone number for voice tag\n");
|
||||
printf("X - current call status (ECS)\n");
|
||||
printf("y - release call with index 2 (ECC)\n");
|
||||
printf("Y - private consulation with call 2(ECC)\n");
|
||||
|
||||
printf("[ - Query Response and Hold status (RHH ?)\n");
|
||||
printf("] - Place call in a response and held state(RHH 0)\n");
|
||||
printf("{ - Accept held call(RHH 1)\n");
|
||||
printf("} - Reject held call(RHH 2)\n");
|
||||
|
||||
printf("? - Query Subscriber Number (NUM)\n");
|
||||
|
||||
printf("! - Update HF indicator with assigned number 1 (HFI)\n");
|
||||
|
||||
printf("---\n");
|
||||
printf("Ctrl-c - exit\n");
|
||||
@ -235,10 +248,6 @@ static int stdin_process(struct data_source *ds){
|
||||
printf("Terminate HCI connection.\n");
|
||||
gap_disconnect(handle);
|
||||
break;
|
||||
case 'y':
|
||||
memcpy(device_addr, phone_addr, 6);
|
||||
printf("Use iPhone %s as Audiogateway.\n", bd_addr_to_str(device_addr));
|
||||
break;
|
||||
case 'i':
|
||||
printf("Dial 1234567\n");
|
||||
hfp_hf_dial_number(device_addr, "1234567");
|
||||
@ -311,6 +320,14 @@ static int stdin_process(struct data_source *ds){
|
||||
printf("Set microphone gain to 9\n");
|
||||
hfp_hf_set_microphone_gain(device_addr, 9);
|
||||
break;
|
||||
case 's':
|
||||
printf("Set microphone gain to 12\n");
|
||||
hfp_hf_set_microphone_gain(device_addr, 12);
|
||||
break;
|
||||
case 'S':
|
||||
printf("Set microphone gain to 15\n");
|
||||
hfp_hf_set_microphone_gain(device_addr, 15);
|
||||
break;
|
||||
case 'u':
|
||||
printf("Send 'user busy' (Three-Way Call 0)\n");
|
||||
hfp_hf_user_busy(device_addr);
|
||||
@ -339,6 +356,47 @@ static int stdin_process(struct data_source *ds){
|
||||
printf("Request phone number for voice tag\n");
|
||||
hfp_hf_request_phone_number_for_voice_tag(device_addr);
|
||||
break;
|
||||
case 'X':
|
||||
printf("Query current call status\n");
|
||||
hfp_hf_query_current_call_status(device_addr);
|
||||
break;
|
||||
case 'y':
|
||||
printf("Release call with index 2\n");
|
||||
hfp_hf_release_call_with_index(device_addr, 2);
|
||||
break;
|
||||
case 'Y':
|
||||
printf("Private consulation with call 2\n");
|
||||
hfp_hf_private_consultation_with_call(device_addr, 2);
|
||||
break;
|
||||
case 'z':
|
||||
memcpy(device_addr, phone_addr, 6);
|
||||
printf("Use iPhone %s as Audiogateway.\n", bd_addr_to_str(device_addr));
|
||||
break;
|
||||
case '[':
|
||||
printf("Query Response and Hold status (RHH ?)\n");
|
||||
hfp_hf_rrh_query_status(device_addr);
|
||||
break;
|
||||
case ']':
|
||||
printf("Place call in a response and held state (RHH 0)\n");
|
||||
hfp_hf_rrh_hold_call(device_addr);
|
||||
break;
|
||||
case '{':
|
||||
printf("Accept held call (RHH 1)\n");
|
||||
hfp_hf_rrh_accept_held_call(device_addr);
|
||||
break;
|
||||
case '}':
|
||||
printf("Reject held call (RHH 2)\n");
|
||||
hfp_hf_rrh_reject_held_call(device_addr);
|
||||
break;
|
||||
case '?':
|
||||
printf("Query Subscriber Number\n");
|
||||
hfp_hf_query_subscriber_number(device_addr);
|
||||
break;
|
||||
case '!':
|
||||
printf("Update HF indicator with assigned number 1 (HFI)\n");
|
||||
hfp_hf_set_hf_indicator(device_addr, 1, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
show_usage();
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user