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 383deb3ec6SMatthias Ringwald // ***************************************************************************** 393deb3ec6SMatthias Ringwald // 403deb3ec6SMatthias Ringwald // Minimal setup for HFP Hands-Free (HF) unit (!! UNDER DEVELOPMENT !!) 413deb3ec6SMatthias Ringwald // 423deb3ec6SMatthias Ringwald // ***************************************************************************** 433deb3ec6SMatthias Ringwald 443deb3ec6SMatthias Ringwald 453deb3ec6SMatthias Ringwald #ifndef btstack_hfp_hf_h 463deb3ec6SMatthias Ringwald #define btstack_hfp_hf_h 473deb3ec6SMatthias Ringwald 483deb3ec6SMatthias Ringwald #include "hci.h" 493edc84c5SMatthias Ringwald #include "classic/sdp_query_rfcomm.h" 503edc84c5SMatthias Ringwald #include "classic/hfp.h" 513deb3ec6SMatthias Ringwald 523deb3ec6SMatthias Ringwald #if defined __cplusplus 533deb3ec6SMatthias Ringwald extern "C" { 543deb3ec6SMatthias Ringwald #endif 553deb3ec6SMatthias Ringwald 563deb3ec6SMatthias Ringwald /* API_START */ 573deb3ec6SMatthias Ringwald 583deb3ec6SMatthias Ringwald 593deb3ec6SMatthias Ringwald /** 603deb3ec6SMatthias Ringwald * @brief Create HFP Hands-Free (HF) SDP service record. 613deb3ec6SMatthias Ringwald */ 629b1c3b4dSMatthias 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); 633deb3ec6SMatthias Ringwald 643deb3ec6SMatthias Ringwald /** 653deb3ec6SMatthias Ringwald * @brief Intialize HFP Hands-Free (HF) device. 663deb3ec6SMatthias Ringwald * TODO: move optional params into setters 673deb3ec6SMatthias Ringwald */ 683deb3ec6SMatthias Ringwald void hfp_hf_init(uint16_t rfcomm_channel_nr, uint32_t supported_features, uint16_t * indicators, int indicators_nr, uint32_t indicators_status); 693deb3ec6SMatthias Ringwald void hfp_hf_set_codecs(uint8_t * codecs, int codecs_nr); 703deb3ec6SMatthias Ringwald 713deb3ec6SMatthias Ringwald /** 723deb3ec6SMatthias Ringwald * @brief Register callback for the HFP Hands-Free (HF) client. 733deb3ec6SMatthias Ringwald */ 743deb3ec6SMatthias Ringwald void hfp_hf_register_packet_handler(hfp_callback_t callback); 753deb3ec6SMatthias Ringwald 763deb3ec6SMatthias Ringwald /** 773deb3ec6SMatthias Ringwald * @brief Establish RFCOMM connection, and perform service level connection agreement: 783deb3ec6SMatthias Ringwald * - exchange of supported features 793deb3ec6SMatthias Ringwald * - retrieve Audio Gateway (AG) indicators and their status 803deb3ec6SMatthias Ringwald * - enable indicator status update in the AG 813deb3ec6SMatthias Ringwald * - notify the AG about its own available codecs, if possible 823deb3ec6SMatthias Ringwald * - retrieve the AG information describing the call hold and multiparty services, if possible 833deb3ec6SMatthias Ringwald * - retrieve which HF indicators are enabled on the AG, if possible 843deb3ec6SMatthias Ringwald */ 853deb3ec6SMatthias Ringwald void hfp_hf_establish_service_level_connection(bd_addr_t bd_addr); 863deb3ec6SMatthias Ringwald 873deb3ec6SMatthias Ringwald /** 883deb3ec6SMatthias Ringwald * @brief Release the RFCOMM channel and the audio connection between the HF and the AG. 893deb3ec6SMatthias Ringwald * TODO: trigger release of the audio connection 903deb3ec6SMatthias Ringwald */ 913deb3ec6SMatthias Ringwald void hfp_hf_release_service_level_connection(bd_addr_t bd_addr); 923deb3ec6SMatthias Ringwald 933deb3ec6SMatthias Ringwald /** 943deb3ec6SMatthias Ringwald * @brief Deactivate/reactivate status update for all indicators in the AG. 953deb3ec6SMatthias Ringwald */ 96ce263fc8SMatthias Ringwald void hfp_hf_enable_status_update_for_all_ag_indicators(bd_addr_t bd_addr); 97ce263fc8SMatthias Ringwald void hfp_hf_disable_status_update_for_all_ag_indicators(bd_addr_t bd_addr); 983deb3ec6SMatthias Ringwald 993deb3ec6SMatthias Ringwald /** 1003deb3ec6SMatthias Ringwald * @brief Deactivate/reactivate status update for the individual indicators in the AG using bitmap. 1013deb3ec6SMatthias Ringwald */ 102ce263fc8SMatthias Ringwald void hfp_hf_set_status_update_for_individual_ag_indicators(bd_addr_t bd_addr, uint32_t indicators_status_bitmap); 1033deb3ec6SMatthias Ringwald 1043deb3ec6SMatthias Ringwald 1053deb3ec6SMatthias Ringwald /** 1063deb3ec6SMatthias Ringwald * @brief Find out the name of the currently selected Network operator by AG. 1073deb3ec6SMatthias Ringwald * The name is restricted to max 16 characters. 1083deb3ec6SMatthias Ringwald */ 1093deb3ec6SMatthias Ringwald void hfp_hf_query_operator_selection(bd_addr_t bd_addr); 1103deb3ec6SMatthias Ringwald 1113deb3ec6SMatthias Ringwald /** 1123deb3ec6SMatthias Ringwald * @brief Enable/disable Extended Audio Gateway Error result codes in the AG. 1133deb3ec6SMatthias Ringwald * Whenever there is an error relating to the functionality of the AG as a 1143deb3ec6SMatthias Ringwald * result of AT command, the AG shall send +CME ERROR: 1153deb3ec6SMatthias Ringwald * - +CME ERROR: 0 - AG failure 1163deb3ec6SMatthias Ringwald * - +CME ERROR: 1 - no connection to phone 1173deb3ec6SMatthias Ringwald * - +CME ERROR: 3 - operation not allowed 1183deb3ec6SMatthias Ringwald * - +CME ERROR: 4 - operation not supported 1193deb3ec6SMatthias Ringwald * - +CME ERROR: 5 - PH-SIM PIN required 1203deb3ec6SMatthias Ringwald * - +CME ERROR: 10 - SIM not inserted 1213deb3ec6SMatthias Ringwald * - +CME ERROR: 11 - SIM PIN required 1223deb3ec6SMatthias Ringwald * - +CME ERROR: 12 - SIM PUK required 1233deb3ec6SMatthias Ringwald * - +CME ERROR: 13 - SIM failure 1243deb3ec6SMatthias Ringwald * - +CME ERROR: 14 - SIM busy 1253deb3ec6SMatthias Ringwald * - +CME ERROR: 16 - incorrect password 1263deb3ec6SMatthias Ringwald * - +CME ERROR: 17 - SIM PIN2 required 1273deb3ec6SMatthias Ringwald * - +CME ERROR: 18 - SIM PUK2 required 1283deb3ec6SMatthias Ringwald * - +CME ERROR: 20 - memory full 1293deb3ec6SMatthias Ringwald * - +CME ERROR: 21 - invalid index 1303deb3ec6SMatthias Ringwald * - +CME ERROR: 23 - memory failure 1313deb3ec6SMatthias Ringwald * - +CME ERROR: 24 - text string too long 1323deb3ec6SMatthias Ringwald * - +CME ERROR: 25 - invalid characters in text string 1333deb3ec6SMatthias Ringwald * - +CME ERROR: 26 - dial string too long 1343deb3ec6SMatthias Ringwald * - +CME ERROR: 27 - invalid characters in dial string 1353deb3ec6SMatthias Ringwald * - +CME ERROR: 30 - no network service 1363deb3ec6SMatthias Ringwald * - +CME ERROR: 31 - network Timeout. 1373deb3ec6SMatthias Ringwald * - +CME ERROR: 32 - network not allowed – Emergency calls only 1383deb3ec6SMatthias Ringwald */ 139ce263fc8SMatthias Ringwald void hfp_hf_enable_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr); 140ce263fc8SMatthias Ringwald void hfp_hf_disable_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr); 1413deb3ec6SMatthias Ringwald 1423deb3ec6SMatthias Ringwald /** 1433deb3ec6SMatthias Ringwald * @brief 1443deb3ec6SMatthias Ringwald */ 1453deb3ec6SMatthias Ringwald void hfp_hf_establish_audio_connection(bd_addr_t bd_addr); 1463deb3ec6SMatthias Ringwald 1473deb3ec6SMatthias Ringwald /** 1483deb3ec6SMatthias Ringwald * @brief 1493deb3ec6SMatthias Ringwald */ 1503deb3ec6SMatthias Ringwald void hfp_hf_release_audio_connection(bd_addr_t bd_addr); 1513deb3ec6SMatthias Ringwald 152ce263fc8SMatthias Ringwald /** 153ce263fc8SMatthias Ringwald * @brief 154ce263fc8SMatthias Ringwald */ 155ce263fc8SMatthias Ringwald void hfp_hf_answer_incoming_call(bd_addr_t bd_addr); 156ce263fc8SMatthias Ringwald 157ce263fc8SMatthias Ringwald /** 158ce263fc8SMatthias Ringwald * @brief 159ce263fc8SMatthias Ringwald */ 160ce263fc8SMatthias Ringwald void hfp_hf_reject_call(bd_addr_t bd_addr); 161ce263fc8SMatthias Ringwald 162ce263fc8SMatthias Ringwald /** 163ce263fc8SMatthias Ringwald * @brief 164ce263fc8SMatthias Ringwald */ 165ce263fc8SMatthias Ringwald void hfp_hf_user_busy(bd_addr_t addr); 166ce263fc8SMatthias Ringwald 167ce263fc8SMatthias Ringwald /** 168ce263fc8SMatthias Ringwald * @brief 169ce263fc8SMatthias Ringwald */ 170ce263fc8SMatthias Ringwald void hfp_hf_end_active_and_accept_other(bd_addr_t addr); 171ce263fc8SMatthias Ringwald 172ce263fc8SMatthias Ringwald /** 173ce263fc8SMatthias Ringwald * @brief 174ce263fc8SMatthias Ringwald */ 175ce263fc8SMatthias Ringwald void hfp_hf_swap_calls(bd_addr_t addr); 176ce263fc8SMatthias Ringwald 177ce263fc8SMatthias Ringwald /** 178ce263fc8SMatthias Ringwald * @brief 179ce263fc8SMatthias Ringwald */ 180ce263fc8SMatthias Ringwald void hfp_hf_join_held_call(bd_addr_t addr); 181ce263fc8SMatthias Ringwald 182ce263fc8SMatthias Ringwald /** 183ce263fc8SMatthias Ringwald * @brief 184ce263fc8SMatthias Ringwald */ 185ce263fc8SMatthias Ringwald void hfp_hf_connect_calls(bd_addr_t addr); 186ce263fc8SMatthias Ringwald 187ce263fc8SMatthias Ringwald /** 188ce263fc8SMatthias Ringwald * @brief 189ce263fc8SMatthias Ringwald */ 190ce263fc8SMatthias Ringwald void hfp_hf_terminate_call(bd_addr_t bd_addr); 191ce263fc8SMatthias Ringwald 192ce263fc8SMatthias Ringwald /** 193ce263fc8SMatthias Ringwald * @brief 194ce263fc8SMatthias Ringwald */ 195ce263fc8SMatthias Ringwald void hfp_hf_dial_number(bd_addr_t bd_addr, char * number); 196ce263fc8SMatthias Ringwald 197ce263fc8SMatthias Ringwald /** 198ce263fc8SMatthias Ringwald * @brief 199ce263fc8SMatthias Ringwald */ 200ce263fc8SMatthias Ringwald void hfp_hf_dial_memory(bd_addr_t bd_addr, char * number); 201ce263fc8SMatthias Ringwald 202ce263fc8SMatthias Ringwald /** 203ce263fc8SMatthias Ringwald * @brief 204ce263fc8SMatthias Ringwald */ 205ce263fc8SMatthias Ringwald void hfp_hf_redial_last_number(bd_addr_t bd_addr); 206ce263fc8SMatthias Ringwald 207ce263fc8SMatthias Ringwald /* 208ce263fc8SMatthias Ringwald * @brief 209ce263fc8SMatthias Ringwald */ 210ce263fc8SMatthias Ringwald void hfp_hf_activate_call_waiting_notification(bd_addr_t bd_addr); 211ce263fc8SMatthias Ringwald 212ce263fc8SMatthias Ringwald /* 213ce263fc8SMatthias Ringwald * @brief 214ce263fc8SMatthias Ringwald */ 215ce263fc8SMatthias Ringwald void hfp_hf_deactivate_call_waiting_notification(bd_addr_t bd_addr); 216ce263fc8SMatthias Ringwald 217ce263fc8SMatthias Ringwald /* 218ce263fc8SMatthias Ringwald * @brief 219ce263fc8SMatthias Ringwald */ 220ce263fc8SMatthias Ringwald void hfp_hf_activate_calling_line_notification(bd_addr_t bd_addr); 221ce263fc8SMatthias Ringwald 222ce263fc8SMatthias Ringwald /* 223ce263fc8SMatthias Ringwald * @brief 224ce263fc8SMatthias Ringwald */ 225ce263fc8SMatthias Ringwald void hfp_hf_deactivate_calling_line_notification(bd_addr_t bd_addr); 226ce263fc8SMatthias Ringwald 227ce263fc8SMatthias Ringwald 228ce263fc8SMatthias Ringwald /* 229ce263fc8SMatthias Ringwald * @brief 230ce263fc8SMatthias Ringwald */ 231ce263fc8SMatthias Ringwald void hfp_hf_activate_echo_canceling_and_noise_reduction(bd_addr_t bd_addr); 232ce263fc8SMatthias Ringwald 233ce263fc8SMatthias Ringwald /* 234ce263fc8SMatthias Ringwald * @brief 235ce263fc8SMatthias Ringwald */ 236ce263fc8SMatthias Ringwald void hfp_hf_deactivate_echo_canceling_and_noise_reduction(bd_addr_t bd_addr); 237ce263fc8SMatthias Ringwald 238ce263fc8SMatthias Ringwald /* 239ce263fc8SMatthias Ringwald * @brief 240ce263fc8SMatthias Ringwald */ 241ce263fc8SMatthias Ringwald void hfp_hf_activate_voice_recognition_notification(bd_addr_t bd_addr); 242ce263fc8SMatthias Ringwald 243ce263fc8SMatthias Ringwald /* 244ce263fc8SMatthias Ringwald * @brief 245ce263fc8SMatthias Ringwald */ 246ce263fc8SMatthias Ringwald void hfp_hf_deactivate_voice_recognition_notification(bd_addr_t bd_addr); 247ce263fc8SMatthias Ringwald 248ce263fc8SMatthias Ringwald /* 249ce263fc8SMatthias Ringwald * @brief 250ce263fc8SMatthias Ringwald */ 251ce263fc8SMatthias Ringwald void hfp_hf_set_microphone_gain(bd_addr_t bd_addr, int gain); 252ce263fc8SMatthias Ringwald 253ce263fc8SMatthias Ringwald /* 254ce263fc8SMatthias Ringwald * @brief 255ce263fc8SMatthias Ringwald */ 256ce263fc8SMatthias Ringwald void hfp_hf_set_speaker_gain(bd_addr_t bd_addr, int gain); 257ce263fc8SMatthias Ringwald 258ce263fc8SMatthias Ringwald /* 259ce263fc8SMatthias Ringwald * @brief 260ce263fc8SMatthias Ringwald */ 261ce263fc8SMatthias Ringwald void hfp_hf_send_dtmf_code(bd_addr_t bd_addr, char code); 262ce263fc8SMatthias Ringwald 263ce263fc8SMatthias Ringwald /* 264ce263fc8SMatthias Ringwald * @brief 265ce263fc8SMatthias Ringwald */ 266ce263fc8SMatthias Ringwald void hfp_hf_request_phone_number_for_voice_tag(bd_addr_t addr); 2673deb3ec6SMatthias Ringwald 268*667ec068SMatthias Ringwald /* 269*667ec068SMatthias Ringwald * @brief 270*667ec068SMatthias Ringwald */ 271*667ec068SMatthias Ringwald void hfp_hf_query_current_call_status(bd_addr_t addr); 272*667ec068SMatthias Ringwald 273*667ec068SMatthias Ringwald /* 274*667ec068SMatthias Ringwald * @brief 275*667ec068SMatthias Ringwald */ 276*667ec068SMatthias Ringwald void hfp_hf_release_call_with_index(bd_addr_t addr, int index); 277*667ec068SMatthias Ringwald 278*667ec068SMatthias Ringwald /* 279*667ec068SMatthias Ringwald * @brief 280*667ec068SMatthias Ringwald */ 281*667ec068SMatthias Ringwald void hfp_hf_private_consultation_with_call(bd_addr_t addr, int index); 282*667ec068SMatthias Ringwald 283*667ec068SMatthias Ringwald /* 284*667ec068SMatthias Ringwald * @brief 285*667ec068SMatthias Ringwald */ 286*667ec068SMatthias Ringwald void hfp_hf_rrh_query_status(bd_addr_t addr); 287*667ec068SMatthias Ringwald 288*667ec068SMatthias Ringwald /* 289*667ec068SMatthias Ringwald * @brief 290*667ec068SMatthias Ringwald */ 291*667ec068SMatthias Ringwald void hfp_hf_rrh_hold_call(bd_addr_t addr); 292*667ec068SMatthias Ringwald 293*667ec068SMatthias Ringwald /* 294*667ec068SMatthias Ringwald * @brief 295*667ec068SMatthias Ringwald */ 296*667ec068SMatthias Ringwald void hfp_hf_rrh_accept_held_call(bd_addr_t addr); 297*667ec068SMatthias Ringwald 298*667ec068SMatthias Ringwald /* 299*667ec068SMatthias Ringwald * @brief 300*667ec068SMatthias Ringwald */ 301*667ec068SMatthias Ringwald void hfp_hf_rrh_reject_held_call(bd_addr_t addr); 302*667ec068SMatthias Ringwald 303*667ec068SMatthias Ringwald /* 304*667ec068SMatthias Ringwald * @brief 305*667ec068SMatthias Ringwald */ 306*667ec068SMatthias Ringwald void hfp_hf_query_subscriber_number(bd_addr_t addr); 307*667ec068SMatthias Ringwald 308*667ec068SMatthias Ringwald /* 309*667ec068SMatthias Ringwald * @brief 310*667ec068SMatthias Ringwald */ 311*667ec068SMatthias Ringwald void hfp_hf_set_hf_indicator(bd_addr_t addr, int assigned_number, int value); 312*667ec068SMatthias Ringwald 3133deb3ec6SMatthias Ringwald /* API_END */ 3143deb3ec6SMatthias Ringwald 3153deb3ec6SMatthias Ringwald #if defined __cplusplus 3163deb3ec6SMatthias Ringwald } 3173deb3ec6SMatthias Ringwald #endif 3183deb3ec6SMatthias Ringwald 3193deb3ec6SMatthias Ringwald #endif