1 /*
2  * Copyright (C) 2021 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_REQUEST_PROCESS_H
17 #define CALL_REQUEST_PROCESS_H
18 
19 #include <mutex>
20 
21 #include "call_object_manager.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 class CallRequestProcess : public CallObjectManager {
26 public:
27     CallRequestProcess();
28     ~CallRequestProcess();
29 
30     int32_t DialRequest();
31     void AnswerRequest(int32_t callId, int32_t videoState);
32     void AnswerRequestForDsda(sptr<CallBase> call, int32_t callId, int32_t videoState);
33     void RejectRequest(int32_t callId, bool isSendSms, std::string &content);
34     void HangUpRequest(int32_t callId);
35     bool HangUpForDsdaRequest(sptr<CallBase> call);
36     void HandleHoldAfterHangUp(TelCallState state, int32_t waitingCallNum);
37     void HoldRequest(int32_t callId);
38     void UnHoldRequest(int32_t callId);
39     void SwitchRequest(int32_t callId);
40     void CombineConferenceRequest(int32_t mainCallId);
41     void SeparateConferenceRequest(int32_t callId);
42     void KickOutFromConferenceRequest(int32_t callId);
43     void StartRttRequest(int32_t callId, std::u16string &msg);
44     void StopRttRequest(int32_t callId);
45     void JoinConference(int32_t callId, std::vector<std::string> &numberList);
46     bool IsDsdsMode3();
47     bool IsDsdsMode5();
48     bool HasActiveCall();
49     bool HasDialingCall();
50     bool NeedAnswerVTAndEndActiveVO(int32_t callId, int32_t videoState);
51     bool NeedAnswerVOAndEndActiveVT(int32_t callId, int32_t videoState);
52     void DisconnectOtherSubIdCall(int32_t callId, int32_t slotId, int32_t videoState);
53     void DisconnectOtherCallForVideoCall(int32_t callId);
54     void HandleCallWaitingNumTwo(sptr<CallBase> incomingCall, sptr<CallBase> call, int32_t slotId,
55         int32_t activeCallNum, bool &flagForConference);
56     void HandleCallWaitingNumOne(sptr<CallBase> incomingCall, sptr<CallBase> call, int32_t slotId,
57         int32_t activeCallNum, bool &flagForConference);
58     void HandleCallWaitingNumOneNext(sptr<CallBase> incomingCall, sptr<CallBase> call, sptr<CallBase> holdCall,
59         int32_t slotId, bool &flagForConference);
60     void HandleCallWaitingNumZero(sptr<CallBase> incomingCall, sptr<CallBase> call, int32_t slotId,
61         int32_t activeCallNum, bool &flagForConference);
62     void HoldOrDisconnectedCall(int32_t callId, int32_t slotId, int32_t videoState);
63     bool HandleDsdaIncomingCall(
64         sptr<CallBase> call, int32_t activeCallNum, int32_t slotId, int32_t videoState, sptr<CallBase> incomingCall);
65     void IsExistCallOtherSlot(std::list<int32_t> &list, int32_t slotId, bool &noOtherCall);
66     int32_t HandleDialingInfo(std::string newPhoneNum, DialParaInfo &info);
67 
68 private:
69     int32_t CarrierDialProcess(DialParaInfo &info);
70     int32_t IsDialCallForDsda(DialParaInfo &info);
71     int32_t HandleEccCallForDsda(std::string newPhoneNum, DialParaInfo &info, bool &isEcc);
72     int32_t VoiceMailDialProcess(DialParaInfo &info);
73     int32_t OttDialProcess(DialParaInfo &info);
74     int32_t PackCellularCallInfo(DialParaInfo &info, CellularCallInfo &callInfo);
75     bool IsFdnNumber(std::vector<std::u16string> fdnNumberList, std::string phoneNumber);
76     int32_t UpdateCallReportInfo(const DialParaInfo &info, TelCallState state);
77     int32_t HandleStartDial(bool isMMiCode, CellularCallInfo callInfo);
78     int32_t HandleDialFail();
79     int32_t GetOtherRingingCall(int32_t currentCallId);
80     int32_t EccDialPolicy();
81 
82 private:
83     std::mutex mutex_;
84 };
85 } // namespace Telephony
86 } // namespace OHOS
87 
88 #endif // CALL_REQUEST_PROCESS_H
89