• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Winner Microelectronics Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @file    wm_bt_hf_client.h
18  *
19  * @brief   Bluetooth API
20  *
21  * @author  WinnerMicro
22  *
23  * Copyright (c) 2020 Winner Microelectronics Co., Ltd.
24  */
25 
26 #ifndef __WM_BT_HF_CLIENT_H__
27 #define __WM_BT_HF_CLIENT_H__
28 
29 #include "wm_bt.h"
30 /**
31  * @defgroup BT_APIs Bluetooth APIs
32  * @brief Bluetooth related APIs
33  */
34 
35 /**
36  * @addtogroup BT_APIs
37  * @{
38  */
39 
40 /**
41  * @defgroup BT_HF_CLIENT_APIs
42  * @brief BT_HF_CLIENT APIs
43  */
44 
45 /**
46  * @addtogroup BT_HF_CLIENT_APIs
47  * @{
48  */
49 
50 /**
51  * @brief         initializes the hf client interface
52  *
53  * @param[in]     callback    pointer on callback function
54  *
55  * @retval         @ref tls_bt_status_t
56  *
57  * @note           None
58  */
59 tls_bt_status_t tls_bt_hf_client_init(tls_bthf_client_callback_t callback);
60 
61 /**
62  * @brief          Closes the HF client interface
63  *
64  * @param       None
65  *
66  * @retval         @ref tls_bt_status_t
67  *
68  * @note           None
69  */
70 tls_bt_status_t tls_bt_hf_client_deinit(void);
71 
72 /**
73  * @brief          connect to audio gateway
74  *
75  * @param[in]      *bd_addr         remote device bluetooth device address
76  *
77  * @retval         @ref tls_bt_status_t
78  *
79  * @note           None
80  */
81 tls_bt_status_t tls_bt_hf_client_connect(tls_bt_addr_t *bd_addr);
82 
83 /**
84  * @brief          disconnect from audio gateway
85  *
86  * @param[in]      *bd_addr         remote device bluetooth device address
87  *
88  * @retval         @ref tls_bt_status_t
89  *
90  * @note           None
91  */
92 
93 tls_bt_status_t tls_bt_hf_client_disconnect(tls_bt_addr_t *bd_addr);
94 
95 /**
96  * @brief           create an audio connection
97  *
98  * @param[in]      *bd_addr         remote device bluetooth device address
99  *
100  * @retval         @ref tls_bt_status_t
101  *
102  * @note           None
103  */
104 tls_bt_status_t tls_bt_hf_client_connect_audio(tls_bt_addr_t *bd_addr);
105 
106 /**
107  * @brief           close the audio connection
108  *
109  * @param[in]      *bd_addr         remote device bluetooth device address
110  *
111  * @retval         @ref tls_bt_status_t
112  *
113  * @note           None
114  */
115 tls_bt_status_t tls_bt_hf_client_disconnect_audio(tls_bt_addr_t *bd_addr);
116 
117 /**
118  * @brief           start voice recognition
119  *
120  * @param[in]    None
121  *
122  * @retval         @ref tls_bt_status_t
123  *
124  * @note           None
125  */
126 tls_bt_status_t tls_bt_hf_client_start_voice_recognition(void);
127 
128 /**
129  * @brief           stop voice recognition
130  *
131  * @param[in]    None
132  *
133  * @retval         @ref tls_bt_status_t
134  *
135  * @note           None
136  */
137 tls_bt_status_t tls_bt_hf_client_stop_voice_recognition(void);
138 
139 /**
140  * @brief           volume control
141  *
142  * @param[in]    type Mic or speaker
143 
144  * @param[in]    volume index value
145  *
146  * @retval         @ref tls_bt_status_t
147  *
148  * @note           None
149  */
150 tls_bt_status_t tls_bt_hf_client_volume_control(tls_bthf_client_volume_type_t type, int volume);
151 
152 /**
153  * @brief           place a call
154  *
155  * @param[in]    number  phone number to be called
156  *
157  * @retval         @ref tls_bt_status_t
158  *
159  * @note           None
160  */
161 tls_bt_status_t tls_bt_hf_client_dial(const char *number);
162 
163 /**
164  * @brief          place a call with number specified by location (speed dial)
165  *
166  * @param[in]    location
167  *
168  * @retval         @ref tls_bt_status_t
169  *
170  * @note           None
171  */
172 tls_bt_status_t tls_bt_hf_client_dial_memory(int location);
173 
174 /**
175  * @brief           handle specified call related action
176  *
177  * @param[in]    action  call action
178  * @param[in]    idx      index indicator
179  *
180  * @retval         @ref tls_bt_status_t
181  *
182  * @note           None
183  */
184 tls_bt_status_t tls_bt_hf_client_handle_call_action(tls_bthf_client_call_action_t action, int idx);
185 
186 /**
187  * @brief           query list of current calls
188  *
189  * @param[in]    None
190  *
191  * @retval         @ref tls_bt_status_t
192  *
193  * @note           None
194  */
195 
196 tls_bt_status_t tls_bt_hf_client_query_current_calls(void);
197 
198 /**
199  * @brief           query current selected operator name
200  *
201  * @param[in]    None
202  *
203  * @retval         @ref tls_bt_status_t
204  *
205  * @note           None
206  */
207 tls_bt_status_t tls_bt_hf_client_query_current_operator_name(void);
208 
209 /**
210  * @brief            retrieve subscriber number information
211  *
212  * @param[in]    None
213  *
214  * @retval         @ref tls_bt_status_t
215  *
216  * @note           None
217  */
218 
219 tls_bt_status_t tls_bt_hf_client_retrieve_subscriber_info(void);
220 
221 /**
222  * @brief            send dtmf
223  *
224  * @param[in]    code   number code
225  *
226  * @retval         @ref tls_bt_status_t
227  *
228  * @note           None
229  */
230 
231 tls_bt_status_t tls_bt_hf_client_send_dtmf(char code);
232 
233 /**
234  * @brief            Request number from AG for VR purposes
235  *
236  * @param[in]    None
237  *
238  * @retval         @ref tls_bt_status_t
239  *
240  * @note           None
241  */
242 
243 tls_bt_status_t tls_bt_hf_client_request_last_voice_tag_number(void);
244 
245 /**
246  * @brief             Send requested AT command to remote device
247  *
248  * @param[in]    cmd
249  * @param[in]    val1
250  * @param[in]    val2
251  * @param[in]    arg
252  *
253  * @retval         @ref tls_bt_status_t
254  *
255  * @note           None
256  */
257 
258 tls_bt_status_t tls_bt_hf_client_send_at_cmd(int cmd, int val1, int val2, const char *arg);
259 
260 /**
261  * @brief             Send audio to audio gateway
262  *
263  * @param[in]    bd_addr    bluetooth address of audio gateway
264  * @param[in]    p_data      audio data
265  * @param[in]    length       audio length
266  *
267  * @retval         @ref tls_bt_status_t
268  *
269  * @note           None
270  */
271 
272 tls_bt_status_t tls_bt_hf_client_send_audio(tls_bt_addr_t *bd_addr, uint8_t *p_data, uint16_t length);
273 #endif
274