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 CELLULAR_CALL_CONTROL_IMS_H 17 #define CELLULAR_CALL_CONTROL_IMS_H 18 19 #include "hril_call_parcel.h" 20 #include "cellular_call_data_struct.h" 21 #include "cellular_call_connection_ims.h" 22 #include "control_base.h" 23 24 namespace OHOS { 25 namespace Telephony { 26 using ImsConnectionMap = std::map<std::string, CellularCallConnectionIMS>; 27 class IMSControl : public ControlBase { 28 public: 29 /** 30 * constructor 31 */ 32 IMSControl() = default; 33 34 /** 35 * destructor 36 */ 37 ~IMSControl(); 38 39 /** 40 * Dial 41 * 42 * @param CellularCallInfo 43 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 44 */ 45 int32_t Dial(const CellularCallInfo &callInfo) override; 46 47 /** 48 * HangUp 49 * 50 * @param CellularCallInfo 51 * @param CallSupplementType 52 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 53 */ 54 int32_t HangUp(const CellularCallInfo &callInfo, CallSupplementType type) override; 55 56 /** 57 * Answer 58 * 59 * @param CellularCallInfo 60 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 61 */ 62 int32_t Answer(const CellularCallInfo &callInfo) override; 63 64 /** 65 * Reject 66 * 67 * @param CellularCallInfo 68 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 69 */ 70 int32_t Reject(const CellularCallInfo &callInfo) override; 71 72 /** 73 * HoldCall 74 * 75 * @param slotId 76 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 77 */ 78 int32_t HoldCall(int32_t slotId) override; 79 80 /** 81 * UnHoldCall 82 * 83 * @param slotId 84 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 85 */ 86 int32_t UnHoldCall(int32_t slotId) override; 87 88 /** 89 * SwitchCall 90 * 91 * @param slotId 92 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 93 */ 94 int32_t SwitchCall(int32_t slotId) override; 95 96 /** 97 * CombineConference 98 * 99 * 22084-400_2001 1.3.8.2 Managing an active multiParty call 100 * 3GPP TS 22.030 101 * 102 * Add another remote party 103 * @param slotId 104 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 105 */ 106 int32_t CombineConference(int32_t slotId) override; 107 108 /** 109 * InviteToConference 110 * 111 * @param slotId 112 * @param numberList 113 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 114 */ 115 int32_t InviteToConference(int32_t slotId, const std::vector<std::string> &numberList); 116 117 /** 118 * KickOutFromConference 119 * 120 * @param slotId 121 * @param numberList 122 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 123 */ 124 int32_t KickOutFromConference(int32_t slotId, const std::vector<std::string> &numberList); 125 126 /** 127 * HangUpAllConnection 128 * 129 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 130 */ 131 int32_t HangUpAllConnection(int32_t slotId) override; 132 133 /** 134 * Update Call Media Mode 135 * 136 * @param CellularCallInfo 137 * @param ImsCallMode 138 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 139 */ 140 int32_t UpdateImsCallMode(const CellularCallInfo &callInfo, ImsCallMode mode); 141 142 /** 143 * Start Rtt 144 * 145 * @param msg 146 * @param slotId 147 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 148 */ 149 int32_t StartRtt(int32_t slotId, const std::string &msg); 150 151 /** 152 * Stop Rtt 153 * 154 * @param slotId 155 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 156 */ 157 int32_t StopRtt(int32_t slotId); 158 159 /** 160 * Release all Connection 161 */ 162 void ReleaseAllConnection(); 163 164 /** 165 * GetConnectionMap 166 * 167 * @return ImsConnectionMap 168 */ 169 ImsConnectionMap GetConnectionMap(); 170 171 /** 172 * IMSControl ReportImsCallsData. 173 * 174 * @param slotId 175 * @param CallInfoList 176 * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 177 */ 178 int32_t ReportImsCallsData(int32_t slotId, const ImsCurrentCallList &callInfoList); 179 180 /** 181 * IMSControl ReportCallsData. 182 * 183 * @param slotId 184 * @param CallInfoList 185 * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 186 */ 187 int32_t ReportCallsData(int32_t slotId, const CallInfoList &callInfoList) override; 188 189 private: 190 /** 191 * handle dial judgment 192 * 193 * @param slotId 194 * @param std::string phoneNum 195 * @param CLIRMode clirMode 196 * @param videoState 0: audio 1:video 197 * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 198 */ 199 int32_t DialJudgment(int32_t slotId, const std::string &phoneNum, CLIRMode &clirMode, int32_t videoState); 200 201 /** 202 * Encapsulate Dial Common 203 * 204 * @param std::string phoneNum 205 * @param CLIRMode clirMode 206 * @param videoState 0: audio 1:video 207 * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 208 */ 209 int32_t EncapsulateDial(int32_t slotId, const std::string &phoneNum, CLIRMode &clirMode, int32_t videoState) const; 210 211 /** 212 * Report being hung up data 213 * 214 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 215 */ 216 int32_t ReportHungUpInfo(int32_t slotId); 217 218 /** 219 * Report Incoming info 220 * 221 * @param CallInfoList 222 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 223 */ 224 int32_t ReportIncomingInfo(int32_t slotId, const ImsCurrentCallList &callInfoList); 225 226 /** 227 * Report update info 228 * 229 * @param CallInfoList 230 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 231 */ 232 int32_t ReportUpdateInfo(int32_t slotId, const ImsCurrentCallList &callInfoList); 233 234 /** 235 * Encapsulation CallReportInfo 236 * 237 * @param CallInfo 238 * @return CallReportInfo 239 */ 240 CallReportInfo EncapsulationCallReportInfo(int32_t slotId, const ImsCurrentCall &callInfo); 241 242 /** 243 * DeleteConnection Connection send 244 * 245 * @param CallsReportInfo 246 * @param CallInfoList 247 */ 248 void DeleteConnection(CallsReportInfo &callsReportInfo, const ImsCurrentCallList &callInfoList); 249 250 private: 251 ImsConnectionMap connectionMap_; // save callConnection map 252 }; 253 } // namespace Telephony 254 } // namespace OHOS 255 256 #endif // CELLULAR_CALL_CONTROL_IMS_H 257