blob: 7d4e0380fb2386933eacc524a7505691bc102ac3 [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001/**
2 @file
3 ql_voice.h
4
5 @brief
6 This file provides the definitions for voice, and declares the
7 API functions.
8
9*/
10/*============================================================================
11 Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
12 Quectel Wireless Solution Proprietary and Confidential.
13 =============================================================================*/
14/*===========================================================================
15
16 EDIT HISTORY FOR MODULE
17
18This section contains comments describing changes made to the module.
19Notice that changes are listed in reverse chronological order.
20
21
22WHEN WHO WHAT, WHERE, WHY
23---------- ------------ ----------------------------------------------------
2414/11/2019 gunner.yang create
2506/01/2020 pony.made add net_state
2618/02/2020 gale.gao Add API: imsd get, wait status get, voice unhold;
27=============================================================================*/
28
29#ifndef __QL_VOICE_H__
30#define __QL_VOICE_H__
31
32#include <stdlib.h>
33#include <stdint.h>
34#include <string.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40typedef enum
41{
42 QL_VOICE_SUCCESS,
43 QL_VOICE_GENERIC_FAILURE,
44 QL_VOICE_RADIO_NOT_AVAILABLE,
45}QL_VOICE_ERROR_CODE;
46
47typedef enum{
48 GSM = 0,
49 GSM_COMPACT,
50 GSM_wEGPRS,
51 UTRAN,
52 UTRAN_wHSDPA,
53 UTRAN_wHSUPA,
54 UTRAN_wHSDPA_HSUPA,
55 E_UTRAN,
56 UTRAN_HSPA_PLUS,
57}QL_REG_STATE;
58
59typedef enum{
60 REASON_INVALID=-1,
61 REASON_UNCONDITIONAL =0,
62 REASON_DEVICE_BUSY =1,
63 REASON_DEVICE_NO_REPLY =2,
64 REASON_DEVICE_UNREACHABLE =3,
65 REASON_DEVICE_ALL_FORWARDING =4,
66 REASON_DEVICE_ALL_CONDITIONAL =5,
67}QL_VOICE_CALL_FW_REASON;
68
69typedef enum{
70 MODE_DISABLE=0,
71 MODE_ENABLE,
72 MODE_QUERY_STATUS,
73 MODE_REGISTRATION,
74 MODE_ERASURE,
75}QL_VOICE_CALL_FW_MODE;
76
77typedef struct
78{
79 int status;
80 int fw_class;
81 char num[20];
82 int type;
83 char subaddr[20];
84 int satype;
85 int time;
86} ql_voice_call_fw_list_t;
87
88typedef enum {
89 QL_CALL_ACTIVE = 0,
90 QL_CALL_HOLDING = 1,
91 QL_CALL_DIALING = 2, /* MO call only */
92 QL_CALL_ALERTING = 3, /* MO call only */
93 QL_CALL_INCOMING = 4, /* MT call only */
94 QL_CALL_WAITING = 5, /* MT call only */
95 QL_CALL_OFFERING = 6, /*MT call offering (call setup)*/
96 QL_CALL_DISCONNECTING = 7, /*call in disconnect procedure*/
97 QL_CALL_DISCONNECTED = 8, /*call is disconnected*/
98} QL_CallState;
99
100typedef struct
101{
102 int idx; /*call index, identification number*/
103 int dir; /*0: mobile originated(MO) call, 1: mobile terminated(MT) call*/
104 int state; /*define in QL_CallState*/
105 char number[20]; /*string type phone number in format specified by <type>*/
106 int type; /*type of address octet in interger format(refer TS24.008 subclause 10.5.4.7)*/
107}ql_voice_call_item;
108
109typedef struct
110{
111 int count;
112 ql_voice_call_item items[16];
113}ql_voice_call_list_t;
114/*
115 callbackfunction prototype
116*/
117typedef void (*QL_VOICE_EventHandlerFunc_t)(QL_CallState voice_flag, char *number,void *contextPtr);
118
119QL_VOICE_ERROR_CODE ql_voice_call_init ();
120QL_VOICE_ERROR_CODE ql_voice_call_release();
121
122/*
123 Register voice call event.
124 -handlerPtr : user_cb
125 -contextPtr : user_cb_data
126*/
127QL_VOICE_ERROR_CODE ql_voice_call_event_register(QL_VOICE_EventHandlerFunc_t handlerPtr, void* contextPtr);
128
129
130/*
131 Phone call.
132 -call_num : dst phone number
133*/
134QL_VOICE_ERROR_CODE ql_voice_call_start(char* call_num);
135
136
137/*
138 Put through.
139*/
140QL_VOICE_ERROR_CODE ql_voice_call_answer();
141QL_VOICE_ERROR_CODE ql_voice_auto_answer(int seconds);
142
143
144/*
145 Hang up.
146*/
147QL_VOICE_ERROR_CODE ql_voice_call_end();
148
149
150/* dfmf call */
151QL_VOICE_ERROR_CODE ql_voice_call_dtmf(char *dtmf,int duration);
152
153/* get voice net state
154 * Just use in call to judge Volte or CS-vioce
155 * regstate:
156 * 7 -> Volte call
157 * else -> CS call
158*/
159QL_VOICE_ERROR_CODE ql_voice_call_get_regstate(int* regstate);
160
161/* set imsd value
162 1: open votle
163 0: close votle
164 */
165QL_VOICE_ERROR_CODE ql_voice_call_set_imsd(int imsd);
166
167/* get imsd value
168 1: open volte
169 0: close volte
170 */
171QL_VOICE_ERROR_CODE ql_voice_call_get_imsd(int *imsd);
172
173/* set call wait
174 0: close
175 1: open */
176QL_VOICE_ERROR_CODE ql_voice_call_set_wait(int wait);
177
178/* get call wait status
179 0: close
180 1: open */
181QL_VOICE_ERROR_CODE ql_voice_call_get_wait(int *wait);
182
183/* hold the voice */
184QL_VOICE_ERROR_CODE ql_voice_call_hold();
185
186/* unhold the voice */
187QL_VOICE_ERROR_CODE ql_voice_call_unhold();
188
189QL_VOICE_ERROR_CODE ql_voice_call_fw_set(QL_VOICE_CALL_FW_REASON reason, QL_VOICE_CALL_FW_MODE mode, char *num);
190
191QL_VOICE_ERROR_CODE ql_voice_call_fw_query(QL_VOICE_CALL_FW_REASON reason, ql_voice_call_fw_list_t *resp_data);
192
193/**
194 * get the current call list, same as AT+CLCC
195*/
196QL_VOICE_ERROR_CODE ql_voice_call_get_current_list(ql_voice_call_list_t *resp_data);
197#ifdef __cplusplus
198}
199#endif
200
201#endif