1 /** @file 2 * @brief Internal APIs for Bluetooth Handsfree profile handling. 3 */ 4 5 /* 6 * Copyright (c) 2015-2016 Intel Corporation 7 * 8 * SPDX-License-Identifier: Apache-2.0 9 */ 10 11 #define BT_HFP_MAX_MTU 140 12 #define BT_HF_CLIENT_MAX_PDU BT_HFP_MAX_MTU 13 14 /* HFP AG Features */ 15 #define BT_HFP_AG_FEATURE_3WAY_CALL 0x00000001 /* Three-way calling */ 16 #define BT_HFP_AG_FEATURE_ECNR 0x00000002 /* EC and/or NR function */ 17 #define BT_HFP_AG_FEATURE_VOICE_RECG 0x00000004 /* Voice recognition */ 18 #define BT_HFP_AG_FEATURE_INBAND_RINGTONE 0x00000008 /* In-band ring capability */ 19 #define BT_HFP_AG_FEATURE_VOICE_TAG 0x00000010 /* Attach no. to voice tag */ 20 #define BT_HFP_AG_FEATURE_REJECT_CALL 0x00000020 /* Ability to reject call */ 21 #define BT_HFP_AG_FEATURE_ECS 0x00000040 /* Enhanced call status */ 22 #define BT_HFP_AG_FEATURE_ECC 0x00000080 /* Enhanced call control */ 23 #define BT_HFP_AG_FEATURE_EXT_ERR 0x00000100 /* Extended error codes */ 24 #define BT_HFP_AG_FEATURE_CODEC_NEG 0x00000200 /* Codec negotiation */ 25 #define BT_HFP_AG_FEATURE_HF_IND 0x00000400 /* HF Indicators */ 26 #define BT_HFP_AG_FEATURE_ESCO_S4 0x00000800 /* eSCO S4 Settings */ 27 #define BT_HFP_AG_FEATURE_ENH_VOICE_RECG 0x00001000 /* Enhanced Voice Recognition Status */ 28 #define BT_HFP_AG_FEATURE_VOICE_RECG_TEXT 0x00002000 /* Voice Recognition Text */ 29 30 /* HFP HF Features */ 31 #define BT_HFP_HF_FEATURE_ECNR 0x00000001 /* EC and/or NR function */ 32 #define BT_HFP_HF_FEATURE_3WAY_CALL 0x00000002 /* Three-way calling */ 33 #define BT_HFP_HF_FEATURE_CLI 0x00000004 /* CLI presentation */ 34 #define BT_HFP_HF_FEATURE_VOICE_RECG 0x00000008 /* Voice recognition */ 35 #define BT_HFP_HF_FEATURE_VOLUME 0x00000010 /* Remote volume control */ 36 #define BT_HFP_HF_FEATURE_ECS 0x00000020 /* Enhanced call status */ 37 #define BT_HFP_HF_FEATURE_ECC 0x00000040 /* Enhanced call control */ 38 #define BT_HFP_HF_FEATURE_CODEC_NEG 0x00000080 /* CODEC Negotiation */ 39 #define BT_HFP_HF_FEATURE_HF_IND 0x00000100 /* HF Indicators */ 40 #define BT_HFP_HF_FEATURE_ESCO_S4 0x00000200 /* eSCO S4 Settings */ 41 #define BT_HFP_HF_FEATURE_ENH_VOICE_RECG 0x00000400 /* Enhanced Voice Recognition Status */ 42 #define BT_HFP_HF_FEATURE_VOICE_RECG_TEXT 0x00000800 /* Voice Recognition Text */ 43 44 /* HFP HF Features in SDP */ 45 #define BT_HFP_HF_SDP_FEATURE_ECNR BIT(0) /* EC and/or NR function */ 46 #define BT_HFP_HF_SDP_FEATURE_3WAY_CALL BIT(1) /* Three-way calling */ 47 #define BT_HFP_HF_SDP_FEATURE_CLI BIT(2) /* CLI presentation */ 48 #define BT_HFP_HF_SDP_FEATURE_VOICE_RECG BIT(3) /* Voice recognition */ 49 #define BT_HFP_HF_SDP_FEATURE_VOLUME BIT(4) /* Remote volume control */ 50 #define BT_HFP_HF_SDP_FEATURE_WBS BIT(5) /* Wide Band Speech */ 51 #define BT_HFP_HF_SDP_FEATURE_ENH_VOICE_RECG BIT(6) /* Enhanced Voice Recognition Status */ 52 #define BT_HFP_HF_SDP_FEATURE_VOICE_RECG_TEXT BIT(7) /* Voice Recognition Text */ 53 #define BT_HFP_HF_SDP_FEATURE_SUPER_WBS BIT(7) /* Super Wide Band Speech */ 54 55 /* HFP AG Features in SDP */ 56 #define BT_HFP_AG_SDP_FEATURE_3WAY_CALL BIT(0) /* Three-way calling */ 57 #define BT_HFP_AG_SDP_FEATURE_ECNR BIT(1) /* EC and/or NR function */ 58 #define BT_HFP_AG_SDP_FEATURE_VOICE_RECG BIT(2) /* Voice recognition */ 59 #define BT_HFP_AG_SDP_FEATURE_INBAND_RINGTONE BIT(3) /* In-band ring tone capability */ 60 #define BT_HFP_AG_SDP_FEATURE_VOICE_TAG BIT(4) /* Attach no. to voice tag */ 61 #define BT_HFP_AG_SDP_FEATURE_WBS BIT(5) /* Wide Band Speech */ 62 #define BT_HFP_AG_SDP_FEATURE_ENH_VOICE_RECG BIT(6) /* Enhanced Voice Recognition Status */ 63 #define BT_HFP_AG_SDP_FEATURE_VOICE_RECG_TEXT BIT(7) /* Voice Recognition Text */ 64 #define BT_HFP_AG_SDP_FEATURE_SUPER_WBS BIT(8) /* Super Wide Band Speech */ 65 #define HF_MAX_BUF_LEN BT_HF_CLIENT_MAX_PDU 66 #define HF_MAX_AG_INDICATORS 20 67 68 #define BT_HFP_HF_VGM_GAIN_MAX 15 69 #define BT_HFP_HF_VGM_GAIN_MIN 0 70 71 #define BT_HFP_HF_VGS_GAIN_MAX 15 72 #define BT_HFP_HF_VGS_GAIN_MIN 0 73 74 /* HFP call setup status */ 75 #define BT_HFP_CALL_SETUP_NONE 0 76 #define BT_HFP_CALL_SETUP_INCOMING 1 77 #define BT_HFP_CALL_SETUP_OUTGOING 2 78 #define BT_HFP_CALL_SETUP_REMOTE_ALERTING 3 79 80 /* HFP incoming call status */ 81 #define BT_HFP_BTRH_ON_HOLD 0 82 #define BT_HFP_BTRH_ACCEPTED 1 83 #define BT_HFP_BTRH_REJECTED 2 84 85 /* HFP Call held status */ 86 /* No calls held */ 87 #define BT_HFP_CALL_HELD_NONE 0 88 /* Call is placed on hold or active/held calls swapped 89 * The AG has both an active AND a held call 90 */ 91 #define BT_HFP_CALL_HELD_ACTIVE_HELD 1 92 /* Call on hold, no active call */ 93 #define BT_HFP_CALL_HELD_HELD 2 94 95 /* HFP AT+CHLD command value */ 96 /* Releases all held calls or sets User Determined User Busy 97 * (UDUB) for a waiting call 98 */ 99 #define BT_HFP_CHLD_RELEASE_ALL 0 100 /* Releases all active calls (if any exist) and accepts the 101 * other (held or waiting) call. 102 */ 103 #define BT_HFP_CHLD_RELEASE_ACTIVE_ACCEPT_OTHER 1 104 /* Places all active calls (if any exist) on hold and accepts 105 * the other (held or waiting) call 106 */ 107 #define BT_HFP_CALL_HOLD_ACTIVE_ACCEPT_OTHER 2 108 /* Adds a held call to the conversation */ 109 #define BT_HFP_CALL_ACTIVE_HELD 3 110 /* Connects the two calls and disconnects the subscriber from 111 * both calls (Explicit Call Transfer). 112 * Support for this value and its associated functionality is 113 * optional for the HF. 114 */ 115 #define BT_HFP_CALL_QUITE 4 116 /* Release a specific active call */ 117 #define BT_HFP_CALL_RELEASE_SPECIFIED_ACTIVE 10 118 /* Private Consultation Mode 119 * place all parties of a multiparty call on hold with the 120 * exception of the specified call. 121 */ 122 #define BT_HFP_CALL_PRIVATE_CNLTN_MODE 20 123 124 /* Active */ 125 #define BT_HFP_CLCC_STATUS_ACTIVE 0 126 /* Held */ 127 #define BT_HFP_CLCC_STATUS_HELD 1 128 /* Dialing (outgoing calls only) */ 129 #define BT_HFP_CLCC_STATUS_DIALING 2 130 /* Alerting (outgoing calls only) */ 131 #define BT_HFP_CLCC_STATUS_ALERTING 3 132 /* Incoming (incoming calls only) */ 133 #define BT_HFP_CLCC_STATUS_INCOMING 4 134 /* Waiting (incoming calls only) */ 135 #define BT_HFP_CLCC_STATUS_WAITING 5 136 /* Call held by Response and Hold */ 137 #define BT_HFP_CLCC_STATUS_CALL_HELD_HOLD 6 138 139 /* CLCC direction */ 140 /* CLCC direction: incoming */ 141 #define BT_HFP_CLCC_DIR_INCOMING 1 142 /* CLCC direction: outgoing */ 143 #define BT_HFP_CLCC_DIR_OUTGOING 0 144 145 /* BVRA Value */ 146 /* BVRA Deactivation */ 147 #define BT_HFP_BVRA_DEACTIVATION 0 148 /* BVRA Activation */ 149 #define BT_HFP_BVRA_ACTIVATION 1 150 /* Ready to accept audio */ 151 #define BT_HFP_BVRA_READY_TO_ACCEPT 2 152 153 /* a maximum of 4 characters in length, but 154 * less than 4 characters in length is valid. 155 */ 156 #define BT_HFP_BVRA_TEXT_ID_MAX_LEN 4 157 158 /* BVRA VRE state */ 159 /* BVRA VRE state: the AG is ready to accept audio input */ 160 #define BT_HFP_BVRA_STATE_ACCEPT_INPUT BIT(0) 161 /* BVRA VRE state: the AG is sending audio to the HF */ 162 #define BT_HFP_BVRA_STATE_SEND_AUDIO BIT(1) 163 /* BVRA VRE state: the AG is processing the audio input */ 164 #define BT_HFP_BVRA_STATE_PROCESS_AUDIO BIT(2) 165 166 #define IS_VALID_DTMF(c) ((((c) >= '0') && ((c) <= '9')) || \ 167 (((c) >= 'A') && ((c) <= 'D')) || ((c) == '#') || ((c) == '*')) 168 169 /* HFP HF Indicators */ 170 enum { 171 HFP_HF_ENHANCED_SAFETY_IND = 1, /* Enhanced Safety */ 172 HFP_HF_BATTERY_LEVEL_IND = 2, /* Remaining level of Battery */ 173 HFP_HF_IND_MAX 174 }; 175 176 #define IS_VALID_BATTERY_LEVEL(level) (((level) >= 0) && ((level) <= 100)) 177