blob: 54707e51b73f8bcb8856ac86665f9e1355c8df5a [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001/*-----------------------------------------------------------------------------------------------*/
2/**
3 @file ql_ms_voice.h
4 @brief Voice service DSDA API.
5*/
6/*-----------------------------------------------------------------------------------------------*/
7
8/*-------------------------------------------------------------------------------------------------
9 Copyright (c) 2019 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
10 Quectel Wireless Solution Proprietary and Confidential.
11-------------------------------------------------------------------------------------------------*/
12
13/*-------------------------------------------------------------------------------------------------
14 EDIT HISTORY
15 This section contains comments describing changes made to the file.
16 Notice that changes are listed in reverse chronological order.
17 $Header: $
18 when who what, where, why
19 -------- --- ----------------------------------------------------------
20 20210622 Rambo.shan Created, Added Voice DSDA API.
21-------------------------------------------------------------------------------------------------*/
22
23#ifndef __QL_MS_VOICE_H__
24#define __QL_MS_VOICE_H__
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <stdint.h>
31#include "ql_voice.h"
32
33typedef void (*ql_ms_voice_ecall_status_cb_f)(int sim_id, uint32_t id,
34 QL_VOICE_ECALL_MSD_TRANS_STATUS_E status);
35
36typedef void (*ql_ms_voice_ecall_event_cb_f)(int sim_id, ql_voice_ecall_event_t *p_event);
37
38typedef void (*ql_ms_voice_call_cb_f)(int sim_id, ql_voice_record_array_t *p_arr);
39
40/** voice dtmf event callback */
41typedef void (*ql_ms_voice_dtmf_cb_f)(int sim_id, uint32_t id, QL_VOICE_DTMF_EVENT_E event,
42 char *digits, int len); /**< len: length of digits */
43
44/*-----------------------------------------------------------------------------------------------*/
45/**
46 @brief Initializes voice service.
47 @return Whether the voice service was initialized successfully.
48 @retval QL_ERR_OK successful.
49 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
50 @retval Other error code defined by ql_type.h.
51 */
52/*-----------------------------------------------------------------------------------------------*/
53int ql_ms_voice_init(void);
54
55/*-----------------------------------------------------------------------------------------------*/
56/**
57 @brief Deinitializes voice service.
58 @return Whether the voice service was deinitialized successfully.
59 @retval QL_ERR_OK successful.
60 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
61 @retval Other error code defined by ql_type.h.
62 */
63/*-----------------------------------------------------------------------------------------------*/
64int ql_ms_voice_deinit(void);
65
66/*-----------------------------------------------------------------------------------------------*/
67/**
68 @brief Dials a call.
69 @param[in] num phone number to dial.
70 @param[in] len length of phone number, should be less than
71 or euqnal to QL_VOICE_MAX_PHONE_NUMBER.
72 @param[out] id call id.
73 @return Whether a voice call was successfully dialed.
74 @retval QL_ERR_OK successful.
75 @retval QL_ERR_INVALID_ARG invalid argument.
76 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
77 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
78 @retval Other error code defined by ql_type.h.
79 */
80/*-----------------------------------------------------------------------------------------------*/
81int ql_ms_voice_dial(int sim_id, char *num, int len, uint32_t *id);
82
83/*-----------------------------------------------------------------------------------------------*/
84/**
85 @brief Cancels dialing with given id.
86 @param[in] id call id returned from dial.
87 @return Whether the voice call was successfully cancelled.
88 @retval QL_ERR_OK successful.
89 @retval QL_ERR_INVALID_ARG invalid argument.
90 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
91 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
92 @retval Other error code defined by ql_type.h.
93 */
94/*-----------------------------------------------------------------------------------------------*/
95int ql_ms_voice_cancel_dial(int sim_id, uint32_t id);
96
97/*-----------------------------------------------------------------------------------------------*/
98/**
99 @brief hangup all dialing.
100 @return Whether all voice call were successfully hangup.
101 @retval QL_ERR_OK successful.
102 @retval QL_ERR_INVALID_ARG invalid argument.
103 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
104 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
105 @retval Other error code defined by ql_type.h.
106 */
107/*-----------------------------------------------------------------------------------------------*/
108int ql_ms_voice_hangup_all(int sim_id);
109
110/*-----------------------------------------------------------------------------------------------*/
111/**
112 @brief Answers the call.
113 @param[in] id call id returned from dial.
114 @return Whether the voice call was successfully answered.
115 @retval QL_ERR_OK successful.
116 @retval QL_ERR_INVALID_ARG invalid argument.
117 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
118 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
119 @retval Other error code defined by ql_type.h.
120 */
121/*-----------------------------------------------------------------------------------------------*/
122int ql_ms_voice_answer(int sim_id, uint32_t id);
123
124/*-----------------------------------------------------------------------------------------------*/
125/**
126 @brief Hangs up the call.
127 @param[in] id call id returned from dial.
128 @return Whether the voice call was successfully hung up.
129 @retval QL_ERR_OK successful.
130 @retval QL_ERR_INVALID_ARG invalid argument.
131 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
132 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
133 @retval Other error code defined by ql_type.h.
134 */
135/*-----------------------------------------------------------------------------------------------*/
136int ql_ms_voice_hangup(int sim_id, uint32_t id);
137
138/*-----------------------------------------------------------------------------------------------*/
139/**
140 @brief Holds the call when mutil calls is activated.
141 @param[in] id call id returned from dial.
142 @return Whether the voice call was successfully held.
143 @retval QL_ERR_OK successful.
144 @retval QL_ERR_INVALID_ARG invalid argument.
145 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
146 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
147 @retval Other error code defined by ql_type.h.
148 */
149/*-----------------------------------------------------------------------------------------------*/
150int ql_ms_voice_hold(int sim_id, uint32_t id);
151
152/*-----------------------------------------------------------------------------------------------*/
153/**
154 @brief Releases the call from hold when mutil calls is activated.
155 @param[in] id call id returned from dial.
156 @return Whether the voice call was successfully unheld.
157 @retval QL_ERR_OK successful.
158 @retval QL_ERR_INVALID_ARG invalid argument.
159 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
160 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
161 @retval Other error code defined by ql_type.h.
162 */
163/*-----------------------------------------------------------------------------------------------*/
164int ql_ms_voice_unhold(int sim_id, uint32_t id);
165
166/*-----------------------------------------------------------------------------------------------*/
167/**
168 @brief Gets call records.
169 @param[in] p_arr pointer to ql_voice_record_array_t.
170 @return Whether the call records were successfully obtained.
171 @retval QL_ERR_OK successful.
172 @retval QL_ERR_INVALID_ARG invalid argument.
173 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
174 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
175 @retval Other error code defined by ql_type.h.
176 */
177/*-----------------------------------------------------------------------------------------------*/
178int ql_ms_voice_get_records(int sim_id, ql_voice_record_array_t *p_arr);
179
180/*-----------------------------------------------------------------------------------------------*/
181/**
182 @brief Registers or Unregisters forwarding.
183 @param[in] reg 0 - unregister, 1 - register.
184 @param[in] cond forwarding condition.
185 @param[in] num phone number.
186 @param[in] len length of phone numebr.
187 @return Whether the voice call forward was registered or unregistered successfully.
188 @retval QL_ERR_OK successful.
189 @retval QL_ERR_INVALID_ARG invalid argument.
190 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
191 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
192 @retval Other error code defined by ql_type.h.
193 */
194/*-----------------------------------------------------------------------------------------------*/
195int ql_ms_voice_forwarding(int sim_id, int reg, QL_VOICE_FW_COND_E cond, char *num, int len);
196
197/*-----------------------------------------------------------------------------------------------*/
198/**
199 @brief Gets forwarding status.
200 @param[in] cond forwarding condition.
201 @param[out] p_status pointer to ql_voice_fw_status_t.
202 @return Whether the voice call forward status was successfully obtained.
203 @retval QL_ERR_OK successful.
204 @retval QL_ERR_INVALID_ARG invalid argument.
205 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
206 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
207 @retval Other error code defined by ql_type.h.
208 */
209/*-----------------------------------------------------------------------------------------------*/
210int ql_ms_voice_get_forwarding_status(int sim_id, QL_VOICE_FW_COND_E cond, ql_voice_fw_status_t *p_status);
211
212/*-----------------------------------------------------------------------------------------------*/
213/**
214 @brief Enables or disables call waiting.
215 @param[in] enable 0 - disable, other - enable.
216 @return Whether the voice call waiting was enabled or disabled successfully.
217 @retval QL_ERR_OK successful.
218 @retval QL_ERR_INVALID_ARG invalid argument.
219 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
220 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
221 @retval Other error code defined by ql_type.h.
222 */
223/*-----------------------------------------------------------------------------------------------*/
224int ql_ms_voice_waiting(int sim_id, int enable);
225
226/*-----------------------------------------------------------------------------------------------*/
227/**
228 @brief Gets call waiting status.
229 @param[out] enabled 0 - waiting is disabled, 1 - waiting is enabled.
230 @return Whether the voice call waiting status was successfully obtained.
231 @retval QL_ERR_OK successful.
232 @retval QL_ERR_INVALID_ARG invalid argument.
233 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
234 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
235 @retval Other error code defined by ql_type.h.
236 */
237/*-----------------------------------------------------------------------------------------------*/
238int ql_ms_voice_get_waiting_status(int sim_id, int *enabled);
239
240/*-----------------------------------------------------------------------------------------------*/
241/**
242 @brief Enables or disables auto answer.
243 @param[in] enable 0 - disable, other - enable.
244 @param[in] sec wait this `sec' seconds before auto answer.
245 @return Whether the voice call autoanswer was enabled or disabled successfully.
246 @retval QL_ERR_OK successful.
247 @retval QL_ERR_INVALID_ARG invalid argument.
248 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
249 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
250 @retval Other error code defined by ql_type.h.
251 */
252/*-----------------------------------------------------------------------------------------------*/
253int ql_ms_voice_autoanswer(int sim_id, int enable, uint32_t sec);
254
255/*-----------------------------------------------------------------------------------------------*/
256/**
257 @brief Sends a DTMF(Dual Tone Multi Frequency) character over the call ID.
258 @param[in] id call id returned from dial.
259 @param[in] c DTMF character to be sent. Valid DTMF characters are 0-9, A-D, '*', '#'.
260 @return Whether a DTMF character was successfully sent.
261 @retval QL_ERR_OK successful.
262 @retval QL_ERR_INVALID_ARG invalid argument.
263 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
264 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
265 @retval Other error code defined by ql_type.h.
266 */
267/*-----------------------------------------------------------------------------------------------*/
268int ql_ms_voice_send_dtmf_char(int sim_id, uint32_t id, char c);
269
270/*-----------------------------------------------------------------------------------------------*/
271/**
272 @brief Sets voice call callback handler.
273 @param[in] cb call back handler.
274 @return Whether the voice call callback handler was successfully set.
275 @retval QL_ERR_OK successful.
276 @retval QL_ERR_INVALID_ARG invalid argument.
277 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
278 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
279 @retval Other error code defined by ql_type.h.
280 */
281/*-----------------------------------------------------------------------------------------------*/
282int ql_ms_voice_set_call_cb(int sim_id, ql_ms_voice_call_cb_f cb);
283
284/*-----------------------------------------------------------------------------------------------*/
285/**
286 @brief Sets voice dtmf callback handler.
287 @param[in] cb call back handler.
288 @return Whether the voice call DTMF repcetion callback handler was successfully set.
289 @retval QL_ERR_OK successful.
290 @retval QL_ERR_INVALID_ARG invalid argument.
291 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
292 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
293 @retval Other error code defined by ql_type.h.
294 */
295/*-----------------------------------------------------------------------------------------------*/
296int ql_ms_voice_set_dtmf_cb(int sim_id, ql_ms_voice_dtmf_cb_f cb);
297
298/*-----------------------------------------------------------------------------------------------*/
299/**
300 @brief Dials eCall.
301 @param[in] p_info eCall info.
302 @return Whether a eCall was successfully dialed.
303 @retval QL_ERR_OK successful.
304 @retval QL_ERR_INVALID_ARG invalid argument.
305 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
306 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
307 @retval Other error code defined by ql_type.h.
308 */
309/*-----------------------------------------------------------------------------------------------*/
310int ql_ms_voice_ecall_dial(int sim_id, ql_voice_ecall_info_t *p_info);
311
312/*-----------------------------------------------------------------------------------------------*/
313/**
314 @brief Hangs up eCall.
315 @return Whether the eCall was successfully hung up.
316 @retval QL_ERR_OK successful.
317 @retval QL_ERR_INVALID_ARG invalid argument.
318 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
319 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
320 @retval Other error code defined by ql_type.h.
321 */
322/*-----------------------------------------------------------------------------------------------*/
323int ql_ms_voice_ecall_hangup(int sim_id);
324
325/*-----------------------------------------------------------------------------------------------*/
326/**
327 @brief Updates eCall MSD.
328 @param[in] msd Minimum Set of Data.
329 @param[in] msd_len Length of Minimum Set of Data.
330 @return Whether the eCall MSD was successfully updated.
331 @retval QL_ERR_OK successful.
332 @retval QL_ERR_INVALID_ARG invalid argument.
333 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
334 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
335 @retval Other error code defined by ql_type.h.
336 */
337/*-----------------------------------------------------------------------------------------------*/
338int ql_ms_voice_ecall_update_msd(int sim_id, const uint8_t *msd, uint32_t msd_len);
339
340/*-----------------------------------------------------------------------------------------------*/
341/**
342 @brief Pushes eCall MSD.
343 @param[out] state eCall state.
344 @return Whether the eCall MSD was successfully pushed.
345 @retval QL_ERR_OK successful.
346 @retval QL_ERR_INVALID_ARG invalid argument.
347 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
348 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
349 @retval Other error code defined by ql_type.h.
350 */
351/*-----------------------------------------------------------------------------------------------*/
352int ql_ms_voice_ecall_push_msd(int sim_id, QL_VOICE_ECALL_STATE_E *state);
353
354/*-----------------------------------------------------------------------------------------------*/
355/**
356 @brief Gets eCall config.
357 @param[in] p_config eCall config.
358 @return Whether the eCall config was successfully obtained.
359 @retval QL_ERR_OK successful.
360 @retval QL_ERR_INVALID_ARG invalid argument.
361 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
362 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
363 @retval Other error code defined by ql_type.h.
364 */
365/*-----------------------------------------------------------------------------------------------*/
366int ql_ms_voice_ecall_get_config(int sim_id, ql_voice_ecall_config_t *p_config);
367
368/*-----------------------------------------------------------------------------------------------*/
369/**
370 @brief Sets eCall config.
371 @param[in] item Items to set.
372 @param[in] p_config eCall config.
373 @return Whether the eCall config was successfully set.
374 @retval QL_ERR_OK successful.
375 @retval QL_ERR_INVALID_ARG invalid argument.
376 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
377 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
378 @retval Other error code defined by ql_type.h.
379 */
380/*-----------------------------------------------------------------------------------------------*/
381int ql_ms_voice_ecall_set_config(int sim_id, int item, ql_voice_ecall_config_t *p_config);
382
383/*-----------------------------------------------------------------------------------------------*/
384/**
385 @brief Sets eCall event callback handler.
386 @param[in] cb call back handler.
387 @return Whether the eCall event callback handler was successfully set.
388 @retval QL_ERR_OK successful.
389 @retval QL_ERR_INVALID_ARG invalid argument.
390 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
391 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
392 @retval Other error code defined by ql_type.h.
393 */
394/*-----------------------------------------------------------------------------------------------*/
395int ql_ms_voice_ecall_set_event_cb(int sim_id, ql_ms_voice_ecall_event_cb_f cb);
396
397/*-----------------------------------------------------------------------------------------------*/
398/**
399 @brief Sets eCall status callback handler.
400 @param[in] cb call back handler.
401 @return Whether the eCall status callback handler was successfully set.
402 @retval QL_ERR_OK successful.
403 @retval QL_ERR_INVALID_ARG invalid argument.
404 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
405 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
406 @retval Other error code defined by ql_type.h.
407 */
408/*-----------------------------------------------------------------------------------------------*/
409int ql_ms_voice_ecall_set_status_cb(int sim_id, ql_ms_voice_ecall_status_cb_f cb);
410
411/*-----------------------------------------------------------------------------------------------*/
412/**
413 @brief Registration server error callback. Currently, only if the server exits abnormally,
414 the callback function will be executed, and the error code is QL_ERR_ABORTED;
415 @param[in] cb Callback function
416 @return
417 QL_ERR_OK - successful
418 Other - error code defined by ql_type.h
419 */
420/*-----------------------------------------------------------------------------------------------*/
421int ql_ms_voice_set_service_error_cb(ql_voice_service_error_cb_f cb);
422
423#ifdef __cplusplus
424}
425#endif
426
427#endif /* __QL_VOICE_H__ */
428