1 /* 2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HFP_AG_DEFINES_H 17 #define HFP_AG_DEFINES_H 18 19 #include <cstdint> 20 #include <string> 21 22 #include "log.h" 23 24 namespace OHOS { 25 namespace bluetooth { 26 #define HFP_AG_RETURN_IF_FAIL(ret) \ 27 do { \ 28 if (ret == BT_ALREADY) { \ 29 LOG_WARN("[HFP AG]%{public}s():ret[%{public}d]", __FUNCTION__, ret); \ 30 } \ 31 if ((ret != BT_SUCCESS) && (ret != BT_ALREADY)) { \ 32 LOG_ERROR("[HFP AG]%{public}s():ret[%{public}d]", __FUNCTION__, ret); \ 33 return ret; \ 34 } \ 35 } while (0) 36 37 constexpr int HFP_AG_COMMAND_MTU = 512; 38 39 // SDP attribute defines 40 static constexpr uint16_t HFP_AG_SDP_ATTRIBUTE_DATA_STORES_OR_NETWORK = 0x0301; 41 static constexpr uint16_t HFP_AG_SDP_ATTRIBUTE_SUPPORTED_FEATURES = 0x0311; 42 static constexpr uint16_t HSP_AG_SDP_ATTRIBUTE_REMOTE_AUDIO_VOLUME_CONTROL = 0x0302; 43 44 // AG service name string 45 static const std::string HFP_AG_SERVER_SERVICE_NAME = "Handsfree Audio Gateway"; 46 47 // AG service name string 48 static const std::string HSP_AG_SERVER_SERVICE_NAME = "Headset Audio Gateway"; 49 // HSP support name string 50 static const std::string HSP_AG_STATE_SECTION_NAME = "HfpAgService"; 51 static const std::string HSP_AG_STATE_PROPERY_NAME = "HspAgState"; 52 53 54 // Service class UUID 55 static constexpr uint16_t HFP_AG_UUID_SERVCLASS_HFP_HF = 0X111E; 56 static constexpr uint16_t HFP_AG_UUID_SERVCLASS_HFP_AG = 0X111F; 57 static constexpr uint16_t HFP_AG_UUID_SERVCLASS_GENERIC_AUDIO = 0X1203; 58 static constexpr uint16_t HSP_UUID_SERVCLASS = 0X1108; 59 static constexpr uint16_t HSP_HS_UUID_SERVCLASS = 0X1131; 60 static constexpr uint16_t HSP_AG_UUID_SERVCLASS = 0X1112; 61 62 // HFP version 63 static constexpr uint16_t HFP_AG_HFP_VERSION_1_1 = 0x0101; 64 static constexpr uint16_t HFP_AG_HFP_VERSION_1_5 = 0x0105; 65 static constexpr uint16_t HFP_AG_HFP_VERSION_1_6 = 0x0106; 66 static constexpr uint16_t HFP_AG_HFP_VERSION_1_7 = 0x0107; 67 static constexpr uint16_t HSP_AG_HSP_VERSION_1_2 = 0x0102; 68 69 // Feature mask for HFP 1.6 (and below) 70 static constexpr uint32_t HFP_AG_1_6_FEATURES_MASK = 0x000003FF; 71 72 // HF features masks: using 16 ~ 0 bits 73 static constexpr uint16_t HFP_AG_HF_FEATURES_NONE = 0x0000; 74 static constexpr uint16_t HFP_AG_HF_FEATURES_SUPPORT_WBS = 0x0020; 75 static constexpr uint16_t HFP_AG_HF_FEATURES_BRSF_MASK = 0x001F; 76 77 // AG feature masks 78 static constexpr uint32_t HFP_AG_FEATURES_THREE_WAY = 0x00000001; // Three-way calling 79 static constexpr uint32_t HFP_AG_FEATURES_ECNR = 0x00000002; // Echo cancellation/noise reduction 80 static constexpr uint32_t HFP_AG_FEATURES_VOICE_RECOGNITION = 0x00000004; // Voice recognition 81 static constexpr uint32_t HFP_AG_FEATURES_IN_BAND_RING = 0x00000008; // In-band ring tone 82 static constexpr uint32_t HFP_AG_FEATURES_VOICE_TAG = 0x00000010; // Attach a phone number to a voice tag 83 static constexpr uint32_t HFP_AG_FEATURES_REJECT_CALL = 0x00000020; // Ability to reject incoming call 84 static constexpr uint32_t HFP_AG_FEATURES_ENHANCED_CALL_STATUS = 0x00000040; // Enhanced Call Status 85 static constexpr uint32_t HFP_AG_FEATURES_ENHANCED_CALL_CONTROL = 0x00000080; // Enhanced Call Control 86 static constexpr uint32_t HFP_AG_FEATURES_EXTEND_ERROR_CODE = 0x00000100; // Extended error codes 87 static constexpr uint32_t HFP_AG_FEATURES_CODEC_NEGOTIATION = 0x00000200; // Codec Negotiation 88 static constexpr uint32_t HFP_AG_FEATURES_HF_INDICATORS = 0x00000400; // HF Indicators 89 static constexpr uint32_t HFP_AG_FEATURES_SUPPORT_ESCO = 0x00000800; // eSCO S4 (and T2) setting supported 90 91 // Hf feature masks 92 static constexpr uint32_t HFP_AG_HF_FEATURES_ECNR = 0x00000001; // Echo cancellation/noise reduction 93 static constexpr uint32_t HFP_AG_HF_FEATURES_THREE_WAY = 0x00000002; // Three-way calling 94 static constexpr uint32_t HFP_AG_HF_FEATURES_CALLING_ID = 0x00000004; // CLI presentation capability 95 static constexpr uint32_t HFP_AG_HF_FEATURES_VOICE_RECOGNITION = 0x00000008; // Voice recognition 96 static constexpr uint32_t HFP_AG_HF_FEATURES_REMOTE_VOLUME_CONTROL = 0x00000010; // Remote volume control 97 static constexpr uint32_t HFP_AG_HF_FEATURES_ENHANCED_CALL_STATUS = 0x00000020; // Enhanced Call Status 98 static constexpr uint32_t HFP_AG_HF_FEATURES_ENHANCED_CALL_CONTROL = 0x00000040; // Enhanced Call Control 99 static constexpr uint32_t HFP_AG_HF_FEATURES_CODEC_NEGOTIATION = 0x00000080; // Codec Negotiation 100 static constexpr uint32_t HFP_AG_HF_FEATURES_HF_INDICATORS = 0x00000100; // HF indicators 101 static constexpr uint32_t HFP_AG_HF_FEATURES_ESCO = 0x00000200; // eSCO S4 Settings Supported 102 103 // AG Proprietary features: using 31 ~ 16 bits 104 static constexpr uint32_t HFP_AG_FEATURES_SUPPORT_BTRH = 0x00010000; // CCAP incoming call hold 105 static constexpr uint32_t HFP_AG_FEATURES_PASS_UNKNOWN_AT = 0x00020000; // Pass unknown AT commands to app 106 static constexpr uint32_t HFP_AG_FEATURES_NO_SCO_CONTROL = 0x00040000; // No SCO control performed by AG 107 static constexpr uint32_t HFP_AG_FEATURES_NO_ESCO = 0x00080000; // Do not allow or use eSCO 108 static constexpr uint32_t HFP_AG_FEATURES_VOIP_CALL = 0x00100000; // VoIP call 109 110 // Default AG features 111 static constexpr uint32_t HFP_AG_FEATURES_DEFAULT = HFP_AG_FEATURES_THREE_WAY | 112 HFP_AG_FEATURES_ECNR | 113 HFP_AG_FEATURES_VOICE_RECOGNITION | 114 HFP_AG_FEATURES_IN_BAND_RING | 115 HFP_AG_FEATURES_REJECT_CALL | 116 HFP_AG_FEATURES_ENHANCED_CALL_STATUS | 117 HFP_AG_FEATURES_EXTEND_ERROR_CODE | 118 HFP_AG_FEATURES_CODEC_NEGOTIATION | 119 HFP_AG_FEATURES_HF_INDICATORS | 120 HFP_AG_FEATURES_PASS_UNKNOWN_AT; 121 122 // Specific SDP AG features 123 static constexpr uint32_t HFP_AG_FEATURES_SDP_SPEC = HFP_AG_FEATURES_THREE_WAY | 124 HFP_AG_FEATURES_ECNR | 125 HFP_AG_FEATURES_VOICE_RECOGNITION | 126 HFP_AG_FEATURES_IN_BAND_RING | 127 HFP_AG_FEATURES_VOICE_TAG; 128 129 typedef struct { 130 uint8_t remoteServerChannelNumber {0}; 131 uint16_t remoteVersion {0}; 132 uint16_t remoteFeatures {0}; 133 int remoteCodec {0}; 134 } HfpAgRemoteSdpInfo; 135 136 // Ag 137 enum HfpAgCodecsType { HFP_AG_CODEC_NONE = 0x00, HFP_AG_CODEC_CVSD = 0x01, HFP_AG_CODEC_MSBC = 0x02 }; 138 139 // Default AG Codec 140 constexpr int HFP_AG_CODEC_DEFAULT = HFP_AG_CODEC_MSBC | HFP_AG_CODEC_CVSD; 141 142 enum HfpAgEsco { HFP_AG_ESCO_S4, HFP_AG_ESCO_S1 }; 143 144 enum HfpAGMsbc { HFP_AG_MSBC_T2, HFP_AG_MSBC_T1 }; 145 146 enum HfpAgRoleType { HFP_AG_INITIATOR, HFP_AG_ACCEPTOR }; 147 148 enum HfpAgHfIndicatorType { HFP_AG_HF_INDICATOR_DRIVER_SAFETY = 1, HFP_AG_HF_INDICATOR_BATTERY_LEVEL = 2 }; 149 150 enum HfpAgCnumServiceType { HFP_AG_CNUM_SERVICE_VOICE = 4, HFP_AG_CNUM_SERVICE_FAX = 5 }; 151 152 enum HfpAgCallNumberType { HFP_AG_CALL_NUMBER_UNKNOW = 0x81, HFP_AG_CALL_NUMBER_INTERNATIONAL = 0x91 }; 153 154 enum HfpAgConnectState { 155 HFP_AG_STATE_DISCONNECTED = 0, 156 HFP_AG_STATE_CONNECTING, 157 HFP_AG_STATE_DISCONNECTING, 158 HFP_AG_STATE_CONNECTED 159 }; 160 161 enum HfpAgAudioState { 162 HFP_AG_AUDIO_STATE_DISCONNECTED = HFP_AG_STATE_CONNECTED, 163 HFP_AG_AUDIO_STATE_CONNECTING, 164 HFP_AG_AUDIO_STATE_DISCONNECTING, 165 HFP_AG_AUDIO_STATE_CONNECTED 166 }; 167 168 // Ag 169 enum HfpAgResultType { 170 HFP_AG_RESULT_OK = 0, 171 HFP_AG_RESULT_CONNECT = 1, 172 HFP_AG_RESULT_RING = 2, 173 HFP_AG_RESULT_NO_CARRIER = 3, 174 HFP_AG_RESULT_ERROR = 4, 175 HFP_AG_RESULT_NO_DIALTONE = 6, 176 HFP_AG_RESULT_BUSY = 7, 177 HFP_AG_RESULT_NO_ANSWER = 8, 178 HFP_AG_RESULT_DELAYED = 9, 179 HFP_AG_RESULT_BLOCKLISTED = 10, 180 HFP_AG_RESULT_CME_ERROR = 11 181 }; 182 183 // Ag 184 enum HfpAgExtError { 185 HFP_AG_ERROR_AG_FAILURE = 0, 186 HFP_AG_ERROR_NO_CONNECTION_TO_PHONE = 1, 187 HFP_AG_ERROR_OPERATION_NOT_ALLOWED = 3, 188 HFP_AG_ERROR_OPERATION_NOT_SUPPORTED = 4, 189 HFP_AG_ERROR_PH_SIM_PIN_REQUIRED = 5, 190 HFP_AG_ERROR_SIM_NOT_INSERTED = 10, 191 HFP_AG_ERROR_SIM_PIN_REQUIRED = 11, 192 HFP_AG_ERROR_SIM_PUK_REQUIRED = 12, 193 HFP_AG_ERROR_SIM_FAILURE = 13, 194 HFP_AG_ERROR_SIM_BUSY = 14, 195 HFP_AG_ERROR_INCORRECT_PASSWORD = 16, 196 HFP_AG_ERROR_SIM_PIN2_REQUIRED = 17, 197 HFP_AG_ERROR_SIM_PUK2_REQUIRED = 18, 198 HFP_AG_ERROR_MEMORY_FULL = 20, 199 HFP_AG_ERROR_INVALID_INDEX = 21, 200 HFP_AG_ERROR_MEMORY_FAILURE = 23, 201 HFP_AG_ERROR_TEXT_STRING_TOO_LONG = 24, 202 HFP_AG_ERROR_INVALID_CHARS_IN_TEXT_STRING = 25, 203 HFP_AG_ERROR_DIAL_STRING_TO_LONG = 26, 204 HFP_AG_ERROR_INVALID_CHARS_IN_DIAL_STRING = 27, 205 HFP_AG_ERROR_NO_NETWORK_SERVICE = 30, 206 HFP_AG_ERROR_NETWORK_TIMEOUT = 31, 207 HFP_AG_ERROR_NETWORK_NOT_ALLOWED = 32 208 }; 209 210 enum { 211 HFP_AG_OK_RES = 0, 212 HFP_AG_ERROR_RES, 213 HFP_AG_RING_RES, 214 HFP_AG_CLIP_RES, 215 HFP_AG_BRSF_RES, 216 HFP_AG_CMEE_RES, 217 HFP_AG_BCS_RES, 218 HFP_AG_SPK_RES, // Handfree Uint speaker volume 219 HFP_AG_MIC_RES, // Handfree Uint microphone gain 220 HFP_AG_INBAND_RING_RES, // Handsfree Uint in-band ring tone 221 HFP_AG_CIND_RES, // Indicator response for AT+CIND 222 HFP_AG_IND_RES, // Audio Gateway's indicator value 223 HFP_AG_BVRA_RES, // Voice recognition control 224 HFP_AG_CNUM_RES, // Subscriber number information 225 HFP_AG_CLCC_RES, // List of calls*/ 226 HFP_AG_COPS_RES, // Network operator name 227 HFP_AG_IN_CALL_RES, // Incoming call 228 HFP_AG_IN_CALL_HELD_RES, // Incoming call held 229 HFP_AG_IN_CALL_ANS_RES, // Incoming phone call answered 230 HFP_AG_OUT_CALL_DIAL_RES, // Outgoing phone call dialing 231 HFP_AG_OUT_CALL_ALERT_RES, // Outgoing phone call alerting 232 HFP_AG_OUT_CALL_CONN_RES, // Outgoing phone call answered 233 HFP_AG_CALL_WAIT_RES, // Call waiting notification 234 HFP_AG_CALL_CANCEL_RES, // Call canceled 235 HFP_AG_TERM_CALL_RES, // Terminate call 236 HFP_AG_UNKNOWN_AT_RES, // Unknown AT command 237 HFP_AG_MULTI_CALL_RES, // SLC in three way call 238 HFP_AG_BIND_RES // HandsFree Unit indicator 239 }; 240 241 // AG indicators 242 enum HfpAgIndicatorType { 243 HFP_AG_INDICATOR_SERVICE = 1, // service indicator 244 HFP_AG_INDICATOR_CALL, // call indicator 245 HFP_AG_INDICATOR_CALLSETUP, // callsetup indicator 246 HFP_AG_INDICATOR_CALLHELD, // callheld indicator 247 HFP_AG_INDICATOR_SIGNAL_STRENGTH, // signal strength indicator 248 HFP_AG_INDICATOR_ROAMING_STATE, // roaming indicator 249 HFP_AG_INDICATOR_BATTERY_LEVEL, // battery indicator 250 }; 251 252 // call indicator 253 enum HfpAgCallStatus { 254 HFP_AG_CALL_INACTIVE = 0, // call inactive 255 HFP_AG_CALL_ACTIVE // call active 256 }; 257 258 // response hold state 259 enum HfpAgResponseHoldStatus { 260 HFP_AG_RESPONSE_HOLD = 0, 261 HFP_AG_RESPONSE_HOLD_ACCEPT, 262 HFP_AG_RESPONSE_HOLD_REJECT, 263 }; 264 265 // hfp ag mock state 266 enum HfpAgMockState { 267 HFP_AG_MOCK_DEFAULT = 0, 268 HFP_AG_MOCK, 269 }; 270 // callsetup indicator 271 enum HfpCallSetupStatus { 272 HFP_AG_CALLSETUP_NONE = 0, // Not currently in call set up 273 HFP_AG_CALLSETUP_INCOMING, // Incoming call 274 HFP_AG_CALLSETUP_OUTGOING, // Outgoing call dialing 275 HFP_AG_CALLSETUP_ALERTING // Outgoing call alerting 276 }; 277 278 // callheld indicator 279 enum HfpCallheldStatus { 280 HFP_AG_CALLHELD_INACTIVE = 0, // No held calls 281 HFP_AG_CALLHELD_ACTIVE, // Call held and call active 282 HFP_AG_CALLHELD_NOACTIVE, // Call held and no call active 283 }; 284 285 // service indicator 286 enum HfpAgServiceStatus { 287 HFP_AG_SERVICE_NOT_AVAILABLE = 0, // Service not available 288 HFP_AG_SERVICE_AVAILABLE // Service available 289 }; 290 291 // roam indicator 292 enum HfpAgRoamingState { HFP_AG_ROMAING_STATE_HOME = 0, HFP_AG_ROMAING_STATE_ROAMING }; 293 294 enum HfpAgCallState { 295 HFP_AG_CALL_STATE_ACTIVE = 0, 296 HFP_AG_CALL_STATE_HELD, 297 HFP_AG_CALL_STATE_DIALING, 298 HFP_AG_CALL_STATE_ALERTING, 299 HFP_AG_CALL_STATE_INCOMING, 300 HFP_AG_CALL_STATE_WAITING, 301 HFP_AG_CALL_STATE_DISCONNECTED, 302 HFP_AG_CALL_STATE_DISCONNECTING, 303 HFP_AG_CALL_STATE_IDLE 304 }; 305 306 // Ag 307 enum HfpAgNumberType { HFP_AG_UNKNOWN_NUMBER = 0, HFP_AG_INTERNATIONAL_NUMBER }; 308 309 // Ag 310 enum HfpAgInbandRingAction { HFP_AG_INBAND_RING_DISABLE = 0, HFP_AG_INBAND_RING_ENABLE = 1 }; 311 312 // Ag 313 typedef struct { 314 uint8_t index {0}; 315 uint8_t dir {0}; 316 uint8_t state {0}; 317 uint8_t mode {0}; 318 uint8_t mpty {0}; 319 uint8_t type {0}; 320 std::string number {""}; 321 } HfpAgCallList; 322 323 typedef struct { 324 int activeNum {0}; 325 int heldNum {0}; 326 int callState {0}; 327 std::string number {""}; 328 int type {0}; 329 std::string name {""}; 330 } HfpAgPhoneState; 331 332 enum HfpAgNrecAction { HFP_AG_ECNR_ENABLE = 0, HFP_AG_ECNR_DISABLE }; 333 334 enum HfpAgCmeeAction { HFP_AG_CMEE_ENABLE = 0, HFP_AG_CMEE_DISABLE }; 335 336 enum HfpAgChldAction { HFP_AG_ACTION_CHLD_1 = 0, HFP_AG_ACTION_CHLD_2, HFP_AG_ACTION_CHLD_1X, HFP_AG_ACTION_CHLD_2X }; 337 338 enum HfpAgBtrhAction { 339 HFP_AG_ACTION_BTRH_0 = 0, // Incoming call is put on hold in the AG 340 HFP_AG_ACTION_BTRH_1 = 1, // Held incoming call is accepted in the AG 341 HFP_AG_ACTION_BTRH_2 = 2 // Held incoming call is rejected in the AG 342 }; 343 344 enum HfpAgCliAction { HFP_AG_CLI_ENABLE = 0, HFP_AG_CLI_DISABLE }; 345 346 enum HfpAgCcwaAction { HFP_AG_CCWA_ENABLE = 0, HFP_AG_CCWA_DISABLE }; 347 348 enum { 349 HFP_AG_NOTIFY_AG_OF_HF_SUPPORTED_INDICATORS = 0, 350 HFP_AG_QUERY_AG_SUPPORTED_INDICATORS, 351 HFP_AG_QUERY_AG_ENABLED_INDICATORS, 352 }; 353 354 enum { 355 HFP_AG_INVALID_EVT = 0, 356 357 // service start/stop 358 HFP_AG_SERVICE_STARTUP_EVT = 1, 359 HFP_AG_SERVICE_SHUTDOWN_EVT = 2, 360 361 // service connect events 362 HFP_AG_CONNECT_EVT = 10, 363 HFP_AG_DISCONNECT_EVT = 11, 364 HFP_AG_CONNECT_AUDIO_EVT = 20, 365 HFP_AG_DISCONNECT_AUDIO_EVT = 21, 366 HFP_AG_RETRY_CONNECT_AUDIO_EVT = 22, 367 HFP_AG_REMOVE_STATE_MACHINE_EVT = 30, 368 369 // service timeout events 370 HFP_AG_CONNECTION_TIMEOUT_EVT, 371 HFP_AG_DISCONNECT_TIMEOUT_EVT, 372 HFP_AG_CONNECT_AUDIO_TIMEOUT_EVT, 373 HFP_AG_DISCONNECT_AUDIO_TIMEOUT_EVT, 374 375 // service normal events 376 HFP_AG_OPEN_VOICE_RECOGNITION_EVT, 377 HFP_AG_CLOSE_VOICE_RECOGNITION_EVT, 378 HFP_AG_VOICE_RECOGNITION_RESULT_EVT, 379 HFP_AG_SET_MICROPHONE_GAIN_EVT, 380 HFP_AG_SET_VOLUME_EVT, 381 HFP_AG_SET_INBAND_RING_TONE_EVT, 382 HFP_AG_SEND_SUBSCRIBER_NUMBER_EVT, 383 HFP_AG_SEND_NETWORK_OPERATOR_EVT, 384 HFP_AG_CONTROL_OTHER_MODULES_EVT, 385 HFP_AG_DIALING_OUT_RESULT, 386 HFP_AG_CALL_STATE_CHANGE, 387 HFP_AG_CALL_STATE_CHANGE_MOCK, 388 HFP_AG_SEND_CCLC_RESPONSE, 389 HFP_AG_NOTIFY_SERVICE_STATE, 390 HFP_AG_NOTIFY_ROAM_STATE, 391 HFP_AG_NOTIFY_SIGNAL_STRENGTH, 392 HFP_AG_NOTIFY_BATTERY_LEVEL, 393 HFP_AG_RESPONSE_CLCC_TIME_OUT_EVT, 394 HFP_AG_VOICE_RECOGNITION_TIME_OUT_EVT, 395 HFP_AG_DIAL_TIME_OUT_EVT, 396 HFP_AG_NOTIFY_INDICATOR_EVT, 397 HFP_AG_SEND_INCOMING_EVT, 398 HFP_AG_SEND_CALL_SETUP_EVT, 399 HFP_AG_SEND_CALL_HELD_EVT, 400 HFP_AG_SEND_CALL_STATE_EVT, 401 HFP_AG_SEND_RESPONSE_HOLD_STATE, 402 403 // stack sdp events 404 HFP_AG_SDP_DISCOVERY_RESULT_SUCCESS = 98, 405 HFP_AG_SDP_DISCOVERY_RESULT_FAIL = 99, 406 407 // stack rfcomm events 408 HFP_AG_CONNECT_REQUEST_EVT = 100, 409 HFP_AG_CONNECTED_EVT = 110, 410 HFP_AG_DISCONNECTED_EVT = 111, 411 HFP_AG_CONNECT_FAILED_EVT = 112, 412 HFP_AG_DISCONNECT_FAILED_EVT = 113, 413 HFP_AG_DATA_AVAILABLE_EVT = 114, 414 415 // service level connection established event 416 HFP_AG_CODEC_NEGOTIATION_FAILED = 197, 417 HFP_AG_SETUP_CODEC_CVSD = 198, 418 HFP_AG_SLC_ESTABLISHED_EVT = 199, 419 HFP_AG_CODEC_NEGOTIATED_EVT = 200, 420 421 // stack audio events 422 HFP_AG_AUDIO_CONNECT_REQUEST_EVT = 201, 423 HFP_AG_AUDIO_CONNECTING_EVT = 202, 424 HFP_AG_AUDIO_DISCONNECTING_EVT = 203, 425 HFP_AG_AUDIO_CONNECTED_EVT = 220, 426 HFP_AG_AUDIO_DISCONNECTED_EVT = 221, 427 HFP_AG_AUDIO_CONNECT_FAILED_EVT, 428 HFP_AG_AUDIO_DISCONNECT_FAILED_EVT, 429 430 HFP_AG_RING_TIMEOUT_EVT, 431 HFP_AG_PROCESS_CKPD_EVT, 432 HFP_AG_RESPONE_OK_EVT, 433 HFP_AG_GET_VOICE_NUMBER, 434 HFP_AG_SEND_BINP_EVT, 435 HFP_AG_GET_BTRH_EVT, 436 HFP_AG_SET_BTRH_EVT, 437 HFP_AG_SEND_BTRH_EVT, 438 HFP_AG_SEND_NO_CARRIER, 439 HFP_AG_START_MOCK, 440 441 HFP_AG_MOCK_RING, 442 HFP_AG_MOCK_CLIP, 443 }; 444 445 constexpr int HFP_AG_HF_FOUND = 1; 446 constexpr int HFP_AG_HS_FOUND = 2; 447 constexpr int HFP_AG_HF_HS_FOUND = 3; 448 449 constexpr int HSP_AG_STATE_BOTH = 0X01; 450 constexpr int HSP_AG_STATE_HSP = 0X02; 451 constexpr int HSP_AG_STATE_NONE = 0X03; 452 453 // This is the message type that Hfp controls other modules. 454 enum { 455 HFP_AG_MSG_TYPE_TYPE_NONE, 456 HFP_AG_MSG_TYPE_ANSWER_CALL, 457 HFP_AG_MSG_TYPE_HANGUP_CALL, 458 HFP_AG_MSG_TYPE_VOLUME_CHANGED, 459 HFP_AG_MSG_TYPE_DIAL_CALL, 460 HFP_AG_MSG_TYPE_SEND_DTMF, 461 HFP_AG_MSG_TYPE_NOISE_REDUCTION, 462 HFP_AG_MSG_TYPE_AT_WBS, 463 HFP_AG_MSG_TYPE_AT_CHLD, 464 HFP_AG_MSG_TYPE_SUBSCRIBER_NUMBER_REQUEST, 465 HFP_AG_MSG_TYPE_AT_CIND, 466 HFP_AG_MSG_TYPE_AT_COPS, 467 HFP_AG_MSG_TYPE_AT_CLCC, 468 HFP_AG_MSG_TYPE_AT_UNKNOWN, 469 HFP_AG_MSG_TYPE_KEY_PRESSED, 470 HFP_AG_MSG_TYPE_AT_BIND, 471 HFP_AG_MSG_TYPE_AT_BIEV, 472 HFP_AG_MSG_TYPE_AT_BIA, 473 HFP_AG_MSG_TYPE_QUERY_AG_INDICATOR, 474 HFP_AG_MSG_TYPE_VR_CHANGED, 475 }; 476 477 enum HfpAgVolumeType { HFP_AG_VOLUME_TYPE_SPK, HFP_AG_VOLUME_TYPE_MIC }; 478 479 enum { HFP_AG_WBS_NONE, HFP_AG_WBS_NO, HFP_AG_WBS_YES }; 480 481 enum { HFP_AG_SUCCESS = 0, HFP_AG_FAILURE }; 482 483 enum { HFP_AG_HF_INDICATOR_ENHANCED_DRIVER_SAFETY_ID = 1, HFP_AG_HF_INDICATOR_BATTERY_LEVEL_ID = 2 }; 484 485 enum { HFP_AG_HF_VR_ClOSED, HFP_AG_HF_VR_OPENED }; 486 487 enum { HFP_AG_NUMBER_DIAL, HFP_AG_MEMORY_DIAL, HFP_AG_LAST_NUMBER_REDIAL }; 488 489 enum BTCallDirection { 490 BT_CALL_DIRECTION_OUT = 0, 491 BT_CALL_DIRECTION_IN, 492 BT_CALL_DIRECTION_UNKNOW 493 }; 494 495 struct MockCall { 496 std::string number = ""; 497 int callstate = 0; 498 int type = 0; 499 }; 500 501 struct BluetoothCall { 502 std::string number = ""; 503 int callstate = 0; 504 int precallstate = 0; 505 int type = 0; 506 int callid = 0; 507 }; 508 509 constexpr int CALL_TYPE_DEFAULT = 129; 510 constexpr int CALL_TYPE_VOIP = 225; 511 512 constexpr int ATCHLD_RELEASE_ALL_HELD_CALLS = 0; 513 constexpr int ATCHLD_RELEASE_ACTIVE_ACCPET_OTHER = 1; 514 constexpr int ATCHLD_RELEASE_HOLD_ACCPET_OTHER = 2; 515 constexpr int ATCHLD_ADD_CALL_TO_CONVERSATION = 3; 516 constexpr int ATCHLD_CONNECT_TWO_CALL = 4; 517 constexpr int ATCHLD_RELEASE_INDEX_ONE = 11; 518 constexpr int ATCHLD_RELEASE_INDEX_TWO = 12; 519 constexpr int ATCHLD_CONSULTATION_INDEX_ONE = 21; 520 constexpr int ATCHLD_CONSULTATION_INDEX_TWO = 22; 521 522 constexpr int HFP_AG_CALL_NUM_TWO = 2; 523 } // namespace bluetooth 524 } // namespace OHOS 525 #endif // HFP_AG_DEFINES_H 526