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 // HFP Hands-Free (HF) unit and Audio-Gateway Commons 413deb3ec6SMatthias Ringwald // 423deb3ec6SMatthias Ringwald // ***************************************************************************** 433deb3ec6SMatthias Ringwald 443deb3ec6SMatthias Ringwald 453deb3ec6SMatthias Ringwald #ifndef btstack_hfp_h 463deb3ec6SMatthias Ringwald #define btstack_hfp_h 473deb3ec6SMatthias Ringwald 483deb3ec6SMatthias Ringwald #include "hci.h" 493edc84c5SMatthias Ringwald #include "classic/sdp_query_rfcomm.h" 503deb3ec6SMatthias Ringwald 513deb3ec6SMatthias Ringwald #if defined __cplusplus 523deb3ec6SMatthias Ringwald extern "C" { 533deb3ec6SMatthias Ringwald #endif 543deb3ec6SMatthias Ringwald 553deb3ec6SMatthias Ringwald 563deb3ec6SMatthias Ringwald /* HF Supported Features: 573deb3ec6SMatthias Ringwald 0: EC and/or NR function 583deb3ec6SMatthias Ringwald 1: Three-way calling 593deb3ec6SMatthias Ringwald 2: CLI presentation capability 603deb3ec6SMatthias Ringwald 3: Voice recognition activation 613deb3ec6SMatthias Ringwald 4: Remote volume control 623deb3ec6SMatthias Ringwald 5: Enhanced call status 633deb3ec6SMatthias Ringwald 6: Enhanced call control 643deb3ec6SMatthias Ringwald 7: Codec negotiation 653deb3ec6SMatthias Ringwald 8: HF Indicators 663deb3ec6SMatthias Ringwald 9: eSCO S4 (and T2) Settings Supported 673deb3ec6SMatthias Ringwald 10-31: Reserved for future definition 683deb3ec6SMatthias Ringwald */ 693deb3ec6SMatthias Ringwald #define HFP_HFSF_EC_NR_FUNCTION 0 70aa4dd815SMatthias Ringwald #define HFP_HFSF_THREE_WAY_CALLING 1 71aa4dd815SMatthias Ringwald #define HFP_HFSF_VOICE_RECOGNITION_FUNCTION 3 723deb3ec6SMatthias Ringwald #define HFP_HFSF_CODEC_NEGOTIATION 7 733deb3ec6SMatthias Ringwald #define HFP_HFSF_HF_INDICATORS 8 74ce263fc8SMatthias Ringwald #define HFP_HFSF_ESCO_S4 9 753deb3ec6SMatthias Ringwald 763deb3ec6SMatthias Ringwald /* AG Supported Features: 773deb3ec6SMatthias Ringwald 0: Three-way calling 783deb3ec6SMatthias Ringwald 1: EC and/or NR function 793deb3ec6SMatthias Ringwald 2: Voice recognition function 803deb3ec6SMatthias Ringwald 3: In-band ring tone capability 813deb3ec6SMatthias Ringwald 4: Attach a number to a voice tag 823deb3ec6SMatthias Ringwald 5: Ability to reject a call 833deb3ec6SMatthias Ringwald 6: Enhanced call status 843deb3ec6SMatthias Ringwald 7: Enhanced call control 853deb3ec6SMatthias Ringwald 8: Extended Error Result Codes 863deb3ec6SMatthias Ringwald 9: Codec negotiation 873deb3ec6SMatthias Ringwald 10: HF Indicators 883deb3ec6SMatthias Ringwald 11: eSCO S4 (and T2) Settings Supported 893deb3ec6SMatthias Ringwald 12-31: Reserved for future definition 903deb3ec6SMatthias Ringwald */ 913deb3ec6SMatthias Ringwald #define HFP_AGSF_THREE_WAY_CALLING 0 923deb3ec6SMatthias Ringwald #define HFP_AGSF_EC_NR_FUNCTION 1 93aa4dd815SMatthias Ringwald #define HFP_AGSF_VOICE_RECOGNITION_FUNCTION 2 94aa4dd815SMatthias Ringwald #define HFP_AGSF_IN_BAND_RING_TONE 3 953deb3ec6SMatthias Ringwald #define HFP_AGSF_CODEC_NEGOTIATION 9 963deb3ec6SMatthias Ringwald #define HFP_AGSF_HF_INDICATORS 10 97ce263fc8SMatthias Ringwald #define HFP_AGSF_ESCO_S4 11 983deb3ec6SMatthias Ringwald 993deb3ec6SMatthias Ringwald #define HFP_DEFAULT_HF_SUPPORTED_FEATURES 0x0000 1003deb3ec6SMatthias Ringwald #define HFP_DEFAULT_AG_SUPPORTED_FEATURES 0x0009 1013deb3ec6SMatthias Ringwald 1023deb3ec6SMatthias Ringwald #define HFP_MAX_NUM_CODECS 20 1033deb3ec6SMatthias Ringwald #define HFP_MAX_NUM_AG_INDICATORS 20 1043deb3ec6SMatthias Ringwald #define HFP_MAX_NUM_HF_INDICATORS 20 1053deb3ec6SMatthias Ringwald #define HFP_MAX_INDICATOR_DESC_SIZE 20 1063deb3ec6SMatthias Ringwald 1073deb3ec6SMatthias Ringwald #define HFP_SUPPORTED_FEATURES "+BRSF" 1083deb3ec6SMatthias Ringwald #define HFP_AVAILABLE_CODECS "+BAC" 1093deb3ec6SMatthias Ringwald #define HFP_INDICATOR "+CIND" 1103deb3ec6SMatthias Ringwald #define HFP_ENABLE_STATUS_UPDATE_FOR_AG_INDICATORS "+CMER" 111aa4dd815SMatthias Ringwald #define HFP_ENABLE_CLIP "+CLIP" 112aa4dd815SMatthias Ringwald #define HFP_ENABLE_CALL_WAITING_NOTIFICATION "+CCWA" 1133deb3ec6SMatthias Ringwald #define HFP_UPDATE_ENABLE_STATUS_FOR_INDIVIDUAL_AG_INDICATORS "+BIA" // +BIA:<enabled>,,<enabled>,,,<enabled> 1143deb3ec6SMatthias Ringwald #define HFP_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES "+CHLD" 1153deb3ec6SMatthias Ringwald #define HFP_GENERIC_STATUS_INDICATOR "+BIND" 1163deb3ec6SMatthias Ringwald #define HFP_TRANSFER_AG_INDICATOR_STATUS "+CIEV" // +CIEV: <index>,<value> 117ce263fc8SMatthias Ringwald #define HFP_TRANSFER_HF_INDICATOR_STATUS "+BIEV" // +BIEC: <index>,<value> 1183deb3ec6SMatthias Ringwald #define HFP_QUERY_OPERATOR_SELECTION "+COPS" // +COPS: <mode>,0,<opearator> 1193deb3ec6SMatthias Ringwald #define HFP_ENABLE_EXTENDED_AUDIO_GATEWAY_ERROR "+CMEE" 1203deb3ec6SMatthias Ringwald #define HFP_EXTENDED_AUDIO_GATEWAY_ERROR "+CME ERROR" 1213deb3ec6SMatthias Ringwald #define HFP_TRIGGER_CODEC_CONNECTION_SETUP "+BCC" 1223deb3ec6SMatthias Ringwald #define HFP_CONFIRM_COMMON_CODEC "+BCS" 123aa4dd815SMatthias Ringwald #define HFP_CALL_ANSWERED "ATA" 124aa4dd815SMatthias Ringwald #define HFP_HANG_UP_CALL "+CHUP" 125aa4dd815SMatthias Ringwald #define HFP_CHANGE_IN_BAND_RING_TONE_SETTING "+BSIR" 126aa4dd815SMatthias Ringwald #define HFP_CALL_PHONE_NUMBER "ATD" 127ce263fc8SMatthias Ringwald #define HFP_REDIAL_LAST_NUMBER "+BLDN" 128aa4dd815SMatthias Ringwald #define HFP_TURN_OFF_EC_AND_NR "+NREC" // EC (Echo CAnceling), NR (Noise Reduction) 129aa4dd815SMatthias Ringwald #define HFP_ACTIVATE_VOICE_RECOGNITION "+BVRA" // EC (Echo CAnceling), NR (Noise Reduction) 130aa4dd815SMatthias Ringwald #define HFP_SET_MICROPHONE_GAIN "+VGM" 131aa4dd815SMatthias Ringwald #define HFP_SET_SPEAKER_GAIN "+VGS" 132aa4dd815SMatthias Ringwald #define HFP_PHONE_NUMBER_FOR_VOICE_TAG "+BINP" 133aa4dd815SMatthias Ringwald #define HFP_TRANSMIT_DTMF_CODES "+VTS" 134ce263fc8SMatthias Ringwald #define HFP_SUBSCRIBER_NUMBER_INFORMATION "+CNUM" 135ce263fc8SMatthias Ringwald #define HFP_LIST_CURRENT_CALLS "+CLCC" 136ce263fc8SMatthias Ringwald #define HFP_RESPONSE_AND_HOLD "+BTRH" 1373deb3ec6SMatthias Ringwald 1383deb3ec6SMatthias Ringwald #define HFP_OK "OK" 1393deb3ec6SMatthias Ringwald #define HFP_ERROR "ERROR" 140ce263fc8SMatthias Ringwald #define HFP_RING "RING" 1413deb3ec6SMatthias Ringwald 1423deb3ec6SMatthias Ringwald // Codecs 1433deb3ec6SMatthias Ringwald #define HFP_CODEC_CVSD 0x01 1443deb3ec6SMatthias Ringwald #define HFP_CODEC_MSBC 0x02 1453deb3ec6SMatthias Ringwald 1463deb3ec6SMatthias Ringwald typedef enum { 1473deb3ec6SMatthias Ringwald HFP_CMD_NONE = 0, 1483deb3ec6SMatthias Ringwald HFP_CMD_ERROR, 149aa4dd815SMatthias Ringwald HFP_CMD_UNKNOWN, 1503deb3ec6SMatthias Ringwald HFP_CMD_OK, 151ce263fc8SMatthias Ringwald HFP_CMD_RING, 1523deb3ec6SMatthias Ringwald HFP_CMD_SUPPORTED_FEATURES, 1533deb3ec6SMatthias Ringwald HFP_CMD_AVAILABLE_CODECS, 154aa4dd815SMatthias Ringwald 155aa4dd815SMatthias Ringwald HFP_CMD_RETRIEVE_AG_INDICATORS, 156aa4dd815SMatthias Ringwald HFP_CMD_RETRIEVE_AG_INDICATORS_STATUS, 157aa4dd815SMatthias Ringwald 1583deb3ec6SMatthias Ringwald HFP_CMD_ENABLE_INDICATOR_STATUS_UPDATE, 1593deb3ec6SMatthias Ringwald HFP_CMD_ENABLE_INDIVIDUAL_AG_INDICATOR_STATUS_UPDATE, 1603deb3ec6SMatthias Ringwald HFP_CMD_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES, 161aa4dd815SMatthias Ringwald HFP_CMD_ENABLE_CLIP, 162aa4dd815SMatthias Ringwald HFP_CMD_ENABLE_CALL_WAITING_NOTIFICATION, 1633deb3ec6SMatthias Ringwald 164aa4dd815SMatthias Ringwald HFP_CMD_LIST_GENERIC_STATUS_INDICATORS, 165aa4dd815SMatthias Ringwald HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS, 166aa4dd815SMatthias Ringwald HFP_CMD_RETRIEVE_GENERIC_STATUS_INDICATORS_STATE, 167667ec068SMatthias Ringwald HFP_CMD_SET_GENERIC_STATUS_INDICATOR_STATUS, 1683deb3ec6SMatthias Ringwald 1693deb3ec6SMatthias Ringwald HFP_CMD_TRANSFER_AG_INDICATOR_STATUS, 170aa4dd815SMatthias Ringwald 171aa4dd815SMatthias Ringwald HFP_CMD_QUERY_OPERATOR_SELECTION_NAME, 172aa4dd815SMatthias Ringwald HFP_CMD_QUERY_OPERATOR_SELECTION_NAME_FORMAT, 1733deb3ec6SMatthias Ringwald 1743deb3ec6SMatthias Ringwald HFP_CMD_ENABLE_EXTENDED_AUDIO_GATEWAY_ERROR, 1753deb3ec6SMatthias Ringwald HFP_CMD_EXTENDED_AUDIO_GATEWAY_ERROR, 1763deb3ec6SMatthias Ringwald HFP_CMD_TRIGGER_CODEC_CONNECTION_SETUP, 177aa4dd815SMatthias Ringwald HFP_CMD_AG_SEND_COMMON_CODEC, 1783deb3ec6SMatthias Ringwald HFP_CMD_AG_SUGGESTED_CODEC, 179aa4dd815SMatthias Ringwald HFP_CMD_HF_CONFIRMED_CODEC, 180aa4dd815SMatthias Ringwald HFP_CMD_CALL_ANSWERED, 181aa4dd815SMatthias Ringwald HFP_CMD_CALL_HOLD, 182aa4dd815SMatthias Ringwald HFP_CMD_AG_ANSWER_CALL, 183aa4dd815SMatthias Ringwald HFP_CMD_HANG_UP_CALL, 184aa4dd815SMatthias Ringwald HFP_CMD_CHANGE_IN_BAND_RING_TONE_SETTING, 185aa4dd815SMatthias Ringwald HFP_CMD_CALL_PHONE_NUMBER, 186aa4dd815SMatthias Ringwald HFP_CMD_REDIAL_LAST_NUMBER, 187aa4dd815SMatthias Ringwald HFP_CMD_TURN_OFF_EC_AND_NR, 188aa4dd815SMatthias Ringwald HFP_CMD_AG_ACTIVATE_VOICE_RECOGNITION, 189aa4dd815SMatthias Ringwald HFP_CMD_HF_ACTIVATE_VOICE_RECOGNITION, 190aa4dd815SMatthias Ringwald HFP_CMD_HF_REQUEST_PHONE_NUMBER, 191ce263fc8SMatthias Ringwald HFP_CMD_AG_SENT_PHONE_NUMBER, 192aa4dd815SMatthias Ringwald HFP_CMD_TRANSMIT_DTMF_CODES, 193aa4dd815SMatthias Ringwald HFP_CMD_SET_MICROPHONE_GAIN, 194ce263fc8SMatthias Ringwald HFP_CMD_SET_SPEAKER_GAIN, 195ce263fc8SMatthias Ringwald HFP_CMD_GET_SUBSCRIBER_NUMBER_INFORMATION, 196ce263fc8SMatthias Ringwald HFP_CMD_LIST_CURRENT_CALLS, 197ce263fc8SMatthias Ringwald HFP_CMD_RESPONSE_AND_HOLD_QUERY, 198ce263fc8SMatthias Ringwald HFP_CMD_RESPONSE_AND_HOLD_COMMAND, 199667ec068SMatthias Ringwald HFP_CMD_RESPONSE_AND_HOLD_STATUS, 200ce263fc8SMatthias Ringwald HFP_CMD_HF_INDICATOR_STATUS 2013deb3ec6SMatthias Ringwald } hfp_command_t; 2023deb3ec6SMatthias Ringwald 203aa4dd815SMatthias Ringwald 2043deb3ec6SMatthias Ringwald typedef enum { 2053deb3ec6SMatthias Ringwald HFP_CME_ERROR_AG_FAILURE = 0, 2063deb3ec6SMatthias Ringwald HFP_CME_ERROR_NO_CONNECTION_TO_PHONE, 2073deb3ec6SMatthias Ringwald HFP_CME_ERROR_2, 2083deb3ec6SMatthias Ringwald HFP_CME_ERROR_OPERATION_NOT_ALLOWED, 2093deb3ec6SMatthias Ringwald HFP_CME_ERROR_OPERATION_NOT_SUPPORTED, 2103deb3ec6SMatthias Ringwald HFP_CME_ERROR_PH_SIM_PIN_REQUIRED, 2113deb3ec6SMatthias Ringwald HFP_CME_ERROR_6, 2123deb3ec6SMatthias Ringwald HFP_CME_ERROR_7, 2133deb3ec6SMatthias Ringwald HFP_CME_ERROR_8, 2143deb3ec6SMatthias Ringwald HFP_CME_ERROR_9, 2153deb3ec6SMatthias Ringwald HFP_CME_ERROR_SIM_NOT_INSERTED, 2163deb3ec6SMatthias Ringwald HFP_CME_ERROR_SIM_PIN_REQUIRED, 2173deb3ec6SMatthias Ringwald HFP_CME_ERROR_SIM_PUK_REQUIRED, 2183deb3ec6SMatthias Ringwald HFP_CME_ERROR_SIM_FAILURE, 2193deb3ec6SMatthias Ringwald HFP_CME_ERROR_SIM_BUSY, 2203deb3ec6SMatthias Ringwald HFP_CME_ERROR_15, 2213deb3ec6SMatthias Ringwald HFP_CME_ERROR_INCORRECT_PASSWORD, 2223deb3ec6SMatthias Ringwald HFP_CME_ERROR_SIM_PIN2_REQUIRED, 2233deb3ec6SMatthias Ringwald HFP_CME_ERROR_SIM_PUK2_REQUIRED, 2243deb3ec6SMatthias Ringwald HFP_CME_ERROR_19, 2253deb3ec6SMatthias Ringwald HFP_CME_ERROR_MEMORY_FULL, 2263deb3ec6SMatthias Ringwald HFP_CME_ERROR_INVALID_INDEX, 2273deb3ec6SMatthias Ringwald HFP_CME_ERROR_22, 2283deb3ec6SMatthias Ringwald HFP_CME_ERROR_MEMORY_FAILURE, 2293deb3ec6SMatthias Ringwald HFP_CME_ERROR_TEXT_STRING_TOO_LONG, 2303deb3ec6SMatthias Ringwald HFP_CME_ERROR_INVALID_CHARACTERS_IN_TEXT_STRING, 2313deb3ec6SMatthias Ringwald HFP_CME_ERROR_DIAL_STRING_TOO_LONG, 2323deb3ec6SMatthias Ringwald HFP_CME_ERROR_INVALID_CHARACTERS_IN_DIAL_STRING, 2333deb3ec6SMatthias Ringwald HFP_CME_ERROR_28, 2343deb3ec6SMatthias Ringwald HFP_CME_ERROR_29, 2353deb3ec6SMatthias Ringwald HFP_CME_ERROR_NO_NETWORK_SERVICE, 2363deb3ec6SMatthias Ringwald HFP_CME_ERROR_NETWORK_TIMEOUT, 2373deb3ec6SMatthias Ringwald HFP_CME_ERROR_NETWORK_NOT_ALLOWED_EMERGENCY_CALLS_ONLY 2383deb3ec6SMatthias Ringwald } hfp_cme_error_t; 2393deb3ec6SMatthias Ringwald 2403deb3ec6SMatthias Ringwald typedef enum { 2413deb3ec6SMatthias Ringwald HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS = 0, 2423deb3ec6SMatthias Ringwald HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT 2433deb3ec6SMatthias Ringwald } hfp_call_status_t; 2443deb3ec6SMatthias Ringwald 2453deb3ec6SMatthias Ringwald typedef enum { 2463deb3ec6SMatthias Ringwald HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS = 0, 2473deb3ec6SMatthias Ringwald HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS, 2483deb3ec6SMatthias Ringwald HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_DIALING_STATE, 2493deb3ec6SMatthias Ringwald HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_ALERTING_STATE 2503deb3ec6SMatthias Ringwald } hfp_callsetup_status_t; 2513deb3ec6SMatthias Ringwald 2523deb3ec6SMatthias Ringwald typedef enum { 253aa4dd815SMatthias Ringwald HFP_CALLHELD_STATUS_NO_CALLS_HELD = 0, 254aa4dd815SMatthias Ringwald HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED, 255aa4dd815SMatthias Ringwald HFP_CALLHELD_STATUS_CALL_ON_HOLD_AND_NO_ACTIVE_CALLS 2563deb3ec6SMatthias Ringwald } hfp_callheld_status_t; 2573deb3ec6SMatthias Ringwald 258d210d9c4SMatthias Ringwald 2593deb3ec6SMatthias Ringwald typedef enum { 260aa4dd815SMatthias Ringwald HFP_AG_INCOMING_CALL, 261aa4dd815SMatthias Ringwald HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG, 262aa4dd815SMatthias Ringwald HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF, 263aa4dd815SMatthias Ringwald HFP_AG_AUDIO_CONNECTION_ESTABLISHED, 264aa4dd815SMatthias Ringwald HFP_AG_OUTGOING_CALL_INITIATED, 265aa4dd815SMatthias Ringwald HFP_AG_OUTGOING_CALL_REJECTED, 266aa4dd815SMatthias Ringwald HFP_AG_OUTGOING_CALL_ACCEPTED, 267aa4dd815SMatthias Ringwald HFP_AG_OUTGOING_CALL_RINGING, 268aa4dd815SMatthias Ringwald HFP_AG_OUTGOING_CALL_ESTABLISHED, 269aa4dd815SMatthias Ringwald HFP_AG_OUTGOING_REDIAL_INITIATED, 270ce263fc8SMatthias Ringwald HFP_AG_HELD_CALL_JOINED_BY_AG, 271aa4dd815SMatthias Ringwald HFP_AG_TERMINATE_CALL_BY_AG, 272aa4dd815SMatthias Ringwald HFP_AG_TERMINATE_CALL_BY_HF, 273aa4dd815SMatthias Ringwald HFP_AG_CALL_DROPPED, 274ce263fc8SMatthias Ringwald HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_AG, 275ce263fc8SMatthias Ringwald HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_AG, 276ce263fc8SMatthias Ringwald HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_AG, 277ce263fc8SMatthias Ringwald HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF, 278ce263fc8SMatthias Ringwald HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_HF, 279d210d9c4SMatthias Ringwald HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_HF, 280d210d9c4SMatthias Ringwald HFP_AG_CALL_HOLD_USER_BUSY, 281d210d9c4SMatthias Ringwald HFP_AG_CALL_HOLD_RELEASE_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL, 282d210d9c4SMatthias Ringwald HFP_AG_CALL_HOLD_PARK_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL, 283d210d9c4SMatthias Ringwald HFP_AG_CALL_HOLD_ADD_HELD_CALL, 284d0c20769SMatthias Ringwald HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS, 285d0c20769SMatthias Ringwald HFP_AG_SET_CLIP 286aa4dd815SMatthias Ringwald } hfp_ag_call_event_t; 287aa4dd815SMatthias Ringwald 288aa4dd815SMatthias Ringwald 289aa4dd815SMatthias Ringwald typedef enum { 2903deb3ec6SMatthias Ringwald HFP_PARSER_CMD_HEADER = 0, 2913deb3ec6SMatthias Ringwald HFP_PARSER_CMD_SEQUENCE, 2923deb3ec6SMatthias Ringwald HFP_PARSER_SECOND_ITEM, 2933deb3ec6SMatthias Ringwald HFP_PARSER_THIRD_ITEM 2943deb3ec6SMatthias Ringwald } hfp_parser_state_t; 2953deb3ec6SMatthias Ringwald 2963deb3ec6SMatthias Ringwald 2973deb3ec6SMatthias Ringwald typedef enum { 2983deb3ec6SMatthias Ringwald HFP_IDLE = 0, //0 2993deb3ec6SMatthias Ringwald HFP_SDP_QUERY_RFCOMM_CHANNEL, 3003deb3ec6SMatthias Ringwald HFP_W4_SDP_QUERY_COMPLETE, 3013deb3ec6SMatthias Ringwald HFP_W4_RFCOMM_CONNECTED, 3023deb3ec6SMatthias Ringwald 3033deb3ec6SMatthias Ringwald HFP_EXCHANGE_SUPPORTED_FEATURES, 3043deb3ec6SMatthias Ringwald HFP_W4_EXCHANGE_SUPPORTED_FEATURES, // 5 3053deb3ec6SMatthias Ringwald 3063deb3ec6SMatthias Ringwald HFP_NOTIFY_ON_CODECS, 3073deb3ec6SMatthias Ringwald HFP_W4_NOTIFY_ON_CODECS, 3083deb3ec6SMatthias Ringwald 3093deb3ec6SMatthias Ringwald HFP_RETRIEVE_INDICATORS, 3103deb3ec6SMatthias Ringwald HFP_W4_RETRIEVE_INDICATORS, 3113deb3ec6SMatthias Ringwald 3123deb3ec6SMatthias Ringwald HFP_RETRIEVE_INDICATORS_STATUS, // 10 3133deb3ec6SMatthias Ringwald HFP_W4_RETRIEVE_INDICATORS_STATUS, 3143deb3ec6SMatthias Ringwald 3153deb3ec6SMatthias Ringwald HFP_ENABLE_INDICATORS_STATUS_UPDATE, 3163deb3ec6SMatthias Ringwald HFP_W4_ENABLE_INDICATORS_STATUS_UPDATE, 3173deb3ec6SMatthias Ringwald 3183deb3ec6SMatthias Ringwald HFP_RETRIEVE_CAN_HOLD_CALL, 3193deb3ec6SMatthias Ringwald HFP_W4_RETRIEVE_CAN_HOLD_CALL, // 15 3203deb3ec6SMatthias Ringwald 3213deb3ec6SMatthias Ringwald HFP_LIST_GENERIC_STATUS_INDICATORS, 3223deb3ec6SMatthias Ringwald HFP_W4_LIST_GENERIC_STATUS_INDICATORS, 3233deb3ec6SMatthias Ringwald 3243deb3ec6SMatthias Ringwald HFP_RETRIEVE_GENERIC_STATUS_INDICATORS, 3253deb3ec6SMatthias Ringwald HFP_W4_RETRIEVE_GENERIC_STATUS_INDICATORS, 3263deb3ec6SMatthias Ringwald 327aa4dd815SMatthias Ringwald HFP_RETRIEVE_INITITAL_STATE_GENERIC_STATUS_INDICATORS, 3283deb3ec6SMatthias Ringwald HFP_W4_RETRIEVE_INITITAL_STATE_GENERIC_STATUS_INDICATORS, 3293deb3ec6SMatthias Ringwald 330aa4dd815SMatthias Ringwald HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED, 3313deb3ec6SMatthias Ringwald 332aa4dd815SMatthias Ringwald HFP_W2_CONNECT_SCO, 333aa4dd815SMatthias Ringwald HFP_W4_SCO_CONNECTED, 3343deb3ec6SMatthias Ringwald 3353deb3ec6SMatthias Ringwald HFP_AUDIO_CONNECTION_ESTABLISHED, 3363deb3ec6SMatthias Ringwald 3373deb3ec6SMatthias Ringwald HFP_W2_DISCONNECT_SCO, 338aa4dd815SMatthias Ringwald HFP_W4_SCO_DISCONNECTED, 3393deb3ec6SMatthias Ringwald 3403deb3ec6SMatthias Ringwald HFP_W2_DISCONNECT_RFCOMM, 3413deb3ec6SMatthias Ringwald HFP_W4_RFCOMM_DISCONNECTED, 3423deb3ec6SMatthias Ringwald HFP_W4_RFCOMM_DISCONNECTED_AND_RESTART, 3433deb3ec6SMatthias Ringwald HFP_W4_CONNECTION_ESTABLISHED_TO_SHUTDOWN 3443deb3ec6SMatthias Ringwald } hfp_state_t; 3453deb3ec6SMatthias Ringwald 346aa4dd815SMatthias Ringwald typedef enum { 347aa4dd815SMatthias Ringwald HFP_CODECS_IDLE, 348aa4dd815SMatthias Ringwald HFP_CODECS_RECEIVED_LIST, 349aa4dd815SMatthias Ringwald HFP_CODECS_RECEIVED_TRIGGER_CODEC_EXCHANGE, 350aa4dd815SMatthias Ringwald HFP_CODECS_W4_AG_COMMON_CODEC, 351aa4dd815SMatthias Ringwald HFP_CODECS_AG_SENT_COMMON_CODEC, 352aa4dd815SMatthias Ringwald HFP_CODECS_AG_RESEND_COMMON_CODEC, 353ce263fc8SMatthias Ringwald HFP_CODECS_HF_CONFIRMED_CODEC, 354aa4dd815SMatthias Ringwald HFP_CODECS_EXCHANGED, 355aa4dd815SMatthias Ringwald HFP_CODECS_ERROR 356aa4dd815SMatthias Ringwald } hfp_codecs_state_t; 357aa4dd815SMatthias Ringwald 358aa4dd815SMatthias Ringwald typedef enum { 359aa4dd815SMatthias Ringwald HFP_CALL_IDLE, 360aa4dd815SMatthias Ringwald HFP_CALL_TRIGGER_AUDIO_CONNECTION, 361aa4dd815SMatthias Ringwald HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING, 362aa4dd815SMatthias Ringwald HFP_CALL_RINGING, 363aa4dd815SMatthias Ringwald HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE, 364aa4dd815SMatthias Ringwald HFP_CALL_ACTIVE, 365aa4dd815SMatthias Ringwald HFP_CALL_W2_SEND_CALL_WAITING, 366aa4dd815SMatthias Ringwald HFP_CALL_W4_CHLD, 367aa4dd815SMatthias Ringwald HFP_CALL_OUTGOING_INITIATED, 368aa4dd815SMatthias Ringwald HFP_CALL_OUTGOING_DIALING, 369aa4dd815SMatthias Ringwald HFP_CALL_OUTGOING_RINGING 370aa4dd815SMatthias Ringwald } hfp_call_state_t; 371aa4dd815SMatthias Ringwald 372aa4dd815SMatthias Ringwald typedef enum{ 373ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_DIR_OUTGOING, 374ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_DIR_INCOMING 375ce263fc8SMatthias Ringwald } hfp_enhanced_call_dir_t; 376ce263fc8SMatthias Ringwald 377ce263fc8SMatthias Ringwald typedef enum{ 378ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_STATUS_ACTIVE, 379ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_STATUS_HELD, 380ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_STATUS_OUTGOING_DIALING, 381ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_STATUS_OUTGOING_ALERTING, 382ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_STATUS_INCOMING, 383ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_STATUS_INCOMING_WAITING, 384ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_STATUS_CALL_HELD_BY_RESPONSE_AND_HOLD 385ce263fc8SMatthias Ringwald } hfp_enhanced_call_status_t; 386ce263fc8SMatthias Ringwald 387ce263fc8SMatthias Ringwald typedef enum{ 388ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_MODE_VOICE, 389ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_MODE_DATA, 390ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_MODE_FAX 391ce263fc8SMatthias Ringwald } hfp_enhanced_call_mode_t; 392ce263fc8SMatthias Ringwald 393ce263fc8SMatthias Ringwald typedef enum{ 394ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_MPTY_NOT_A_CONFERENCE_CALL, 395ce263fc8SMatthias Ringwald HFP_ENHANCED_CALL_MPTY_CONFERENCE_CALL 396ce263fc8SMatthias Ringwald } hfp_enhanced_call_mpty_t; 397ce263fc8SMatthias Ringwald 398ce263fc8SMatthias Ringwald typedef enum { 399ce263fc8SMatthias Ringwald HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD = 0, 400ce263fc8SMatthias Ringwald HFP_RESPONSE_AND_HOLD_HELD_INCOMING_ACCEPTED, 401ce263fc8SMatthias Ringwald HFP_RESPONSE_AND_HOLD_HELD_INCOMING_REJECTED 402ce263fc8SMatthias Ringwald } hfp_response_and_hold_state_t; 403ce263fc8SMatthias Ringwald 404ce263fc8SMatthias Ringwald typedef enum { 405ce263fc8SMatthias Ringwald HFP_HF_QUERY_OPERATOR_FORMAT_NOT_SET = 0, 406ce263fc8SMatthias Ringwald HFP_HF_QUERY_OPERATOR_SET_FORMAT, 407ce263fc8SMatthias Ringwald HFP_HF_QUERY_OPERATOR_W4_SET_FORMAT_OK, 408ce263fc8SMatthias Ringwald HFP_HF_QUERY_OPERATOR_FORMAT_SET, 409ce263fc8SMatthias Ringwald HFP_HF_QUERY_OPERATOR_SEND_QUERY, 410ce263fc8SMatthias Ringwald HPF_HF_QUERY_OPERATOR_W4_RESULT 411ce263fc8SMatthias Ringwald } hfp_hf_query_operator_state_t; 412ce263fc8SMatthias Ringwald 413ce263fc8SMatthias Ringwald typedef enum { 414ce263fc8SMatthias Ringwald HFP_LINK_SETTINGS_D0 = 0, 415ce263fc8SMatthias Ringwald HFP_LINK_SETTINGS_D1, 416ce263fc8SMatthias Ringwald HFP_LINK_SETTINGS_S1, 417ce263fc8SMatthias Ringwald HFP_LINK_SETTINGS_S2, 418ce263fc8SMatthias Ringwald HFP_LINK_SETTINGS_S3, 419ce263fc8SMatthias Ringwald HFP_LINK_SETTINGS_S4, 420ce263fc8SMatthias Ringwald HFP_LINK_SETTINGS_T1, 421ce263fc8SMatthias Ringwald HFP_LINK_SETTINGS_T2 422ce263fc8SMatthias Ringwald } hfp_link_setttings_t; 423ce263fc8SMatthias Ringwald 424ce263fc8SMatthias Ringwald typedef enum{ 425aa4dd815SMatthias Ringwald HFP_NONE_SM, 426aa4dd815SMatthias Ringwald HFP_SLC_SM, 427aa4dd815SMatthias Ringwald HFP_SLC_QUERIES_SM, 428aa4dd815SMatthias Ringwald HFP_CODECS_CONNECTION_SM, 429aa4dd815SMatthias Ringwald HFP_AUDIO_CONNECTION_SM, 430aa4dd815SMatthias Ringwald HFP_CALL_SM 431aa4dd815SMatthias Ringwald } hfp_state_machine_t; 432aa4dd815SMatthias Ringwald 4333deb3ec6SMatthias Ringwald typedef void (*hfp_callback_t)(uint8_t * event, uint16_t event_size); 4343deb3ec6SMatthias Ringwald 4353deb3ec6SMatthias Ringwald typedef struct{ 4363deb3ec6SMatthias Ringwald uint16_t uuid; 4373deb3ec6SMatthias Ringwald uint8_t state; // enabled 4383deb3ec6SMatthias Ringwald } hfp_generic_status_indicator_t; 4393deb3ec6SMatthias Ringwald 4403deb3ec6SMatthias Ringwald typedef struct{ 4413deb3ec6SMatthias Ringwald uint8_t index; 4423deb3ec6SMatthias Ringwald char name[HFP_MAX_INDICATOR_DESC_SIZE]; 4433deb3ec6SMatthias Ringwald uint8_t min_range; 4443deb3ec6SMatthias Ringwald uint8_t max_range; 4453deb3ec6SMatthias Ringwald uint8_t status; 4463deb3ec6SMatthias Ringwald uint8_t mandatory; 4473deb3ec6SMatthias Ringwald uint8_t enabled; 4483deb3ec6SMatthias Ringwald uint8_t status_changed; 4493deb3ec6SMatthias Ringwald } hfp_ag_indicator_t; 4503deb3ec6SMatthias Ringwald 4513deb3ec6SMatthias Ringwald typedef struct{ 4523deb3ec6SMatthias Ringwald char name[3]; 4533deb3ec6SMatthias Ringwald } hfp_call_service_t; 4543deb3ec6SMatthias Ringwald 4553deb3ec6SMatthias Ringwald 4563deb3ec6SMatthias Ringwald typedef struct{ 4573deb3ec6SMatthias Ringwald uint8_t mode; 4583deb3ec6SMatthias Ringwald uint8_t format; 4593deb3ec6SMatthias Ringwald char name[17]; // enabled 4603deb3ec6SMatthias Ringwald } hfp_network_opearator_t; 4613deb3ec6SMatthias Ringwald 4623deb3ec6SMatthias Ringwald 4633deb3ec6SMatthias Ringwald typedef struct hfp_connection { 464665d90f2SMatthias Ringwald btstack_linked_item_t item; 4653deb3ec6SMatthias Ringwald 4663deb3ec6SMatthias Ringwald bd_addr_t remote_addr; 4673deb3ec6SMatthias Ringwald uint16_t con_handle; 4683deb3ec6SMatthias Ringwald uint16_t sco_handle; 4693deb3ec6SMatthias Ringwald uint16_t rfcomm_channel_nr; 4703deb3ec6SMatthias Ringwald uint16_t rfcomm_cid; 4713deb3ec6SMatthias Ringwald 472aa4dd815SMatthias Ringwald hfp_state_machine_t state_machine; 473aa4dd815SMatthias Ringwald hfp_call_state_t call_state; 4743deb3ec6SMatthias Ringwald hfp_state_t state; 475aa4dd815SMatthias Ringwald hfp_codecs_state_t codecs_state; 476aa4dd815SMatthias Ringwald 4773deb3ec6SMatthias Ringwald // needed for reestablishing connection 4783deb3ec6SMatthias Ringwald uint16_t service_uuid; 4793deb3ec6SMatthias Ringwald 4803deb3ec6SMatthias Ringwald // used during service level connection establishment 4813deb3ec6SMatthias Ringwald hfp_command_t command; 4823deb3ec6SMatthias Ringwald hfp_parser_state_t parser_state; 4833deb3ec6SMatthias Ringwald int parser_item_index; 484ce263fc8SMatthias Ringwald int parser_indicator_index; 4853deb3ec6SMatthias Ringwald uint8_t line_buffer[HFP_MAX_INDICATOR_DESC_SIZE]; 4863deb3ec6SMatthias Ringwald int line_size; 4873deb3ec6SMatthias Ringwald 4883deb3ec6SMatthias Ringwald uint32_t remote_supported_features; 4893deb3ec6SMatthias Ringwald 4903deb3ec6SMatthias Ringwald // TODO: rename into hf_codecs_nr 4913deb3ec6SMatthias Ringwald int remote_codecs_nr; 4923deb3ec6SMatthias Ringwald uint16_t remote_codecs[HFP_MAX_INDICATOR_DESC_SIZE]; 493667ec068SMatthias Ringwald 4943deb3ec6SMatthias Ringwald int ag_indicators_nr; 4953deb3ec6SMatthias Ringwald hfp_ag_indicator_t ag_indicators[HFP_MAX_INDICATOR_DESC_SIZE]; 496667ec068SMatthias Ringwald uint32_t ag_indicators_status_update_bitmap; 497667ec068SMatthias Ringwald uint8_t enable_status_update_for_ag_indicators; 498667ec068SMatthias Ringwald 4993deb3ec6SMatthias Ringwald int remote_call_services_nr; 5003deb3ec6SMatthias Ringwald hfp_call_service_t remote_call_services[HFP_MAX_INDICATOR_DESC_SIZE]; 5013deb3ec6SMatthias Ringwald 5023deb3ec6SMatthias Ringwald // TODO: use bitmap. 5033deb3ec6SMatthias Ringwald int generic_status_indicators_nr; 504667ec068SMatthias Ringwald uint32_t generic_status_update_bitmap; 5053deb3ec6SMatthias Ringwald hfp_generic_status_indicator_t generic_status_indicators[HFP_MAX_INDICATOR_DESC_SIZE]; 5063deb3ec6SMatthias Ringwald 5073deb3ec6SMatthias Ringwald hfp_network_opearator_t network_operator; 5083deb3ec6SMatthias Ringwald 5093deb3ec6SMatthias Ringwald // Retrieved during service level connection establishment, not used yet 5103deb3ec6SMatthias Ringwald uint8_t negotiated_codec; 5113deb3ec6SMatthias Ringwald 512aa4dd815SMatthias Ringwald // HF -> AG configuration 513aa4dd815SMatthias Ringwald uint8_t clip_enabled; 514aa4dd815SMatthias Ringwald uint8_t call_waiting_notification_enabled; 515aa4dd815SMatthias Ringwald 5163deb3ec6SMatthias Ringwald // TODO: put these bit flags in a bitmap 517aa4dd815SMatthias Ringwald uint8_t ok_pending; 518aa4dd815SMatthias Ringwald // uint8_t send_ok; 5193deb3ec6SMatthias Ringwald uint8_t send_error; 5203deb3ec6SMatthias Ringwald 521ce263fc8SMatthias Ringwald uint8_t keep_byte; 522ce263fc8SMatthias Ringwald uint8_t ignore_value; 523ce263fc8SMatthias Ringwald uint8_t resolve_byte; 5243deb3ec6SMatthias Ringwald 5253deb3ec6SMatthias Ringwald uint8_t change_status_update_for_individual_ag_indicators; 5263deb3ec6SMatthias Ringwald uint8_t operator_name_changed; 5273deb3ec6SMatthias Ringwald 5283deb3ec6SMatthias Ringwald uint8_t enable_extended_audio_gateway_error_report; 5293deb3ec6SMatthias Ringwald uint8_t extended_audio_gateway_error; 5303deb3ec6SMatthias Ringwald 5313deb3ec6SMatthias Ringwald // establish codecs connection 5323deb3ec6SMatthias Ringwald uint8_t suggested_codec; 5333deb3ec6SMatthias Ringwald uint8_t codec_confirmed; 5343deb3ec6SMatthias Ringwald 535ce263fc8SMatthias Ringwald hfp_link_setttings_t link_setting; 536ce263fc8SMatthias Ringwald 5373deb3ec6SMatthias Ringwald uint8_t establish_audio_connection; 5383deb3ec6SMatthias Ringwald uint8_t release_audio_connection; 5393deb3ec6SMatthias Ringwald 540ec820d77SMatthias Ringwald btstack_timer_source_t hfp_timeout; 541aa4dd815SMatthias Ringwald 542aa4dd815SMatthias Ringwald uint8_t microphone_gain; 543aa4dd815SMatthias Ringwald uint8_t send_microphone_gain; 544aa4dd815SMatthias Ringwald 545aa4dd815SMatthias Ringwald uint8_t speaker_gain; 546aa4dd815SMatthias Ringwald uint8_t send_speaker_gain; 547aa4dd815SMatthias Ringwald 548aa4dd815SMatthias Ringwald uint8_t send_phone_number_for_voice_tag; 549ce263fc8SMatthias Ringwald uint8_t send_ag_status_indicators; 550ad902e3dSMatthias Ringwald uint8_t send_ag_indicators_segment; 551a5bdcda8SMatthias Ringwald uint8_t send_response_and_hold_status; // 0 - don't send. BRTH:0 == 1, .. 552ce263fc8SMatthias Ringwald 553ce263fc8SMatthias Ringwald // AG only 554ce263fc8SMatthias Ringwald uint8_t change_in_band_ring_tone_setting; 555ce263fc8SMatthias Ringwald uint8_t ag_ring; 556ce263fc8SMatthias Ringwald uint8_t ag_send_clip; 557ce263fc8SMatthias Ringwald uint8_t ag_echo_and_noise_reduction; 558ce263fc8SMatthias Ringwald uint8_t ag_activate_voice_recognition; 559ce263fc8SMatthias Ringwald uint8_t send_subscriber_number; 560ce263fc8SMatthias Ringwald uint8_t next_subscriber_number_to_send; 561ce263fc8SMatthias Ringwald 562ce263fc8SMatthias Ringwald int send_status_of_current_calls; 563*9cae807eSMatthias Ringwald int next_call_index; 564ce263fc8SMatthias Ringwald 565ce263fc8SMatthias Ringwald // HF only 566ce263fc8SMatthias Ringwald hfp_hf_query_operator_state_t hf_query_operator_state; 567ce263fc8SMatthias Ringwald uint8_t hf_answer_incoming_call; 568ce263fc8SMatthias Ringwald uint8_t hf_initiate_outgoing_call; 569ce263fc8SMatthias Ringwald uint8_t hf_initiate_memory_dialing; 570ce263fc8SMatthias Ringwald uint8_t hf_initiate_redial_last_number; 571ce263fc8SMatthias Ringwald 572ce263fc8SMatthias Ringwald uint8_t hf_send_clip_enable; 573ce263fc8SMatthias Ringwald uint8_t hf_send_chup; 574ce263fc8SMatthias Ringwald uint8_t hf_send_chld_0; 575ce263fc8SMatthias Ringwald uint8_t hf_send_chld_1; 576ce263fc8SMatthias Ringwald uint8_t hf_send_chld_2; 577ce263fc8SMatthias Ringwald uint8_t hf_send_chld_3; 578ce263fc8SMatthias Ringwald uint8_t hf_send_chld_4; 579667ec068SMatthias Ringwald uint8_t hf_send_chld_x; 580667ec068SMatthias Ringwald uint8_t hf_send_chld_x_index; 581ce263fc8SMatthias Ringwald char hf_send_dtmf_code; 582ce263fc8SMatthias Ringwald uint8_t hf_send_binp; 583667ec068SMatthias Ringwald uint8_t hf_send_clcc; 584667ec068SMatthias Ringwald uint8_t hf_send_rrh; 585667ec068SMatthias Ringwald char hf_send_rrh_command; 586667ec068SMatthias Ringwald uint8_t hf_send_cnum; 587667ec068SMatthias Ringwald 588ce263fc8SMatthias Ringwald uint8_t hf_activate_call_waiting_notification; 589ce263fc8SMatthias Ringwald uint8_t hf_deactivate_call_waiting_notification; 590ce263fc8SMatthias Ringwald 591ce263fc8SMatthias Ringwald uint8_t hf_activate_calling_line_notification; 592ce263fc8SMatthias Ringwald uint8_t hf_deactivate_calling_line_notification; 593ce263fc8SMatthias Ringwald uint8_t hf_activate_echo_canceling_and_noise_reduction; 594ce263fc8SMatthias Ringwald uint8_t hf_deactivate_echo_canceling_and_noise_reduction; 595ce263fc8SMatthias Ringwald uint8_t hf_activate_voice_recognition_notification; 596ce263fc8SMatthias Ringwald uint8_t hf_deactivate_voice_recognition_notification; 597ce263fc8SMatthias Ringwald 598667ec068SMatthias Ringwald uint8_t clcc_idx; 599667ec068SMatthias Ringwald uint8_t clcc_dir; 600667ec068SMatthias Ringwald uint8_t clcc_status; 601667ec068SMatthias Ringwald uint8_t clcc_mode; 602667ec068SMatthias Ringwald uint8_t clcc_mpty; 603667ec068SMatthias Ringwald 604d0c20769SMatthias Ringwald uint8_t call_index; 605667ec068SMatthias Ringwald // also used for CLCC if set 606ce263fc8SMatthias Ringwald uint8_t bnip_type; // 0 == not set 607ce263fc8SMatthias Ringwald char bnip_number[25]; // 608ce263fc8SMatthias Ringwald 6093deb3ec6SMatthias Ringwald } hfp_connection_t; 6103deb3ec6SMatthias Ringwald 6113deb3ec6SMatthias Ringwald // UTILS_START : TODO move to utils 6123deb3ec6SMatthias Ringwald int send_str_over_rfcomm(uint16_t cid, char * command); 6133deb3ec6SMatthias Ringwald int join(char * buffer, int buffer_size, uint8_t * values, int values_nr); 6143deb3ec6SMatthias Ringwald int join_bitmap(char * buffer, int buffer_size, uint32_t values, int values_nr); 6153deb3ec6SMatthias Ringwald int get_bit(uint16_t bitmap, int position); 6163deb3ec6SMatthias Ringwald int store_bit(uint32_t bitmap, int position, uint8_t value); 6173deb3ec6SMatthias Ringwald // UTILS_END 6183deb3ec6SMatthias Ringwald 6199b1c3b4dSMatthias Ringwald void hfp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t service_uuid, int rfcomm_channel_nr, const char * name); 6203deb3ec6SMatthias Ringwald void hfp_handle_hci_event(hfp_callback_t callback, uint8_t packet_type, uint8_t *packet, uint16_t size); 6213deb3ec6SMatthias Ringwald void hfp_emit_event(hfp_callback_t callback, uint8_t event_subtype, uint8_t value); 622aa4dd815SMatthias Ringwald void hfp_emit_string_event(hfp_callback_t callback, uint8_t event_subtype, const char * value); 623aa4dd815SMatthias Ringwald 6243deb3ec6SMatthias Ringwald hfp_connection_t * get_hfp_connection_context_for_rfcomm_cid(uint16_t cid); 6253deb3ec6SMatthias Ringwald hfp_connection_t * get_hfp_connection_context_for_bd_addr(bd_addr_t bd_addr); 626aa4dd815SMatthias Ringwald hfp_connection_t * get_hfp_connection_context_for_sco_handle(uint16_t handle); 627aa4dd815SMatthias Ringwald 6283deb3ec6SMatthias Ringwald int get_hfp_generic_status_indicators_nr(void); 6293deb3ec6SMatthias Ringwald hfp_generic_status_indicator_t * get_hfp_generic_status_indicators(void); 6303deb3ec6SMatthias Ringwald void set_hfp_generic_status_indicators(hfp_generic_status_indicator_t * indicators, int indicator_nr); 6313deb3ec6SMatthias Ringwald 6328f2a52f4SMatthias Ringwald btstack_linked_list_t * hfp_get_connections(void); 633aa4dd815SMatthias Ringwald void hfp_parse(hfp_connection_t * context, uint8_t byte, int isHandsFree); 6343deb3ec6SMatthias Ringwald 6353deb3ec6SMatthias Ringwald void hfp_init(uint16_t rfcomm_channel_nr); 6363deb3ec6SMatthias Ringwald void hfp_establish_service_level_connection(bd_addr_t bd_addr, uint16_t service_uuid); 6373deb3ec6SMatthias Ringwald void hfp_release_service_level_connection(hfp_connection_t * connection); 6383deb3ec6SMatthias Ringwald void hfp_reset_context_flags(hfp_connection_t * context); 6393deb3ec6SMatthias Ringwald 6403deb3ec6SMatthias Ringwald void hfp_release_audio_connection(hfp_connection_t * context); 6413deb3ec6SMatthias Ringwald 642ce263fc8SMatthias Ringwald void hfp_setup_synchronous_connection(hci_con_handle_t handle, hfp_link_setttings_t link_settings); 643ce263fc8SMatthias Ringwald 6443deb3ec6SMatthias Ringwald const char * hfp_hf_feature(int index); 6453deb3ec6SMatthias Ringwald const char * hfp_ag_feature(int index); 6463deb3ec6SMatthias Ringwald 6473deb3ec6SMatthias Ringwald #if defined __cplusplus 6483deb3ec6SMatthias Ringwald } 6493deb3ec6SMatthias Ringwald #endif 6503deb3ec6SMatthias Ringwald 6513deb3ec6SMatthias Ringwald #endif