xref: /btstack/src/classic/hfp_hf.h (revision da8e14c5aa3783b6bb7dd63e71572a901bcf168b)
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 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 Terminate all held calls.
285  *
286  * @param acl_handle
287  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
288  */
289 uint8_t hfp_hf_terminate_held_calls(hci_con_handle_t acl_handle);
290 
291 /**
292  * @brief Initiate outgoing voice call by providing the destination phone number to the AG.
293  *
294  * @param acl_handle
295  * @param number
296  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
297  */
298 uint8_t hfp_hf_dial_number(hci_con_handle_t acl_handle, char * number);
299 
300 /**
301  * @brief Initiate outgoing voice call using the memory dialing feature of the AG.
302  *
303  * @param acl_handle
304  * @param memory_id
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_dial_memory(hci_con_handle_t acl_handle, int memory_id);
308 
309 /**
310  * @brief Initiate outgoing voice call by recalling the last number dialed by the AG.
311  *
312  * @param acl_handle
313  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
314  */
315 uint8_t hfp_hf_redial_last_number(hci_con_handle_t acl_handle);
316 
317 /**
318  * @brief Enable the “Call Waiting notification” function in the AG.
319  * The AG shall send the corresponding result code to the HF whenever
320  * an incoming call is waiting during an ongoing call. In that event,
321  * the HFP_SUBEVENT_CALL_WAITING_NOTIFICATION is emitted.
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_activate_call_waiting_notification(hci_con_handle_t acl_handle);
327 
328 /**
329  * @brief Disable the “Call Waiting notification” function in the AG.
330  *
331  * @param acl_handle
332  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
333  */
334 uint8_t hfp_hf_deactivate_call_waiting_notification(hci_con_handle_t acl_handle);
335 
336 /**
337  * @brief Enable the “Calling Line Identification notification” function in the AG.
338  * The AG shall issue the corresponding result code just after every RING indication,
339  * when the HF is alerted in an incoming call. In that event,
340  * the HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION is emitted.
341  * @param acl_handle
342  */
343 uint8_t hfp_hf_activate_calling_line_notification(hci_con_handle_t acl_handle);
344 
345 /**
346  * @brief Disable the “Calling Line Identification notification” function in the AG.
347  *
348  * @param acl_handle
349  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
350  */
351 uint8_t hfp_hf_deactivate_calling_line_notification(hci_con_handle_t acl_handle);
352 
353 
354 /**
355  * @brief Deactivate echo canceling (EC) and noise reduction (NR) in the AG and emit
356  * HFP_SUBEVENT_ECHO_CANCELING_NOISE_REDUCTION_DEACTIVATE with status ERROR_CODE_SUCCESS if AG supports EC and AG.
357  * If the AG supports its own embedded echo canceling and/or noise reduction function,
358  * it shall have EC and NR activated until this function is called.
359  *
360  * @param acl_handle
361  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
362  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
363  *              - ERROR_CODE_COMMAND_DISALLOWED if HFP_(HF/AG)SF_EC_NR_FUNCTION feature is not supported by AG and HF
364  */
365 uint8_t hfp_hf_deactivate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle);
366 
367 /**
368  * @brief Activate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED event with status ERROR_CODE_SUCCESS
369  * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. Prerequisite is established SLC.
370  *
371  * @param acl_handle
372  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
373  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
374  *              - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated
375  */
376 uint8_t hfp_hf_activate_voice_recognition(hci_con_handle_t acl_handle);
377 
378 /**
379  * @brief Dectivate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED event with status ERROR_CODE_SUCCESS
380  * if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. Prerequisite is established SLC.
381  *
382  * @param acl_handle
383  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
384  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
385  *              - ERROR_CODE_COMMAND_DISALLOWED if feature HFP_(HF/AG)SF_VOICE_RECOGNITION_FUNCTION is not supported by HF and AG, or already activated
386  */
387 uint8_t hfp_hf_deactivate_voice_recognition(hci_con_handle_t acl_handle);
388 
389 
390 /**
391  * @brief Indicate that the HF is ready to accept audio. Prerequisite is established voice recognition session.
392  * The HF may call this function during an ongoing AVR (Audio Voice Recognition) session to terminate audio output from
393  * the AG (if there is any) and prepare the AG for new audio input.
394  *
395  * @param acl_handle
396  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
397  *              - 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
398  */
399 uint8_t hfp_hf_enhanced_voice_recognition_report_ready_for_audio(hci_con_handle_t acl_handle);
400 
401 
402 /**
403  * @brief Set microphone gain.
404  *
405  * @param acl_handle
406  * @param gain Valid range: [0,15]
407  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
408  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
409  *              - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range
410  */
411 uint8_t hfp_hf_set_microphone_gain(hci_con_handle_t acl_handle, int gain);
412 
413 /**
414  * @brief Set speaker gain.
415  *
416  * @param acl_handle
417  * @param gain Valid range: [0,15]
418  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
419  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
420  *              - ERROR_CODE_COMMAND_DISALLOWED if invalid gain range
421  */
422 uint8_t hfp_hf_set_speaker_gain(hci_con_handle_t acl_handle, int gain);
423 
424 /**
425  * @brief Instruct the AG to transmit a DTMF code.
426  *
427  * @param acl_handle
428  * @param dtmf_code
429  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
430  */
431 uint8_t hfp_hf_send_dtmf_code(hci_con_handle_t acl_handle, char code);
432 
433 /**
434  * @brief Read numbers from the AG for the purpose of creating
435  * a unique voice tag and storing the number and its linked voice
436  * tag in the HF’s memory.
437  * The number is reported via HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG.
438  *
439  * @param acl_handle
440  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
441  */
442 uint8_t hfp_hf_request_phone_number_for_voice_tag(hci_con_handle_t acl_handle);
443 
444 /**
445  * @brief Query the list of current calls in AG.
446  * The result is received via HFP_SUBEVENT_ENHANCED_CALL_STATUS.
447  *
448  * @param acl_handle
449  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
450  */
451 uint8_t hfp_hf_query_current_call_status(hci_con_handle_t acl_handle);
452 
453 /**
454  * @brief Release a call with index in the AG.
455  *
456  * @param acl_handle
457  * @param index
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_release_call_with_index(hci_con_handle_t acl_handle, int index);
461 
462 /**
463  * @brief Place all parties of a multiparty call on hold with the
464  * exception of the specified call.
465  *
466  * @param acl_handle
467  * @param index
468  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
469  */
470 uint8_t hfp_hf_private_consultation_with_call(hci_con_handle_t acl_handle, int index);
471 
472 /**
473  * @brief Query the status of the “Response and Hold” state of the AG.
474  * The result is reported via HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS.
475  *
476  * @param acl_handle
477  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
478  */
479 uint8_t hfp_hf_rrh_query_status(hci_con_handle_t acl_handle);
480 
481 /**
482  * @brief Put an incoming call on hold in the AG.
483  *
484  * @param acl_handle
485  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
486  */
487 uint8_t hfp_hf_rrh_hold_call(hci_con_handle_t acl_handle);
488 
489 /**
490  * @brief Accept held incoming call in the AG.
491  *
492  * @param acl_handle
493  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
494  */
495 uint8_t hfp_hf_rrh_accept_held_call(hci_con_handle_t acl_handle);
496 
497 /**
498  * @brief Reject held incoming call in the AG.
499  *
500  * @param acl_handle
501  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
502  */
503 uint8_t hfp_hf_rrh_reject_held_call(hci_con_handle_t acl_handle);
504 
505 /**
506  * @brief Query the AG subscriber number. The result is reported via HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION.
507  *
508  * @param acl_handle
509  * @return status ERROR_CODE_SUCCESS if successful, otherwise ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist
510  */
511 uint8_t hfp_hf_query_subscriber_number(hci_con_handle_t acl_handle);
512 
513 /**
514  * @brief Set HF indicator.
515  *
516  * @param acl_handle
517  * @param assigned_number
518  * @param value
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_set_hf_indicator(hci_con_handle_t acl_handle, int assigned_number, int value);
522 
523 /**
524  * @brief Tests if in-band ringtone is active on AG (requires SLC)
525  *
526  * @param acl_handler
527  * @return 0 if unknown acl_handle or in-band ring-tone disabled, otherwise 1
528  */
529 int hfp_hf_in_band_ringtone_active(hci_con_handle_t acl_handle);
530 
531 /**
532  * @brief Send AT command (most likely a vendor-specific command not part of standard HFP).
533  * @note  Result (OK/ERROR) is reported via HFP_SUBEVENT_COMPLETE
534  *        To receive potential unsolicited result code, add ENABLE_HFP_AT_MESSAGES to get all message via HFP_SUBEVENT_AT_MESSAGE_RECEIVED
535  *
536  * @param acl_handle
537  * @param at_command to send
538  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
539  *              - ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if connection does not exist, or
540  *              - ERROR_CODE_COMMAND_DISALLOWED if extended audio gateway error report is disabled
541  */
542 uint8_t hfp_hf_send_at_command(hci_con_handle_t acl_handle, const char * at_command);
543 
544 /**
545  * @brief De-Init HFP HF
546  */
547 void hfp_hf_deinit(void);
548 
549 /* API_END */
550 
551 #if defined __cplusplus
552 }
553 #endif
554 
555 #endif // BTSTACK_HFP_HF_H
556