1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
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 #ifndef TELEPHONY_IMS_CALL_TYPES_H
17 #define TELEPHONY_IMS_CALL_TYPES_H
18 
19 #include "call_manager_errors.h"
20 #include "call_manager_inner_type.h"
21 #include "tel_ril_call_parcel.h"
22 #include "ims_core_service_types.h"
23 
24 namespace OHOS {
25 namespace Telephony {
26 const int32_t kMaxNumberLength = 255;
27 const int32_t SLOT_0 = 0;
28 const int32_t SLOT_1 = 1;
29 
30 /**
31  * @brief Indicates the reason for rejecting the ims call.
32  */
33 enum ImsRejectReason {
34     /**
35      * Indicates the reject reason is user busy.
36      */
37     USER_IS_BUSY = 0,
38     /**
39      * Indicates the reject reason is user decline.
40      */
41     USER_DECLINE = 1,
42 };
43 
44 /**
45  * @brief Indicates the class of Ims service,which used in IMS Set Call Waiting interface.
46  */
47 enum ImsServiceClass {
48     /**
49      * Indicates service class is voice.
50      */
51     SERVICE_CLASS_VOICE = 1,
52     /**
53      * Indicates service class is video.
54      */
55     SERVICE_CLASS_VIDEO = 2,
56 };
57 
58 /**
59  * @brief Indicates the state of Srvcc.
60  */
61 enum SrvccState {
62     /**
63      * Indicates SrvccState is null.
64      */
65     SRVCC_NONE = -1,
66     /**
67      * Indicates SrvccState is started.
68      */
69     STARTED = 0,
70     /**
71      * Indicates SrvccState is completed.
72      */
73     COMPLETED = 1,
74     /**
75      * Indicates SrvccState is failed.
76      */
77     FAILED = 2,
78     /**
79      * Indicates SrvccState is canceled.
80      */
81     CANCELED = 3
82 };
83 
84 enum ImsSrvccAction {
85     ACTION_DIAL,
86     ACTION_HANGUP,
87     ACTION_ANSWER,
88     ACTION_REJECT,
89     ACTION_CONFERENCE,
90     ACTION_SWITCH_CALL,
91     ACTION_SEND_DTMF,
92     ACTION_START_DTMF,
93     ACTION_STOP_DTMF,
94 };
95 
96 /**
97  * @brief Indicates the type of ImsCall.
98  */
99 enum ImsCallType {
100     /**
101      * Indicates the ImsCall type is voice.
102      */
103     TEL_IMS_CALL_TYPE_VOICE,
104     /**
105      * Indicates the ImsCall type is VT_TX.
106      */
107     TEL_IMS_CALL_TYPE_VT_TX,
108     /**
109      * Indicates the ImsCall type is VT_RX.
110      */
111     TEL_IMS_CALL_TYPE_VT_RX,
112     /**
113      * Indicates the ImsCall type is VT.
114      */
115     TEL_IMS_CALL_TYPE_VT,
116     /**
117      * Indicates the ImsCall type is VT call pause.
118      */
119     TEL_IMS_CALL_TYPE_PAUSE,
120 };
121 
122 /**
123  * @brief Indicates the type of video call event.
124  */
125 enum VideoCallEventType {
126     /**
127      * Indicates the camera event failure type.
128      */
129     EVENT_CAMERA_FAILURE = 0,
130     /**
131      * Indicates the camera event ready type.
132      */
133     EVENT_CAMERA_READY,
134     /**
135      * Indicates the display surface release type.
136      */
137     EVENT_RELEASE_DISPLAY_SURFACE = 100,
138     /**
139      * Indicates the preview surface release type.
140      */
141     EVENT_RELEASE_PREVIEW_SURFACE,
142 };
143 
144 /**
145  * @brief Indicates the result of ImsCall mode request.
146  */
147 enum ImsCallModeRequestResult {
148     /**
149      * Indicates the ImsCall Mode request success.
150      */
151     MODIFY_REQUEST_SUCCESS = 0,
152     /**
153      * Indicates the ImsCall Mode request fail.
154      */
155     MODIFY_REQUEST_FAIL,
156     /**
157      * Indicates the ImsCall Mode request invalid.
158      */
159     MODIFY_REQUEST_INVALID,
160     /**
161      * Indicates the ImsCall Mode request timeout.
162      */
163     MODIFY_REQUEST_TIMED_OUT,
164     /**
165      * Indicates the ImsCall Mode request reject by remote.
166      */
167     MODIFY_REQUEST_REJECTED_BY_REMOTE,
168     /**
169      * Indicates the ImsCall Mode request cancel.
170      */
171     MODIFY_REQUEST_CANCEL,
172     /**
173      * Indicates the ImsCall Mode downgrade RTP time out.
174      */
175     MODIFY_DOWNGRADE_RTP_OR_RTCP_TIMEOUT = 100,
176     /**
177      * Indicates the ImsCall Mode downgrade RTP and RTCP time out.
178      */
179     MODIFY_DOWNGRADE_RTP_AND_RTCP_TIMEOUT,
180 };
181 
182 /**
183  * @brief Indicates the type of ImsCall.
184  */
185 struct ImsSrvccActionInfo {
186     CellularCallInfo callInfo;
187     /**
188      * Indicates the initial value of dtmfCode is 0.
189      */
190     char dtmfCode = 0;
191 };
192 
193 /**
194  * @brief Indicates the code of TransferState.
195  */
196 enum TransferState {
197     /**
198      * Indicates the code value of VT transfer to WFC is 0.
199      */
200     VT_TRANSFER_TO_WFC = 0,
201     /**
202      * Indicates the code value of WFC transfer to VT is 1.
203      */
204     WFC_TRANSFER_TO_VT = 1,
205 };
206 
207 /**
208  * @brief Indicates the information of ImsCall.
209  */
210 struct ImsCallInfo {
211     /**
212      * Indicates the call phone number,its initial value is 0.
213      */
214     char phoneNum[kMaxNumberLength] = { 0 };
215     /**
216      * Indicates the slotId.
217      */
218     int32_t slotId = 0;
219     /**
220      * Indicates the video state,when the audio state is 0 represents audio and 3 represents video.
221      */
222     int32_t videoState = 0;
223     /**
224      * Indicates the call index and its initial value is 0.
225      */
226     int32_t index = 0;
227 };
228 
229 /**
230  * @brief Indicates the call status information.
231  */
232 struct ImsCurrentCall {
233     /**
234      * Indicates connection Index for use with, eg, AT+CHLD.
235      */
236     int32_t index = 0;
237     /**
238      * Indicates the call direction, The value 0 indicates mobile originated (MO) call,
239      * and the value 1 indicates mobile terminated (MT) call.
240      */
241     int32_t dir = 0;
242     /**
243      * Indicates the call state:
244      * - 0: activated state
245      * - 1: holding state
246      * - 2: MO call, dialing state
247      * - 3: MO call, alerting state
248      * - 4: MT call, incoming call state
249      * - 5: MT call, call waiting state
250      */
251     int32_t state = 0;
252     /**
253      * Indicates the call mode:
254      * - 0: voice call
255      * - 1: data call
256      * - 2: fax
257      */
258     int32_t mode = 0;
259     /**
260      * Indicates the multiparty call status:
261      * - 0: not one of multiparty (conference) call parties
262      * - 1: one of multiparty (conference) call parties
263      */
264     int32_t mpty = 0;
265     /**
266      * Identifies the service domain:
267      * - 0: CS domain phone
268      * - 1: IMS domain phone
269      */
270     int32_t voiceDomain = 0;
271     /**
272      * Indicates the call type:
273      * - 0: Voice call
274      * - 1: VT_TX Video call: send one-way video, two-way voice
275      * - 2: VT_RX Video call: one-way receiving video, two-way voice
276      * - 3: VT Video call: two-way video, two-way voice
277      */
278     ImsCallType callType = ImsCallType::TEL_IMS_CALL_TYPE_VOICE;
279     /**
280      * Indicates remote party number.
281      */
282     std::string number = "";
283     /**
284      * Indicates remote party name.
285      */
286     std::string name = "";
287     /**
288      * Indicates the type of address octet in integer format.
289      */
290     int32_t type = 0;
291     /**
292      * Indicates alphanumeric representation of <number> corresponding to the entry found in phonebook;
293      */
294     std::string alpha = "";
295     /**
296      * Indicates the type of address, eg 145 = intl.
297      */
298     int32_t toa = 0;
299     /**
300      * Indicates the color tone type.
301      */
302     int32_t toneType = 0;
303     /**
304      * Indicates the initial type of this call.
305      */
306     int32_t callInitialType = 0;
307 };
308 
309 /**
310  * @brief Indicates the call status information list.
311  */
312 struct ImsCurrentCallList {
313     /**
314      * Indicates the size of call status information list.
315      */
316     int32_t callSize = 0;
317     /**
318      * Indicates the ID of call status information list.
319      */
320     int32_t flag = 0;
321     /**
322      * Indicates the call status information list.
323      */
324     std::vector<ImsCurrentCall> calls {};
325 };
326 
327 /**
328  * @brief Indicates the call mode information.
329  */
330 struct ImsCallModeReceiveInfo {
331     /**
332      * Indicates connection Index of call.
333      */
334     int32_t callIndex = 0;
335     /**
336      * Indicates response result.
337      */
338     ImsCallModeRequestResult result = ImsCallModeRequestResult::MODIFY_REQUEST_SUCCESS;
339     /**
340      * Indicates the call type:
341      * - 0: Voice call
342      * - 1: VT_TX Video call: send one-way video, two-way voice
343      * - 2: VT_RX Video call: one-way receiving video, two-way voice
344      * - 3: VT Video call: two-way video, two-way voice
345      */
346     ImsCallType callType = ImsCallType::TEL_IMS_CALL_TYPE_VOICE;
347 };
348 
349 /**
350  * @brief Indicates the call session event information.
351  */
352 struct ImsCallSessionEventInfo {
353     /**
354      * Indicates connection Index of call.
355      */
356     int32_t callIndex = 0;
357     /**
358      * Indicates the call  session event type:
359      * - 0: Indicates the camera event failure type.
360      * - 1: Indicates the camera event ready type.
361      * - 2: Indicates the display surface release type.
362      * - 3: Indicates the preview surface release type.
363      */
364     VideoCallEventType eventType = VideoCallEventType::EVENT_CAMERA_FAILURE;
365 };
366 
367 /**
368  * @brief Indicates the video window width and height in video call.
369  */
370 struct ImsCallPeerDimensionsInfo {
371     /**
372      * Indicates connection Index of call.
373      */
374     int32_t callIndex = 0;
375     /**
376      * the width of video window
377      */
378     int32_t width = 0;
379     /**
380      * the height of video window
381      */
382     int32_t height = 0;
383 };
384 
385 /**
386  * @brief Indicates the ims video call data usage info
387  */
388 struct ImsCallDataUsageInfo {
389     /**
390      * Indicates connection Index of call.
391      */
392     int32_t callIndex = 0;
393     /**
394      * the data usage info
395      */
396     int64_t dataUsage = 0;
397 };
398 
399 /**
400  * @brief Indicates camera capabilities info in ims video call
401  */
402 struct CameraCapabilitiesInfo {
403     /**
404      * Indicates connection Index of call.
405      */
406     int32_t callIndex = 0;
407     /**
408      * the width of video window
409      */
410     int32_t width = 0;
411     /**
412      * the height of video window
413      */
414     int32_t height = 0;
415 };
416 } // namespace Telephony
417 } // namespace OHOS
418 
419 #endif // TELEPHONY_IMS_CALL_TYPES_H
420