1 /* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 /** 39 * @title HFP Hands-Free (HF) 40 * 41 */ 42 43 #ifndef BTSTACK_HFP_HF_H 44 #define BTSTACK_HFP_HF_H 45 46 #include "hci.h" 47 #include "classic/sdp_client_rfcomm.h" 48 #include "classic/hfp.h" 49 50 #if defined __cplusplus 51 extern "C" { 52 #endif 53 54 /* API_START */ 55 56 /** 57 * @brief Create HFP Hands-Free (HF) SDP service record. 58 * @param service 59 * @param rfcomm_channel_nr 60 * @param name 61 * @param suported_features 32-bit bitmap, see HFP_HFSF_* values in hfp.h 62 * @param wide_band_speech supported 63 */ 64 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, int wide_band_speech); 65 66 /** 67 * @brief Set up HFP Hands-Free (HF) device without additional supported features. 68 * @param rfcomm_channel_nr 69 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 70 * - L2CAP_SERVICE_ALREADY_REGISTERED, 71 * - RFCOMM_SERVICE_ALREADY_REGISTERED or 72 * - BTSTACK_MEMORY_ALLOC_FAILED if allocation of any of RFCOMM or L2CAP services failed 73 */ 74 uint8_t hfp_hf_init(uint16_t rfcomm_channel_nr); 75 76 /** 77 * @brief Set codecs. 78 * @param codecs_nr 79 * @param codecs 80 */ 81 void hfp_hf_init_codecs(int codecs_nr, const uint8_t * codecs); 82 83 /** 84 * @brief Set supported features. 85 * @param supported_features 32-bit bitmap, see HFP_HFSF_* values in hfp.h 86 */ 87 void hfp_hf_init_supported_features(uint32_t supported_features); 88 89 /** 90 * @brief Set HF indicators. 91 * @param indicators_nr 92 * @param indicators 93 */ 94 void hfp_hf_init_hf_indicators(int indicators_nr, const uint16_t * indicators); 95 96 97 /** 98 * @brief Register callback for the HFP Hands-Free (HF) client. 99 * @param callback 100 */ 101 void hfp_hf_register_packet_handler(btstack_packet_handler_t callback); 102 103 /** 104 * @brief Establish RFCOMM connection with the AG with given Bluetooth address, 105 * and perform service level connection (SLC) agreement: 106 * - exchange supported features 107 * - retrieve Audio Gateway (AG) indicators and their status 108 * - enable indicator status update in the AG 109 * - notify the AG about its own available codecs, if possible 110 * - retrieve the AG information describing the call hold and multiparty services, if possible 111 * - retrieve which HF indicators are enabled on the AG, if possible 112 * The status of SLC connection establishment is reported via 113 * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED. 114 * 115 * @param bd_addr Bluetooth address of the AG 116 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 117 * - ERROR_CODE_COMMAND_DISALLOWED if connection already exists, or 118 * - BTSTACK_MEMORY_ALLOC_FAILED 119 */ 120 uint8_t hfp_hf_establish_service_level_connection(bd_addr_t bd_addr); 121 122 /** 123 * @brief Release the RFCOMM channel and the audio connection between the HF and the AG. 124 * The status of releasing the SLC connection is reported via 125 * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED. 126 * 127 * @param acl_handle 128 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 129 */ 130 uint8_t hfp_hf_release_service_level_connection(hci_con_handle_t acl_handle); 131 132 /** 133 * @brief Enable status update for all indicators in the AG. 134 * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted. 135 * The status of an AG indicator is reported via HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED. 136 * 137 * @param acl_handle 138 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 139 */ 140 uint8_t hfp_hf_enable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle); 141 142 /** 143 * @brief Disable status update for all indicators in the AG. 144 * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted. 145 * 146 * @param acl_handle 147 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 148 */ 149 uint8_t hfp_hf_disable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle); 150 151 /** 152 * @brief Enable or disable status update for the individual indicators in the AG using bitmap. 153 * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted. 154 * The status of an AG indicator is reported via HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED. 155 * 156 * @param acl_handle 157 * @param indicators_status_bitmap 32-bit bitmap, 0 - indicator is disabled, 1 - indicator is enabled 158 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 159 */ 160 uint8_t hfp_hf_set_status_update_for_individual_ag_indicators(hci_con_handle_t acl_handle, uint32_t indicators_status_bitmap); 161 162 /** 163 * @brief Query the name of the currently selected Network operator by AG. 164 * 165 * The name is restricted to max 16 characters. The result is reported via 166 * HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED subtype 167 * containing network operator mode, format and name. 168 * If no operator is selected, format and operator are omitted. 169 * 170 * @param acl_handle 171 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 172 * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 173 * - ERROR_CODE_COMMAND_DISALLOWED if connection in wrong state 174 */ 175 uint8_t hfp_hf_query_operator_selection(hci_con_handle_t acl_handle); 176 177 /** 178 * @brief Enable Extended Audio Gateway Error result codes in the AG. 179 * Whenever there is an error relating to the functionality of the AG as a 180 * result of AT command, the AG shall send +CME ERROR. This error is reported via 181 * HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR, see hfp_cme_error_t in hfp.h 182 * 183 * @param acl_handle 184 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 185 */ 186 uint8_t hfp_hf_enable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle); 187 188 /** 189 * @brief Disable Extended Audio Gateway Error result codes in the AG. 190 * 191 * @param acl_handle 192 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 193 */ 194 uint8_t hfp_hf_disable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle); 195 196 /** 197 * @brief Establish audio connection. 198 * The status of audio connection establishment is reported via HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED. 199 * 200 * @param acl_handle 201 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 202 * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 203 * - ERROR_CODE_COMMAND_DISALLOWED if connection in wrong state 204 */ 205 uint8_t hfp_hf_establish_audio_connection(hci_con_handle_t acl_handle); 206 207 /** 208 * @brief Release audio connection. 209 * The status of releasing of the audio connection is reported via 210 * HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED. 211 * 212 * @param acl_handle 213 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 214 */ 215 uint8_t hfp_hf_release_audio_connection(hci_con_handle_t acl_handle); 216 217 /** 218 * @brief Answer incoming call. 219 * 220 * @param acl_handle 221 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 222 * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 223 * - ERROR_CODE_COMMAND_DISALLOWED if answering incoming call with wrong callsetup status 224 */ 225 uint8_t hfp_hf_answer_incoming_call(hci_con_handle_t acl_handle); 226 227 /** 228 * @brief Reject incoming call. 229 * 230 * @param acl_handle 231 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 232 */ 233 uint8_t hfp_hf_reject_incoming_call(hci_con_handle_t acl_handle); 234 235 /** 236 * @brief Release all held calls or sets User Determined User Busy (UDUB) for a waiting call. 237 * 238 * @param acl_handle 239 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 240 */ 241 uint8_t hfp_hf_user_busy(hci_con_handle_t acl_handle); 242 243 /** 244 * @brief Release all active calls (if any exist) and accepts the other (held or waiting) call. 245 * 246 * @param acl_handle 247 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 248 */ 249 uint8_t hfp_hf_end_active_and_accept_other(hci_con_handle_t acl_handle); 250 251 /** 252 * @brief Place all active calls (if any exist) on hold and accepts the other (held or waiting) call. 253 * 254 * @param acl_handle 255 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 256 */ 257 uint8_t hfp_hf_swap_calls(hci_con_handle_t acl_handle); 258 259 /** 260 * @brief Add a held call to the conversation. 261 * 262 * @param acl_handle 263 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 264 */ 265 uint8_t hfp_hf_join_held_call(hci_con_handle_t acl_handle); 266 267 /** 268 * @brief Connect the two calls and disconnects the subscriber from both calls (Explicit Call Transfer). 269 * 270 * @param acl_handle 271 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 272 */ 273 uint8_t hfp_hf_connect_calls(hci_con_handle_t acl_handle); 274 275 /** 276 * @brief Terminate an incoming or an outgoing call. HFP_SUBEVENT_CALL_TERMINATED is sent upon call termination. 277 * 278 * @param acl_handle 279 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 280 */ 281 uint8_t hfp_hf_terminate_call(hci_con_handle_t acl_handle); 282 283 /** 284 * @brief Initiate outgoing voice call by providing the destination phone number to the AG. 285 * 286 * @param acl_handle 287 * @param number 288 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 289 */ 290 uint8_t hfp_hf_dial_number(hci_con_handle_t acl_handle, char * number); 291 292 /** 293 * @brief Initiate outgoing voice call using the memory dialing feature of the AG. 294 * 295 * @param acl_handle 296 * @param memory_id 297 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 298 */ 299 uint8_t hfp_hf_dial_memory(hci_con_handle_t acl_handle, int memory_id); 300 301 /** 302 * @brief Initiate outgoing voice call by recalling the last number dialed by the AG. 303 * 304 * @param acl_handle 305 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 306 */ 307 uint8_t hfp_hf_redial_last_number(hci_con_handle_t acl_handle); 308 309 /* 310 * @brief Enable the “Call Waiting notification” function in the AG. 311 * The AG shall send the corresponding result code to the HF whenever 312 * an incoming call is waiting during an ongoing call. In that event, 313 * the HFP_SUBEVENT_CALL_WAITING_NOTIFICATION is emitted. 314 * 315 * @param acl_handle 316 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 317 */ 318 uint8_t hfp_hf_activate_call_waiting_notification(hci_con_handle_t acl_handle); 319 320 /* 321 * @brief Disable the “Call Waiting notification” function in the AG. 322 * 323 * @param acl_handle 324 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 325 */ 326 uint8_t hfp_hf_deactivate_call_waiting_notification(hci_con_handle_t acl_handle); 327 328 /* 329 * @brief Enable the “Calling Line Identification notification” function in the AG. 330 * The AG shall issue the corresponding result code just after every RING indication, 331 * when the HF is alerted in an incoming call. In that event, 332 * the HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION is emitted. 333 * @param acl_handle 334 */ 335 uint8_t hfp_hf_activate_calling_line_notification(hci_con_handle_t acl_handle); 336 337 /* 338 * @brief Disable the “Calling Line Identification notification” function in the AG. 339 * 340 * @param acl_handle 341 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 342 */ 343 uint8_t hfp_hf_deactivate_calling_line_notification(hci_con_handle_t acl_handle); 344 345 346 /* 347 * @brief Deactivate echo canceling (EC) and noise reduction (NR) in the AG and emit 348 * HFP_SUBEVENT_ECHO_CANCELING_NOISE_REDUCTION_DEACTIVATE with status ERROR_CODE_SUCCESS if AG supports EC and AG. 349 * If the AG supports its own embedded echo canceling and/or noise reduction function, 350 * it shall have EC and NR activated until this function is called. 351 * 352 * @param acl_handle 353 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 354 * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 355 * - ERROR_CODE_COMMAND_DISALLOWED if HFP_(HF/AG)SF_EC_NR_FUNCTION feature is not supported by AG and HF 356 */ 357 uint8_t hfp_hf_deactivate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle); 358 359 /** 360 * @brief Activate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 361 * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is set to the current voice 362 * recognition state: 1 for activated, 0 otherwise. Prerequisite is established SLC. 363 * 364 * @param acl_handle 365 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 366 * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 367 * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated 368 */ 369 uint8_t hfp_hf_activate_voice_recognition(hci_con_handle_t acl_handle); 370 371 /** 372 * @brief Dectivate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 373 * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is set to the current voice 374 * recognition state: 1 for activated, 0 otherwise. Prerequisite is established SLC. 375 * 376 * @param acl_handle 377 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 378 * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 379 * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated 380 */ 381 uint8_t hfp_hf_deactivate_voice_recognition(hci_con_handle_t acl_handle); 382 383 /** 384 * @brief Activate enhanced voice recognition (EVR) and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 385 * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is to the current state of EVR: 1 if activated, otherwise 0. 386 * Prerequisite is established SLC. 387 * 388 * @param acl_handle 389 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 390 * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG, or wrong VRA status 391 */ 392 uint8_t hfp_hf_activate_enhanced_voice_recognition(hci_con_handle_t acl_handle); 393 394 395 /** 396 * @brief Indicate that the HF is ready to accept audio. Prerequisite is established voice recognition session. 397 * The HF may call this function during an ongoing AVR (Audio Voice Recognition) session to terminate audio output from 398 * the AG (if there is any) and prepare the AG for new audio input. 399 * 400 * @param acl_handle 401 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 402 * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG, or wrong VRA status 403 */ 404 uint8_t hfp_hf_enhanced_voice_recognition_report_ready_for_audio(hci_con_handle_t acl_handle); 405 406 /** 407 * @brief Deactivate enhanced voice recognition (EVR) and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS 408 * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is to the current state of EVR: 1 if activated, otherwise 0. 409 * Prerequisite is established SLC. 410 * 411 * @param acl_handle 412 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 413 * - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_ENHANCED_VOICE_RECOGNITION_STATUS is not supported by HF and AG, or wrong VRA status 414 */ 415 uint8_t hfp_hf_deactivate_enhanced_voice_recognition(hci_con_handle_t acl_handle); 416 417 /* 418 * @brief Set microphone gain. 419 * 420 * @param acl_handle 421 * @param gain Valid range: [0,15] 422 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 423 * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 424 * - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range 425 */ 426 uint8_t hfp_hf_set_microphone_gain(hci_con_handle_t acl_handle, int gain); 427 428 /* 429 * @brief Set speaker gain. 430 * 431 * @param acl_handle 432 * @param gain Valid range: [0,15] 433 * @return status ERROR_CODE_SUCCESS if successful, otherwise: 434 * - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or 435 * - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range 436 */ 437 uint8_t hfp_hf_set_speaker_gain(hci_con_handle_t acl_handle, int gain); 438 439 /* 440 * @brief Instruct the AG to transmit a DTMF code. 441 * 442 * @param acl_handle 443 * @param dtmf_code 444 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 445 */ 446 uint8_t hfp_hf_send_dtmf_code(hci_con_handle_t acl_handle, char code); 447 448 /* 449 * @brief Read numbers from the AG for the purpose of creating 450 * a unique voice tag and storing the number and its linked voice 451 * tag in the HF’s memory. 452 * The number is reported via HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG. 453 * 454 * @param acl_handle 455 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 456 */ 457 uint8_t hfp_hf_request_phone_number_for_voice_tag(hci_con_handle_t acl_handle); 458 459 /* 460 * @brief Query the list of current calls in AG. 461 * The result is received via HFP_SUBEVENT_ENHANCED_CALL_STATUS. 462 * 463 * @param acl_handle 464 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 465 */ 466 uint8_t hfp_hf_query_current_call_status(hci_con_handle_t acl_handle); 467 468 /* 469 * @brief Release a call with index in the AG. 470 * 471 * @param acl_handle 472 * @param index 473 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 474 */ 475 uint8_t hfp_hf_release_call_with_index(hci_con_handle_t acl_handle, int index); 476 477 /* 478 * @brief Place all parties of a multiparty call on hold with the 479 * exception of the specified call. 480 * 481 * @param acl_handle 482 * @param index 483 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 484 */ 485 uint8_t hfp_hf_private_consultation_with_call(hci_con_handle_t acl_handle, int index); 486 487 /* 488 * @brief Query the status of the “Response and Hold” state of the AG. 489 * The result is reported via HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS. 490 * 491 * @param acl_handle 492 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 493 */ 494 uint8_t hfp_hf_rrh_query_status(hci_con_handle_t acl_handle); 495 496 /* 497 * @brief Put an incoming call on hold in the AG. 498 * 499 * @param acl_handle 500 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 501 */ 502 uint8_t hfp_hf_rrh_hold_call(hci_con_handle_t acl_handle); 503 504 /* 505 * @brief Accept held incoming call in the AG. 506 * 507 * @param acl_handle 508 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 509 */ 510 uint8_t hfp_hf_rrh_accept_held_call(hci_con_handle_t acl_handle); 511 512 /* 513 * @brief Reject held incoming call in the AG. 514 * 515 * @param acl_handle 516 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 517 */ 518 uint8_t hfp_hf_rrh_reject_held_call(hci_con_handle_t acl_handle); 519 520 /* 521 * @brief Query the AG subscriber number. The result is reported via HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION. 522 * 523 * @param acl_handle 524 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 525 */ 526 uint8_t hfp_hf_query_subscriber_number(hci_con_handle_t acl_handle); 527 528 /* 529 * @brief Set HF indicator. 530 * 531 * @param acl_handle 532 * @param assigned_number 533 * @param value 534 * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist 535 */ 536 uint8_t hfp_hf_set_hf_indicator(hci_con_handle_t acl_handle, int assigned_number, int value); 537 538 /* 539 * @brief Tests if in-band ringtone is active on AG (requires SLC) 540 * 541 * @param acl_handler 542 * @return 0 if unknown acl_handle or in-band ring-tone disabled, otherwise 1 543 */ 544 int hfp_hf_in_band_ringtone_active(hci_con_handle_t acl_handle); 545 546 /** 547 * @brief De-Init HFP HF 548 */ 549 void hfp_hf_deinit(void); 550 551 /* API_END */ 552 553 #if defined __cplusplus 554 } 555 #endif 556 557 #endif // BTSTACK_HFP_HF_H 558