hfp.h (51a2ebde0031fdd3ad6bb64362108b25da7cb703) | hfp.h (471dea41ab395d4c7fcbf32edf8a18b239742ccb) |
---|---|
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 --- 303 unchanged lines hidden (view full) --- 312 HFP_AG_SET_CLIP 313} hfp_ag_call_event_t; 314 315 316typedef enum { 317 HFP_PARSER_CMD_HEADER = 0, 318 HFP_PARSER_CMD_SEQUENCE, 319 HFP_PARSER_SECOND_ITEM, | 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 --- 303 unchanged lines hidden (view full) --- 312 HFP_AG_SET_CLIP 313} hfp_ag_call_event_t; 314 315 316typedef enum { 317 HFP_PARSER_CMD_HEADER = 0, 318 HFP_PARSER_CMD_SEQUENCE, 319 HFP_PARSER_SECOND_ITEM, |
320 HFP_PARSER_THIRD_ITEM | 320 HFP_PARSER_THIRD_ITEM, 321 HFP_PARSER_CUSTOM_COMMAND |
321} hfp_parser_state_t; 322 323typedef enum { 324 HFP_VOICE_RECOGNITION_STATE_AG_READY = 0, 325 HFP_VOICE_RECOGNITION_STATE_AG_READY_TO_ACCEPT_AUDIO_INPUT = 1, 326 HFP_VOICE_RECOGNITION_STATE_AG_IS_STARTING_SOUND = 2, 327 HFP_VOICE_RECOGNITION_STATE_AG_IS_PROCESSING_AUDIO_INPUT = 4 328} hfp_voice_recognition_state_t; --- 230 unchanged lines hidden (view full) --- 559 560 // used during service level connection establishment 561 hfp_command_t command; 562 hfp_parser_state_t parser_state; 563 int parser_item_index; 564 int parser_indicator_index; 565 uint32_t parser_indicator_value; 566 bool parser_quoted; | 322} hfp_parser_state_t; 323 324typedef enum { 325 HFP_VOICE_RECOGNITION_STATE_AG_READY = 0, 326 HFP_VOICE_RECOGNITION_STATE_AG_READY_TO_ACCEPT_AUDIO_INPUT = 1, 327 HFP_VOICE_RECOGNITION_STATE_AG_IS_STARTING_SOUND = 2, 328 HFP_VOICE_RECOGNITION_STATE_AG_IS_PROCESSING_AUDIO_INPUT = 4 329} hfp_voice_recognition_state_t; --- 230 unchanged lines hidden (view full) --- 560 561 // used during service level connection establishment 562 hfp_command_t command; 563 hfp_parser_state_t parser_state; 564 int parser_item_index; 565 int parser_indicator_index; 566 uint32_t parser_indicator_value; 567 bool parser_quoted; |
568 569 // line buffer is always \0 terminated |
|
567 uint8_t line_buffer[HFP_MAX_VR_TEXT_SIZE]; 568 int line_size; 569 570 uint32_t remote_supported_features; 571 572 uint16_t remote_codecs_nr; 573 uint8_t remote_codecs[HFP_MAX_NUM_CODECS]; 574 --- 80 unchanged lines hidden (view full) --- 655 bool ag_send_no_carrier; 656 bool ag_vra_send_command; 657 bool ag_send_in_band_ring_tone_setting; 658 bool ag_send_common_codec; 659 bool ag_vra_requested_by_hf; 660 661 int send_status_of_current_calls; 662 int next_call_index; | 570 uint8_t line_buffer[HFP_MAX_VR_TEXT_SIZE]; 571 int line_size; 572 573 uint32_t remote_supported_features; 574 575 uint16_t remote_codecs_nr; 576 uint8_t remote_codecs[HFP_MAX_NUM_CODECS]; 577 --- 80 unchanged lines hidden (view full) --- 658 bool ag_send_no_carrier; 659 bool ag_vra_send_command; 660 bool ag_send_in_band_ring_tone_setting; 661 bool ag_send_common_codec; 662 bool ag_vra_requested_by_hf; 663 664 int send_status_of_current_calls; 665 int next_call_index; |
666 uint16_t ag_custom_at_command_id; |
|
663 664 // HF only 665 // HF: track command for which ok/error response need to be received 666 hfp_command_t response_pending_for_command; 667 668 hfp_hf_query_operator_state_t hf_query_operator_state; 669 uint8_t hf_answer_incoming_call; 670 uint8_t hf_initiate_outgoing_call; --- 61 unchanged lines hidden (view full) --- 732 bool bcm_send_disable_wbs; 733 bool bcm_send_write_i2spcm_interface_param; 734#endif 735#ifdef ENABLE_RTK_PCM_WBS 736 bool rtk_send_sco_config; 737#endif 738} hfp_connection_t; 739 | 667 668 // HF only 669 // HF: track command for which ok/error response need to be received 670 hfp_command_t response_pending_for_command; 671 672 hfp_hf_query_operator_state_t hf_query_operator_state; 673 uint8_t hf_answer_incoming_call; 674 uint8_t hf_initiate_outgoing_call; --- 61 unchanged lines hidden (view full) --- 736 bool bcm_send_disable_wbs; 737 bool bcm_send_write_i2spcm_interface_param; 738#endif 739#ifdef ENABLE_RTK_PCM_WBS 740 bool rtk_send_sco_config; 741#endif 742} hfp_connection_t; 743 |
744/** 745 * @brief Struct to register custom AT Command. 746 */ 747typedef struct { 748 btstack_linked_item_t * next; 749 const char * command; 750 uint16_t command_id; 751} hfp_custom_at_command_t; 752 |
|
740// UTILS_START : TODO move to utils 741int send_str_over_rfcomm(uint16_t cid, const char * command); 742int join(char * buffer, int buffer_size, uint8_t * values, int values_nr); 743int join_bitmap(char * buffer, int buffer_size, uint32_t values, int values_nr); 744int get_bit(uint16_t bitmap, int position); 745int store_bit(uint32_t bitmap, int position, uint8_t value); 746// UTILS_END 747 --- 4 unchanged lines hidden (view full) --- 752void hfp_set_ag_rfcomm_packet_handler(btstack_packet_handler_t handler); 753 754void hfp_set_hf_callback(btstack_packet_handler_t callback); 755void hfp_set_hf_rfcomm_packet_handler(btstack_packet_handler_t handler); 756 757void hfp_init(void); 758void hfp_deinit(void); 759 | 753// UTILS_START : TODO move to utils 754int send_str_over_rfcomm(uint16_t cid, const char * command); 755int join(char * buffer, int buffer_size, uint8_t * values, int values_nr); 756int join_bitmap(char * buffer, int buffer_size, uint32_t values, int values_nr); 757int get_bit(uint16_t bitmap, int position); 758int store_bit(uint32_t bitmap, int position, uint8_t value); 759// UTILS_END 760 --- 4 unchanged lines hidden (view full) --- 765void hfp_set_ag_rfcomm_packet_handler(btstack_packet_handler_t handler); 766 767void hfp_set_hf_callback(btstack_packet_handler_t callback); 768void hfp_set_hf_rfcomm_packet_handler(btstack_packet_handler_t handler); 769 770void hfp_init(void); 771void hfp_deinit(void); 772 |
773void hfp_register_custom_ag_command(hfp_custom_at_command_t * at_command); 774 |
|
760void hfp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t service_uuid, int rfcomm_channel_nr, const char * name); 761void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, hfp_role_t local_role); 762void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, hfp_role_t local_role); 763void hfp_emit_event(hfp_connection_t * hfp_connection, uint8_t event_subtype, uint8_t value); 764void hfp_emit_simple_event(hfp_connection_t * hfp_connection, uint8_t event_subtype); 765void hfp_emit_string_event(hfp_connection_t * hfp_connection, uint8_t event_subtype, const char * value); 766void hfp_emit_slc_connection_event(hfp_role_t local_role, uint8_t status, hci_con_handle_t con_handle, bd_addr_t addr); 767 --- 16 unchanged lines hidden (view full) --- 784 785hfp_connection_t * get_hfp_connection_context_for_rfcomm_cid(uint16_t cid); 786hfp_connection_t * get_hfp_connection_context_for_bd_addr(bd_addr_t bd_addr, hfp_role_t hfp_role); 787hfp_connection_t * get_hfp_connection_context_for_sco_handle(uint16_t handle, hfp_role_t hfp_role); 788hfp_connection_t * get_hfp_connection_context_for_acl_handle(uint16_t handle, hfp_role_t hfp_role); 789 790btstack_linked_list_t * hfp_get_connections(void); 791void hfp_parse(hfp_connection_t * connection, uint8_t byte, int isHandsFree); | 775void hfp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t service_uuid, int rfcomm_channel_nr, const char * name); 776void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, hfp_role_t local_role); 777void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, hfp_role_t local_role); 778void hfp_emit_event(hfp_connection_t * hfp_connection, uint8_t event_subtype, uint8_t value); 779void hfp_emit_simple_event(hfp_connection_t * hfp_connection, uint8_t event_subtype); 780void hfp_emit_string_event(hfp_connection_t * hfp_connection, uint8_t event_subtype, const char * value); 781void hfp_emit_slc_connection_event(hfp_role_t local_role, uint8_t status, hci_con_handle_t con_handle, bd_addr_t addr); 782 --- 16 unchanged lines hidden (view full) --- 799 800hfp_connection_t * get_hfp_connection_context_for_rfcomm_cid(uint16_t cid); 801hfp_connection_t * get_hfp_connection_context_for_bd_addr(bd_addr_t bd_addr, hfp_role_t hfp_role); 802hfp_connection_t * get_hfp_connection_context_for_sco_handle(uint16_t handle, hfp_role_t hfp_role); 803hfp_connection_t * get_hfp_connection_context_for_acl_handle(uint16_t handle, hfp_role_t hfp_role); 804 805btstack_linked_list_t * hfp_get_connections(void); 806void hfp_parse(hfp_connection_t * connection, uint8_t byte, int isHandsFree); |
807void hfp_parser_reset_line_buffer(hfp_connection_t *hfp_connection); |
|
792 793/** 794 * @brief Establish RFCOMM connection, and perform service level connection agreement: 795 * @param bd_addr 796 * @param service_uuid 797 * @param local_role 798 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 799 * - ERROR_CODE_COMMAND_DISALLOWED if connection already exists, or --- 61 unchanged lines hidden --- | 808 809/** 810 * @brief Establish RFCOMM connection, and perform service level connection agreement: 811 * @param bd_addr 812 * @param service_uuid 813 * @param local_role 814 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 815 * - ERROR_CODE_COMMAND_DISALLOWED if connection already exists, or --- 61 unchanged lines hidden --- |