1 /*
2  * Copyright (C) 2021-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 CALL_POLICY_H
17 #define CALL_POLICY_H
18 
19 #include <string>
20 #include <memory>
21 
22 #include "pac_map.h"
23 
24 #include "call_object_manager.h"
25 
26 /**
27  * @ClassName: CallPolicy
28  * @Description: check prerequisites before performing ops in callcontrolmanager
29  */
30 namespace OHOS {
31 namespace Telephony {
32 class CallPolicy : public CallObjectManager {
33 public:
34     CallPolicy();
35     ~CallPolicy();
36 
37     int32_t DialPolicy(std::u16string &number, AppExecFwk::PacMap &extras, bool isEcc);
38     int32_t AnswerCallPolicy(int32_t callId, int32_t videoState);
39     int32_t RejectCallPolicy(int32_t callId);
40     int32_t HoldCallPolicy(int32_t callId);
41     int32_t UnHoldCallPolicy(int32_t callId);
42     int32_t HangUpPolicy(int32_t callId);
43     int32_t SwitchCallPolicy(int32_t callId);
44     static int32_t VideoCallPolicy(int32_t callId);
45     static int32_t StartRttPolicy(int32_t callId);
46     static int32_t StopRttPolicy(int32_t callId);
47     int32_t IsValidSlotId(int32_t slotId);
48     int32_t EnableVoLtePolicy(int32_t slotId);
49     int32_t DisableVoLtePolicy(int32_t slotId);
50     int32_t IsVoLteEnabledPolicy(int32_t slotId);
51     int32_t VoNRStatePolicy(int32_t slotId, int32_t state);
52     int32_t GetCallWaitingPolicy(int32_t slotId);
53     int32_t SetCallWaitingPolicy(int32_t slotId);
54     int32_t GetCallRestrictionPolicy(int32_t slotId);
55     int32_t SetCallRestrictionPolicy(int32_t slotId);
56     int32_t GetCallTransferInfoPolicy(int32_t slotId);
57     int32_t SetCallTransferInfoPolicy(int32_t slotId);
58     int32_t SetCallPreferenceModePolicy(int32_t slotId);
59     int32_t GetImsConfigPolicy(int32_t slotId);
60     int32_t SetImsConfigPolicy(int32_t slotId);
61     int32_t GetImsFeatureValuePolicy(int32_t slotId);
62     int32_t SetImsFeatureValuePolicy(int32_t slotId);
63     static int32_t InviteToConferencePolicy(int32_t callId, std::vector<std::string> &numberList);
64     int32_t CloseUnFinishedUssdPolicy(int32_t slotId);
65     bool IsSupportVideoCall(AppExecFwk::PacMap &extras);
66     int32_t CanDialMulityCall(AppExecFwk::PacMap &extras, bool isEcc);
67     int32_t IsValidCallType(CallType callType);
68     int32_t IsVoiceCallValid(VideoStateType videoState);
69     int32_t HasNormalCall(bool isEcc, int32_t slotId, CallType callType);
70     int32_t GetAirplaneMode(bool &isAirplaneModeOn);
71     int32_t SuperPrivacyMode(std::u16string &number, AppExecFwk::PacMap &extras, bool isEcc);
72 
73 private:
74     uint16_t onlyTwoCall_ = 2;
75 };
76 } // namespace Telephony
77 } // namespace OHOS
78 
79 #endif // CALL_POLICY_H
80