xref: /btstack/src/classic/hfp_hf.h (revision c824d78c0a34df89b57d535abafcc7dacf30bb06)
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 BLUEKITCHEN
24  * GMBH 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(uint8_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 Set microphone gain used during SLC for Volume Synchronization.
105  *
106  * @param gain Valid range: [0,15]
107  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
108  *              - ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS if invalid gain range
109  */
110 uint8_t hfp_hf_set_default_microphone_gain(uint8_t gain);
111 
112 /**
113  * @brief Set speaker gain used during SLC for Volume Synchronization.
114  *
115  * @param gain Valid range: [0,15]
116  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
117  *              - ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS if invalid gain range
118  */
119 uint8_t hfp_hf_set_default_speaker_gain(uint8_t gain);
120 
121 /**
122  * @brief Establish RFCOMM connection with the AG with given Bluetooth address,
123  * and perform service level connection (SLC) agreement:
124  * - exchange supported features
125  * - retrieve Audio Gateway (AG) indicators and their status
126  * - enable indicator status update in the AG
127  * - notify the AG about its own available codecs, if possible
128  * - retrieve the AG information describing the call hold and multiparty services, if possible
129  * - retrieve which HF indicators are enabled on the AG, if possible
130  * The status of SLC connection establishment is reported via
131  * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED.
132  *
133  * @param bd_addr Bluetooth address of the AG
134  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
135  *              - ERROR_CODE_COMMAND_DISALLOWED if connection already exists, or
136  *              - BTSTACK_MEMORY_ALLOC_FAILED
137  */
138 uint8_t hfp_hf_establish_service_level_connection(bd_addr_t bd_addr);
139 
140 /**
141  * @brief Release the RFCOMM channel and the audio connection between the HF and the AG.
142  * The status of releasing the SLC connection is reported via
143  * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED.
144  *
145  * @param acl_handle
146  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
147  */
148 uint8_t hfp_hf_release_service_level_connection(hci_con_handle_t acl_handle);
149 
150 /**
151  * @brief Enable status update for all indicators in the AG.
152  * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted.
153  * The status of an AG indicator is reported via HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED.
154  *
155  * @param acl_handle
156  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
157  */
158 uint8_t hfp_hf_enable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle);
159 
160 /**
161  * @brief Disable status update for all indicators in the AG.
162  * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted.
163  *
164  * @param acl_handle
165  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
166  */
167 uint8_t hfp_hf_disable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle);
168 
169 /**
170  * @brief Enable or disable status update for the individual indicators in the AG using bitmap.
171  * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted.
172  * The status of an AG indicator is reported via HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED.
173  *
174  * @param acl_handle
175  * @param indicators_status_bitmap 32-bit bitmap, 0 - indicator is disabled, 1 - indicator is enabled
176  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
177  */
178 uint8_t hfp_hf_set_status_update_for_individual_ag_indicators(hci_con_handle_t acl_handle, uint32_t indicators_status_bitmap);
179 
180 /**
181  * @brief Query the name of the currently selected Network operator by AG.
182  *
183  * The name is restricted to max 16 characters. The result is reported via
184  * HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED subtype
185  * containing network operator mode, format and name.
186  * If no operator is selected, format and operator are omitted.
187  *
188  * @param acl_handle
189  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
190  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
191  *              - ERROR_CODE_COMMAND_DISALLOWED if connection in wrong state
192  */
193 uint8_t hfp_hf_query_operator_selection(hci_con_handle_t acl_handle);
194 
195 /**
196  * @brief Enable Extended Audio Gateway Error result codes in the AG.
197  * Whenever there is an error relating to the functionality of the AG as a
198  * result of AT command, the AG shall send +CME ERROR. This error is reported via
199  * HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR, see hfp_cme_error_t in hfp.h
200  *
201  * @param acl_handle
202  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
203  */
204 uint8_t hfp_hf_enable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle);
205 
206 /**
207  * @brief Disable Extended Audio Gateway Error result codes in the AG.
208  *
209  * @param acl_handle
210  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
211  */
212  uint8_t hfp_hf_disable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle);
213 
214 /**
215  * @brief Establish audio connection.
216  * The status of audio connection establishment is reported via HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED.
217  *
218  * @param acl_handle
219  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
220  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
221  *              - ERROR_CODE_COMMAND_DISALLOWED if connection in wrong state
222  */
223 uint8_t hfp_hf_establish_audio_connection(hci_con_handle_t acl_handle);
224 
225 /**
226  * @brief Release audio connection.
227  * The status of releasing of the audio connection is reported via
228  * HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED.
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_release_audio_connection(hci_con_handle_t acl_handle);
234 
235 /**
236  * @brief Answer incoming call.
237  *
238  * @param acl_handle
239  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
240  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
241  *              - ERROR_CODE_COMMAND_DISALLOWED if answering incoming call with wrong callsetup status
242  */
243 uint8_t hfp_hf_answer_incoming_call(hci_con_handle_t acl_handle);
244 
245 /**
246  * @brief Reject incoming call.
247  *
248  * @param acl_handle
249  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
250  */
251 uint8_t hfp_hf_reject_incoming_call(hci_con_handle_t acl_handle);
252 
253 /**
254  * @brief Release all held calls or sets User Determined User Busy (UDUB) for a waiting call.
255  *
256  * @param acl_handle
257  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
258  */
259 uint8_t hfp_hf_user_busy(hci_con_handle_t acl_handle);
260 
261 /**
262  * @brief Release all active calls (if any exist) and accepts the other (held or waiting) call.
263  *
264  * @param acl_handle
265  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
266  */
267 uint8_t hfp_hf_end_active_and_accept_other(hci_con_handle_t acl_handle);
268 
269 /**
270  * @brief Place all active calls (if any exist) on hold and accepts the other (held or waiting) call.
271  *
272  * @param acl_handle
273  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
274  */
275 uint8_t hfp_hf_swap_calls(hci_con_handle_t acl_handle);
276 
277 /**
278  * @brief Add a held call to the conversation.
279  *
280  * @param acl_handle
281  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
282  */
283 uint8_t hfp_hf_join_held_call(hci_con_handle_t acl_handle);
284 
285 /**
286  * @brief Connect the two calls and disconnects the subscriber from both calls (Explicit Call Transfer).
287  *
288  * @param acl_handle
289  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
290  */
291 uint8_t hfp_hf_connect_calls(hci_con_handle_t acl_handle);
292 
293 /**
294  * @brief Terminate an incoming or an outgoing call. HFP_SUBEVENT_CALL_TERMINATED is sent upon call termination.
295  *
296  * @param acl_handle
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_terminate_call(hci_con_handle_t acl_handle);
300 
301 /**
302  * @brief Terminate all held calls.
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_terminate_held_calls(hci_con_handle_t acl_handle);
308 
309 /**
310  * @brief Initiate outgoing voice call by providing the destination phone number to the AG.
311  *
312  * @param acl_handle
313  * @param number
314  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
315  */
316 uint8_t hfp_hf_dial_number(hci_con_handle_t acl_handle, char * number);
317 
318 /**
319  * @brief Initiate outgoing voice call using the memory dialing feature of the AG.
320  *
321  * @param acl_handle
322  * @param memory_id
323  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
324  */
325 uint8_t hfp_hf_dial_memory(hci_con_handle_t acl_handle, int memory_id);
326 
327 /**
328  * @brief Initiate outgoing voice call by recalling the last number dialed by the AG.
329  *
330  * @param acl_handle
331  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
332  */
333 uint8_t hfp_hf_redial_last_number(hci_con_handle_t acl_handle);
334 
335 /**
336  * @brief Enable the “Call Waiting notification” function in the AG.
337  * The AG shall send the corresponding result code to the HF whenever
338  * an incoming call is waiting during an ongoing call. In that event,
339  * the HFP_SUBEVENT_CALL_WAITING_NOTIFICATION is emitted.
340  *
341  * @param acl_handle
342  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
343  */
344 uint8_t hfp_hf_activate_call_waiting_notification(hci_con_handle_t acl_handle);
345 
346 /**
347  * @brief Disable the “Call Waiting notification” function in the AG.
348  *
349  * @param acl_handle
350  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
351  */
352 uint8_t hfp_hf_deactivate_call_waiting_notification(hci_con_handle_t acl_handle);
353 
354 /**
355  * @brief Enable the “Calling Line Identification notification” function in the AG.
356  * The AG shall issue the corresponding result code just after every RING indication,
357  * when the HF is alerted in an incoming call. In that event,
358  * the HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION is emitted.
359  * @param acl_handle
360  */
361 uint8_t hfp_hf_activate_calling_line_notification(hci_con_handle_t acl_handle);
362 
363 /**
364  * @brief Disable the “Calling Line Identification notification” function in the AG.
365  *
366  * @param acl_handle
367  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
368  */
369 uint8_t hfp_hf_deactivate_calling_line_notification(hci_con_handle_t acl_handle);
370 
371 
372 /**
373  * @brief Deactivate echo canceling (EC) and noise reduction (NR) in the AG and emit
374  * HFP_SUBEVENT_ECHO_CANCELING_NOISE_REDUCTION_DEACTIVATE with status ERROR_CODE_SUCCESS if AG supports EC and AG.
375  * If the AG supports its own embedded echo canceling and/or noise reduction function,
376  * it shall have EC and NR activated until this function is called.
377  *
378  * @param acl_handle
379  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
380  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
381  *              - ERROR_CODE_COMMAND_DISALLOWED if HFP_(HF/AG)SF_EC_NR_FUNCTION feature is not supported by AG and HF
382  */
383 uint8_t hfp_hf_deactivate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle);
384 
385 /**
386  * @brief Activate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED event with status ERROR_CODE_SUCCESS
387  * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. Prerequisite is established SLC.
388  *
389  * @param acl_handle
390  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
391  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
392  *              - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated
393  */
394 uint8_t hfp_hf_activate_voice_recognition(hci_con_handle_t acl_handle);
395 
396 /**
397  * @brief Dectivate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED event with status ERROR_CODE_SUCCESS
398  * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. Prerequisite is established SLC.
399  *
400  * @param acl_handle
401  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
402  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
403  *              - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated
404  */
405 uint8_t hfp_hf_deactivate_voice_recognition(hci_con_handle_t acl_handle);
406 
407 
408 /**
409  * @brief Indicate that the HF is ready to accept audio. Prerequisite is established voice recognition session.
410  * The HF may call this function during an ongoing AVR (Audio Voice Recognition) session to terminate audio output from
411  * the AG (if there is any) and prepare the AG for new audio input.
412  *
413  * @param acl_handle
414  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
415  *              - 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
416  */
417 uint8_t hfp_hf_enhanced_voice_recognition_report_ready_for_audio(hci_con_handle_t acl_handle);
418 
419 
420 /**
421  * @brief Set microphone gain.
422  *
423  * @param acl_handle
424  * @param gain Valid range: [0,15]
425  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
426  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
427  *              - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range
428  */
429 uint8_t hfp_hf_set_microphone_gain(hci_con_handle_t acl_handle, int gain);
430 
431 /**
432  * @brief Set speaker gain.
433  *
434  * @param acl_handle
435  * @param gain Valid range: [0,15]
436  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
437  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
438  *              - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range
439  */
440 uint8_t hfp_hf_set_speaker_gain(hci_con_handle_t acl_handle, int gain);
441 
442 /**
443  * @brief Instruct the AG to transmit a DTMF code.
444  *
445  * @param acl_handle
446  * @param dtmf_code
447  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
448  */
449 uint8_t hfp_hf_send_dtmf_code(hci_con_handle_t acl_handle, char code);
450 
451 /**
452  * @brief Read numbers from the AG for the purpose of creating
453  * a unique voice tag and storing the number and its linked voice
454  * tag in the HF’s memory.
455  * The number is reported via HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG.
456  *
457  * @param acl_handle
458  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
459  */
460 uint8_t hfp_hf_request_phone_number_for_voice_tag(hci_con_handle_t acl_handle);
461 
462 /**
463  * @brief Query the list of current calls in AG.
464  * The result is received via HFP_SUBEVENT_ENHANCED_CALL_STATUS.
465  *
466  * @param acl_handle
467  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
468  */
469 uint8_t hfp_hf_query_current_call_status(hci_con_handle_t acl_handle);
470 
471 /**
472  * @brief Release a call with index in the AG.
473  *
474  * @param acl_handle
475  * @param index
476  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
477  */
478 uint8_t hfp_hf_release_call_with_index(hci_con_handle_t acl_handle, int index);
479 
480 /**
481  * @brief Place all parties of a multiparty call on hold with the
482  * exception of the specified call.
483  *
484  * @param acl_handle
485  * @param index
486  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
487  */
488 uint8_t hfp_hf_private_consultation_with_call(hci_con_handle_t acl_handle, int index);
489 
490 /**
491  * @brief Query the status of the “Response and Hold” state of the AG.
492  * The result is reported via HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS.
493  *
494  * @param acl_handle
495  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
496  */
497 uint8_t hfp_hf_rrh_query_status(hci_con_handle_t acl_handle);
498 
499 /**
500  * @brief Put an incoming call on hold in the AG.
501  *
502  * @param acl_handle
503  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
504  */
505 uint8_t hfp_hf_rrh_hold_call(hci_con_handle_t acl_handle);
506 
507 /**
508  * @brief Accept held incoming call in the AG.
509  *
510  * @param acl_handle
511  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
512  */
513 uint8_t hfp_hf_rrh_accept_held_call(hci_con_handle_t acl_handle);
514 
515 /**
516  * @brief Reject held incoming call in the AG.
517  *
518  * @param acl_handle
519  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
520  */
521 uint8_t hfp_hf_rrh_reject_held_call(hci_con_handle_t acl_handle);
522 
523 /**
524  * @brief Query the AG subscriber number. The result is reported via HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION.
525  *
526  * @param acl_handle
527  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
528  */
529 uint8_t hfp_hf_query_subscriber_number(hci_con_handle_t acl_handle);
530 
531 /**
532  * @brief Set HF indicator.
533  *
534  * @param acl_handle
535  * @param assigned_number
536  * @param value
537  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
538  */
539 uint8_t hfp_hf_set_hf_indicator(hci_con_handle_t acl_handle, int assigned_number, int value);
540 
541 /**
542  * @brief Tests if in-band ringtone is active on AG (requires SLC)
543  *
544  * @param acl_handler
545  * @return 0 if unknown acl_handle or in-band ring-tone disabled, otherwise 1
546  */
547 int hfp_hf_in_band_ringtone_active(hci_con_handle_t acl_handle);
548 
549 /**
550  * @brief Send AT command (most likely a vendor-specific command not part of standard HFP).
551  * @note  Result (OK/ERROR) is reported via HFP_SUBEVENT_COMPLETE
552  *        To receive potential unsolicited result code, add ENABLE_HFP_AT_MESSAGES to get all message via HFP_SUBEVENT_AT_MESSAGE_RECEIVED
553  *
554  * @param acl_handle
555  * @param at_command to send
556  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
557  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
558  *              - ERROR_CODE_COMMAND_DISALLOWED if extended audio gateway error report is disabled
559  */
560 uint8_t hfp_hf_send_at_command(hci_con_handle_t acl_handle, const char * at_command);
561 
562 /**
563  * @brief De-Init HFP HF
564  */
565 void hfp_hf_deinit(void);
566 
567 /* API_END */
568 
569 #if defined __cplusplus
570 }
571 #endif
572 
573 #endif // BTSTACK_HFP_HF_H
574