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