13deb3ec6SMatthias Ringwald /* 23deb3ec6SMatthias Ringwald * Copyright (C) 2014 BlueKitchen GmbH 33deb3ec6SMatthias Ringwald * 43deb3ec6SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 53deb3ec6SMatthias Ringwald * modification, are permitted provided that the following conditions 63deb3ec6SMatthias Ringwald * are met: 73deb3ec6SMatthias Ringwald * 83deb3ec6SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 93deb3ec6SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 103deb3ec6SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 113deb3ec6SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 123deb3ec6SMatthias Ringwald * documentation and/or other materials provided with the distribution. 133deb3ec6SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 143deb3ec6SMatthias Ringwald * contributors may be used to endorse or promote products derived 153deb3ec6SMatthias Ringwald * from this software without specific prior written permission. 163deb3ec6SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 173deb3ec6SMatthias Ringwald * personal benefit and not for any commercial purpose or for 183deb3ec6SMatthias Ringwald * monetary gain. 193deb3ec6SMatthias Ringwald * 203deb3ec6SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 213deb3ec6SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 223deb3ec6SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 233deb3ec6SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 243deb3ec6SMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 253deb3ec6SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 263deb3ec6SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 273deb3ec6SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 283deb3ec6SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 293deb3ec6SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 303deb3ec6SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 313deb3ec6SMatthias Ringwald * SUCH DAMAGE. 323deb3ec6SMatthias Ringwald * 333deb3ec6SMatthias Ringwald * Please inquire about commercial licensing options at 343deb3ec6SMatthias Ringwald * [email protected] 353deb3ec6SMatthias Ringwald * 363deb3ec6SMatthias Ringwald */ 373deb3ec6SMatthias Ringwald 38fe5a6c4eSMilanka Ringwald /** 39fe5a6c4eSMilanka Ringwald * @title HFP Hands-Free (HF) 40fe5a6c4eSMilanka Ringwald * 41fe5a6c4eSMilanka Ringwald */ 423deb3ec6SMatthias Ringwald 4380e33422SMatthias Ringwald #ifndef BTSTACK_HFP_HF_H 4480e33422SMatthias Ringwald #define BTSTACK_HFP_HF_H 453deb3ec6SMatthias Ringwald 463deb3ec6SMatthias Ringwald #include "hci.h" 47efda0b48SMatthias Ringwald #include "classic/sdp_client_rfcomm.h" 483edc84c5SMatthias Ringwald #include "classic/hfp.h" 493deb3ec6SMatthias Ringwald 503deb3ec6SMatthias Ringwald #if defined __cplusplus 513deb3ec6SMatthias Ringwald extern "C" { 523deb3ec6SMatthias Ringwald #endif 533deb3ec6SMatthias Ringwald 543deb3ec6SMatthias Ringwald /* API_START */ 553deb3ec6SMatthias Ringwald 563deb3ec6SMatthias Ringwald /** 573deb3ec6SMatthias Ringwald * @brief Create HFP Hands-Free (HF) SDP service record. 58a0ffb263SMatthias Ringwald * @param service 59a0ffb263SMatthias Ringwald * @param rfcomm_channel_nr 60a0ffb263SMatthias Ringwald * @param name 61a0ffb263SMatthias Ringwald * @param suported_features 32-bit bitmap, see HFP_HFSF_* values in hfp.h 624f84bf36SMatthias Ringwald * @param wide_band_speech supported 633deb3ec6SMatthias Ringwald */ 644f84bf36SMatthias Ringwald void hfp_hf_create_sdp_record(uint8_t * service, uint32_t service_record_handle, int rfcomm_channel_nr, const char * name, uint16_t supported_features, int wide_band_speech); 653deb3ec6SMatthias Ringwald 663deb3ec6SMatthias Ringwald /** 67a0ffb263SMatthias Ringwald * @brief Set up HFP Hands-Free (HF) device without additional supported features. 68a0ffb263SMatthias Ringwald * @param rfcomm_channel_nr 69b4df8028SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 70b4df8028SMilanka Ringwald * - L2CAP_SERVICE_ALREADY_REGISTERED, 71b4df8028SMilanka Ringwald * - RFCOMM_SERVICE_ALREADY_REGISTERED or 72b4df8028SMilanka Ringwald * - BTSTACK_MEMORY_ALLOC_FAILED if allocation of any of RFCOMM or L2CAP services failed 733deb3ec6SMatthias Ringwald */ 74b4df8028SMilanka Ringwald uint8_t hfp_hf_init(uint16_t rfcomm_channel_nr); 7566a048abSMatthias Ringwald 76a0ffb263SMatthias Ringwald /** 77a0ffb263SMatthias Ringwald * @brief Set codecs. 78a0ffb263SMatthias Ringwald * @param codecs_nr 79a0ffb263SMatthias Ringwald * @param codecs 80a0ffb263SMatthias Ringwald */ 817ca89cabSMatthias Ringwald void hfp_hf_init_codecs(int codecs_nr, const uint8_t * codecs); 823deb3ec6SMatthias Ringwald 83a0ffb263SMatthias Ringwald /** 84a0ffb263SMatthias Ringwald * @brief Set supported features. 85a0ffb263SMatthias Ringwald * @param supported_features 32-bit bitmap, see HFP_HFSF_* values in hfp.h 86a0ffb263SMatthias Ringwald */ 87a0ffb263SMatthias Ringwald void hfp_hf_init_supported_features(uint32_t supported_features); 88a0ffb263SMatthias Ringwald 89a0ffb263SMatthias Ringwald /** 90a0ffb263SMatthias Ringwald * @brief Set HF indicators. 91a0ffb263SMatthias Ringwald * @param indicators_nr 92a0ffb263SMatthias Ringwald * @param indicators 93a0ffb263SMatthias Ringwald */ 947ca89cabSMatthias Ringwald void hfp_hf_init_hf_indicators(int indicators_nr, const uint16_t * indicators); 95a0ffb263SMatthias Ringwald 9666a048abSMatthias Ringwald 973deb3ec6SMatthias Ringwald /** 983deb3ec6SMatthias Ringwald * @brief Register callback for the HFP Hands-Free (HF) client. 99a0ffb263SMatthias Ringwald * @param callback 1003deb3ec6SMatthias Ringwald */ 10113839019SMatthias Ringwald void hfp_hf_register_packet_handler(btstack_packet_handler_t callback); 1023deb3ec6SMatthias Ringwald 1033deb3ec6SMatthias Ringwald /** 104a0ffb263SMatthias Ringwald * @brief Establish RFCOMM connection with the AG with given Bluetooth address, 105a0ffb263SMatthias Ringwald * and perform service level connection (SLC) agreement: 106a0ffb263SMatthias Ringwald * - exchange supported features 1073deb3ec6SMatthias Ringwald * - retrieve Audio Gateway (AG) indicators and their status 1083deb3ec6SMatthias Ringwald * - enable indicator status update in the AG 1093deb3ec6SMatthias Ringwald * - notify the AG about its own available codecs, if possible 1103deb3ec6SMatthias Ringwald * - retrieve the AG information describing the call hold and multiparty services, if possible 1113deb3ec6SMatthias Ringwald * - retrieve which HF indicators are enabled on the AG, if possible 112a0ffb263SMatthias Ringwald * The status of SLC connection establishment is reported via 113a0ffb263SMatthias Ringwald * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED. 114a0ffb263SMatthias Ringwald * 115a0ffb263SMatthias Ringwald * @param bd_addr Bluetooth address of the AG 1164eb3f1d8SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 117657bc59fSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if connection already exists, or 1184eb3f1d8SMilanka Ringwald * - BTSTACK_MEMORY_ALLOC_FAILED 1193deb3ec6SMatthias Ringwald */ 1204eb3f1d8SMilanka Ringwald uint8_t hfp_hf_establish_service_level_connection(bd_addr_t bd_addr); 1213deb3ec6SMatthias Ringwald 1223deb3ec6SMatthias Ringwald /** 1233deb3ec6SMatthias Ringwald * @brief Release the RFCOMM channel and the audio connection between the HF and the AG. 124a0ffb263SMatthias Ringwald * The status of releasing the SLC connection is reported via 125a0ffb263SMatthias Ringwald * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED. 126a0ffb263SMatthias Ringwald * 1273c65e705SMilanka Ringwald * @param acl_handle 128657bc59fSMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 1293deb3ec6SMatthias Ringwald */ 130657bc59fSMilanka Ringwald uint8_t hfp_hf_release_service_level_connection(hci_con_handle_t acl_handle); 1313deb3ec6SMatthias Ringwald 1323deb3ec6SMatthias Ringwald /** 133a0ffb263SMatthias Ringwald * @brief Enable status update for all indicators in the AG. 134a0ffb263SMatthias Ringwald * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted. 135a0ffb263SMatthias Ringwald * The status of an AG indicator is reported via HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED. 136a0ffb263SMatthias Ringwald * 1373c65e705SMilanka Ringwald * @param acl_handle 1383c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 1393deb3ec6SMatthias Ringwald */ 1403c65e705SMilanka Ringwald uint8_t hfp_hf_enable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle); 14166a048abSMatthias Ringwald 142a0ffb263SMatthias Ringwald /** 143a0ffb263SMatthias Ringwald * @brief Disable status update for all indicators in the AG. 144a0ffb263SMatthias Ringwald * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted. 1453c65e705SMilanka Ringwald * 1463c65e705SMilanka Ringwald * @param acl_handle 1473c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 148a0ffb263SMatthias Ringwald */ 1493c65e705SMilanka Ringwald uint8_t hfp_hf_disable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle); 1503deb3ec6SMatthias Ringwald 1513deb3ec6SMatthias Ringwald /** 152a0ffb263SMatthias Ringwald * @brief Enable or disable status update for the individual indicators in the AG using bitmap. 153a0ffb263SMatthias Ringwald * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted. 154a0ffb263SMatthias Ringwald * The status of an AG indicator is reported via HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED. 155a0ffb263SMatthias Ringwald * 1563c65e705SMilanka Ringwald * @param acl_handle 157a0ffb263SMatthias Ringwald * @param indicators_status_bitmap 32-bit bitmap, 0 - indicator is disabled, 1 - indicator is enabled 1583c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 1593deb3ec6SMatthias Ringwald */ 1603c65e705SMilanka Ringwald uint8_t hfp_hf_set_status_update_for_individual_ag_indicators(hci_con_handle_t acl_handle, uint32_t indicators_status_bitmap); 1613deb3ec6SMatthias Ringwald 1623deb3ec6SMatthias Ringwald /** 163a0ffb263SMatthias Ringwald * @brief Query the name of the currently selected Network operator by AG. 16466a048abSMatthias Ringwald * 165a0ffb263SMatthias Ringwald * The name is restricted to max 16 characters. The result is reported via 166a0ffb263SMatthias Ringwald * HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED subtype 167a0ffb263SMatthias Ringwald * containing network operator mode, format and name. 168a0ffb263SMatthias Ringwald * If no operator is selected, format and operator are omitted. 169a0ffb263SMatthias Ringwald * 1703c65e705SMilanka Ringwald * @param acl_handle 1713c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 1723c65e705SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 1733c65e705SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if connection in wrong state 1743deb3ec6SMatthias Ringwald */ 1753c65e705SMilanka Ringwald uint8_t hfp_hf_query_operator_selection(hci_con_handle_t acl_handle); 1763deb3ec6SMatthias Ringwald 1773deb3ec6SMatthias Ringwald /** 178a0ffb263SMatthias Ringwald * @brief Enable Extended Audio Gateway Error result codes in the AG. 1793deb3ec6SMatthias Ringwald * Whenever there is an error relating to the functionality of the AG as a 180a0ffb263SMatthias Ringwald * result of AT command, the AG shall send +CME ERROR. This error is reported via 181a0ffb263SMatthias Ringwald * HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR, see hfp_cme_error_t in hfp.h 182a0ffb263SMatthias Ringwald * 1833c65e705SMilanka Ringwald * @param acl_handle 1843c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 1853deb3ec6SMatthias Ringwald */ 1863c65e705SMilanka Ringwald uint8_t hfp_hf_enable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle); 187a0ffb263SMatthias Ringwald 188a0ffb263SMatthias Ringwald /** 189a0ffb263SMatthias Ringwald * @brief Disable Extended Audio Gateway Error result codes in the AG. 190a0ffb263SMatthias Ringwald * 1913c65e705SMilanka Ringwald * @param acl_handle 1923c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 193a0ffb263SMatthias Ringwald */ 1943c65e705SMilanka Ringwald uint8_t hfp_hf_disable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle); 1953deb3ec6SMatthias Ringwald 1963deb3ec6SMatthias Ringwald /** 197a0ffb263SMatthias Ringwald * @brief Establish audio connection. 1983c65e705SMilanka Ringwald * The status of audio connection establishment is reported via HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED. 1993c65e705SMilanka Ringwald * 2003c65e705SMilanka Ringwald * @param acl_handle 2013c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 2023c65e705SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 2033c65e705SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if connection in wrong state 2043deb3ec6SMatthias Ringwald */ 2053c65e705SMilanka Ringwald uint8_t hfp_hf_establish_audio_connection(hci_con_handle_t acl_handle); 2063deb3ec6SMatthias Ringwald 2073deb3ec6SMatthias Ringwald /** 208a0ffb263SMatthias Ringwald * @brief Release audio connection. 209a0ffb263SMatthias Ringwald * The status of releasing of the audio connection is reported via 210a0ffb263SMatthias Ringwald * HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED. 211a0ffb263SMatthias Ringwald * 2123c65e705SMilanka Ringwald * @param acl_handle 2133c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 2143deb3ec6SMatthias Ringwald */ 2153c65e705SMilanka Ringwald uint8_t hfp_hf_release_audio_connection(hci_con_handle_t acl_handle); 2163deb3ec6SMatthias Ringwald 217ce263fc8SMatthias Ringwald /** 218a0ffb263SMatthias Ringwald * @brief Answer incoming call. 2193c65e705SMilanka Ringwald * 2203c65e705SMilanka Ringwald * @param acl_handle 2213c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 2223c65e705SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 2233c65e705SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if answering incoming call with wrong callsetup status 224ce263fc8SMatthias Ringwald */ 2253c65e705SMilanka Ringwald uint8_t hfp_hf_answer_incoming_call(hci_con_handle_t acl_handle); 226ce263fc8SMatthias Ringwald 227ce263fc8SMatthias Ringwald /** 228a0ffb263SMatthias Ringwald * @brief Reject incoming call. 2293c65e705SMilanka Ringwald * 2303c65e705SMilanka Ringwald * @param acl_handle 2313c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 232ce263fc8SMatthias Ringwald */ 2333c65e705SMilanka Ringwald uint8_t hfp_hf_reject_incoming_call(hci_con_handle_t acl_handle); 234ce263fc8SMatthias Ringwald 235ce263fc8SMatthias Ringwald /** 236a0ffb263SMatthias Ringwald * @brief Release all held calls or sets User Determined User Busy (UDUB) for a waiting call. 2373c65e705SMilanka Ringwald * 2383c65e705SMilanka Ringwald * @param acl_handle 2393c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 240ce263fc8SMatthias Ringwald */ 2413c65e705SMilanka Ringwald uint8_t hfp_hf_user_busy(hci_con_handle_t acl_handle); 242ce263fc8SMatthias Ringwald 243ce263fc8SMatthias Ringwald /** 244a0ffb263SMatthias Ringwald * @brief Release all active calls (if any exist) and accepts the other (held or waiting) call. 2453c65e705SMilanka Ringwald * 2463c65e705SMilanka Ringwald * @param acl_handle 2473c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 248ce263fc8SMatthias Ringwald */ 2493c65e705SMilanka Ringwald uint8_t hfp_hf_end_active_and_accept_other(hci_con_handle_t acl_handle); 250ce263fc8SMatthias Ringwald 251ce263fc8SMatthias Ringwald /** 252a0ffb263SMatthias Ringwald * @brief Place all active calls (if any exist) on hold and accepts the other (held or waiting) call. 2533c65e705SMilanka Ringwald * 2543c65e705SMilanka Ringwald * @param acl_handle 2553c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 256ce263fc8SMatthias Ringwald */ 2573c65e705SMilanka Ringwald uint8_t hfp_hf_swap_calls(hci_con_handle_t acl_handle); 258ce263fc8SMatthias Ringwald 259ce263fc8SMatthias Ringwald /** 260a0ffb263SMatthias Ringwald * @brief Add a held call to the conversation. 2613c65e705SMilanka Ringwald * 2623c65e705SMilanka Ringwald * @param acl_handle 2633c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 264ce263fc8SMatthias Ringwald */ 2653c65e705SMilanka Ringwald uint8_t hfp_hf_join_held_call(hci_con_handle_t acl_handle); 266ce263fc8SMatthias Ringwald 267ce263fc8SMatthias Ringwald /** 2683c65e705SMilanka Ringwald * @brief Connect the two calls and disconnects the subscriber from both calls (Explicit Call Transfer). 2693c65e705SMilanka Ringwald * 2703c65e705SMilanka Ringwald * @param acl_handle 2713c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 272ce263fc8SMatthias Ringwald */ 2733c65e705SMilanka Ringwald uint8_t hfp_hf_connect_calls(hci_con_handle_t acl_handle); 274ce263fc8SMatthias Ringwald 275ce263fc8SMatthias Ringwald /** 2763c65e705SMilanka Ringwald * @brief Terminate an incoming or an outgoing call. HFP_SUBEVENT_CALL_TERMINATED is sent upon call termination. 2773c65e705SMilanka Ringwald * 2783c65e705SMilanka Ringwald * @param acl_handle 2793c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 280ce263fc8SMatthias Ringwald */ 2813c65e705SMilanka Ringwald uint8_t hfp_hf_terminate_call(hci_con_handle_t acl_handle); 282ce263fc8SMatthias Ringwald 283ce263fc8SMatthias Ringwald /** 284a0ffb263SMatthias Ringwald * @brief Initiate outgoing voice call by providing the destination phone number to the AG. 2853c65e705SMilanka Ringwald * 2863c65e705SMilanka Ringwald * @param acl_handle 287a0ffb263SMatthias Ringwald * @param number 2883c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 289ce263fc8SMatthias Ringwald */ 2903c65e705SMilanka Ringwald uint8_t hfp_hf_dial_number(hci_con_handle_t acl_handle, char * number); 291ce263fc8SMatthias Ringwald 292ce263fc8SMatthias Ringwald /** 293a0ffb263SMatthias Ringwald * @brief Initiate outgoing voice call using the memory dialing feature of the AG. 2943c65e705SMilanka Ringwald * 2953c65e705SMilanka Ringwald * @param acl_handle 296a0ffb263SMatthias Ringwald * @param memory_id 2973c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 298ce263fc8SMatthias Ringwald */ 2993c65e705SMilanka Ringwald uint8_t hfp_hf_dial_memory(hci_con_handle_t acl_handle, int memory_id); 300ce263fc8SMatthias Ringwald 301ce263fc8SMatthias Ringwald /** 302a0ffb263SMatthias Ringwald * @brief Initiate outgoing voice call by recalling the last number dialed by the AG. 3033c65e705SMilanka Ringwald * 3043c65e705SMilanka Ringwald * @param acl_handle 3053c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 306ce263fc8SMatthias Ringwald */ 3073c65e705SMilanka Ringwald uint8_t hfp_hf_redial_last_number(hci_con_handle_t acl_handle); 308ce263fc8SMatthias Ringwald 309ce263fc8SMatthias Ringwald /* 310a0ffb263SMatthias Ringwald * @brief Enable the “Call Waiting notification” function in the AG. 311a0ffb263SMatthias Ringwald * The AG shall send the corresponding result code to the HF whenever 312a0ffb263SMatthias Ringwald * an incoming call is waiting during an ongoing call. In that event, 313a0ffb263SMatthias Ringwald * the HFP_SUBEVENT_CALL_WAITING_NOTIFICATION is emitted. 314a0ffb263SMatthias Ringwald * 3153c65e705SMilanka Ringwald * @param acl_handle 3163c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 317ce263fc8SMatthias Ringwald */ 3183c65e705SMilanka Ringwald uint8_t hfp_hf_activate_call_waiting_notification(hci_con_handle_t acl_handle); 319ce263fc8SMatthias Ringwald 320ce263fc8SMatthias Ringwald /* 321a0ffb263SMatthias Ringwald * @brief Disable the “Call Waiting notification” function in the AG. 3223c65e705SMilanka Ringwald * 3233c65e705SMilanka Ringwald * @param acl_handle 3243c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 325ce263fc8SMatthias Ringwald */ 3263c65e705SMilanka Ringwald uint8_t hfp_hf_deactivate_call_waiting_notification(hci_con_handle_t acl_handle); 327ce263fc8SMatthias Ringwald 328ce263fc8SMatthias Ringwald /* 329a0ffb263SMatthias Ringwald * @brief Enable the “Calling Line Identification notification” function in the AG. 330a0ffb263SMatthias Ringwald * The AG shall issue the corresponding result code just after every RING indication, 331a0ffb263SMatthias Ringwald * when the HF is alerted in an incoming call. In that event, 332a0ffb263SMatthias Ringwald * the HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION is emitted. 3333c65e705SMilanka Ringwald * @param acl_handle 334ce263fc8SMatthias Ringwald */ 3353c65e705SMilanka Ringwald uint8_t hfp_hf_activate_calling_line_notification(hci_con_handle_t acl_handle); 336ce263fc8SMatthias Ringwald 337ce263fc8SMatthias Ringwald /* 338a0ffb263SMatthias Ringwald * @brief Disable the “Calling Line Identification notification” function in the AG. 3393c65e705SMilanka Ringwald * 3403c65e705SMilanka Ringwald * @param acl_handle 3413c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 342ce263fc8SMatthias Ringwald */ 3433c65e705SMilanka Ringwald uint8_t hfp_hf_deactivate_calling_line_notification(hci_con_handle_t acl_handle); 344ce263fc8SMatthias Ringwald 345ce263fc8SMatthias Ringwald 346ce263fc8SMatthias Ringwald /* 347*6ba83b5eSMilanka Ringwald * @brief Deactivate echo canceling (EC) and noise reduction (NR) in the AG and emit 348*6ba83b5eSMilanka Ringwald * HFP_SUBEVENT_ECHO_CANCELING_NOISE_REDUCTION_DEACTIVATE with status ERROR_CODE_SUCCESS if AG supports EC and AG. 349*6ba83b5eSMilanka Ringwald * If the AG supports its own embedded echo canceling and/or noise reduction function, 350*6ba83b5eSMilanka Ringwald * it shall have EC and NR activated until this function is called. 3513c65e705SMilanka Ringwald * 3523c65e705SMilanka Ringwald * @param acl_handle 353*6ba83b5eSMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 354*6ba83b5eSMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 355*6ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if HFP_(HF/AG)SF_EC_NR_FUNCTION feature is not supported by AG and HF 356ce263fc8SMatthias Ringwald */ 3573c65e705SMilanka Ringwald uint8_t hfp_hf_deactivate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle); 358ce263fc8SMatthias Ringwald 359af97579eSMilanka Ringwald /** 360af97579eSMilanka Ringwald * @brief Activate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 361371c1bb2SMilanka Ringwald * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is set to the current voice 362371c1bb2SMilanka Ringwald * recognition state: 1 for activated, 0 otherwise. Prerequisite is established SLC. 3633c65e705SMilanka Ringwald * 3643c65e705SMilanka Ringwald * @param acl_handle 365af97579eSMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 366af97579eSMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 367*6ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated 368ce263fc8SMatthias Ringwald */ 369af97579eSMilanka Ringwald uint8_t hfp_hf_activate_voice_recognition(hci_con_handle_t acl_handle); 370ce263fc8SMatthias Ringwald 371af97579eSMilanka Ringwald /** 372af97579eSMilanka Ringwald * @brief Dectivate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 373371c1bb2SMilanka Ringwald * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is set to the current voice 374371c1bb2SMilanka Ringwald * recognition state: 1 for activated, 0 otherwise. Prerequisite is established SLC. 3753c65e705SMilanka Ringwald * 3763c65e705SMilanka Ringwald * @param acl_handle 377af97579eSMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 378af97579eSMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 379*6ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated 380ce263fc8SMatthias Ringwald */ 381af97579eSMilanka Ringwald uint8_t hfp_hf_deactivate_voice_recognition(hci_con_handle_t acl_handle); 382be55a11dSMilanka Ringwald 383371c1bb2SMilanka Ringwald /** 384e8e72901SMilanka Ringwald * @brief Activate enhanced voice recognition (EVR) and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 385371c1bb2SMilanka Ringwald * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is to the current state of EVR: 1 if activated, otherwise 0. 386371c1bb2SMilanka Ringwald * Prerequisite is established SLC. 3873c65e705SMilanka Ringwald * 3883c65e705SMilanka Ringwald * @param acl_handle 3893c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 390*6ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG, or wrong VRA status 3913c65e705SMilanka Ringwald */ 392e83c2025SMilanka Ringwald uint8_t hfp_hf_activate_enhanced_voice_recognition(hci_con_handle_t acl_handle); 393be55a11dSMilanka Ringwald 394371c1bb2SMilanka Ringwald 395371c1bb2SMilanka Ringwald /** 396371c1bb2SMilanka Ringwald * @brief Indicate that the HF is ready to accept audio. Prerequisite is established voice recognition session. 397e8e72901SMilanka Ringwald * The HF may call this function during an ongoing AVR (Audio Voice Recognition) session to terminate audio output from 398371c1bb2SMilanka Ringwald * the AG (if there is any) and prepare the AG for new audio input. 399371c1bb2SMilanka Ringwald * 400371c1bb2SMilanka Ringwald * @param acl_handle 401371c1bb2SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 402*6ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG, or wrong VRA status 403371c1bb2SMilanka Ringwald */ 404de9e0ea7SMilanka Ringwald uint8_t hfp_hf_enhanced_voice_recognition_report_ready_for_audio(hci_con_handle_t acl_handle); 405371c1bb2SMilanka Ringwald 406371c1bb2SMilanka Ringwald /** 407e8e72901SMilanka Ringwald * @brief Deactivate enhanced voice recognition (EVR) and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 408371c1bb2SMilanka Ringwald * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is to the current state of EVR: 1 if activated, otherwise 0. 409371c1bb2SMilanka Ringwald * Prerequisite is established SLC. 4103c65e705SMilanka Ringwald * 4113c65e705SMilanka Ringwald * @param acl_handle 4123c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 413*6ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG, or wrong VRA status 4143c65e705SMilanka Ringwald */ 415e83c2025SMilanka Ringwald uint8_t hfp_hf_deactivate_enhanced_voice_recognition(hci_con_handle_t acl_handle); 416ce263fc8SMatthias Ringwald 417ce263fc8SMatthias Ringwald /* 418a0ffb263SMatthias Ringwald * @brief Set microphone gain. 4193c65e705SMilanka Ringwald * 4203c65e705SMilanka Ringwald * @param acl_handle 421a0ffb263SMatthias Ringwald * @param gain Valid range: [0,15] 4223c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 4233c65e705SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 4243c65e705SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range 425ce263fc8SMatthias Ringwald */ 4263c65e705SMilanka Ringwald uint8_t hfp_hf_set_microphone_gain(hci_con_handle_t acl_handle, int gain); 427ce263fc8SMatthias Ringwald 428ce263fc8SMatthias Ringwald /* 429a0ffb263SMatthias Ringwald * @brief Set speaker gain. 4303c65e705SMilanka Ringwald * 4313c65e705SMilanka Ringwald * @param acl_handle 432a0ffb263SMatthias Ringwald * @param gain Valid range: [0,15] 4333c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 4343c65e705SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 4353c65e705SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range 436ce263fc8SMatthias Ringwald */ 4373c65e705SMilanka Ringwald uint8_t hfp_hf_set_speaker_gain(hci_con_handle_t acl_handle, int gain); 438ce263fc8SMatthias Ringwald 439ce263fc8SMatthias Ringwald /* 440a0ffb263SMatthias Ringwald * @brief Instruct the AG to transmit a DTMF code. 4413c65e705SMilanka Ringwald * 4423c65e705SMilanka Ringwald * @param acl_handle 443a0ffb263SMatthias Ringwald * @param dtmf_code 4443c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 445ce263fc8SMatthias Ringwald */ 4463c65e705SMilanka Ringwald uint8_t hfp_hf_send_dtmf_code(hci_con_handle_t acl_handle, char code); 447ce263fc8SMatthias Ringwald 448ce263fc8SMatthias Ringwald /* 449a0ffb263SMatthias Ringwald * @brief Read numbers from the AG for the purpose of creating 450a0ffb263SMatthias Ringwald * a unique voice tag and storing the number and its linked voice 451a0ffb263SMatthias Ringwald * tag in the HF’s memory. 452a0ffb263SMatthias Ringwald * The number is reported via HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG. 4533c65e705SMilanka Ringwald * 4543c65e705SMilanka Ringwald * @param acl_handle 4553c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 456ce263fc8SMatthias Ringwald */ 4573c65e705SMilanka Ringwald uint8_t hfp_hf_request_phone_number_for_voice_tag(hci_con_handle_t acl_handle); 4583deb3ec6SMatthias Ringwald 459667ec068SMatthias Ringwald /* 460a0ffb263SMatthias Ringwald * @brief Query the list of current calls in AG. 461a0ffb263SMatthias Ringwald * The result is received via HFP_SUBEVENT_ENHANCED_CALL_STATUS. 4623c65e705SMilanka Ringwald * 4633c65e705SMilanka Ringwald * @param acl_handle 4643c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 465667ec068SMatthias Ringwald */ 4663c65e705SMilanka Ringwald uint8_t hfp_hf_query_current_call_status(hci_con_handle_t acl_handle); 467667ec068SMatthias Ringwald 468667ec068SMatthias Ringwald /* 469a0ffb263SMatthias Ringwald * @brief Release a call with index in the AG. 4703c65e705SMilanka Ringwald * 4713c65e705SMilanka Ringwald * @param acl_handle 472a0ffb263SMatthias Ringwald * @param index 4733c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 474667ec068SMatthias Ringwald */ 4753c65e705SMilanka Ringwald uint8_t hfp_hf_release_call_with_index(hci_con_handle_t acl_handle, int index); 476667ec068SMatthias Ringwald 477667ec068SMatthias Ringwald /* 478a0ffb263SMatthias Ringwald * @brief Place all parties of a multiparty call on hold with the 479a0ffb263SMatthias Ringwald * exception of the specified call. 4803c65e705SMilanka Ringwald * 4813c65e705SMilanka Ringwald * @param acl_handle 482a0ffb263SMatthias Ringwald * @param index 4833c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 484667ec068SMatthias Ringwald */ 4853c65e705SMilanka Ringwald uint8_t hfp_hf_private_consultation_with_call(hci_con_handle_t acl_handle, int index); 486667ec068SMatthias Ringwald 487667ec068SMatthias Ringwald /* 488a0ffb263SMatthias Ringwald * @brief Query the status of the “Response and Hold” state of the AG. 489a0ffb263SMatthias Ringwald * The result is reported via HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS. 4903c65e705SMilanka Ringwald * 4913c65e705SMilanka Ringwald * @param acl_handle 4923c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 493667ec068SMatthias Ringwald */ 4943c65e705SMilanka Ringwald uint8_t hfp_hf_rrh_query_status(hci_con_handle_t acl_handle); 495667ec068SMatthias Ringwald 496667ec068SMatthias Ringwald /* 497a0ffb263SMatthias Ringwald * @brief Put an incoming call on hold in the AG. 4983c65e705SMilanka Ringwald * 4993c65e705SMilanka Ringwald * @param acl_handle 5003c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 501667ec068SMatthias Ringwald */ 5023c65e705SMilanka Ringwald uint8_t hfp_hf_rrh_hold_call(hci_con_handle_t acl_handle); 503667ec068SMatthias Ringwald 504667ec068SMatthias Ringwald /* 505a0ffb263SMatthias Ringwald * @brief Accept held incoming call in the AG. 5063c65e705SMilanka Ringwald * 5073c65e705SMilanka Ringwald * @param acl_handle 5083c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 509667ec068SMatthias Ringwald */ 5103c65e705SMilanka Ringwald uint8_t hfp_hf_rrh_accept_held_call(hci_con_handle_t acl_handle); 511667ec068SMatthias Ringwald 512667ec068SMatthias Ringwald /* 513a0ffb263SMatthias Ringwald * @brief Reject held incoming call in the AG. 5143c65e705SMilanka Ringwald * 5153c65e705SMilanka Ringwald * @param acl_handle 5163c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 517667ec068SMatthias Ringwald */ 5183c65e705SMilanka Ringwald uint8_t hfp_hf_rrh_reject_held_call(hci_con_handle_t acl_handle); 519667ec068SMatthias Ringwald 520667ec068SMatthias Ringwald /* 5213c65e705SMilanka Ringwald * @brief Query the AG subscriber number. The result is reported via HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION. 5223c65e705SMilanka Ringwald * 5233c65e705SMilanka Ringwald * @param acl_handle 5243c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 525667ec068SMatthias Ringwald */ 5263c65e705SMilanka Ringwald uint8_t hfp_hf_query_subscriber_number(hci_con_handle_t acl_handle); 527667ec068SMatthias Ringwald 528667ec068SMatthias Ringwald /* 529a0ffb263SMatthias Ringwald * @brief Set HF indicator. 5303c65e705SMilanka Ringwald * 5313c65e705SMilanka Ringwald * @param acl_handle 532a0ffb263SMatthias Ringwald * @param assigned_number 533a0ffb263SMatthias Ringwald * @param value 5343c65e705SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 535667ec068SMatthias Ringwald */ 5363c65e705SMilanka Ringwald uint8_t hfp_hf_set_hf_indicator(hci_con_handle_t acl_handle, int assigned_number, int value); 537667ec068SMatthias Ringwald 538d7f6b5cbSMatthias Ringwald /* 539d7f6b5cbSMatthias Ringwald * @brief Tests if in-band ringtone is active on AG (requires SLC) 5403c65e705SMilanka Ringwald * 5413c65e705SMilanka Ringwald * @param acl_handler 5423c65e705SMilanka Ringwald * @return 0 if unknown acl_handle or in-band ring-tone disabled, otherwise 1 543d7f6b5cbSMatthias Ringwald */ 544d7f6b5cbSMatthias Ringwald int hfp_hf_in_band_ringtone_active(hci_con_handle_t acl_handle); 545d7f6b5cbSMatthias Ringwald 54620b2edb6SMatthias Ringwald /** 54720b2edb6SMatthias Ringwald * @brief De-Init HFP HF 54820b2edb6SMatthias Ringwald */ 54920b2edb6SMatthias Ringwald void hfp_hf_deinit(void); 55020b2edb6SMatthias Ringwald 5513deb3ec6SMatthias Ringwald /* API_END */ 5523deb3ec6SMatthias Ringwald 5533deb3ec6SMatthias Ringwald #if defined __cplusplus 5543deb3ec6SMatthias Ringwald } 5553deb3ec6SMatthias Ringwald #endif 5563deb3ec6SMatthias Ringwald 55780e33422SMatthias Ringwald #endif // BTSTACK_HFP_HF_H 558