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 CELLULAR_CALL_CONNECTION_IMS_H 17 #define CELLULAR_CALL_CONNECTION_IMS_H 18 19 #include "base_connection.h" 20 #include "module_service_utils.h" 21 #include "ims_call_interface.h" 22 #include "call_manager_disconnected_details.h" 23 24 namespace OHOS { 25 namespace Telephony { 26 class CellularCallConnectionIMS : public BaseConnection { 27 public: 28 /** 29 * Constructor 30 */ 31 CellularCallConnectionIMS() = default; 32 33 /** 34 * Destructor 35 */ 36 ~CellularCallConnectionIMS() = default; 37 38 /** 39 * Dial Request 40 * 41 * @param slotId 42 * @param ImsDialInfoStruct 43 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 44 */ 45 int32_t DialRequest(int32_t slotId, const ImsDialInfoStruct &dialRequest); 46 47 /** 48 * HangUp Request 49 * 50 * @param slotId 51 * @param phoneNum 52 * @param index 53 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 54 */ 55 int32_t HangUpRequest(int32_t slotId, const std::string &phoneNum, int32_t index); 56 57 /** 58 * Answer Request 59 * 60 * @param slotId 61 * @param phoneNum 62 * @param videoState 63 * @param index 64 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 65 */ 66 int32_t AnswerRequest(int32_t slotId, const std::string &phoneNum, int32_t videoState, int32_t index); 67 68 /** 69 * Reject Request 70 * 71 * @param slotId 72 * @param phoneNum 73 * @param index 74 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 75 */ 76 int32_t RejectRequest(int32_t slotId, const std::string &phoneNum, int32_t index); 77 78 /** 79 * HoldCall Request 80 * 81 * @param slotId 82 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 83 */ 84 int32_t HoldCallRequest(int32_t slotId); 85 86 /** 87 * UnHoldCall Request 88 * 89 * @param slotId 90 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 91 */ 92 int32_t UnHoldCallRequest(int32_t slotId); 93 94 /** 95 * SwitchCall Request 96 * 97 * @param slotId 98 * @param videoState 99 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 100 */ 101 int32_t SwitchCallRequest(int32_t slotId, int32_t videoState); 102 103 /** 104 * CombineConference Request 105 * 106 * @param slotId 107 * @param voiceCall 108 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 109 */ 110 int32_t CombineConferenceRequest(int32_t slotId, int32_t voiceCall); 111 112 /** 113 * InviteToConference Request 114 * 115 * @param slotId 116 * @param numberList 117 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 118 */ 119 int32_t InviteToConferenceRequest(int32_t slotId, const std::vector<std::string> &numberList); 120 121 /** 122 * KickOutFromConference Request 123 * 124 * @param slotId 125 * @param index 126 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 127 */ 128 int32_t KickOutFromConferenceRequest(int32_t slotId, int32_t index); 129 130 /** 131 * CallSupplement Request 132 * 133 * @param slotId 134 * @param CallSupplementType 135 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 136 */ 137 int32_t CallSupplementRequest(int32_t slotId, CallSupplementType type); 138 139 /** 140 * StartRtt Request 141 * 142 * @param slotId 143 * @param msg 144 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 145 */ 146 int32_t StartRttRequest(int32_t slotId, const std::string &msg); 147 148 /** 149 * StopRtt Request 150 * 151 * @param slotId 152 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 153 */ 154 int32_t StopRttRequest(int32_t slotId); 155 156 /** 157 * GetImsCallsData Request 158 * 159 * @param slotId 160 * @param lastCallsDataFlag 161 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 162 */ 163 int32_t GetImsCallsDataRequest(int32_t slotId, int64_t lastCallsDataFlag); 164 165 /** 166 * Send Dtmf Request 167 * 168 * @param slotId 169 * @param char cDtmfCode 170 * @param index 171 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 172 */ 173 int32_t SendDtmfRequest(int32_t slotId, char cDtmfCode, int32_t index) const; 174 175 /** 176 * Start Dtmf Request 177 * 178 * @param slotId 179 * @param char cDtmfCode 180 * @param index 181 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 182 */ 183 int32_t StartDtmfRequest(int32_t slotId, char cDtmfCode, int32_t index) const; 184 185 /** 186 * Stop Dtmf Request 187 * 188 * @param slotId 189 * @param index 190 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 191 */ 192 int32_t StopDtmfRequest(int32_t slotId, int32_t index) const; 193 194 /** 195 * Get Call Fail Reason Request 196 * 197 * @param slotId 198 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 199 */ 200 int32_t GetCallFailReasonRequest(int32_t slotId) const; 201 202 void SetHoldToDialInfo(std::string holdToDialNum, CLIRMode holdToDialClirMode, int32_t holdToDialVideoState, 203 bool isEmergency); 204 205 bool IsNeedToDial(); 206 207 void SetDialFlag(bool isNeedToDial); 208 209 ImsDialInfoStruct GetHoldToDialInfo(); 210 211 bool IsPendingHold(); 212 213 bool IsPendingHangup(); 214 215 void SetHangupFlag(bool isPendingHangup); 216 217 RilDisconnectedReason GetDisconnectReason(); 218 219 void SetDisconnectReason(RilDisconnectedReason reason); 220 221 std::string GetDisconnectMessage(); 222 223 void SetDisconnectMessage(const std::string &message); 224 225 private: 226 virtual int32_t ProcessPostDialCallChar(int32_t slotId, char c) override; 227 228 private: 229 ModuleServiceUtils moduleUtils_; 230 bool isNeedToDial_ = false; 231 ImsDialInfoStruct holdToDialInfo_; 232 bool isPendingHangup_ = false; 233 RilDisconnectedReason disconnectReason_ = RilDisconnectedReason::DISCONNECTED_REASON_INVALID; 234 std::string disconnectMessage_ = ""; 235 }; 236 } // namespace Telephony 237 } // namespace OHOS 238 239 #endif // CELLULAR_CALL_CONNECTION_IMS_H