1 /*
2  * Copyright (C) 2021-2023 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 CALL_MANAGER_INNER_TYPE_H
17 #define CALL_MANAGER_INNER_TYPE_H
18 
19 #include "call_manager_base.h"
20 #include "call_manager_disconnected_details.h"
21 #include "call_manager_info.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 /**
26  * @brief Indicates the Call Waiting response result.
27  */
28 struct CallWaitResponse {
29     /**
30      * 0: ok  other: error
31      */
32     int32_t result = 0;
33     /**
34      * parameter sets/shows the result code presentation status in the TA.
35      */
36     int32_t status = 0;
37     /**
38      * parameter shows the subscriber CW service status in the network.
39      */
40     int32_t classCw = 0;
41 };
42 
43 /**
44  * @brief Indicates the Clip response result.
45  */
46 struct ClipResponse {
47     /**
48      * 0: ok  other: error
49      */
50     int32_t result = 0;
51     /**
52      * parameter sets/shows the result code presentation status in the TA.
53      */
54     int32_t action = 0;
55     /**
56      * parameter shows the subscriber CLIP service status in the network.
57      */
58     int32_t clipStat = 0;
59 };
60 
61 /**
62  * @brief Indicates the Clir response result.
63  */
64 struct ClirResponse {
65     /**
66      * 0: ok  other: error
67      */
68     int32_t result = 0;
69     /**
70      * parameter sets/shows the result code presentation status in the TA.
71      */
72     int32_t action = 0;
73     /**
74      * parameter shows the subscriber CLIR service status in the network.
75      */
76     int32_t clirStat = 0;
77 };
78 
79 /**
80  * @brief Indicates the Colr response result.
81  */
82 struct ColrResponse {
83     /**
84      * 0: ok  other: error
85      */
86     int32_t result = 0;
87     /**
88      * parameter sets/shows the result code presentation status in the TA.
89      */
90     int32_t action = 0;
91     /**
92      * parameter shows the subscriber COLR service status in the network.
93      */
94     int32_t colrStat = 0;
95 };
96 
97 /**
98  * @brief Indicates the Colp response result.
99  */
100 struct ColpResponse {
101     /**
102      * 0: ok  other: error
103      */
104     int32_t result = 0;
105     /**
106      * parameter sets/shows the result code presentation status in the TA.
107      */
108     int32_t action = 0;
109     /**
110      * parameter shows the subscriber COLP service status in the network.
111      */
112     int32_t colpStat = 0;
113 };
114 
115 /**
116  * @brief Indicates the MMI Code response result.
117  */
118 struct MmiCodeInfo {
119     /**
120      * 0: ok  other: error
121      */
122     int32_t result = 0;
123     /**
124      * Indicates the specific message of MMI code response.
125      */
126     char message[kMaxMessageLen + 1] = { 0 };
127 };
128 
129 /**
130  * @brief Indicates the Call Transfer response result.
131  */
132 struct CallTransferResponse {
133     /**
134      * 0: ok  other: error
135      */
136     int32_t result = 0;
137     /**
138      * Indicates the status of the CF option. 0: not active; 1: active
139      */
140     int32_t status = 0;
141     /**
142      * <classx> is a sum of integers each representing a class of information
143      * (default 7):
144      * 1	voice (telephony)
145      * 2	data (refers to all bearer services)
146      * 4	fax (facsimile services)
147      * 8	short message service
148      * 16	data circuit sync
149      * 32	data circuit async
150      * 64	dedicated packet access
151      * 128	dedicated PAD access
152      */
153     int32_t classx = 0;
154     /**
155      * type of address octet in integer format (refer GSM 04.08 [8]
156      * subclause 10.5.4.7); default 145 when dialling string includes
157      * international access code character "+", otherwise 129.
158      */
159     int32_t type = 0;
160     /**
161      * Indication the phone number which will forward to.
162      */
163     char number[kMaxNumberLen + 1] = { 0 };
164     int32_t reason = 0;
165     int32_t time = 0;
166     /**
167      * Indicates the Call forwarding start time.
168      */
169     int32_t startHour = INVALID_TIME;
170     int32_t startMinute = INVALID_TIME;
171     /**
172      * Indicates the Call forwarding end time.
173      */
174     int32_t endHour = INVALID_TIME;
175     int32_t endMinute = INVALID_TIME;
176 };
177 
178 /**
179  * @brief Indicates the Call Restriction response result.
180  */
181 struct CallRestrictionResponse {
182     /**
183      * 0: ok  other: error
184      */
185     int32_t result = 0;
186     /**
187      * parameter sets/shows the result code presentation status in the TA
188      */
189     int32_t status = 0;
190     /**
191      * parameter shows the subscriber Call Restriction service status
192      * in the network.
193      */
194     int32_t classCw = 0;
195 };
196 
197 /**
198  * @brief Indicates the Call Preference response result.
199  */
200 struct CallPreferenceResponse {
201     /**
202      * 0: ok  other: error
203      */
204     int32_t result = 0;
205     /**
206      * Indicates the specific value of the call preference mode.
207      *
208      * 1:CS Voice only
209      * 2:CS Voice preferred, IMS PS Voice as secondary
210      * 3:IMS PS Voice preferred, CS Voice as secondary
211      * 4:IMS PS Voice only
212      */
213     int32_t mode = 0;
214 };
215 
216 /**
217  * @brief Indicates the GetImsConfig response result.
218  */
219 struct GetImsConfigResponse {
220     /**
221      * 0: ok  other: error
222      */
223     int32_t result = 0;
224     /**
225      * Indicates the specific value of the corresponding IMS config.
226      */
227     int32_t value = 0;
228 };
229 
230 /**
231  * @brief Indicates the GetImsFeatureValue response result.
232  */
233 struct GetImsFeatureValueResponse {
234     /**
235      * 0: ok  other: error
236      */
237     int32_t result = 0;
238     /**
239      * Indicates the specific value of the corresponding IMS feature.
240      */
241     int32_t value = 0;
242 };
243 
244 struct GetLteEnhanceModeResponse {
245     /**
246      * 0: ok  other: error
247      */
248     int32_t result = 0;
249     /**
250      * Indicates the specific value of the LTE Enhance mode.
251      */
252     int32_t value = 0;
253 };
254 
255 struct MuteControlResponse {
256     /**
257      * 0: ok  other: error
258      */
259     int32_t result = 0;
260     /**
261      * Indicates the specific value of mute setting. 0: not mute 1: set mute
262      */
263     int32_t value = 0;
264 };
265 
266 /**
267  * @brief Indicates the type of supplementary service request.
268  */
269 enum class SsRequestType {
270     SS_ACTIVATION = 0,
271     SS_DEACTIVATION,
272     SS_INTERROGATION,
273     SS_REGISTRATION,
274     SS_ERASURE,
275 };
276 
277 /**
278  * @brief Indicates the video window size and location in video call.
279  */
280 struct VideoWindow {
281     /**
282      * X coordinate of window
283      */
284     int32_t x = 0;
285     /**
286      * Y coordinate of window
287      */
288     int32_t y = 0;
289     /**
290      * Z coordinate of window
291      */
292     int32_t z = 0;
293     /**
294      * the width of window
295      */
296     int32_t width = 0;
297     /**
298      * the height of window
299      */
300     int32_t height = 0;
301 };
302 
303 /**
304  * @brief Indicates the +CHLD related supplementary services
305  *
306  * 3GPP TS 27.007 V3.9.0 (2001-06) Call related supplementary services +CHLD
307  * 3GPP TS 27.007 V3.9.0 (2001-06) 7.22	Informative examples
308  */
309 enum CallSupplementType {
310     /**
311      * default type
312      */
313     TYPE_DEFAULT = 0,
314     /**
315      * release the held call and the wait call
316      */
317     TYPE_HANG_UP_HOLD_WAIT = 1,
318     /**
319      * release the active call and recover the held call
320      */
321     TYPE_HANG_UP_ACTIVE = 2,
322     /**
323      * release all calls
324      */
325     TYPE_HANG_UP_ALL = 3,
326 };
327 
328 enum CellularCallReturnType {
329     /**
330      * 3GPP TS 27.007 V3.9.0 (2001-06) 6.27	Informative examples
331      */
332     RETURN_TYPE_MMI = 0,
333 };
334 
335 /**
336  * @brief Indicates the voice domain preference.
337  *
338  * 3GPP TS 27.007 V17.3.0 (2021-09) 10.1.35	UE's voice domain
339  * preference E-UTRAN +CEVDP
340  */
341 enum DomainPreferenceMode {
342     /**
343      * Indicates the voice domain preference is CS only.
344      */
345     CS_VOICE_ONLY = 1,
346     /**
347      * Indicates the voice domain preference is CS prefered.
348      */
349     CS_VOICE_PREFERRED = 2,
350     /**
351      * Indicates the voice domain preference is PS prefered.
352      */
353     IMS_PS_VOICE_PREFERRED = 3,
354     /**
355      * Indicates the voice domain preference is PS only.
356      */
357     IMS_PS_VOICE_ONLY = 4,
358 };
359 
360 /**
361  * @brief Indicates the IMS call mode.
362  */
363 enum ImsCallMode {
364     CALL_MODE_AUDIO_ONLY = 0,
365     CALL_MODE_SEND_ONLY,
366     CALL_MODE_RECEIVE_ONLY,
367     CALL_MODE_SEND_RECEIVE,
368     CALL_MODE_VIDEO_PAUSED,
369 };
370 
371 /**
372  * @brief Indicates the IMS call mode request result.
373  */
374 enum VideoRequestResultType {
375     TYPE_REQUEST_SUCCESS = 0,
376     TYPE_REQUEST_FAIL,
377     TYPE_REQUEST_INVALID,
378     TYPE_REQUEST_TIMED_OUT,
379     REQUEST_REJECTED_BY_REMOTE,
380     TYPE_REQUEST_UPGRADE_CANCELED,
381     TYPE_MODIFY_DOWNGRADE_RTP_OR_RTCP_TIMEOUT = 100,
382     TYPE_MODIFY_DOWNGRADE_RTP_AND_RTCP_TIMEOUT,
383 };
384 
385 /**
386  * @brief Indicates the request call media mode.
387  */
388 struct CallMediaModeRequest {
389     /**
390      * Indicates the call phone number.
391      */
392     char phoneNum[kMaxNumberLen + 1] = { 0 };
393     /**
394      * Indicates the IMS call mode. {@link ImsCallMode}
395      */
396     ImsCallMode mode = ImsCallMode::CALL_MODE_AUDIO_ONLY;
397 };
398 
399 /**
400  * @brief Indicates the response of the call media mode request.
401  */
402 struct CallMediaModeInfo {
403     /**
404      * Indicates the call id.
405      */
406     int32_t callId = 0;
407     /**
408      * Indicates if the ims call info is request which received from remote.
409      */
410     bool isRequestInfo = false;
411     /**
412      * Indicates the response result.
413      */
414     VideoRequestResultType result = VideoRequestResultType::TYPE_REQUEST_SUCCESS;
415     /**
416      * Indicates the call mode result.
417      */
418     ImsCallMode callMode = ImsCallMode::CALL_MODE_AUDIO_ONLY;
419 
CallMediaModeInfoCallMediaModeInfo420     CallMediaModeInfo() {}
421 
CallMediaModeInfoCallMediaModeInfo422     CallMediaModeInfo(const CallMediaModeInfo &temp)
423     {
424         *this = temp;
425     }
426 
427     CallMediaModeInfo &operator=(const CallMediaModeInfo &temp)
428     {
429         callId = temp.callId;
430         isRequestInfo = temp.isRequestInfo;
431         result = temp.result;
432         callMode = temp.callMode;
433         return *this;
434     }
435 };
436 
437 /**
438  * @brief Indicates the ImsCallMode report information from cellular call.
439  */
440 struct CallModeReportInfo {
441     /**
442      * Indicates the call index.
443      */
444     int32_t callIndex = 0;
445     /**
446      * Indicates the response result.
447      */
448     VideoRequestResultType result = VideoRequestResultType::TYPE_REQUEST_SUCCESS;
449     /**
450      * Indicates the response result.
451      */
452     ImsCallMode callMode = ImsCallMode::CALL_MODE_AUDIO_ONLY;
453 
454     int32_t slotId = -1;
455 };
456 
457 /**
458  * @brief Indicates the response of the call media mode request.
459  */
460 struct CallSessionEvent {
461     /**
462      * Indicates the event ID of call ability. {@link CallAbilityEventId}
463      */
464     CallSessionEventId eventId = CallSessionEventId::EVENT_CAMERA_FAILURE;
465     /**
466      * Indicates the call phone number.
467      */
468     int32_t callId = 0;
469 
CallSessionEventCallSessionEvent470     CallSessionEvent() {}
471 
CallSessionEventCallSessionEvent472     CallSessionEvent(const CallSessionEvent &temp)
473     {
474         *this = temp;
475     }
476 
477     CallSessionEvent &operator=(const CallSessionEvent &temp)
478     {
479         callId = temp.callId;
480         eventId = temp.eventId;
481         return *this;
482     }
483 };
484 
485 /**
486  * @brief Indicates the detail information of some calls record.
487  */
488 struct CallSessionReportInfo {
489     /**
490      * Indicates call index.
491      */
492     int32_t index = 0;
493     /**
494      * Indicates the response result.
495      */
496     CallSessionEventId eventId = CallSessionEventId::EVENT_CAMERA_FAILURE;
497 };
498 
499 struct PeerDimensionsDetail {
500     /**
501      * Indicates the call phone number.
502      */
503     int32_t callId = 0;
504     /**
505      * Indicates the call phone number.
506      */
507     int32_t width = 0;
508     /**
509      * Indicates the response result.
510      */
511     int32_t height = 0;
512 
PeerDimensionsDetailPeerDimensionsDetail513     PeerDimensionsDetail() {}
514 
PeerDimensionsDetailPeerDimensionsDetail515     PeerDimensionsDetail(const PeerDimensionsDetail &temp)
516     {
517         *this = temp;
518     }
519 
520     PeerDimensionsDetail &operator=(const PeerDimensionsDetail &temp)
521     {
522         callId = temp.callId;
523         width = temp.width;
524         height = temp.height;
525         return *this;
526     }
527 };
528 
529 struct PeerDimensionsReportInfo {
530     /**
531      * Indicates call index.
532      */
533     int32_t index = 0;
534     /**
535      * Indicates the peer window width.
536      */
537     int32_t width = 0;
538     /**
539      * Indicates the peer window height.
540      */
541     int32_t height = 0;
542 };
543 
544 struct CameraCapabilities {
545     /**
546      * Indicates the call phone number.
547      */
548     int32_t callId = 0;
549     /**
550      * Indicates the call phone number.
551      */
552     int32_t width = 0;
553     /**
554      * Indicates the response result.
555      */
556     int32_t height = 0;
557 
CameraCapabilitiesCameraCapabilities558     CameraCapabilities() {}
559 
CameraCapabilitiesCameraCapabilities560     CameraCapabilities(const CameraCapabilities &temp)
561     {
562         *this = temp;
563     }
564 
565     CameraCapabilities &operator=(const CameraCapabilities &temp)
566     {
567         callId = temp.callId;
568         width = temp.width;
569         height = temp.height;
570         return *this;
571     }
572 };
573 
574 struct CameraCapabilitiesReportInfo {
575     /**
576      * Indicates call index.
577      */
578     int32_t index = 0;
579     /**
580      * Indicates the camera width.
581      */
582     int32_t width = 0;
583     /**
584      * Indicates the camera height.
585      */
586     int32_t height = 0;
587 };
588 
589 /**
590  * @brief Indicates the specific IMS config item.
591  */
592 enum ImsConfigItem {
593     /**
594      * Indicates the specific IMS config item is video quality.
595      */
596     ITEM_VIDEO_QUALITY = 0,
597 
598     /**
599      * Indicates the specific IMS config item is IMS switch status.
600      *
601      * 3GPP TS 24.167 V17.1.0 (2020-12) 5.31
602      * /<X>/Mobility_Management_IMS_Voice_Termination
603      * Ims Switch Status
604      *
605      * format: bool
606      * Access Types: Get, Replace
607      * Values: 0, 1
608      * 0 – Mobility Management for IMS Voice Termination disabled.
609      * 1 – Mobility Management for IMS Voice Termination enabled.
610      */
611     ITEM_IMS_SWITCH_STATUS,
612 };
613 
614 /**
615  * @brief Indicates the VoNR switch status.
616  */
617 enum class VoNRState {
618     /**
619      * Indicates the VoNR switch is off.
620      */
621     VONR_STATE_OFF = 0,
622     /**
623      * Indicates the VoNR switch is on.
624      */
625     VONR_STATE_ON = 1,
626 };
627 
628 /**
629  * @brief Indicates the video quality is high or low.
630  */
631 enum VideoQualityValue {
632     /**
633      * Indicates the video quality is high.
634      */
635     LOW = 0,
636     /**
637      * Indicates the video quality is low.
638      */
639     HIGH = 1,
640 };
641 
642 enum ImsConfigValue {
643     CONFIG_SUCCESS = 0,
644     CONFIG_FAILED = 1,
645 };
646 
647 /**
648  * @brief Indicates the specific IMS feature.
649  *
650  * Official Document IR.92 - IMS Profile for Voice and SMS
651  * Annex C MNO provisioning and Late Customization
652  *
653  * format: bool
654  * 3GPP TS 24.167 V17.1.0 (2020-12) 5.43 /<X>/Media_type_restriction_policy
655  */
656 enum FeatureType {
657     /**
658      * Indicates the IMS feature is Voice over LTE.
659      */
660     TYPE_VOICE_OVER_LTE = 0,
661     /**
662      * Indicates the IMS feature is Video over LTE.
663      */
664     TYPE_VIDEO_OVER_LTE,
665     /**
666      * Indicates the IMS feature is SS over UT.
667      */
668     TYPE_SS_OVER_UT,
669 };
670 
671 /**
672  * @brief Indicates the specific OTT call request service.
673  */
674 enum class OttCallRequestId {
675     OTT_REQUEST_DIAL = 0,
676     OTT_REQUEST_HANG_UP,
677     OTT_REQUEST_REJECT,
678     OTT_REQUEST_ANSWER,
679     OTT_REQUEST_HOLD,
680     OTT_REQUEST_UN_HOLD,
681     OTT_REQUEST_SWITCH,
682     OTT_REQUEST_COMBINE_CONFERENCE,
683     OTT_REQUEST_SEPARATE_CONFERENCE,
684     OTT_REQUEST_KICK_OUT_CONFERENCE,
685     OTT_REQUEST_INVITE_TO_CONFERENCE,
686     OTT_REQUEST_UPDATE_CALL_MEDIA_MODE,
687 };
688 
689 /**
690  * @brief Indicates the OTT call request information.
691  */
692 struct OttCallRequestInfo {
693     /**
694      * Indicates the call phone number.
695      */
696     char phoneNum[kMaxNumberLen + 1] = { 0 };
697     /**
698      * Indicates the bundle name.
699      */
700     char bundleName[kMaxBundleNameLen + 1] = { 0 };
701     /**
702      * Indicates the call video state, 0: audio 1:video.
703      */
704     VideoStateType videoState = VideoStateType::TYPE_VOICE;
705 };
706 
707 /**
708  * @brief Indicates the OTT call detail information.
709  */
710 struct OttCallDetailsInfo {
711     /**
712      * Indicates the call phone number.
713      */
714     char phoneNum[kMaxNumberLen + 1] = { 0 };
715     /**
716      * Indicates the bundle name.
717      */
718     char bundleName[kMaxBundleNameLen + 1] = { 0 };
719     /**
720      * Indicates the call video state, 0: audio 1:video.
721      */
722     VideoStateType videoState = VideoStateType::TYPE_VOICE;
723     /**
724      * Indicates the call status.
725      */
726     TelCallState callState = TelCallState::CALL_STATUS_UNKNOWN;
727 };
728 
729 /**
730  * @brief Indicates the OTT call event ID.
731  */
732 enum class OttCallEventId {
733     OTT_CALL_EVENT_FUNCTION_UNSUPPORTED = 0,
734 };
735 
736 /**
737  * @brief Indicates the OTT call event information.
738  */
739 struct OttCallEventInfo {
740     /**
741      * Indicates the OTT call event ID.
742      */
743     OttCallEventId ottCallEventId = OttCallEventId::OTT_CALL_EVENT_FUNCTION_UNSUPPORTED;
744     /**
745      * Indicates the bundle name.
746      */
747     char bundleName[kMaxBundleNameLen + 1] = { 0 };
748 
OttCallEventInfoOttCallEventInfo749     OttCallEventInfo() {}
750 
OttCallEventInfoOttCallEventInfo751     OttCallEventInfo(const OttCallEventInfo &temp)
752     {
753         *this = temp;
754     }
755 
756     OttCallEventInfo &operator=(const OttCallEventInfo &temp)
757     {
758         ottCallEventId = temp.ottCallEventId;
759         std::copy(std::begin(temp.bundleName), std::end(temp.bundleName), std::begin(bundleName));
760         return *this;
761     }
762 };
763 
764 /**
765  * @brief Indicates the audio device type and address.
766  */
767 struct AudioDevice {
768     /**
769      * Indicates the audio device type. {@link AudioDeviceType}
770      */
771     AudioDeviceType deviceType = AudioDeviceType::DEVICE_UNKNOWN;
772     /**
773      * Indicates the device address.
774      */
775     char address[kMaxAddressLen + 1] = { 0 };
776     /**
777      * Indicates the device name.
778      */
779     char deviceName[kMaxDeviceNameLen + 1] = { 0 };
780 };
781 
782 /**
783  * @brief Indicates the audio device information.
784  */
785 struct AudioDeviceInfo {
786     /**
787      * Indicates the list of all audio devices.
788      */
789     std::vector<AudioDevice> audioDeviceList {};
790     /**
791      * Indicates the current audio device.
792      */
793     AudioDevice currentAudioDevice;
794     /**
795      * Indicates wether the device is muted, true: mute, false: no mute
796      */
797     bool isMuted = false;
798 };
799 
800 enum class MmiCodeResult {
801     MMI_CODE_SUCCESS = 0,
802     MMI_CODE_FAILED = 1
803 };
804 } // namespace Telephony
805 } // namespace OHOS
806 #endif // CALL_MANAGER_INNER_TYPE_H
807