• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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_INFO_H
17 #define CALL_MANAGER_INFO_H
18 
19 #include "call_manager_base.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 /**
24  * @brief Indicates the cellular call detail information.
25  */
26 struct CellularCallInfo {
27     /**
28      * Indicates the call index
29      */
30     int32_t callId = 0;
31     /**
32      * Indicates the call phone number.
33      */
34     char phoneNum[kMaxNumberLen] = { 0 };
35     /**
36      * Indicates the slot id.
37      */
38     int32_t slotId = 0;
39     int32_t accountId = 0;
40     /**
41      * Indicates the type of call, includs CS, IMS, OTT, OTHER. {@link CallType}
42      */
43     CallType callType = CallType::TYPE_ERR_CALL;
44     /**
45      * Indicates whether the call is video. 0: audio 1: send only 2: revive ony 3:video
46      */
47     int32_t videoState = 0;
48     int32_t index = 0;
49 };
50 
51 /**
52  * @brief Indicates the cellular call event information.
53  */
54 struct CellularCallEventInfo {
55     /**
56      * Indicates the call event type. {@link CellularCallEventType}
57      */
58     CellularCallEventType eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
59     /**
60      * Indicates the call event id, one id corresponds to one request.
61      * {@link RequestResultEventId}
62      */
63     RequestResultEventId eventId = RequestResultEventId::INVALID_REQUEST_RESULT_EVENT_ID;
64 };
65 
66 /**
67  * @brief Indicates the ringback tone playing mode.
68  */
69 enum class RBTPlayInfo {
70     /**
71      * Indicates the mode is network, the tone is from network.
72      */
73     NETWORK_ALERTING,
74     /**
75      * Indicates the mode is local, the tone is from local file.
76      */
77     LOCAL_ALERTING,
78 };
79 
80 struct VoipCallReportInfo {
81     std::string voipCallId = "";
82     std::string userName = "";
83     std::vector<uint8_t> userProfile = {};
84     std::string abilityName = "";
85     std::string extensionId = "";
86     std::string voipBundleName = "";
87 };
88 
89 /**
90  * @brief Indicates the call event detail information.
91  */
92 struct CallEventInfo {
93     /**
94      * Indicates the event ID of call ability. {@link CallAbilityEventId}
95      */
96     CallAbilityEventId eventId = CallAbilityEventId::EVENT_DIAL_NO_CARRIER;
97     /**
98      * Indicates the call phone number.
99      */
100     char phoneNum[kMaxNumberLen + 1] = { 0 };
101     /**
102      * Indicates the bundle name.
103      */
104     char bundleName[kMaxBundleNameLen + 1] = { 0 };
105 };
106 
107 struct AccountInfo {
108     int32_t accountId = 0;
109     int32_t power = 0;
110     char bundleName[kMaxNumberLen + 1] = { 0 };
111     bool isEnabled = false;
112 };
113 
114 /**
115  * @brief Indicates the call report information.
116  */
117 struct CallReportInfo {
118     int32_t index = 0;
119     /**
120      * Indicates the call phone number.
121      */
122     char accountNum[kMaxNumberLen + 1] = { 0 };
123     int32_t accountId = 0;
124     /**
125      * Indicates the type of call, includs CS, IMS, OTT, OTHER. {@link CallType}
126      */
127     CallType callType = CallType::TYPE_ERR_CALL;
128     /**
129      * Indicates the type of video state. {@link VideoStateType}
130      */
131     VideoStateType callMode = VideoStateType::TYPE_VOICE;
132     /**
133      * Indicates the detailed state of call. {@link TelCallState}
134      */
135     TelCallState state = TelCallState::CALL_STATUS_UNKNOWN;
136     /**
137      * Indicates the voica domain, 0: CS, 1: IMS
138      */
139     int32_t voiceDomain = 0;
140     /**
141      * Indicates the Multi-party call status:
142      * 0: not a multi-party(conference) call
143      * 1: a multi-party(conference) call
144      */
145     int32_t mpty = 0;
146     /**
147      * Indicates the color tone type.
148      */
149     int32_t crsType = 0;
150     /**
151      * Indicates the initial type of this call.
152      */
153     int32_t originalCallType = 0;
154     /**
155      * Indicates the VoIP call specific information
156      */
157     VoipCallReportInfo voipCallInfo;
158 };
159 
160 /**
161  * @brief Indicates the detail information of some calls record.
162  */
163 struct CallsReportInfo {
164     /**
165      * Indicates a list of the call report information.
166      */
167     std::vector<CallReportInfo> callVec {};
168     /**
169      * Indicates the slot id.
170      */
171     int32_t slotId = 0;
172 };
173 
174 /**
175  * @brief Indicates the detail information of a call.
176  */
177 struct CallAttributeInfo {
178     /**
179      * Indicates the call phone number.
180      */
181     char accountNumber[kMaxNumberLen + 1] = { 0 };
182     /**
183      * Indicates the bundle name.
184      */
185     char bundleName[kMaxBundleNameLen + 1] = { 0 };
186     /**
187      * Indicates whether the speaker phone is on.
188      */
189     bool speakerphoneOn = false;
190     int32_t accountId = 0;
191     /**
192      * Indicates the type of video state. {@link VideoStateType}
193      */
194     VideoStateType videoState = VideoStateType::TYPE_VOICE;
195     /**
196      * Indicates the Call start time.
197      */
198     int64_t startTime = 0;
199     /**
200      * Indicates whether the call is emergency call.
201      */
202     bool isEcc = false;
203     /**
204      * Indicates the type of call, includs CS, IMS, OTT, OTHER. {@link CallType}
205      */
206     CallType callType = CallType::TYPE_ERR_CALL;
207     /**
208      * Indicates the call index.
209      */
210     int32_t callId = 0;
211     /**
212      * Indicates the detailed state of call. {@link TelCallState}
213      */
214     TelCallState callState = TelCallState::CALL_STATUS_UNKNOWN;
215     /**
216      * Indicates the state of conference call. {@link TelConferenceState}
217      */
218     TelConferenceState conferenceState = TelConferenceState::TEL_CONFERENCE_IDLE;
219     /**
220      * Indicates the call beginning and ending time.
221      */
222     time_t callBeginTime = 0;
223     time_t callEndTime = 0;
224     time_t ringBeginTime = 0;
225     time_t ringEndTime = 0;
226     /**
227      * Indicates the call is MO or MT. {@link CallDirection}
228      */
229     CallDirection callDirection = CallDirection::CALL_DIRECTION_UNKNOW;
230     /**
231      * Indicates the cause when the call is answered. {@link CallAnswerType}
232      */
233     CallAnswerType answerType = CallAnswerType::CALL_ANSWER_MISSED;
234     /*
235      * Indicates the call index in cellular call
236      */
237     int32_t index = 0;
238     /**
239      * Indicates the color tone type.
240      */
241     int32_t crsType = 0;
242     /**
243      * Indicates the initial type of this call.
244      */
245     int32_t originalCallType = 0;
246     /**
247      * Indicates the VoIP call specific information
248      */
249     VoipCallReportInfo voipCallInfo;
250 };
251 
252 /**
253  * @brief Indicates the detail information of call record.
254  */
255 struct CallRecordInfo {
256     /**
257      * Indicates the call index.
258      */
259     int32_t callId = 0;
260     /**
261      * Indicates the call phone number.
262      */
263     char phoneNumber[kMaxNumberLen + 1] = { 0 };
264     /**
265      * Indicates the phone number after formatted.
266      */
267     char formattedPhoneNumber[kMaxNumberLen + 1] = { 0 };
268     /**
269      * Indicates the type of call, includs CS, IMS, OTT, OTHER. {@link CallType}
270      */
271     CallType callType = CallType::TYPE_ERR_CALL;
272     /**
273      * Indicates the type of video state. {@link VideoStateType}
274      */
275     VideoStateType videoState = VideoStateType::TYPE_VOICE;
276     /**
277      * Indicates the call beginning time.
278      */
279     time_t callBeginTime = 0;
280     /**
281      * Indicates the call ending time.
282      */
283     time_t callEndTime = 0;
284     /**
285      * Indicates the call ring duration.
286      */
287     uint32_t ringDuration = 0;
288     /**
289      * Indicates the call session duration.
290      */
291     uint32_t callDuration = 0;
292     /**
293      * Indicates the call is MO or MT. {@link CallDirection}
294      */
295     CallDirection directionType = CallDirection::CALL_DIRECTION_UNKNOW;
296     /**
297      * Indicates the cause when the call is answered. {@link CallAnswerType}
298      */
299     CallAnswerType answerType = CallAnswerType::CALL_ANSWER_MISSED;
300     /**
301      * Indicates the country code of the call.
302      */
303     int32_t countryCode = 0;
304     /**
305      * Indicates the slot id.
306      */
307     int32_t slotId = 0;
308     /**
309      * Indicates the call features.
310      */
311     int32_t features = 0;
312 
CallRecordInfoCallRecordInfo313     CallRecordInfo() {}
314 
CallRecordInfoCallRecordInfo315     CallRecordInfo(const CallRecordInfo &temp)
316     {
317         *this = temp;
318     }
319 
320     CallRecordInfo &operator=(const CallRecordInfo &temp)
321     {
322         callId = temp.callId;
323         std::copy(std::begin(temp.phoneNumber), std::end(temp.phoneNumber), std::begin(phoneNumber));
324         std::copy(std::begin(temp.formattedPhoneNumber), std::end(temp.formattedPhoneNumber),
325             std::begin(formattedPhoneNumber));
326         callType = temp.callType;
327         callBeginTime = temp.callBeginTime;
328         callEndTime = temp.callEndTime;
329         ringDuration = temp.ringDuration;
330         callDuration = temp.callDuration;
331         directionType = temp.directionType;
332         answerType = temp.answerType;
333         countryCode = temp.countryCode;
334         slotId = temp.slotId;
335         videoState = temp.videoState;
336         features = temp.features;
337         return *this;
338     }
339 };
340 
341 /**
342  * @brief Indicates detail information of a call.
343  */
344 struct CallDetailInfo {
345     /**
346      * Indicates the call index.
347      */
348     int32_t index = 0;
349     /**
350      * Indicates the call phone number.
351      */
352     char phoneNum[kMaxNumberLen + 1] = { 0 };
353     /**
354      * Indicates the bundle name.
355      */
356     char bundleName[kMaxBundleNameLen + 1] = { 0 };
357     /**
358      * Indicates the account id.
359      */
360     int32_t accountId = 0;
361     /**
362      * Indicates the call type, CS, IMS, ERROR
363      */
364     CallType callType = CallType::TYPE_ERR_CALL;
365     /**
366      * Indicates the call video state, 0: audio 1:video.
367      */
368     VideoStateType callMode = VideoStateType::TYPE_VOICE;
369     /**
370      * Indicates the call status.
371      */
372     TelCallState state = TelCallState::CALL_STATUS_UNKNOWN;
373     /**
374      * Indicates the voice domain. 0: CS, 1: IMS
375      */
376     int32_t voiceDomain = 0;
377     /**
378      * Indicates the Multi-party call status:
379      * 0: not a multi-party(conference) call
380      * 1: a multi-party(conference) call
381      */
382     int32_t mpty = 0;
383     /**
384      * Indicates the color tone type.
385      */
386     int32_t crsType = 0;
387     /**
388      * Indicates the initial type of this call.
389      */
390     int32_t originalCallType = 0;
391     /**
392      * Indicates the VoIP call specific information
393      */
394     VoipCallReportInfo voipCallInfo;
395 
CallDetailInfoCallDetailInfo396     CallDetailInfo() {}
397 
CallDetailInfoCallDetailInfo398     CallDetailInfo(const CallDetailInfo &temp)
399     {
400         *this = temp;
401     }
402 
403     CallDetailInfo &operator=(const CallDetailInfo &temp)
404     {
405         index = temp.index;
406         std::copy(std::begin(temp.phoneNum), std::end(temp.phoneNum), std::begin(phoneNum));
407         std::copy(std::begin(temp.bundleName), std::end(temp.bundleName), std::begin(bundleName));
408         accountId = temp.accountId;
409         callType = temp.callType;
410         callMode = temp.callMode;
411         state = temp.state;
412         voiceDomain = temp.voiceDomain;
413         mpty = temp.mpty;
414         crsType = temp.crsType;
415         originalCallType = temp.originalCallType;
416         voipCallInfo.voipCallId = temp.voipCallInfo.voipCallId;
417         voipCallInfo.extensionId = temp.voipCallInfo.extensionId;
418         voipCallInfo.userName = temp.voipCallInfo.userName;
419         (voipCallInfo.userProfile).assign(
420             (temp.voipCallInfo.userProfile).begin(), (temp.voipCallInfo.userProfile).end());
421         voipCallInfo.abilityName = temp.voipCallInfo.abilityName;
422         voipCallInfo.voipBundleName = temp.voipCallInfo.voipBundleName;
423         return *this;
424     }
425 };
426 
427 /**
428  * @brief Indicates detail information of some calls.
429  */
430 struct CallDetailsInfo {
431     /**
432      * Indicates a CallDetailInfo list. {@link CallDetailInfo}
433      */
434     std::vector<CallDetailInfo> callVec {};
435     /**
436      * Indicates the slot id.
437      */
438     int32_t slotId = 0;
439     /**
440      * Indicates the bundle name.
441      */
442     char bundleName[kMaxBundleNameLen + 1] = { 0 };
443 };
444 
445 /**
446  * @brief Indicates the type of call transfer setting.
447  *
448  * 27007-430_2001 7.11	Call forwarding number and conditions +CCFC
449  * 3GPP TS 22.082 [4]
450  * <mode>:
451  * 0	disable
452  * 1	enable
453  * 3	registration
454  * 4	erasure
455  */
456 enum class CallTransferSettingType {
457     /**
458      * Indicates disable the call transfer.
459      */
460     CALL_TRANSFER_DISABLE = 0,
461     /**
462      * Indicates enable the call transfer.
463      */
464     CALL_TRANSFER_ENABLE = 1,
465     /**
466      * Indicates register the call transfer.
467      */
468     CALL_TRANSFER_REGISTRATION = 3,
469     /**
470      * Indicates erasure the call transfer.
471      */
472     CALL_TRANSFER_ERASURE = 4,
473 };
474 
475 /**
476  * @brief Indicates the Call forwarding type
477  *
478  * 27007-430_2001 7.11	Call forwarding number and conditions +CCFC
479  * 3GPP TS 22.082 [4]
480  * <reason>:
481  * 0	unconditional
482  * 1	mobile busy
483  * 2	no reply
484  * 3	not reachable
485  */
486 enum class CallTransferType {
487     /**
488      * Indicates transfer the call unconditionally.
489      */
490     TRANSFER_TYPE_UNCONDITIONAL = 0,
491     /**
492      * Indicates transfer the call when busy.
493      */
494     TRANSFER_TYPE_BUSY = 1,
495     /**
496      * Indicates transfer the call when no reply.
497      */
498     TRANSFER_TYPE_NO_REPLY = 2,
499     /**
500      * Indicates transfer the call when unreachable.
501      */
502     TRANSFER_TYPE_NOT_REACHABLE = 3,
503 };
504 
505 /**
506  * @brief Indicates the information of call transfer.
507  */
508 struct CallTransferInfo {
509     /**
510      * Indication the phone number which will forward to.
511      */
512     char transferNum[kMaxNumberLen + 1] = { 0 };
513     /**
514      * Indicates the type of call transfer setting. {@link CallTransferSettingType}
515      */
516     CallTransferSettingType settingType = CallTransferSettingType::CALL_TRANSFER_DISABLE;
517     /**
518      * Indicates the Call forwarding type. {@link CallTransferType}
519      */
520     CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL;
521     /**
522      * Start time hours.
523      */
524     int32_t startHour = 0;
525     /**
526      * Start time minutes.
527      */
528     int32_t startMinute = 0;
529     /**
530      * End time hours.
531      */
532     int32_t endHour = 0;
533     /**
534      * End time minutes.
535      */
536     int32_t endMinute = 0;
537 };
538 
539 /**
540  * @brief Indicates the type of call restriction.
541  *
542  * 3GPP TS 22.030 V4.0.0 (2001-03)
543  * 3GPP TS 22.088 V4.0.0 (2001-03)
544  */
545 enum class CallRestrictionType {
546     /**
547      * Indicates restrict all incoming calls.
548      */
549     RESTRICTION_TYPE_ALL_INCOMING = 0,
550     /**
551      * Indicates restrict all outgoing calls.
552      */
553     RESTRICTION_TYPE_ALL_OUTGOING,
554     /**
555      * Indicates restrict international calls.
556      */
557     RESTRICTION_TYPE_INTERNATIONAL,
558     /**
559      * Indicates restrict international roaming calls.
560      */
561     RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME,
562     /**
563      * Indicates restrict roaming calls.
564      */
565     RESTRICTION_TYPE_ROAMING_INCOMING,
566     /**
567      * Indicates restrict all calls.
568      */
569     RESTRICTION_TYPE_ALL_CALLS,
570     /**
571      * Indicates restrict all outgoing services.
572      */
573     RESTRICTION_TYPE_OUTGOING_SERVICES,
574     /**
575      * Indicates restrict all incoming services.
576      */
577     RESTRICTION_TYPE_INCOMING_SERVICES,
578 };
579 
580 /**
581  * @brief Indicates the mode of call restriction.
582  *
583  * 3GPP TS 22.088 V4.0.0 (2001-03)
584  */
585 enum class CallRestrictionMode {
586     /**
587      * Indicates call restriction is deactivated.
588      */
589     RESTRICTION_MODE_DEACTIVATION = 0,
590     /**
591      * Indicates call restriction is activated.
592      */
593     RESTRICTION_MODE_ACTIVATION = 1,
594 };
595 
596 /**
597  * @brief Indicates the information of call restriction.
598  */
599 struct CallRestrictionInfo {
600     /**
601      * Indicates the password required to set call restrictions.
602      */
603     char password[kMaxNumberLen + 1] = { 0 };
604     /**
605      * Indicates the type of call restriction.
606      */
607     CallRestrictionType fac = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING;
608     /**
609      * Indicates the mode of call restriction.
610      */
611     CallRestrictionMode mode = CallRestrictionMode::RESTRICTION_MODE_DEACTIVATION;
612 };
613 } // namespace Telephony
614 } // namespace OHOS
615 #endif // CALL_MANAGER_INFO_H