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 Audio Gateway (AG) 40fe5a6c4eSMilanka Ringwald * 41fe5a6c4eSMilanka Ringwald */ 423deb3ec6SMatthias Ringwald 43*50b9afa4SMilanka Ringwald #ifndef BTSTACK_HFP_AG_H 44*50b9afa4SMilanka Ringwald #define BTSTACK_HFP_AG_H 453deb3ec6SMatthias Ringwald 463deb3ec6SMatthias Ringwald #include "hci.h" 47efda0b48SMatthias Ringwald #include "classic/sdp_client_rfcomm.h" 483edc84c5SMatthias Ringwald #include "classic/hfp.h" 4974386ee0SMatthias Ringwald #include "classic/hfp_gsm_model.h" 503deb3ec6SMatthias Ringwald 513deb3ec6SMatthias Ringwald #if defined __cplusplus 523deb3ec6SMatthias Ringwald extern "C" { 533deb3ec6SMatthias Ringwald #endif 543deb3ec6SMatthias Ringwald 553deb3ec6SMatthias Ringwald /* API_START */ 56ce263fc8SMatthias Ringwald typedef struct { 57ce263fc8SMatthias Ringwald uint8_t type; 58ce263fc8SMatthias Ringwald const char * number; 59ce263fc8SMatthias Ringwald } hfp_phone_number_t; 603deb3ec6SMatthias Ringwald 613deb3ec6SMatthias Ringwald /** 623deb3ec6SMatthias Ringwald * @brief Create HFP Audio Gateway (AG) SDP service record. 63a0ffb263SMatthias Ringwald * @param service 64a0ffb263SMatthias Ringwald * @param rfcomm_channel_nr 65a0ffb263SMatthias Ringwald * @param name 66a0ffb263SMatthias Ringwald * @param ability_to_reject_call 67a0ffb263SMatthias Ringwald * @param suported_features 32-bit bitmap, see HFP_AGSF_* values in hfp.h 684f84bf36SMatthias Ringwald * @param wide_band_speech supported 693deb3ec6SMatthias Ringwald */ 704f84bf36SMatthias Ringwald void hfp_ag_create_sdp_record(uint8_t * service, uint32_t service_record_handle, int rfcomm_channel_nr, const char * name, uint8_t ability_to_reject_call, uint16_t supported_features, int wide_band_speech); 713deb3ec6SMatthias Ringwald 723deb3ec6SMatthias Ringwald /** 73a0ffb263SMatthias Ringwald * @brief Set up HFP Audio Gateway (AG) device without additional supported features. 74a0ffb263SMatthias Ringwald * @param rfcomm_channel_nr 753deb3ec6SMatthias Ringwald */ 76a0ffb263SMatthias Ringwald void hfp_ag_init(uint16_t rfcomm_channel_nr); 77a0ffb263SMatthias Ringwald 78a0ffb263SMatthias Ringwald /** 79a0ffb263SMatthias Ringwald * @brief Set codecs. 80a0ffb263SMatthias Ringwald * @param codecs_nr 81a0ffb263SMatthias Ringwald * @param codecs 82a0ffb263SMatthias Ringwald */ 837ca89cabSMatthias Ringwald void hfp_ag_init_codecs(int codecs_nr, const uint8_t * codecs); 84a0ffb263SMatthias Ringwald 85a0ffb263SMatthias Ringwald /** 86a0ffb263SMatthias Ringwald * @brief Set supported features. 87a0ffb263SMatthias Ringwald * @param supported_features 32-bit bitmap, see HFP_AGSF_* values in hfp.h 88a0ffb263SMatthias Ringwald */ 89a0ffb263SMatthias Ringwald void hfp_ag_init_supported_features(uint32_t supported_features); 90a0ffb263SMatthias Ringwald 91a0ffb263SMatthias Ringwald /** 92a0ffb263SMatthias Ringwald * @brief Set AG indicators. 93a0ffb263SMatthias Ringwald * @param indicators_nr 94a0ffb263SMatthias Ringwald * @param indicators 95a0ffb263SMatthias Ringwald */ 967ca89cabSMatthias Ringwald void hfp_ag_init_ag_indicators(int ag_indicators_nr, const hfp_ag_indicator_t * ag_indicators); 97a0ffb263SMatthias Ringwald 98a0ffb263SMatthias Ringwald /** 99a0ffb263SMatthias Ringwald * @brief Set HF indicators. 100a0ffb263SMatthias Ringwald * @param indicators_nr 101a0ffb263SMatthias Ringwald * @param indicators 102a0ffb263SMatthias Ringwald */ 1037ca89cabSMatthias Ringwald void hfp_ag_init_hf_indicators(int hf_indicators_nr, const hfp_generic_status_indicator_t * hf_indicators); 104a0ffb263SMatthias Ringwald 105a0ffb263SMatthias Ringwald /** 106a0ffb263SMatthias Ringwald * @brief Set Call Hold services. 107a0ffb263SMatthias Ringwald * @param indicators_nr 108a0ffb263SMatthias Ringwald * @param indicators 109a0ffb263SMatthias Ringwald */ 110a0ffb263SMatthias Ringwald void hfp_ag_init_call_hold_services(int call_hold_services_nr, const char * call_hold_services[]); 111a0ffb263SMatthias Ringwald 1123deb3ec6SMatthias Ringwald 1133deb3ec6SMatthias Ringwald /** 1143deb3ec6SMatthias Ringwald * @brief Register callback for the HFP Audio Gateway (AG) client. 115a0ffb263SMatthias Ringwald * @param callback 1163deb3ec6SMatthias Ringwald */ 11713839019SMatthias Ringwald void hfp_ag_register_packet_handler(btstack_packet_handler_t callback); 1183deb3ec6SMatthias Ringwald 1193deb3ec6SMatthias Ringwald /** 120c5fa3c94SMilanka Ringwald * @brief Enable/Disable in-band ring tone. 121c5fa3c94SMilanka Ringwald * 122a0ffb263SMatthias Ringwald * @param use_in_band_ring_tone 12366a048abSMatthias Ringwald */ 124d7d354cbSMilanka Ringwald void hfp_ag_set_use_in_band_ring_tone(int use_in_band_ring_tone); 12566a048abSMatthias Ringwald 12666a048abSMatthias Ringwald 12766a048abSMatthias Ringwald // actions used by local device / user 12866a048abSMatthias Ringwald 12966a048abSMatthias Ringwald /** 1303deb3ec6SMatthias Ringwald * @brief Establish RFCOMM connection, and perform service level connection agreement: 1313deb3ec6SMatthias Ringwald * - exchange of supported features 1323deb3ec6SMatthias Ringwald * - report Audio Gateway (AG) indicators and their status 1333deb3ec6SMatthias Ringwald * - enable indicator status update in the AG 1343deb3ec6SMatthias Ringwald * - accept the information about available codecs in the Hands-Free (HF), if sent 1353deb3ec6SMatthias Ringwald * - report own information describing the call hold and multiparty services, if possible 1363deb3ec6SMatthias Ringwald * - report which HF indicators are enabled on the AG, if possible 137a0ffb263SMatthias Ringwald * The status of SLC connection establishment is reported via 138a0ffb263SMatthias Ringwald * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED. 139a0ffb263SMatthias Ringwald * 140c5fa3c94SMilanka Ringwald * @param bd_addr of HF 1414eb3f1d8SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 1424eb3f1d8SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if connection already exists or connection in wrong state, or 1434eb3f1d8SMilanka Ringwald * - BTSTACK_MEMORY_ALLOC_FAILED 1444eb3f1d8SMilanka Ringwald * 1453deb3ec6SMatthias Ringwald */ 1464eb3f1d8SMilanka Ringwald uint8_t hfp_ag_establish_service_level_connection(bd_addr_t bd_addr); 1473deb3ec6SMatthias Ringwald 1483deb3ec6SMatthias Ringwald /** 1493deb3ec6SMatthias Ringwald * @brief Release the RFCOMM channel and the audio connection between the HF and the AG. 150a0ffb263SMatthias Ringwald * If the audio connection exists, it will be released. 151a0ffb263SMatthias Ringwald * The status of releasing the SLC connection is reported via 152a0ffb263SMatthias Ringwald * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED. 153a0ffb263SMatthias Ringwald * 154c5fa3c94SMilanka Ringwald * @param acl_handle 155657bc59fSMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 1563deb3ec6SMatthias Ringwald */ 157657bc59fSMilanka Ringwald uint8_t hfp_ag_release_service_level_connection(hci_con_handle_t acl_handle); 1583deb3ec6SMatthias Ringwald 1593deb3ec6SMatthias Ringwald /** 160a0ffb263SMatthias Ringwald * @brief Establish audio connection. 161c5fa3c94SMilanka Ringwald * The status of Audio connection establishment is reported via is reported via HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE. 162c5fa3c94SMilanka Ringwald * 163c5fa3c94SMilanka Ringwald * @param acl_handle 164c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 165aa4dd815SMatthias Ringwald */ 166c5fa3c94SMilanka Ringwald uint8_t hfp_ag_establish_audio_connection(hci_con_handle_t acl_handle); 1673deb3ec6SMatthias Ringwald 1683deb3ec6SMatthias Ringwald /** 169a0ffb263SMatthias Ringwald * @brief Release audio connection. 170c5fa3c94SMilanka Ringwald * The status of releasing the Audio connection is reported via is reported via HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE. 171c5fa3c94SMilanka Ringwald * 172c5fa3c94SMilanka Ringwald * @param acl_handle 173c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 1743deb3ec6SMatthias Ringwald */ 175c5fa3c94SMilanka Ringwald uint8_t hfp_ag_release_audio_connection(hci_con_handle_t acl_handle); 1763deb3ec6SMatthias Ringwald 17766a048abSMatthias Ringwald /** 178a0ffb263SMatthias Ringwald * @brief Put the current call on hold, if it exists, and accept incoming call. 17966a048abSMatthias Ringwald */ 18066a048abSMatthias Ringwald void hfp_ag_answer_incoming_call(void); 1813deb3ec6SMatthias Ringwald 182aa4dd815SMatthias Ringwald /** 183a0ffb263SMatthias Ringwald * @brief Join held call with active call. 184aa4dd815SMatthias Ringwald */ 18566a048abSMatthias Ringwald void hfp_ag_join_held_call(void); 18666a048abSMatthias Ringwald 18766a048abSMatthias Ringwald /** 188a0ffb263SMatthias Ringwald * @brief Reject incoming call, if exists, or terminate active call. 18966a048abSMatthias Ringwald */ 19066a048abSMatthias Ringwald void hfp_ag_terminate_call(void); 19166a048abSMatthias Ringwald 19266a048abSMatthias Ringwald /* 193a0ffb263SMatthias Ringwald * @brief Put incoming call on hold. 19466a048abSMatthias Ringwald */ 19566a048abSMatthias Ringwald void hfp_ag_hold_incoming_call(void); 19666a048abSMatthias Ringwald 19766a048abSMatthias Ringwald /* 198a0ffb263SMatthias Ringwald * @brief Accept the held incoming call. 19966a048abSMatthias Ringwald */ 20066a048abSMatthias Ringwald void hfp_ag_accept_held_incoming_call(void); 20166a048abSMatthias Ringwald 20266a048abSMatthias Ringwald /* 203a0ffb263SMatthias Ringwald * @brief Reject the held incoming call. 20466a048abSMatthias Ringwald */ 20566a048abSMatthias Ringwald void hfp_ag_reject_held_incoming_call(void); 20666a048abSMatthias Ringwald 20766a048abSMatthias Ringwald /* 208a0ffb263SMatthias Ringwald * @brief Set microphone gain. 209c5fa3c94SMilanka Ringwald * 210c5fa3c94SMilanka Ringwald * @param acl_handle 211a0ffb263SMatthias Ringwald * @param gain Valid range: [0,15] 212c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 213c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 214c5fa3c94SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range 21566a048abSMatthias Ringwald */ 216c5fa3c94SMilanka Ringwald uint8_t hfp_ag_set_microphone_gain(hci_con_handle_t acl_handle, int gain); 21766a048abSMatthias Ringwald 21866a048abSMatthias Ringwald /* 219a0ffb263SMatthias Ringwald * @brief Set speaker gain. 220c5fa3c94SMilanka Ringwald * 221c5fa3c94SMilanka Ringwald * @param acl_handle 222a0ffb263SMatthias Ringwald * @param gain Valid range: [0,15] 223c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 224c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 225c5fa3c94SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range 22666a048abSMatthias Ringwald */ 227c5fa3c94SMilanka Ringwald uint8_t hfp_ag_set_speaker_gain(hci_con_handle_t acl_handle, int gain); 22866a048abSMatthias Ringwald 22966a048abSMatthias Ringwald /* 230a0ffb263SMatthias Ringwald * @brief Set battery level. 231c5fa3c94SMilanka Ringwald * 232c5fa3c94SMilanka Ringwald * @param battery_level Valid range: [0,5] 233c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 234c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 235c5fa3c94SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if invalid battery level range 23666a048abSMatthias Ringwald */ 237c5fa3c94SMilanka Ringwald uint8_t hfp_ag_set_battery_level(int battery_level); 23866a048abSMatthias Ringwald 23966a048abSMatthias Ringwald /* 240a0ffb263SMatthias Ringwald * @brief Clear last dialed number. 24166a048abSMatthias Ringwald */ 24266a048abSMatthias Ringwald void hfp_ag_clear_last_dialed_number(void); 24366a048abSMatthias Ringwald 244a0ffb263SMatthias Ringwald /* 2459de679b7SMilanka Ringwald * @brief Set last dialed number. 2469de679b7SMilanka Ringwald */ 2479de679b7SMilanka Ringwald void hfp_ag_set_last_dialed_number(const char * number); 2489de679b7SMilanka Ringwald 2499de679b7SMilanka Ringwald /* 250a0ffb263SMatthias Ringwald * @brief Notify the HF that an incoming call is waiting 251a0ffb263SMatthias Ringwald * during an ongoing call. The notification will be sent only if the HF has 252a0ffb263SMatthias Ringwald * has previously enabled the "Call Waiting notification" in the AG. 253c5fa3c94SMilanka Ringwald * 254c5fa3c94SMilanka Ringwald * @param acl_handle 255c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 256c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 257c5fa3c94SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if call waiting notification is not enabled 258a0ffb263SMatthias Ringwald */ 259c5fa3c94SMilanka Ringwald uint8_t hfp_ag_notify_incoming_call_waiting(hci_con_handle_t acl_handle); 26066a048abSMatthias Ringwald 26166a048abSMatthias Ringwald // Voice Recognition 26266a048abSMatthias Ringwald 26366a048abSMatthias Ringwald /* 264d84719b1SMilanka Ringwald * @brief Activate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 265371c1bb2SMilanka Ringwald * if successful. The state field of this event is set to current voice recognition state: 1 for activated, 0 otherwise. 266371c1bb2SMilanka Ringwald * Prerequisite is established SLC. 267c5fa3c94SMilanka Ringwald * 268c5fa3c94SMilanka Ringwald * @param acl_handle 269c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 270c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 2716ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated 27266a048abSMatthias Ringwald */ 273d84719b1SMilanka Ringwald uint8_t hfp_ag_activate_voice_recognition(hci_con_handle_t acl_handle); 274d84719b1SMilanka Ringwald 275d84719b1SMilanka Ringwald /* 276d84719b1SMilanka Ringwald * @brief Deactivate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 277371c1bb2SMilanka Ringwald * if successful. The state field of this event is set to current voice recognition state: 1 for activated, 0 otherwise. 278371c1bb2SMilanka Ringwald * Prerequisite is established SLC. 279d84719b1SMilanka Ringwald * 280d84719b1SMilanka Ringwald * @param acl_handle 281d84719b1SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 282d84719b1SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 2836ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already deactivated 284d84719b1SMilanka Ringwald */ 285d84719b1SMilanka Ringwald uint8_t hfp_ag_deactivate_voice_recognition(hci_con_handle_t acl_handle); 28666a048abSMatthias Ringwald 287013cc750SMilanka Ringwald /** 288013cc750SMilanka Ringwald * @brief Activate enhanced voice recognition (EVR) and emit HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 289013cc750SMilanka 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. 290013cc750SMilanka Ringwald * Prerequisite is established SLC. 291c5fa3c94SMilanka Ringwald * 292c5fa3c94SMilanka Ringwald * @param acl_handle 293c5fa3c94SMilanka Ringwald * @param activate 294c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 295c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 2966ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG 297c5fa3c94SMilanka Ringwald */ 298e83c2025SMilanka Ringwald uint8_t hfp_ag_activate_enhanced_voice_recognition(hci_con_handle_t acl_handle); 29945796ff1SMilanka Ringwald 300c5fa3c94SMilanka Ringwald /* 301e8e72901SMilanka Ringwald * @brief Notify HF that sound will be played and HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_AG_IS_STARTING_SOUND event with status ERROR_CODE_SUCCESS 302e8e72901SMilanka Ringwald * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. 303c5fa3c94SMilanka Ringwald * 304c5fa3c94SMilanka Ringwald * @param acl_handle 305c5fa3c94SMilanka Ringwald * @param activate 306c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 307c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 3086ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG 309c5fa3c94SMilanka Ringwald */ 310f0c27a95SMilanka Ringwald uint8_t hfp_ag_enhanced_voice_recognition_report_sending_audio(hci_con_handle_t acl_handle); 311c5fa3c94SMilanka Ringwald 312c5fa3c94SMilanka Ringwald /* 313e8e72901SMilanka Ringwald * @brief Notify HF that AG is ready for input and emit HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_AG_READY_TO_ACCEPT_AUDIO_INPUT event with status ERROR_CODE_SUCCESS 314e8e72901SMilanka Ringwald * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. 315c5fa3c94SMilanka Ringwald * 316c5fa3c94SMilanka Ringwald * @param acl_handle 317c5fa3c94SMilanka Ringwald * @param activate 318c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 319c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 3206ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG 321c5fa3c94SMilanka Ringwald */ 322f0c27a95SMilanka Ringwald uint8_t hfp_ag_enhanced_voice_recognition_report_ready_for_audio(hci_con_handle_t acl_handle); 323c5fa3c94SMilanka Ringwald 324c5fa3c94SMilanka Ringwald /* 325e8e72901SMilanka Ringwald * @brief Notify that AG is processing input and emit HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_AG_IS_PROCESSING_AUDIO_INPUT event with status ERROR_CODE_SUCCESS 326e8e72901SMilanka Ringwald * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. 327c5fa3c94SMilanka Ringwald * 328c5fa3c94SMilanka Ringwald * @param acl_handle 329c5fa3c94SMilanka Ringwald * @param activate 330c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 331c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 3326ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG 333c5fa3c94SMilanka Ringwald */ 334cf75be85SMilanka Ringwald uint8_t hfp_ag_enhanced_voice_recognition_report_processing_input(hci_con_handle_t acl_handle); 335c5fa3c94SMilanka Ringwald 336c5fa3c94SMilanka Ringwald /* 337e8e72901SMilanka Ringwald * @brief Send enhanced audio recognition message and HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_AG_MESSAGE_SENT event with status ERROR_CODE_SUCCESS 338e8e72901SMilanka Ringwald * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. 339c5fa3c94SMilanka Ringwald * 340c5fa3c94SMilanka Ringwald * @param acl_handle 341c5fa3c94SMilanka Ringwald * @param activate 342c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 343c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 3446ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if HF and AG do not support features: HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS and HFP_(HF/AG)SF_VOICE_RECOGNITION_TEXT 345c5fa3c94SMilanka Ringwald */ 346b95cac54SMilanka Ringwald uint8_t hfp_ag_enhanced_voice_recognition_send_message(hci_con_handle_t acl_handle, hfp_voice_recognition_state_t state, hfp_voice_recognition_message_t msg); 347c5fa3c94SMilanka Ringwald 348013cc750SMilanka Ringwald /** 349013cc750SMilanka Ringwald * @brief Deactivate enhanced voice recognition (EVR) and emit HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 350013cc750SMilanka 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. 351013cc750SMilanka Ringwald * Prerequisite is established SLC. 352c5fa3c94SMilanka Ringwald * 353c5fa3c94SMilanka Ringwald * @param acl_handle 354c5fa3c94SMilanka Ringwald * @param activate 355c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 356c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 3576ba83b5eSMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG 358c5fa3c94SMilanka Ringwald */ 359e83c2025SMilanka Ringwald uint8_t hfp_ag_deactivate_enhanced_voice_recognition(hci_con_handle_t acl_handle); 36045796ff1SMilanka Ringwald 36166a048abSMatthias Ringwald /* 362a0ffb263SMatthias Ringwald * @brief Send a phone number back to the HF. 363c5fa3c94SMilanka Ringwald * 364c5fa3c94SMilanka Ringwald * @param acl_handle 365a0ffb263SMatthias Ringwald * @param phone_number 366c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 36766a048abSMatthias Ringwald */ 368c5fa3c94SMilanka Ringwald uint8_t hfp_ag_send_phone_number_for_voice_tag(hci_con_handle_t acl_handle, const char * phone_number); 36966a048abSMatthias Ringwald 37066a048abSMatthias Ringwald /* 371a0ffb263SMatthias Ringwald * @brief Reject sending a phone number to the HF. 372c5fa3c94SMilanka Ringwald * 373c5fa3c94SMilanka Ringwald * @param acl_handle 374c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 37566a048abSMatthias Ringwald */ 376c5fa3c94SMilanka Ringwald uint8_t hfp_ag_reject_phone_number_for_voice_tag(hci_con_handle_t acl_handle); 37766a048abSMatthias Ringwald 378a0ffb263SMatthias Ringwald /** 379a0ffb263SMatthias Ringwald * @brief Store phone number with initiated call. 380a0ffb263SMatthias Ringwald * @param type 381a0ffb263SMatthias Ringwald * @param number 382a0ffb263SMatthias Ringwald */ 383a0ffb263SMatthias Ringwald void hfp_ag_set_clip(uint8_t type, const char * number); 384a0ffb263SMatthias Ringwald 38566a048abSMatthias Ringwald 38666a048abSMatthias Ringwald // Cellular Actions 387aa4dd815SMatthias Ringwald 388aa4dd815SMatthias Ringwald /** 389a0ffb263SMatthias Ringwald * @brief Pass the accept incoming call event to the AG. 390aa4dd815SMatthias Ringwald */ 391aa4dd815SMatthias Ringwald void hfp_ag_incoming_call(void); 392aa4dd815SMatthias Ringwald 393aa4dd815SMatthias Ringwald /** 394fe899794SMatthias Ringwald * @brief Outgoing call initiated 395fe899794SMatthias Ringwald */ 396fe899794SMatthias Ringwald void hfp_ag_outgoing_call_initiated(const char * number); 397fe899794SMatthias Ringwald 398fe899794SMatthias Ringwald /** 399a0ffb263SMatthias Ringwald * @brief Pass the reject outgoing call event to the AG. 400aa4dd815SMatthias Ringwald */ 401aa4dd815SMatthias Ringwald void hfp_ag_outgoing_call_rejected(void); 402aa4dd815SMatthias Ringwald 403aa4dd815SMatthias Ringwald /** 404a0ffb263SMatthias Ringwald * @brief Pass the accept outgoing call event to the AG. 405aa4dd815SMatthias Ringwald */ 406aa4dd815SMatthias Ringwald void hfp_ag_outgoing_call_accepted(void); 407aa4dd815SMatthias Ringwald 408aa4dd815SMatthias Ringwald /** 409a0ffb263SMatthias Ringwald * @brief Pass the outgoing call ringing event to the AG. 410aa4dd815SMatthias Ringwald */ 411aa4dd815SMatthias Ringwald void hfp_ag_outgoing_call_ringing(void); 412aa4dd815SMatthias Ringwald 413aa4dd815SMatthias Ringwald /** 414a0ffb263SMatthias Ringwald * @brief Pass the outgoing call established event to the AG. 415aa4dd815SMatthias Ringwald */ 416aa4dd815SMatthias Ringwald void hfp_ag_outgoing_call_established(void); 417aa4dd815SMatthias Ringwald 418aa4dd815SMatthias Ringwald /** 419674ebed5SMilanka Ringwald * @brief Pass the call dropped event to the AG. 420aa4dd815SMatthias Ringwald */ 421aa4dd815SMatthias Ringwald void hfp_ag_call_dropped(void); 422a0ffb263SMatthias Ringwald 423aa4dd815SMatthias Ringwald /* 424a0ffb263SMatthias Ringwald * @brief Set network registration status. 425a0ffb263SMatthias Ringwald * @param status 0 - not registered, 1 - registered 426c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 427c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 428c5fa3c94SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if invalid registration status 429aa4dd815SMatthias Ringwald */ 430c5fa3c94SMilanka Ringwald uint8_t hfp_ag_set_registration_status(int registration_status); 431aa4dd815SMatthias Ringwald 432aa4dd815SMatthias Ringwald /* 433a0ffb263SMatthias Ringwald * @brief Set network signal strength. 434c5fa3c94SMilanka Ringwald * 435c5fa3c94SMilanka Ringwald * @param signal_strength [0-5] 436c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 437c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 438c5fa3c94SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if invalid signal strength range 439aa4dd815SMatthias Ringwald */ 440c5fa3c94SMilanka Ringwald uint8_t hfp_ag_set_signal_strength(int signal_strength); 441aa4dd815SMatthias Ringwald 442aa4dd815SMatthias Ringwald /* 443a0ffb263SMatthias Ringwald * @brief Set roaming status. 444c5fa3c94SMilanka Ringwald * 445c5fa3c94SMilanka Ringwald * @param roaming_status 0 - no roaming, 1 - roaming active 446c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 447c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 448c5fa3c94SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if invalid roaming status 449aa4dd815SMatthias Ringwald */ 450c5fa3c94SMilanka Ringwald uint8_t hfp_ag_set_roaming_status(int roaming_status); 451aa4dd815SMatthias Ringwald 452aa4dd815SMatthias Ringwald /* 453a0ffb263SMatthias Ringwald * @brief Set subcriber number information, e.g. the phone number 454a0ffb263SMatthias Ringwald * @param numbers 455a0ffb263SMatthias Ringwald * @param numbers_count 456aa4dd815SMatthias Ringwald */ 457ce263fc8SMatthias Ringwald void hfp_ag_set_subcriber_number_information(hfp_phone_number_t * numbers, int numbers_count); 458ce263fc8SMatthias Ringwald 459ce263fc8SMatthias Ringwald /* 460a0ffb263SMatthias Ringwald * @brief Called by cellular unit after a DTMF code was transmitted, so that the next one can be emitted. 461c5fa3c94SMilanka Ringwald * 462c5fa3c94SMilanka Ringwald * @param acl_handle 463c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 464ce263fc8SMatthias Ringwald */ 465c5fa3c94SMilanka Ringwald uint8_t hfp_ag_send_dtmf_code_done(hci_con_handle_t acl_handle); 466ce263fc8SMatthias Ringwald 46766a048abSMatthias Ringwald /** 46866a048abSMatthias Ringwald * @brief Report Extended Audio Gateway Error result codes in the AG. 46966a048abSMatthias Ringwald * Whenever there is an error relating to the functionality of the AG as a 47066a048abSMatthias Ringwald * result of AT command, the AG shall send +CME ERROR: 47166a048abSMatthias Ringwald * - +CME ERROR: 0 - AG failure 47266a048abSMatthias Ringwald * - +CME ERROR: 1 - no connection to phone 47366a048abSMatthias Ringwald * - +CME ERROR: 3 - operation not allowed 47466a048abSMatthias Ringwald * - +CME ERROR: 4 - operation not supported 47566a048abSMatthias Ringwald * - +CME ERROR: 5 - PH-SIM PIN required 47666a048abSMatthias Ringwald * - +CME ERROR: 10 - SIM not inserted 47766a048abSMatthias Ringwald * - +CME ERROR: 11 - SIM PIN required 47866a048abSMatthias Ringwald * - +CME ERROR: 12 - SIM PUK required 47966a048abSMatthias Ringwald * - +CME ERROR: 13 - SIM failure 48066a048abSMatthias Ringwald * - +CME ERROR: 14 - SIM busy 48166a048abSMatthias Ringwald * - +CME ERROR: 16 - incorrect password 48266a048abSMatthias Ringwald * - +CME ERROR: 17 - SIM PIN2 required 48366a048abSMatthias Ringwald * - +CME ERROR: 18 - SIM PUK2 required 48466a048abSMatthias Ringwald * - +CME ERROR: 20 - memory full 48566a048abSMatthias Ringwald * - +CME ERROR: 21 - invalid index 48666a048abSMatthias Ringwald * - +CME ERROR: 23 - memory failure 48766a048abSMatthias Ringwald * - +CME ERROR: 24 - text string too long 48866a048abSMatthias Ringwald * - +CME ERROR: 25 - invalid characters in text string 48966a048abSMatthias Ringwald * - +CME ERROR: 26 - dial string too long 49066a048abSMatthias Ringwald * - +CME ERROR: 27 - invalid characters in dial string 49166a048abSMatthias Ringwald * - +CME ERROR: 30 - no network service 49266a048abSMatthias Ringwald * - +CME ERROR: 31 - network Timeout. 49366a048abSMatthias Ringwald * - +CME ERROR: 32 - network not allowed – Emergency calls only 494a0ffb263SMatthias Ringwald * 495c5fa3c94SMilanka Ringwald * @param acl_handle 496a0ffb263SMatthias Ringwald * @param error 497c5fa3c94SMilanka Ringwald * @return status ERROR_CODE_SUCCESS if successful, otherwise: 498c5fa3c94SMilanka Ringwald * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 499c5fa3c94SMilanka Ringwald * - ERROR_CODE_COMMAND_DISALLOWED if extended audio gateway error report is disabled 500ce263fc8SMatthias Ringwald */ 501c5fa3c94SMilanka Ringwald uint8_t hfp_ag_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle, hfp_cme_error_t error); 5029cae807eSMatthias Ringwald 50320b2edb6SMatthias Ringwald /** 50420b2edb6SMatthias Ringwald * @brief De-Init HFP AG 50520b2edb6SMatthias Ringwald */ 50620b2edb6SMatthias Ringwald void hfp_ag_deinit(void); 50720b2edb6SMatthias Ringwald 5083deb3ec6SMatthias Ringwald /* API_END */ 5093deb3ec6SMatthias Ringwald 510bc06f5acSMatthias Ringwald // testing 511bc06f5acSMatthias Ringwald hfp_ag_indicator_t * hfp_ag_get_ag_indicators(hfp_connection_t * hfp_connection); 51266a048abSMatthias Ringwald 5133deb3ec6SMatthias Ringwald #if defined __cplusplus 5143deb3ec6SMatthias Ringwald } 5153deb3ec6SMatthias Ringwald #endif 5163deb3ec6SMatthias Ringwald 5173deb3ec6SMatthias Ringwald #endif 518