• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 const int32_t MCC_LEN = 3;
33 const std::string CHN_MCC = "460";
34 const std::string MC_MCC = "455";
35 
36 class CallPolicy : public CallObjectManager {
37 public:
38     CallPolicy();
39     ~CallPolicy();
40 
41     int32_t DialPolicy(std::u16string &number, AppExecFwk::PacMap &extras, bool isEcc);
42     int32_t AnswerCallPolicy(int32_t callId, int32_t videoState);
43     int32_t RejectCallPolicy(int32_t callId);
44     int32_t HoldCallPolicy(int32_t callId);
45     int32_t UnHoldCallPolicy(int32_t callId);
46     int32_t HangUpPolicy(int32_t callId);
47     int32_t SwitchCallPolicy(int32_t callId);
48     static int32_t VideoCallPolicy(int32_t callId);
49     static int32_t StartRttPolicy(int32_t callId);
50     static int32_t StopRttPolicy(int32_t callId);
51     int32_t IsValidSlotId(int32_t slotId);
52     int32_t EnableVoLtePolicy(int32_t slotId);
53     int32_t DisableVoLtePolicy(int32_t slotId);
54     int32_t IsVoLteEnabledPolicy(int32_t slotId);
55     int32_t VoNRStatePolicy(int32_t slotId, int32_t state);
56     int32_t GetCallWaitingPolicy(int32_t slotId);
57     int32_t SetCallWaitingPolicy(int32_t slotId);
58     int32_t GetCallRestrictionPolicy(int32_t slotId);
59     int32_t SetCallRestrictionPolicy(int32_t slotId);
60     int32_t GetCallTransferInfoPolicy(int32_t slotId);
61     int32_t SetCallTransferInfoPolicy(int32_t slotId);
62     int32_t SetCallPreferenceModePolicy(int32_t slotId);
63     int32_t GetImsConfigPolicy(int32_t slotId);
64     int32_t SetImsConfigPolicy(int32_t slotId);
65     int32_t GetImsFeatureValuePolicy(int32_t slotId);
66     int32_t SetImsFeatureValuePolicy(int32_t slotId);
67     static int32_t InviteToConferencePolicy(int32_t callId, std::vector<std::string> &numberList);
68     int32_t CloseUnFinishedUssdPolicy(int32_t slotId);
69     bool IsSupportVideoCall(AppExecFwk::PacMap &extras);
70     int32_t CanDialMulityCall(AppExecFwk::PacMap &extras, bool isEcc);
71     int32_t IsValidCallType(CallType callType);
72     int32_t IsVoiceCallValid(VideoStateType videoState);
73     int32_t HasNormalCall(bool isEcc, int32_t slotId, CallType callType);
74     int32_t GetAirplaneMode(bool &isAirplaneModeOn);
75     int32_t SuperPrivacyMode(std::u16string &number, AppExecFwk::PacMap &extras, bool isEcc);
76 
77 private:
78     bool IsCtSimCardSwitchToChnOrMc(int32_t slotId);
79 
80 private:
81     uint16_t onlyTwoCall_ = 2;
82 };
83 } // namespace Telephony
84 } // namespace OHOS
85 
86 #endif // CALL_POLICY_H
87