mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 01:27:41 +00:00
hfp: query subscriber number by HF tester
This commit is contained in:
parent
7c1eb74b34
commit
b00af494fa
16
src/hfp.c
16
src/hfp.c
@ -1066,6 +1066,22 @@ 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_GET_SUBSCRIBER_NUMBER_INFORMATION:
|
||||
// printf("HFP_CMD_GET_SUBSCRIBER_NUMBER_INFORMATION (%u), '%s'\n", context->parser_item_index, (char*)context->line_buffer);
|
||||
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:
|
||||
|
@ -571,6 +571,8 @@ typedef struct hfp_connection {
|
||||
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;
|
||||
|
||||
|
24
src/hfp_hf.c
24
src/hfp_hf.c
@ -734,6 +734,14 @@ static void hfp_run_for_context(hfp_connection_t * context){
|
||||
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;
|
||||
}
|
||||
|
||||
if (done) return;
|
||||
// deal with disconnect
|
||||
switch (context->state){
|
||||
@ -893,6 +901,10 @@ static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8
|
||||
}
|
||||
|
||||
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);
|
||||
@ -1459,3 +1471,15 @@ void hfp_hf_rrh_reject_held_call(bd_addr_t addr)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -300,6 +300,11 @@ void hfp_hf_rrh_accept_held_call(bd_addr_t addr);
|
||||
*/
|
||||
void hfp_hf_rrh_reject_held_call(bd_addr_t addr);
|
||||
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
void hfp_hf_query_subscriber_number(bd_addr_t addr);
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
|
@ -163,6 +163,8 @@ static void show_usage(void){
|
||||
printf("{ - Accept held call(RHH 1)\n");
|
||||
printf("} - Reject held call(RHH 2)\n");
|
||||
|
||||
printf("? - Query Subscriber Number\n");
|
||||
|
||||
printf("---\n");
|
||||
printf("Ctrl-c - exit\n");
|
||||
printf("---\n");
|
||||
@ -384,6 +386,10 @@ static int stdin_process(struct data_source *ds){
|
||||
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;
|
||||
default:
|
||||
show_usage();
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user