xref: /btstack/src/classic/hfp_hf.h (revision b4df802803bba8b85ead791edd944a0012af459e)
13deb3ec6SMatthias Ringwald /*
23deb3ec6SMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
33deb3ec6SMatthias Ringwald  *
43deb3ec6SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
53deb3ec6SMatthias Ringwald  * modification, are permitted provided that the following conditions
63deb3ec6SMatthias Ringwald  * are met:
73deb3ec6SMatthias Ringwald  *
83deb3ec6SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
93deb3ec6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
103deb3ec6SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
113deb3ec6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
123deb3ec6SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
133deb3ec6SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
143deb3ec6SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
153deb3ec6SMatthias Ringwald  *    from this software without specific prior written permission.
163deb3ec6SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
173deb3ec6SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
183deb3ec6SMatthias Ringwald  *    monetary gain.
193deb3ec6SMatthias Ringwald  *
203deb3ec6SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
213deb3ec6SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
223deb3ec6SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
233deb3ec6SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
243deb3ec6SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
253deb3ec6SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
263deb3ec6SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
273deb3ec6SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
283deb3ec6SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
293deb3ec6SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
303deb3ec6SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
313deb3ec6SMatthias Ringwald  * SUCH DAMAGE.
323deb3ec6SMatthias Ringwald  *
333deb3ec6SMatthias Ringwald  * Please inquire about commercial licensing options at
343deb3ec6SMatthias Ringwald  * [email protected]
353deb3ec6SMatthias Ringwald  *
363deb3ec6SMatthias Ringwald  */
373deb3ec6SMatthias Ringwald 
38fe5a6c4eSMilanka Ringwald /**
39fe5a6c4eSMilanka Ringwald  * @title HFP Hands-Free (HF)
40fe5a6c4eSMilanka Ringwald  *
41fe5a6c4eSMilanka Ringwald  */
423deb3ec6SMatthias Ringwald 
4380e33422SMatthias Ringwald #ifndef BTSTACK_HFP_HF_H
4480e33422SMatthias Ringwald #define BTSTACK_HFP_HF_H
453deb3ec6SMatthias Ringwald 
463deb3ec6SMatthias Ringwald #include "hci.h"
47efda0b48SMatthias Ringwald #include "classic/sdp_client_rfcomm.h"
483edc84c5SMatthias Ringwald #include "classic/hfp.h"
493deb3ec6SMatthias Ringwald 
503deb3ec6SMatthias Ringwald #if defined __cplusplus
513deb3ec6SMatthias Ringwald extern "C" {
523deb3ec6SMatthias Ringwald #endif
533deb3ec6SMatthias Ringwald 
543deb3ec6SMatthias Ringwald /* API_START */
553deb3ec6SMatthias Ringwald 
563deb3ec6SMatthias Ringwald /**
573deb3ec6SMatthias Ringwald  * @brief Create HFP Hands-Free (HF) SDP service record.
58a0ffb263SMatthias Ringwald  * @param service
59a0ffb263SMatthias Ringwald  * @param rfcomm_channel_nr
60a0ffb263SMatthias Ringwald  * @param name
61a0ffb263SMatthias Ringwald  * @param suported_features 32-bit bitmap, see HFP_HFSF_* values in hfp.h
624f84bf36SMatthias Ringwald  * @param wide_band_speech supported
633deb3ec6SMatthias Ringwald  */
644f84bf36SMatthias Ringwald 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);
653deb3ec6SMatthias Ringwald 
663deb3ec6SMatthias Ringwald /**
67a0ffb263SMatthias Ringwald  * @brief Set up HFP Hands-Free (HF) device without additional supported features.
68a0ffb263SMatthias Ringwald  * @param rfcomm_channel_nr
69*b4df8028SMilanka Ringwald  * @return status ERROR_CODE_SUCCESS if successful, otherwise:
70*b4df8028SMilanka Ringwald  *                  - L2CAP_SERVICE_ALREADY_REGISTERED,
71*b4df8028SMilanka Ringwald  *                  - RFCOMM_SERVICE_ALREADY_REGISTERED or
72*b4df8028SMilanka Ringwald  *                  - BTSTACK_MEMORY_ALLOC_FAILED if allocation of any of RFCOMM or L2CAP services failed
733deb3ec6SMatthias Ringwald  */
74*b4df8028SMilanka Ringwald uint8_t hfp_hf_init(uint16_t rfcomm_channel_nr);
7566a048abSMatthias Ringwald 
76a0ffb263SMatthias Ringwald /**
77a0ffb263SMatthias Ringwald  * @brief Set codecs.
78a0ffb263SMatthias Ringwald  * @param codecs_nr
79a0ffb263SMatthias Ringwald  * @param codecs
80a0ffb263SMatthias Ringwald  */
817ca89cabSMatthias Ringwald void hfp_hf_init_codecs(int codecs_nr, const uint8_t * codecs);
823deb3ec6SMatthias Ringwald 
83a0ffb263SMatthias Ringwald /**
84a0ffb263SMatthias Ringwald  * @brief Set supported features.
85a0ffb263SMatthias Ringwald  * @param supported_features 32-bit bitmap, see HFP_HFSF_* values in hfp.h
86a0ffb263SMatthias Ringwald  */
87a0ffb263SMatthias Ringwald void hfp_hf_init_supported_features(uint32_t supported_features);
88a0ffb263SMatthias Ringwald 
89a0ffb263SMatthias Ringwald /**
90a0ffb263SMatthias Ringwald  * @brief Set HF indicators.
91a0ffb263SMatthias Ringwald  * @param indicators_nr
92a0ffb263SMatthias Ringwald  * @param indicators
93a0ffb263SMatthias Ringwald  */
947ca89cabSMatthias Ringwald void hfp_hf_init_hf_indicators(int indicators_nr, const uint16_t * indicators);
95a0ffb263SMatthias Ringwald 
9666a048abSMatthias Ringwald 
973deb3ec6SMatthias Ringwald /**
983deb3ec6SMatthias Ringwald  * @brief Register callback for the HFP Hands-Free (HF) client.
99a0ffb263SMatthias Ringwald  * @param callback
1003deb3ec6SMatthias Ringwald  */
10113839019SMatthias Ringwald void hfp_hf_register_packet_handler(btstack_packet_handler_t callback);
1023deb3ec6SMatthias Ringwald 
1033deb3ec6SMatthias Ringwald /**
104a0ffb263SMatthias Ringwald  * @brief Establish RFCOMM connection with the AG with given Bluetooth address,
105a0ffb263SMatthias Ringwald  * and perform service level connection (SLC) agreement:
106a0ffb263SMatthias Ringwald  * - exchange supported features
1073deb3ec6SMatthias Ringwald  * - retrieve Audio Gateway (AG) indicators and their status
1083deb3ec6SMatthias Ringwald  * - enable indicator status update in the AG
1093deb3ec6SMatthias Ringwald  * - notify the AG about its own available codecs, if possible
1103deb3ec6SMatthias Ringwald  * - retrieve the AG information describing the call hold and multiparty services, if possible
1113deb3ec6SMatthias Ringwald  * - retrieve which HF indicators are enabled on the AG, if possible
112a0ffb263SMatthias Ringwald  * The status of SLC connection establishment is reported via
113a0ffb263SMatthias Ringwald  * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED.
114a0ffb263SMatthias Ringwald  *
115a0ffb263SMatthias Ringwald  * @param bd_addr Bluetooth address of the AG
1163deb3ec6SMatthias Ringwald  */
1173deb3ec6SMatthias Ringwald void hfp_hf_establish_service_level_connection(bd_addr_t bd_addr);
1183deb3ec6SMatthias Ringwald 
1193deb3ec6SMatthias Ringwald /**
1203deb3ec6SMatthias Ringwald  * @brief Release the RFCOMM channel and the audio connection between the HF and the AG.
121a0ffb263SMatthias Ringwald  * The status of releasing the SLC connection is reported via
122a0ffb263SMatthias Ringwald  * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED.
123a0ffb263SMatthias Ringwald  *
124959e3c06SMatthias Ringwald  * @param acl_handle of the AG
1253deb3ec6SMatthias Ringwald  */
126c8626498SMilanka Ringwald void hfp_hf_release_service_level_connection(hci_con_handle_t acl_handle);
1273deb3ec6SMatthias Ringwald 
1283deb3ec6SMatthias Ringwald /**
129a0ffb263SMatthias Ringwald  * @brief Enable status update for all indicators in the AG.
130a0ffb263SMatthias Ringwald  * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted.
131a0ffb263SMatthias Ringwald  * The status of an AG indicator is reported via HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED.
132a0ffb263SMatthias Ringwald  *
133959e3c06SMatthias Ringwald  * @param acl_handle of the AG
1343deb3ec6SMatthias Ringwald  */
135c8626498SMilanka Ringwald void hfp_hf_enable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle);
13666a048abSMatthias Ringwald 
137a0ffb263SMatthias Ringwald /**
138a0ffb263SMatthias Ringwald  * @brief Disable status update for all indicators in the AG.
139a0ffb263SMatthias Ringwald  * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted.
140959e3c06SMatthias Ringwald  * @param acl_handle of the AG
141a0ffb263SMatthias Ringwald  */
142c8626498SMilanka Ringwald void hfp_hf_disable_status_update_for_all_ag_indicators(hci_con_handle_t acl_handle);
1433deb3ec6SMatthias Ringwald 
1443deb3ec6SMatthias Ringwald /**
145a0ffb263SMatthias Ringwald  * @brief Enable or disable status update for the individual indicators in the AG using bitmap.
146a0ffb263SMatthias Ringwald  * The status field of the HFP_SUBEVENT_COMPLETE reports if the command was accepted.
147a0ffb263SMatthias Ringwald  * The status of an AG indicator is reported via HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED.
148a0ffb263SMatthias Ringwald  *
149959e3c06SMatthias Ringwald  * @param acl_handle of the AG
150a0ffb263SMatthias Ringwald  * @param indicators_status_bitmap 32-bit bitmap, 0 - indicator is disabled, 1 - indicator is enabled
1513deb3ec6SMatthias Ringwald  */
152c8626498SMilanka Ringwald void hfp_hf_set_status_update_for_individual_ag_indicators(hci_con_handle_t acl_handle, uint32_t indicators_status_bitmap);
1533deb3ec6SMatthias Ringwald 
1543deb3ec6SMatthias Ringwald /**
155a0ffb263SMatthias Ringwald  * @brief Query the name of the currently selected Network operator by AG.
15666a048abSMatthias Ringwald  *
157a0ffb263SMatthias Ringwald  * The name is restricted to max 16 characters. The result is reported via
158a0ffb263SMatthias Ringwald  * HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED subtype
159a0ffb263SMatthias Ringwald  * containing network operator mode, format and name.
160a0ffb263SMatthias Ringwald  * If no operator is selected, format and operator are omitted.
161a0ffb263SMatthias Ringwald  *
162959e3c06SMatthias Ringwald  * @param acl_handle of the AG
1633deb3ec6SMatthias Ringwald  */
164c8626498SMilanka Ringwald void hfp_hf_query_operator_selection(hci_con_handle_t acl_handle);
1653deb3ec6SMatthias Ringwald 
1663deb3ec6SMatthias Ringwald /**
167a0ffb263SMatthias Ringwald  * @brief Enable Extended Audio Gateway Error result codes in the AG.
1683deb3ec6SMatthias Ringwald  * Whenever there is an error relating to the functionality of the AG as a
169a0ffb263SMatthias Ringwald  * result of AT command, the AG shall send +CME ERROR. This error is reported via
170a0ffb263SMatthias Ringwald  * HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR, see hfp_cme_error_t in hfp.h
171a0ffb263SMatthias Ringwald  *
172959e3c06SMatthias Ringwald  * @param acl_handle of the AG
1733deb3ec6SMatthias Ringwald  */
174c8626498SMilanka Ringwald void hfp_hf_enable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle);
175a0ffb263SMatthias Ringwald 
176a0ffb263SMatthias Ringwald /**
177a0ffb263SMatthias Ringwald  * @brief Disable Extended Audio Gateway Error result codes in the AG.
178a0ffb263SMatthias Ringwald  *
179959e3c06SMatthias Ringwald  * @param acl_handle of the AG
180a0ffb263SMatthias Ringwald  */
181c8626498SMilanka Ringwald  void hfp_hf_disable_report_extended_audio_gateway_error_result_code(hci_con_handle_t acl_handle);
1823deb3ec6SMatthias Ringwald 
1833deb3ec6SMatthias Ringwald /**
184a0ffb263SMatthias Ringwald  * @brief Establish audio connection.
185a0ffb263SMatthias Ringwald  * The status of audio connection establishment is reported via
186a0ffb263SMatthias Ringwald  * HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED.
187959e3c06SMatthias Ringwald  * @param acl_handle of the AG
1883deb3ec6SMatthias Ringwald  */
189c8626498SMilanka Ringwald void hfp_hf_establish_audio_connection(hci_con_handle_t acl_handle);
1903deb3ec6SMatthias Ringwald 
1913deb3ec6SMatthias Ringwald /**
192a0ffb263SMatthias Ringwald  * @brief Release audio connection.
193a0ffb263SMatthias Ringwald  * The status of releasing of the audio connection is reported via
194a0ffb263SMatthias Ringwald  * HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED.
195a0ffb263SMatthias Ringwald  *
196959e3c06SMatthias Ringwald  * @param acl_handle of the AG
1973deb3ec6SMatthias Ringwald  */
198c8626498SMilanka Ringwald void hfp_hf_release_audio_connection(hci_con_handle_t acl_handle);
1993deb3ec6SMatthias Ringwald 
200ce263fc8SMatthias Ringwald /**
201a0ffb263SMatthias Ringwald  * @brief Answer incoming call.
202959e3c06SMatthias Ringwald  * @param acl_handle of the AG
203ce263fc8SMatthias Ringwald  */
204c8626498SMilanka Ringwald void hfp_hf_answer_incoming_call(hci_con_handle_t acl_handle);
205ce263fc8SMatthias Ringwald 
206ce263fc8SMatthias Ringwald /**
207a0ffb263SMatthias Ringwald  * @brief Reject incoming call.
208959e3c06SMatthias Ringwald  * @param acl_handle of the AG
209ce263fc8SMatthias Ringwald  */
210c8626498SMilanka Ringwald void hfp_hf_reject_incoming_call(hci_con_handle_t acl_handle);
211ce263fc8SMatthias Ringwald 
212ce263fc8SMatthias Ringwald /**
213a0ffb263SMatthias Ringwald  * @brief Release all held calls or sets User Determined User Busy (UDUB) for a waiting call.
214959e3c06SMatthias Ringwald  * @param acl_handle of the AG
215ce263fc8SMatthias Ringwald  */
216c8626498SMilanka Ringwald void hfp_hf_user_busy(hci_con_handle_t acl_handle);
217ce263fc8SMatthias Ringwald 
218ce263fc8SMatthias Ringwald /**
219a0ffb263SMatthias Ringwald  * @brief Release all active calls (if any exist) and accepts the other (held or waiting) call.
220959e3c06SMatthias Ringwald  * @param acl_handle of the AG
221ce263fc8SMatthias Ringwald  */
222c8626498SMilanka Ringwald void hfp_hf_end_active_and_accept_other(hci_con_handle_t acl_handle);
223ce263fc8SMatthias Ringwald 
224ce263fc8SMatthias Ringwald /**
225a0ffb263SMatthias Ringwald  * @brief Place all active calls (if any exist) on hold and accepts the other (held or waiting) call.
226959e3c06SMatthias Ringwald  * @param acl_handle of the AG
227ce263fc8SMatthias Ringwald  */
228c8626498SMilanka Ringwald void hfp_hf_swap_calls(hci_con_handle_t acl_handle);
229ce263fc8SMatthias Ringwald 
230ce263fc8SMatthias Ringwald /**
231a0ffb263SMatthias Ringwald  * @brief Add a held call to the conversation.
232959e3c06SMatthias Ringwald  * @param acl_handle of the AG
233ce263fc8SMatthias Ringwald  */
234c8626498SMilanka Ringwald void hfp_hf_join_held_call(hci_con_handle_t acl_handle);
235ce263fc8SMatthias Ringwald 
236ce263fc8SMatthias Ringwald /**
237a0ffb263SMatthias Ringwald  * @brief Connect the two calls and disconnects the subscriber from both calls (Explicit Call
238a0ffb263SMatthias Ringwald Transfer).
239959e3c06SMatthias Ringwald  * @param acl_handle of the AG
240ce263fc8SMatthias Ringwald  */
241c8626498SMilanka Ringwald void hfp_hf_connect_calls(hci_con_handle_t acl_handle);
242ce263fc8SMatthias Ringwald 
243ce263fc8SMatthias Ringwald /**
244a0ffb263SMatthias Ringwald  * @brief Terminate an incoming or an outgoing call.
245a0ffb263SMatthias Ringwald  * HFP_SUBEVENT_CALL_TERMINATED is sent upon call termination.
246959e3c06SMatthias Ringwald  * @param acl_handle of the AG
247ce263fc8SMatthias Ringwald  */
248c8626498SMilanka Ringwald void hfp_hf_terminate_call(hci_con_handle_t acl_handle);
249ce263fc8SMatthias Ringwald 
250ce263fc8SMatthias Ringwald /**
251a0ffb263SMatthias Ringwald  * @brief Initiate outgoing voice call by providing the destination phone number to the AG.
252959e3c06SMatthias Ringwald  * @param acl_handle of the AG
253a0ffb263SMatthias Ringwald  * @param number
254ce263fc8SMatthias Ringwald  */
255c8626498SMilanka Ringwald void hfp_hf_dial_number(hci_con_handle_t acl_handle, char * number);
256ce263fc8SMatthias Ringwald 
257ce263fc8SMatthias Ringwald /**
258a0ffb263SMatthias Ringwald  * @brief Initiate outgoing voice call using the memory dialing feature of the AG.
259959e3c06SMatthias Ringwald  * @param acl_handle of the AG
260a0ffb263SMatthias Ringwald  * @param memory_id
261ce263fc8SMatthias Ringwald  */
262c8626498SMilanka Ringwald void hfp_hf_dial_memory(hci_con_handle_t acl_handle, int memory_id);
263ce263fc8SMatthias Ringwald 
264ce263fc8SMatthias Ringwald /**
265a0ffb263SMatthias Ringwald  * @brief Initiate outgoing voice call by recalling the last number dialed by the AG.
266959e3c06SMatthias Ringwald  * @param acl_handle of the AG
267ce263fc8SMatthias Ringwald  */
268c8626498SMilanka Ringwald void hfp_hf_redial_last_number(hci_con_handle_t acl_handle);
269ce263fc8SMatthias Ringwald 
270ce263fc8SMatthias Ringwald /*
271a0ffb263SMatthias Ringwald  * @brief Enable the “Call Waiting notification” function in the AG.
272a0ffb263SMatthias Ringwald  * The AG shall send the corresponding result code to the HF whenever
273a0ffb263SMatthias Ringwald  * an incoming call is waiting during an ongoing call. In that event,
274a0ffb263SMatthias Ringwald  * the HFP_SUBEVENT_CALL_WAITING_NOTIFICATION is emitted.
275a0ffb263SMatthias Ringwald  *
276959e3c06SMatthias Ringwald  * @param acl_handle of the AG
277ce263fc8SMatthias Ringwald  */
278c8626498SMilanka Ringwald void hfp_hf_activate_call_waiting_notification(hci_con_handle_t acl_handle);
279ce263fc8SMatthias Ringwald 
280ce263fc8SMatthias Ringwald /*
281a0ffb263SMatthias Ringwald  * @brief Disable the “Call Waiting notification” function in the AG.
282959e3c06SMatthias Ringwald  * @param acl_handle of the AG
283ce263fc8SMatthias Ringwald  */
284c8626498SMilanka Ringwald void hfp_hf_deactivate_call_waiting_notification(hci_con_handle_t acl_handle);
285ce263fc8SMatthias Ringwald 
286ce263fc8SMatthias Ringwald /*
287a0ffb263SMatthias Ringwald  * @brief Enable the “Calling Line Identification notification” function in the AG.
288a0ffb263SMatthias Ringwald  * The AG shall issue the corresponding result code just after every RING indication,
289a0ffb263SMatthias Ringwald  * when the HF is alerted in an incoming call. In that event,
290a0ffb263SMatthias Ringwald  * the HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION is emitted.
291959e3c06SMatthias Ringwald  * @param acl_handle of the AG
292ce263fc8SMatthias Ringwald  */
293c8626498SMilanka Ringwald void hfp_hf_activate_calling_line_notification(hci_con_handle_t acl_handle);
294ce263fc8SMatthias Ringwald 
295ce263fc8SMatthias Ringwald /*
296a0ffb263SMatthias Ringwald  * @brief Disable the “Calling Line Identification notification” function in the AG.
297959e3c06SMatthias Ringwald  * @param acl_handle of the AG
298ce263fc8SMatthias Ringwald  */
299c8626498SMilanka Ringwald void hfp_hf_deactivate_calling_line_notification(hci_con_handle_t acl_handle);
300ce263fc8SMatthias Ringwald 
301ce263fc8SMatthias Ringwald 
302ce263fc8SMatthias Ringwald /*
303a0ffb263SMatthias Ringwald  * @brief Activate echo canceling and noise reduction in the AG. By default,
304a0ffb263SMatthias Ringwald  * if the AG supports its own embedded echo canceling and/or noise reduction
305a0ffb263SMatthias Ringwald  * functions, it shall have them activated until this function is called.
306a0ffb263SMatthias Ringwald  * If the AG does not support any echo canceling and noise reduction functions,
307a0ffb263SMatthias Ringwald  * it shall respond with the ERROR indicator (TODO)
308959e3c06SMatthias Ringwald  * @param acl_handle of the AG
309ce263fc8SMatthias Ringwald  */
310c8626498SMilanka Ringwald void hfp_hf_activate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle);
311ce263fc8SMatthias Ringwald 
312ce263fc8SMatthias Ringwald /*
313a0ffb263SMatthias Ringwald  * @brief Deactivate echo canceling and noise reduction in the AG.
314ce263fc8SMatthias Ringwald  */
315c8626498SMilanka Ringwald void hfp_hf_deactivate_echo_canceling_and_noise_reduction(hci_con_handle_t acl_handle);
316ce263fc8SMatthias Ringwald 
317ce263fc8SMatthias Ringwald /*
318a0ffb263SMatthias Ringwald  * @brief Activate voice recognition function.
319959e3c06SMatthias Ringwald  * @param acl_handle of the AG
320ce263fc8SMatthias Ringwald  */
321be55a11dSMilanka Ringwald uint8_t hfp_hf_activate_voice_recognition_notification(hci_con_handle_t acl_handle);
322ce263fc8SMatthias Ringwald 
323ce263fc8SMatthias Ringwald /*
324a0ffb263SMatthias Ringwald  * @brief Dectivate voice recognition function.
325959e3c06SMatthias Ringwald  * @param acl_handle of the AG
326ce263fc8SMatthias Ringwald  */
327be55a11dSMilanka Ringwald uint8_t hfp_hf_deactivate_voice_recognition_notification(hci_con_handle_t acl_handle);
328be55a11dSMilanka Ringwald 
329db3cdbd4SMilanka Ringwald uint8_t hfp_hf_start_enhanced_voice_recognition_session(hci_con_handle_t acl_handle);
330be55a11dSMilanka Ringwald 
331db3cdbd4SMilanka Ringwald uint8_t hfp_hf_stop_enhanced_voice_recognition_session(hci_con_handle_t acl_handle);
332ce263fc8SMatthias Ringwald 
333ce263fc8SMatthias Ringwald /*
334a0ffb263SMatthias Ringwald  * @brief Set microphone gain.
335959e3c06SMatthias Ringwald  * @param acl_handle of the AG
336a0ffb263SMatthias Ringwald  * @param gain Valid range: [0,15]
337ce263fc8SMatthias Ringwald  */
338c8626498SMilanka Ringwald void hfp_hf_set_microphone_gain(hci_con_handle_t acl_handle, int gain);
339ce263fc8SMatthias Ringwald 
340ce263fc8SMatthias Ringwald /*
341a0ffb263SMatthias Ringwald  * @brief Set speaker gain.
342959e3c06SMatthias Ringwald  * @param acl_handle of the AG
343a0ffb263SMatthias Ringwald  * @param gain Valid range: [0,15]
344ce263fc8SMatthias Ringwald  */
345c8626498SMilanka Ringwald void hfp_hf_set_speaker_gain(hci_con_handle_t acl_handle, int gain);
346ce263fc8SMatthias Ringwald 
347ce263fc8SMatthias Ringwald /*
348a0ffb263SMatthias Ringwald  * @brief Instruct the AG to transmit a DTMF code.
349959e3c06SMatthias Ringwald  * @param acl_handle of the AG
350a0ffb263SMatthias Ringwald  * @param dtmf_code
351ce263fc8SMatthias Ringwald  */
352c8626498SMilanka Ringwald void hfp_hf_send_dtmf_code(hci_con_handle_t acl_handle, char code);
353ce263fc8SMatthias Ringwald 
354ce263fc8SMatthias Ringwald /*
355a0ffb263SMatthias Ringwald  * @brief Read numbers from the AG for the purpose of creating
356a0ffb263SMatthias Ringwald  * a unique voice tag and storing the number and its linked voice
357a0ffb263SMatthias Ringwald  * tag in the HF’s memory.
358a0ffb263SMatthias Ringwald  * The number is reported via HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG.
359959e3c06SMatthias Ringwald  * @param acl_handle of the AG
360ce263fc8SMatthias Ringwald  */
361c8626498SMilanka Ringwald void hfp_hf_request_phone_number_for_voice_tag(hci_con_handle_t acl_handle);
3623deb3ec6SMatthias Ringwald 
363667ec068SMatthias Ringwald /*
364a0ffb263SMatthias Ringwald  * @brief Query the list of current calls in AG.
365a0ffb263SMatthias Ringwald  * The result is received via HFP_SUBEVENT_ENHANCED_CALL_STATUS.
366959e3c06SMatthias Ringwald  * @param acl_handle of the AG
367667ec068SMatthias Ringwald  */
368c8626498SMilanka Ringwald void hfp_hf_query_current_call_status(hci_con_handle_t acl_handle);
369667ec068SMatthias Ringwald 
370667ec068SMatthias Ringwald /*
371a0ffb263SMatthias Ringwald  * @brief Release a call with index in the AG.
372959e3c06SMatthias Ringwald  * @param acl_handle of the AG
373a0ffb263SMatthias Ringwald  * @param index
374667ec068SMatthias Ringwald  */
375c8626498SMilanka Ringwald void hfp_hf_release_call_with_index(hci_con_handle_t acl_handle, int index);
376667ec068SMatthias Ringwald 
377667ec068SMatthias Ringwald /*
378a0ffb263SMatthias Ringwald  * @brief Place all parties of a multiparty call on hold with the
379a0ffb263SMatthias Ringwald  * exception of the specified call.
380959e3c06SMatthias Ringwald  * @param acl_handle of the AG
381a0ffb263SMatthias Ringwald  * @param index
382667ec068SMatthias Ringwald  */
383c8626498SMilanka Ringwald void hfp_hf_private_consultation_with_call(hci_con_handle_t acl_handle, int index);
384667ec068SMatthias Ringwald 
385667ec068SMatthias Ringwald /*
386a0ffb263SMatthias Ringwald  * @brief Query the status of the “Response and Hold” state of the AG.
387a0ffb263SMatthias Ringwald  * The result is reported via HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS.
388959e3c06SMatthias Ringwald  * @param acl_handle of the AG
389667ec068SMatthias Ringwald  */
390c8626498SMilanka Ringwald void hfp_hf_rrh_query_status(hci_con_handle_t acl_handle);
391667ec068SMatthias Ringwald 
392667ec068SMatthias Ringwald /*
393a0ffb263SMatthias Ringwald  * @brief Put an incoming call on hold in the AG.
394959e3c06SMatthias Ringwald  * @param acl_handle of the AG
395667ec068SMatthias Ringwald  */
396c8626498SMilanka Ringwald void hfp_hf_rrh_hold_call(hci_con_handle_t acl_handle);
397667ec068SMatthias Ringwald 
398667ec068SMatthias Ringwald /*
399a0ffb263SMatthias Ringwald  * @brief Accept held incoming call in the AG.
400959e3c06SMatthias Ringwald  * @param acl_handle of the AG
401667ec068SMatthias Ringwald  */
402c8626498SMilanka Ringwald void hfp_hf_rrh_accept_held_call(hci_con_handle_t acl_handle);
403667ec068SMatthias Ringwald 
404667ec068SMatthias Ringwald /*
405a0ffb263SMatthias Ringwald  * @brief Reject held incoming call in the AG.
406959e3c06SMatthias Ringwald  * @param acl_handle of the AG
407667ec068SMatthias Ringwald  */
408c8626498SMilanka Ringwald void hfp_hf_rrh_reject_held_call(hci_con_handle_t acl_handle);
409667ec068SMatthias Ringwald 
410667ec068SMatthias Ringwald /*
411a0ffb263SMatthias Ringwald  * @brief Query the AG subscriber number.
412a0ffb263SMatthias Ringwald  * The result is reported via HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION.
413959e3c06SMatthias Ringwald  * @param acl_handle of the AG
414667ec068SMatthias Ringwald  */
415c8626498SMilanka Ringwald void hfp_hf_query_subscriber_number(hci_con_handle_t acl_handle);
416667ec068SMatthias Ringwald 
417667ec068SMatthias Ringwald /*
418a0ffb263SMatthias Ringwald  * @brief Set HF indicator.
419959e3c06SMatthias Ringwald  * @param acl_handle of the AG
420a0ffb263SMatthias Ringwald  * @param assigned_number
421a0ffb263SMatthias Ringwald  * @param value
422667ec068SMatthias Ringwald  */
423c8626498SMilanka Ringwald void hfp_hf_set_hf_indicator(hci_con_handle_t acl_handle, int assigned_number, int value);
424667ec068SMatthias Ringwald 
425d7f6b5cbSMatthias Ringwald /*
426d7f6b5cbSMatthias Ringwald  * @brief Tests if in-band ringtone is active on AG (requires SLC)
427d7f6b5cbSMatthias Ringwald  * @aram acl_handler of the AG
428d7f6b5cbSMatthias Ringwald  */
429d7f6b5cbSMatthias Ringwald int hfp_hf_in_band_ringtone_active(hci_con_handle_t acl_handle);
430d7f6b5cbSMatthias Ringwald 
43120b2edb6SMatthias Ringwald /**
43220b2edb6SMatthias Ringwald  * @brief De-Init HFP HF
43320b2edb6SMatthias Ringwald  */
43420b2edb6SMatthias Ringwald void hfp_hf_deinit(void);
43520b2edb6SMatthias Ringwald 
4363deb3ec6SMatthias Ringwald /* API_END */
4373deb3ec6SMatthias Ringwald 
4383deb3ec6SMatthias Ringwald #if defined __cplusplus
4393deb3ec6SMatthias Ringwald }
4403deb3ec6SMatthias Ringwald #endif
4413deb3ec6SMatthias Ringwald 
44280e33422SMatthias Ringwald #endif // BTSTACK_HFP_HF_H
443