hfp.h (fc64f94a8301d3d0e398cde6b9b488722d71c2fc) | hfp.h (a0ffb263e02c613f9155d5035f68cb0ad7b80d74) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 23 unchanged lines hidden (view full) --- 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38// ***************************************************************************** 39// | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 23 unchanged lines hidden (view full) --- 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38// ***************************************************************************** 39// |
40// HFP Hands-Free (HF) unit and Audio-Gateway Commons | 40// HFP Hands-Free (HF) unit and Audio Gateway Commons |
41// 42// ***************************************************************************** 43 44 45#ifndef __BTSTACK_HFP_H 46#define __BTSTACK_HFP_H 47 48#include "hci.h" --- 105 unchanged lines hidden (view full) --- 154 155 HFP_CMD_RETRIEVE_AG_INDICATORS, 156 HFP_CMD_RETRIEVE_AG_INDICATORS_STATUS, 157 158 HFP_CMD_ENABLE_INDICATOR_STATUS_UPDATE, 159 HFP_CMD_ENABLE_INDIVIDUAL_AG_INDICATOR_STATUS_UPDATE, 160 HFP_CMD_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES, 161 HFP_CMD_ENABLE_CLIP, | 41// 42// ***************************************************************************** 43 44 45#ifndef __BTSTACK_HFP_H 46#define __BTSTACK_HFP_H 47 48#include "hci.h" --- 105 unchanged lines hidden (view full) --- 154 155 HFP_CMD_RETRIEVE_AG_INDICATORS, 156 HFP_CMD_RETRIEVE_AG_INDICATORS_STATUS, 157 158 HFP_CMD_ENABLE_INDICATOR_STATUS_UPDATE, 159 HFP_CMD_ENABLE_INDIVIDUAL_AG_INDICATOR_STATUS_UPDATE, 160 HFP_CMD_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES, 161 HFP_CMD_ENABLE_CLIP, |
162 HFP_CMD_AG_SENT_CLIP_INFORMATION, |
|
162 HFP_CMD_ENABLE_CALL_WAITING_NOTIFICATION, | 163 HFP_CMD_ENABLE_CALL_WAITING_NOTIFICATION, |
164 HFP_CMD_AG_SENT_CALL_WAITING_NOTIFICATION_UPDATE, |
|
163 164 HFP_CMD_LIST_GENERIC_STATUS_INDICATORS, 165 HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS, 166 HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS_STATE, 167 HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS, 168 169 HFP_CMD_TRANSFER_AG_INDICATOR_STATUS, 170 --- 121 unchanged lines hidden (view full) --- 292 HFP_PARSER_SECOND_ITEM, 293 HFP_PARSER_THIRD_ITEM 294} hfp_parser_state_t; 295 296 297typedef enum { 298 HFP_IDLE = 0, //0 299 HFP_SDP_QUERY_RFCOMM_CHANNEL, | 165 166 HFP_CMD_LIST_GENERIC_STATUS_INDICATORS, 167 HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS, 168 HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS_STATE, 169 HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS, 170 171 HFP_CMD_TRANSFER_AG_INDICATOR_STATUS, 172 --- 121 unchanged lines hidden (view full) --- 294 HFP_PARSER_SECOND_ITEM, 295 HFP_PARSER_THIRD_ITEM 296} hfp_parser_state_t; 297 298 299typedef enum { 300 HFP_IDLE = 0, //0 301 HFP_SDP_QUERY_RFCOMM_CHANNEL, |
300 HFP_W4_SDP_EVENT_QUERY_COMPLETE, | 302 HFP_W4_SDP_QUERY_COMPLETE, |
301 HFP_W4_RFCOMM_CONNECTED, 302 303 HFP_EXCHANGE_SUPPORTED_FEATURES, 304 HFP_W4_EXCHANGE_SUPPORTED_FEATURES, // 5 305 306 HFP_NOTIFY_ON_CODECS, 307 HFP_W4_NOTIFY_ON_CODECS, 308 --- 212 unchanged lines hidden (view full) --- 521 uint8_t keep_byte; 522 uint8_t ignore_value; 523 uint8_t resolve_byte; 524 525 uint8_t change_status_update_for_individual_ag_indicators; 526 uint8_t operator_name_changed; 527 528 uint8_t enable_extended_audio_gateway_error_report; | 303 HFP_W4_RFCOMM_CONNECTED, 304 305 HFP_EXCHANGE_SUPPORTED_FEATURES, 306 HFP_W4_EXCHANGE_SUPPORTED_FEATURES, // 5 307 308 HFP_NOTIFY_ON_CODECS, 309 HFP_W4_NOTIFY_ON_CODECS, 310 --- 212 unchanged lines hidden (view full) --- 523 uint8_t keep_byte; 524 uint8_t ignore_value; 525 uint8_t resolve_byte; 526 527 uint8_t change_status_update_for_individual_ag_indicators; 528 uint8_t operator_name_changed; 529 530 uint8_t enable_extended_audio_gateway_error_report; |
531 uint8_t extended_audio_gateway_error_value; |
|
529 uint8_t extended_audio_gateway_error; 530 531 // establish codecs connection 532 uint8_t suggested_codec; 533 uint8_t codec_confirmed; 534 535 hfp_link_setttings_t link_setting; 536 --- 14 unchanged lines hidden (view full) --- 551 uint8_t send_response_and_hold_status; // 0 - don't send. BRTH:0 == 1, .. 552 553 // AG only 554 uint8_t change_in_band_ring_tone_setting; 555 uint8_t ag_ring; 556 uint8_t ag_send_clip; 557 uint8_t ag_echo_and_noise_reduction; 558 uint8_t ag_activate_voice_recognition; | 532 uint8_t extended_audio_gateway_error; 533 534 // establish codecs connection 535 uint8_t suggested_codec; 536 uint8_t codec_confirmed; 537 538 hfp_link_setttings_t link_setting; 539 --- 14 unchanged lines hidden (view full) --- 554 uint8_t send_response_and_hold_status; // 0 - don't send. BRTH:0 == 1, .. 555 556 // AG only 557 uint8_t change_in_band_ring_tone_setting; 558 uint8_t ag_ring; 559 uint8_t ag_send_clip; 560 uint8_t ag_echo_and_noise_reduction; 561 uint8_t ag_activate_voice_recognition; |
562 uint8_t ag_notify_incoming_call_waiting; |
|
559 uint8_t send_subscriber_number; 560 uint8_t next_subscriber_number_to_send; 561 562 int send_status_of_current_calls; 563 int next_call_index; 564 565 // HF only 566 hfp_hf_query_operator_state_t hf_query_operator_state; 567 uint8_t hf_answer_incoming_call; 568 uint8_t hf_initiate_outgoing_call; 569 uint8_t hf_initiate_memory_dialing; 570 uint8_t hf_initiate_redial_last_number; | 563 uint8_t send_subscriber_number; 564 uint8_t next_subscriber_number_to_send; 565 566 int send_status_of_current_calls; 567 int next_call_index; 568 569 // HF only 570 hfp_hf_query_operator_state_t hf_query_operator_state; 571 uint8_t hf_answer_incoming_call; 572 uint8_t hf_initiate_outgoing_call; 573 uint8_t hf_initiate_memory_dialing; 574 uint8_t hf_initiate_redial_last_number; |
575 int memory_id; |
|
571 572 uint8_t hf_send_clip_enable; 573 uint8_t hf_send_chup; 574 uint8_t hf_send_chld_0; 575 uint8_t hf_send_chld_1; 576 uint8_t hf_send_chld_2; 577 uint8_t hf_send_chld_3; 578 uint8_t hf_send_chld_4; --- 18 unchanged lines hidden (view full) --- 597 598 uint8_t clcc_idx; 599 uint8_t clcc_dir; 600 uint8_t clcc_status; 601 uint8_t clcc_mode; 602 uint8_t clcc_mpty; 603 604 uint8_t call_index; | 576 577 uint8_t hf_send_clip_enable; 578 uint8_t hf_send_chup; 579 uint8_t hf_send_chld_0; 580 uint8_t hf_send_chld_1; 581 uint8_t hf_send_chld_2; 582 uint8_t hf_send_chld_3; 583 uint8_t hf_send_chld_4; --- 18 unchanged lines hidden (view full) --- 602 603 uint8_t clcc_idx; 604 uint8_t clcc_dir; 605 uint8_t clcc_status; 606 uint8_t clcc_mode; 607 uint8_t clcc_mpty; 608 609 uint8_t call_index; |
605 // also used for CLCC if set | 610 // also used for CLCC, CCWA, CLIP if set |
606 uint8_t bnip_type; // 0 == not set 607 char bnip_number[25]; // 608 609} hfp_connection_t; 610 611// UTILS_START : TODO move to utils 612int send_str_over_rfcomm(uint16_t cid, char * command); 613int join(char * buffer, int buffer_size, uint8_t * values, int values_nr); 614int join_bitmap(char * buffer, int buffer_size, uint32_t values, int values_nr); 615int get_bit(uint16_t bitmap, int position); 616int store_bit(uint32_t bitmap, int position, uint8_t value); 617// UTILS_END 618 619void hfp_set_callback(hfp_callback_t callback); 620 621void hfp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t service_uuid, int rfcomm_channel_nr, const char * name); 622void hfp_handle_hci_event(uint8_t packet_type, uint8_t *packet, uint16_t size); 623void hfp_emit_event(hfp_callback_t callback, uint8_t event_subtype, uint8_t value); | 611 uint8_t bnip_type; // 0 == not set 612 char bnip_number[25]; // 613 614} hfp_connection_t; 615 616// UTILS_START : TODO move to utils 617int send_str_over_rfcomm(uint16_t cid, char * command); 618int join(char * buffer, int buffer_size, uint8_t * values, int values_nr); 619int join_bitmap(char * buffer, int buffer_size, uint32_t values, int values_nr); 620int get_bit(uint16_t bitmap, int position); 621int store_bit(uint32_t bitmap, int position, uint8_t value); 622// UTILS_END 623 624void hfp_set_callback(hfp_callback_t callback); 625 626void hfp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t service_uuid, int rfcomm_channel_nr, const char * name); 627void hfp_handle_hci_event(uint8_t packet_type, uint8_t *packet, uint16_t size); 628void hfp_emit_event(hfp_callback_t callback, uint8_t event_subtype, uint8_t value); |
629void hfp_emit_simple_event(hfp_callback_t callback, uint8_t event_subtype); |
|
624void hfp_emit_string_event(hfp_callback_t callback, uint8_t event_subtype, const char * value); 625 626hfp_connection_t * get_hfp_connection_context_for_rfcomm_cid(uint16_t cid); 627hfp_connection_t * get_hfp_connection_context_for_bd_addr(bd_addr_t bd_addr); 628hfp_connection_t * get_hfp_connection_context_for_sco_handle(uint16_t handle); 629 | 630void hfp_emit_string_event(hfp_callback_t callback, uint8_t event_subtype, const char * value); 631 632hfp_connection_t * get_hfp_connection_context_for_rfcomm_cid(uint16_t cid); 633hfp_connection_t * get_hfp_connection_context_for_bd_addr(bd_addr_t bd_addr); 634hfp_connection_t * get_hfp_connection_context_for_sco_handle(uint16_t handle); 635 |
630int get_hfp_generic_status_indicators_nr(void); 631hfp_generic_status_indicator_t * get_hfp_generic_status_indicators(void); 632void set_hfp_generic_status_indicators(hfp_generic_status_indicator_t * indicators, int indicator_nr); 633 | |
634btstack_linked_list_t * hfp_get_connections(void); | 636btstack_linked_list_t * hfp_get_connections(void); |
635void hfp_parse(hfp_connection_t * context, uint8_t byte, int isHandsFree); | 637void hfp_parse(hfp_connection_t * connection, uint8_t byte, int isHandsFree); |
636 637void hfp_establish_service_level_connection(bd_addr_t bd_addr, uint16_t service_uuid); 638void hfp_release_service_level_connection(hfp_connection_t * connection); | 638 639void hfp_establish_service_level_connection(bd_addr_t bd_addr, uint16_t service_uuid); 640void hfp_release_service_level_connection(hfp_connection_t * connection); |
639void hfp_reset_context_flags(hfp_connection_t * context); | 641void hfp_reset_context_flags(hfp_connection_t * connection); |
640 | 642 |
641void hfp_release_audio_connection(hfp_connection_t * context); | 643void hfp_release_audio_connection(hfp_connection_t * connection); |
642 643void hfp_setup_synchronous_connection(hci_con_handle_t handle, hfp_link_setttings_t link_settings); 644 645const char * hfp_hf_feature(int index); 646const char * hfp_ag_feature(int index); 647 648#if defined __cplusplus 649} 650#endif 651 652#endif // __BTSTACK_HFP_H | 644 645void hfp_setup_synchronous_connection(hci_con_handle_t handle, hfp_link_setttings_t link_settings); 646 647const char * hfp_hf_feature(int index); 648const char * hfp_ag_feature(int index); 649 650#if defined __cplusplus 651} 652#endif 653 654#endif // __BTSTACK_HFP_H |