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_CS_H 17 #define CELLULAR_CALL_CONTROL_CS_H 18 19 #include "call_manager_inner_type.h" 20 21 #include "hril_call_parcel.h" 22 #include "cellular_call_connection_cs.h" 23 #include "control_base.h" 24 25 namespace OHOS { 26 namespace Telephony { 27 using CsConnectionMap = std::map<std::string, CellularCallConnectionCS>; 28 class CSControl : public ControlBase { 29 public: 30 /** 31 * new CSControl 32 * 33 */ 34 CSControl() = default; 35 36 /** 37 * ~CSControl destructor 38 */ 39 ~CSControl(); 40 41 /** 42 * CSControl Dial 43 * 44 * 27007-430_2001 6.27 Informative examples 45 * 3GPP TS 22.030 [19] 46 * 47 * originate a voice call 48 * 49 * @param CellularCallInfo 50 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 51 */ 52 int32_t Dial(const CellularCallInfo &callInfo) override; 53 54 /** 55 * CSControl HangUp 56 * 57 * 27007-430_2001 7.13 Call related supplementary services +CHLD 58 * 3GPP TS 22.030 [19] 59 * 60 * release the active call 61 * 62 * @param CellularCallInfo 63 * @param CallSupplementType 64 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 65 */ 66 int32_t HangUp(const CellularCallInfo &callInfo, CallSupplementType type) override; 67 68 /** 69 * CSControl Answer 70 * 71 * 27007-430_2001 6.6 Alternating mode call control method 72 * 3GPP TS 22.030 [19] 73 * 74 * Answer an incoming voice call. 75 * 76 * @param CellularCallInfo 77 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 78 */ 79 int32_t Answer(const CellularCallInfo &callInfo) override; 80 81 /** 82 * CSControl Reject 83 * 84 * 27007-430_2001 6.6 Alternating mode call control method 85 * 3GPP TS 22.030 [19] 86 * 87 * Reject an incoming voice call 88 * 89 * @param CellularCallInfo 90 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 91 */ 92 int32_t Reject(const CellularCallInfo &callInfo) override; 93 94 /** 95 * CSControl HoldCall 96 * 97 * 22083-400_2001 2 Call hold 98 * 3GPP TS 22.030 [3] 99 * 3GPP TS 23.083 V4.2.0 (2001-04) 2 Call hold (HOLD) 100 * 101 * The call hold service allows a served mobile subscriber 102 * 103 * @param slotId 104 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 105 */ 106 int32_t HoldCall(int32_t slotId) override; 107 108 /** 109 * CSControl UnHoldCall 110 * 111 * 22083-400_2001 2 Call hold 112 * 3GPP TS 22.030 [3] 113 * 114 * Retrieve the held call. 115 * 116 * @param slotId 117 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 118 */ 119 int32_t UnHoldCall(int32_t slotId) override; 120 121 /** 122 * CSControl SwitchCall 123 * 124 * 22083-400_2001 2 Call hold 125 * 3GPP TS 22.030 [3] 126 * 127 * Alternate from one call to the other 128 * 129 * @param slotId 130 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 131 */ 132 int32_t SwitchCall(int32_t slotId) override; 133 134 /** 135 * CSControl CombineConference 136 * 137 * 22084-400_2001 1.3.8.2 Managing an active multiParty call 138 * 3GPP TS 22.030 139 * 140 * Add another remote party 141 * @param slotId 142 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 143 */ 144 int32_t CombineConference(int32_t slotId) override; 145 146 /** 147 * CSControl SeparateConference 148 * 149 * 22084-400_2001 1.3.8.2 Managing an active multiParty call 150 * 3GPP TS 22.030 151 * 152 * Separate a remote party 153 * @param slotId 154 * @param std::string splitString 155 * @param index 156 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 157 */ 158 int32_t SeparateConference(int32_t slotId, const std::string &splitString, int32_t index); 159 160 /** 161 * HangUpAllConnection 162 * 163 * @param slotId 164 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 165 */ 166 int32_t HangUpAllConnection(int32_t slotId) override; 167 168 /** 169 * CSControl ReleaseAllConnection 170 */ 171 void ReleaseAllConnection(); 172 173 /** 174 * CSControl GetConnectionMap 175 * 176 * @return CsConnectionMap 177 */ 178 CsConnectionMap GetConnectionMap(); 179 180 /** 181 * CSControl ReportCallsData 182 * 183 * @returns Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 184 */ 185 int32_t ReportCallsData(int32_t slotId, const CallInfoList &callInfoList) override; 186 187 private: 188 /** 189 * Calculate International Roaming 190 * 191 * @param slotId 192 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 193 */ 194 bool CalculateInternationalRoaming(int32_t slotId) const; 195 196 /** 197 * Report being hung up data 198 * 199 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 200 */ 201 int32_t ReportHungUpInfo(int32_t slotId); 202 203 /** 204 * Report Incoming info 205 * 206 * @param CallInfoList 207 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 208 */ 209 int32_t ReportIncomingInfo(int32_t slotId, const CallInfoList &list); 210 211 /** 212 * Report update info 213 * 214 * @param CallInfoList 215 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 216 */ 217 int32_t ReportUpdateInfo(int32_t slotId, const CallInfoList &list); 218 219 /** 220 * Encapsulation CallReportInfo 221 * 222 * @param callInfo 223 * @return CallReportInfo 224 */ 225 CallReportInfo EncapsulationCallReportInfo(int32_t slotId, const CallInfo &callInfo); 226 227 /** 228 * DeleteConnection Connection send 229 * 230 * @param CallsReportInfo 231 * @param CallInfoList 232 */ 233 void DeleteConnection(CallsReportInfo &callsResponseInfo, const CallInfoList &callInfoList); 234 235 /** 236 * Dial Cdma 237 * 238 * @param CellularCallInfo 239 * @returns Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 240 */ 241 int32_t DialCdma(const CellularCallInfo &callInfo); 242 243 /** 244 * Dial Gsm 245 * 246 * @param CellularCallInfo 247 * @returns Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 248 */ 249 int32_t DialGsm(const CellularCallInfo &callInfo); 250 251 /** 252 * Encapsulate Dial Common 253 * 254 * @param std::string phoneNum 255 * @param CLIRMode clirMode 256 * @returns Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 257 */ 258 int32_t EncapsulateDialCommon(int32_t slotId, const std::string &phoneNum, CLIRMode &clirMode); 259 260 private: 261 CsConnectionMap connectionMap_; // save callConnection map 262 const int32_t VOICE_CALL = 0; 263 }; 264 } // namespace Telephony 265 } // namespace OHOS 266 267 #endif // CELLULAR_CALL_CONTROL_CS_H 268