1*3deb3ec6SMatthias Ringwald /* 2*3deb3ec6SMatthias Ringwald * Copyright (C) 2014 BlueKitchen GmbH 3*3deb3ec6SMatthias Ringwald * 4*3deb3ec6SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5*3deb3ec6SMatthias Ringwald * modification, are permitted provided that the following conditions 6*3deb3ec6SMatthias Ringwald * are met: 7*3deb3ec6SMatthias Ringwald * 8*3deb3ec6SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9*3deb3ec6SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10*3deb3ec6SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11*3deb3ec6SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12*3deb3ec6SMatthias Ringwald * documentation and/or other materials provided with the distribution. 13*3deb3ec6SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14*3deb3ec6SMatthias Ringwald * contributors may be used to endorse or promote products derived 15*3deb3ec6SMatthias Ringwald * from this software without specific prior written permission. 16*3deb3ec6SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 17*3deb3ec6SMatthias Ringwald * personal benefit and not for any commercial purpose or for 18*3deb3ec6SMatthias Ringwald * monetary gain. 19*3deb3ec6SMatthias Ringwald * 20*3deb3ec6SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21*3deb3ec6SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22*3deb3ec6SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23*3deb3ec6SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24*3deb3ec6SMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25*3deb3ec6SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26*3deb3ec6SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27*3deb3ec6SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28*3deb3ec6SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29*3deb3ec6SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30*3deb3ec6SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31*3deb3ec6SMatthias Ringwald * SUCH DAMAGE. 32*3deb3ec6SMatthias Ringwald * 33*3deb3ec6SMatthias Ringwald * Please inquire about commercial licensing options at 34*3deb3ec6SMatthias Ringwald * [email protected] 35*3deb3ec6SMatthias Ringwald * 36*3deb3ec6SMatthias Ringwald */ 37*3deb3ec6SMatthias Ringwald 38*3deb3ec6SMatthias Ringwald // ***************************************************************************** 39*3deb3ec6SMatthias Ringwald // 40*3deb3ec6SMatthias Ringwald // Minimal setup for HFP Hands-Free (HF) unit (!! UNDER DEVELOPMENT !!) 41*3deb3ec6SMatthias Ringwald // 42*3deb3ec6SMatthias Ringwald // ***************************************************************************** 43*3deb3ec6SMatthias Ringwald 44*3deb3ec6SMatthias Ringwald 45*3deb3ec6SMatthias Ringwald #ifndef btstack_hfp_hf_h 46*3deb3ec6SMatthias Ringwald #define btstack_hfp_hf_h 47*3deb3ec6SMatthias Ringwald 48*3deb3ec6SMatthias Ringwald #include "hci.h" 49*3deb3ec6SMatthias Ringwald #include "sdp_query_rfcomm.h" 50*3deb3ec6SMatthias Ringwald #include "hfp.h" 51*3deb3ec6SMatthias Ringwald 52*3deb3ec6SMatthias Ringwald #if defined __cplusplus 53*3deb3ec6SMatthias Ringwald extern "C" { 54*3deb3ec6SMatthias Ringwald #endif 55*3deb3ec6SMatthias Ringwald 56*3deb3ec6SMatthias Ringwald /* API_START */ 57*3deb3ec6SMatthias Ringwald 58*3deb3ec6SMatthias Ringwald 59*3deb3ec6SMatthias Ringwald /** 60*3deb3ec6SMatthias Ringwald * @brief Create HFP Hands-Free (HF) SDP service record. 61*3deb3ec6SMatthias Ringwald */ 62*3deb3ec6SMatthias Ringwald void hfp_hf_create_sdp_record(uint8_t * service, int rfcomm_channel_nr, const char * name, uint16_t supported_features); 63*3deb3ec6SMatthias Ringwald 64*3deb3ec6SMatthias Ringwald /** 65*3deb3ec6SMatthias Ringwald * @brief Intialize HFP Hands-Free (HF) device. 66*3deb3ec6SMatthias Ringwald * TODO: move optional params into setters 67*3deb3ec6SMatthias Ringwald */ 68*3deb3ec6SMatthias Ringwald void hfp_hf_init(uint16_t rfcomm_channel_nr, uint32_t supported_features, uint16_t * indicators, int indicators_nr, uint32_t indicators_status); 69*3deb3ec6SMatthias Ringwald void hfp_hf_set_codecs(uint8_t * codecs, int codecs_nr); 70*3deb3ec6SMatthias Ringwald 71*3deb3ec6SMatthias Ringwald /** 72*3deb3ec6SMatthias Ringwald * @brief Register callback for the HFP Hands-Free (HF) client. 73*3deb3ec6SMatthias Ringwald */ 74*3deb3ec6SMatthias Ringwald void hfp_hf_register_packet_handler(hfp_callback_t callback); 75*3deb3ec6SMatthias Ringwald 76*3deb3ec6SMatthias Ringwald /** 77*3deb3ec6SMatthias Ringwald * @brief Establish RFCOMM connection, and perform service level connection agreement: 78*3deb3ec6SMatthias Ringwald * - exchange of supported features 79*3deb3ec6SMatthias Ringwald * - retrieve Audio Gateway (AG) indicators and their status 80*3deb3ec6SMatthias Ringwald * - enable indicator status update in the AG 81*3deb3ec6SMatthias Ringwald * - notify the AG about its own available codecs, if possible 82*3deb3ec6SMatthias Ringwald * - retrieve the AG information describing the call hold and multiparty services, if possible 83*3deb3ec6SMatthias Ringwald * - retrieve which HF indicators are enabled on the AG, if possible 84*3deb3ec6SMatthias Ringwald */ 85*3deb3ec6SMatthias Ringwald void hfp_hf_establish_service_level_connection(bd_addr_t bd_addr); 86*3deb3ec6SMatthias Ringwald 87*3deb3ec6SMatthias Ringwald 88*3deb3ec6SMatthias Ringwald /** 89*3deb3ec6SMatthias Ringwald * @brief Release the RFCOMM channel and the audio connection between the HF and the AG. 90*3deb3ec6SMatthias Ringwald * TODO: trigger release of the audio connection 91*3deb3ec6SMatthias Ringwald */ 92*3deb3ec6SMatthias Ringwald void hfp_hf_release_service_level_connection(bd_addr_t bd_addr); 93*3deb3ec6SMatthias Ringwald 94*3deb3ec6SMatthias Ringwald /** 95*3deb3ec6SMatthias Ringwald * @brief Deactivate/reactivate status update for all indicators in the AG. 96*3deb3ec6SMatthias Ringwald */ 97*3deb3ec6SMatthias Ringwald void hfp_hf_enable_status_update_for_all_ag_indicators(bd_addr_t bd_addr, uint8_t enable); 98*3deb3ec6SMatthias Ringwald 99*3deb3ec6SMatthias Ringwald /** 100*3deb3ec6SMatthias Ringwald * @brief Deactivate/reactivate status update for the individual indicators in the AG using bitmap. 101*3deb3ec6SMatthias Ringwald */ 102*3deb3ec6SMatthias Ringwald void hfp_hf_enable_status_update_for_individual_ag_indicators(bd_addr_t bd_addr, uint32_t indicators_status_bitmap); 103*3deb3ec6SMatthias Ringwald 104*3deb3ec6SMatthias Ringwald 105*3deb3ec6SMatthias Ringwald /** 106*3deb3ec6SMatthias Ringwald * @brief Find out the name of the currently selected Network operator by AG. 107*3deb3ec6SMatthias Ringwald * The name is restricted to max 16 characters. 108*3deb3ec6SMatthias Ringwald */ 109*3deb3ec6SMatthias Ringwald void hfp_hf_query_operator_selection(bd_addr_t bd_addr); 110*3deb3ec6SMatthias Ringwald 111*3deb3ec6SMatthias Ringwald /** 112*3deb3ec6SMatthias Ringwald * @brief Enable/disable Extended Audio Gateway Error result codes in the AG. 113*3deb3ec6SMatthias Ringwald * Whenever there is an error relating to the functionality of the AG as a 114*3deb3ec6SMatthias Ringwald * result of AT command, the AG shall send +CME ERROR: 115*3deb3ec6SMatthias Ringwald * - +CME ERROR: 0 - AG failure 116*3deb3ec6SMatthias Ringwald * - +CME ERROR: 1 - no connection to phone 117*3deb3ec6SMatthias Ringwald * - +CME ERROR: 3 - operation not allowed 118*3deb3ec6SMatthias Ringwald * - +CME ERROR: 4 - operation not supported 119*3deb3ec6SMatthias Ringwald * - +CME ERROR: 5 - PH-SIM PIN required 120*3deb3ec6SMatthias Ringwald * - +CME ERROR: 10 - SIM not inserted 121*3deb3ec6SMatthias Ringwald * - +CME ERROR: 11 - SIM PIN required 122*3deb3ec6SMatthias Ringwald * - +CME ERROR: 12 - SIM PUK required 123*3deb3ec6SMatthias Ringwald * - +CME ERROR: 13 - SIM failure 124*3deb3ec6SMatthias Ringwald * - +CME ERROR: 14 - SIM busy 125*3deb3ec6SMatthias Ringwald * - +CME ERROR: 16 - incorrect password 126*3deb3ec6SMatthias Ringwald * - +CME ERROR: 17 - SIM PIN2 required 127*3deb3ec6SMatthias Ringwald * - +CME ERROR: 18 - SIM PUK2 required 128*3deb3ec6SMatthias Ringwald * - +CME ERROR: 20 - memory full 129*3deb3ec6SMatthias Ringwald * - +CME ERROR: 21 - invalid index 130*3deb3ec6SMatthias Ringwald * - +CME ERROR: 23 - memory failure 131*3deb3ec6SMatthias Ringwald * - +CME ERROR: 24 - text string too long 132*3deb3ec6SMatthias Ringwald * - +CME ERROR: 25 - invalid characters in text string 133*3deb3ec6SMatthias Ringwald * - +CME ERROR: 26 - dial string too long 134*3deb3ec6SMatthias Ringwald * - +CME ERROR: 27 - invalid characters in dial string 135*3deb3ec6SMatthias Ringwald * - +CME ERROR: 30 - no network service 136*3deb3ec6SMatthias Ringwald * - +CME ERROR: 31 - network Timeout. 137*3deb3ec6SMatthias Ringwald * - +CME ERROR: 32 - network not allowed – Emergency calls only 138*3deb3ec6SMatthias Ringwald */ 139*3deb3ec6SMatthias Ringwald void hfp_hf_enable_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr, uint8_t enable); 140*3deb3ec6SMatthias Ringwald 141*3deb3ec6SMatthias Ringwald /** 142*3deb3ec6SMatthias Ringwald * @brief 143*3deb3ec6SMatthias Ringwald */ 144*3deb3ec6SMatthias Ringwald void hfp_hf_negotiate_codecs(bd_addr_t bd_addr); 145*3deb3ec6SMatthias Ringwald 146*3deb3ec6SMatthias Ringwald void hfp_hf_establish_audio_connection(bd_addr_t bd_addr); 147*3deb3ec6SMatthias Ringwald 148*3deb3ec6SMatthias Ringwald /** 149*3deb3ec6SMatthias Ringwald * @brief 150*3deb3ec6SMatthias Ringwald */ 151*3deb3ec6SMatthias Ringwald void hfp_hf_release_audio_connection(bd_addr_t bd_addr); 152*3deb3ec6SMatthias Ringwald 153*3deb3ec6SMatthias Ringwald 154*3deb3ec6SMatthias Ringwald /* API_END */ 155*3deb3ec6SMatthias Ringwald 156*3deb3ec6SMatthias Ringwald #if defined __cplusplus 157*3deb3ec6SMatthias Ringwald } 158*3deb3ec6SMatthias Ringwald #endif 159*3deb3ec6SMatthias Ringwald 160*3deb3ec6SMatthias Ringwald #endif