1 /* 2 * Copyright (C) 2023 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_SATELLITE_H 17 #define CELLULAR_CALL_CONTROL_SATELLITE_H 18 19 #include "call_manager_inner_type.h" 20 #include "cellular_call_connection_satellite.h" 21 #include "control_base.h" 22 #include "hril_call_parcel.h" 23 #include "satellite_call_types.h" 24 25 namespace OHOS { 26 namespace Telephony { 27 using SatelliteConnectionMap = std::map<int32_t, CellularCallConnectionSatellite>; 28 class SatelliteControl : public ControlBase { 29 public: 30 /** 31 * new SatelliteControl 32 * 33 */ 34 SatelliteControl() = default; 35 36 /** 37 * ~SatelliteControl destructor 38 */ 39 ~SatelliteControl(); 40 41 /** 42 * Dial Satellite 43 * 44 * @param CellularCallInfo 45 * @returns Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 46 */ 47 int32_t Dial(const CellularCallInfo &callInfo, bool isEcc) override; 48 49 /** 50 * SatelliteControl HangUp 51 * 52 * release the active call 53 * 54 * @param CellularCallInfo 55 * @param CallSupplementType 56 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 57 */ 58 int32_t HangUp(const CellularCallInfo &callInfo, CallSupplementType type) override; 59 60 /** 61 * SatelliteControl Answer 62 * 63 * Answer an incoming voice call. 64 * 65 * @param CellularCallInfo 66 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 67 */ 68 int32_t Answer(const CellularCallInfo &callInfo) override; 69 70 /** 71 * SatelliteControl Reject 72 * 73 * Reject an incoming voice call 74 * 75 * @param CellularCallInfo 76 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 77 */ 78 int32_t Reject(const CellularCallInfo &callInfo) override; 79 80 /** 81 * SatelliteControl GetConnectionMap 82 * 83 * @return CsConnectionMap 84 */ 85 SatelliteConnectionMap GetConnectionMap(); 86 87 /** 88 * SatelliteControl ReleaseAllConnection 89 */ 90 void ReleaseAllConnection(); 91 92 /** 93 * SatelliteControl ReportSatelliteCallsData. 94 * 95 * @param slotId 96 * @param CallInfoList 97 * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 98 */ 99 int32_t ReportSatelliteCallsData(int32_t slotId, const SatelliteCurrentCallList &callInfoList); 100 101 /** 102 * SatelliteControl ReportCallsData 103 * 104 * @returns Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 105 */ 106 int32_t ReportCallsData(int32_t slotId, const CallInfoList &callInfoList) override; 107 108 int32_t ReportHangUp(const std::vector<CellularCallInfo> &infos, int32_t slotId); 109 110 /** 111 * HoldCall 112 * 113 * @param slotId 114 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 115 */ 116 int32_t HoldCall(int32_t slotId) override; 117 118 /** 119 * UnHoldCall 120 * 121 * @param slotId 122 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 123 */ 124 int32_t UnHoldCall(int32_t slotId) override; 125 126 /** 127 * SwitchCall 128 * 129 * @param slotId 130 * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. 131 */ 132 int32_t SwitchCall(int32_t slotId) override; 133 134 /** 135 * 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 * HangUpAllConnection 148 * 149 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 150 */ 151 int32_t HangUpAllConnection(int32_t slotId) override; 152 153 private: 154 /** 155 * Report being hung up data 156 * 157 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 158 */ 159 int32_t ReportHungUpInfo(int32_t slotId); 160 161 /** 162 * Report Incoming info 163 * 164 * @param SatelliteCurrentCallList 165 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 166 */ 167 int32_t ReportIncomingInfo(int32_t slotId, const SatelliteCurrentCallList &list); 168 169 /** 170 * Report update info 171 * 172 * @param SatelliteCurrentCallList 173 * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 174 */ 175 int32_t ReportUpdateInfo(int32_t slotId, const SatelliteCurrentCallList &list); 176 177 /** 178 * Encapsulation CallReportInfo 179 * 180 * @param SatelliteCurrentCall 181 * @return CallReportInfo 182 */ 183 CallReportInfo EncapsulationCallReportInfo(int32_t slotId, const SatelliteCurrentCall &callInfo); 184 185 /** 186 * DeleteConnection Connection send 187 * 188 * @param CallsReportInfo 189 * @param SatelliteCurrentCallList 190 */ 191 void DeleteConnection(CallsReportInfo &callsResponseInfo, const SatelliteCurrentCallList &callInfoList); 192 193 /** 194 * Encapsulate Dial Common 195 * 196 * @param std::string phoneNum 197 * @param CLIRMode clirMode 198 * @returns Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. 199 */ 200 int32_t EncapsulateDialCommon(int32_t slotId, const std::string &phoneNum, CLIRMode &clirMode); 201 202 private: 203 SatelliteConnectionMap connectionMap_; // save callConnection map 204 std::string pendingPhoneNumber_; 205 }; 206 } // namespace Telephony 207 } // namespace OHOS 208 209 #endif // CELLULAR_CALL_CONTROL_SATELLITE_H 210