• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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 ReportCallsData.
173      *
174      * @param slotId
175      * @param CallInfoList
176      * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure.
177      */
178     int32_t ReportCallsData(int32_t slotId, const CallInfoList &callInfoList) override;
179 
180 private:
181     /**
182      * handle dial judgment
183      *
184      * @param slotId
185      * @param std::string phoneNum
186      * @param CLIRMode clirMode
187      * @param videoState  0: audio 1:video
188      * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure.
189      */
190     int32_t DialJudgment(int32_t slotId, const std::string &phoneNum, CLIRMode &clirMode, int32_t videoState);
191 
192     /**
193      * Encapsulate Dial Common
194      *
195      * @param std::string phoneNum
196      * @param CLIRMode clirMode
197      * @param videoState  0: audio 1:video
198      * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure.
199      */
200     int32_t EncapsulateDial(int32_t slotId, const std::string &phoneNum, CLIRMode &clirMode, int32_t videoState) const;
201 
202     /**
203      * Report being hung up data
204      *
205      * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure.
206      */
207     int32_t ReportHungUpInfo(int32_t slotId);
208 
209     /**
210      * Report Incoming info
211      *
212      * @param CallInfoList
213      * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure.
214      */
215     int32_t ReportIncomingInfo(int32_t slotId, const CallInfoList &callInfoList);
216 
217     /**
218      * Report update info
219      *
220      * @param CallInfoList
221      * @return Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure.
222      */
223     int32_t ReportUpdateInfo(int32_t slotId, const CallInfoList &callInfoList);
224 
225     /**
226      * Encapsulation CallReportInfo
227      *
228      * @param CallInfo
229      * @return CallReportInfo
230      */
231     CallReportInfo EncapsulationCallReportInfo(int32_t slotId, const CallInfo &callInfo);
232 
233     /**
234      * DeleteConnection Connection send
235      *
236      * @param CallsReportInfo
237      * @param CallInfoList
238      */
239     void DeleteConnection(CallsReportInfo &callsReportInfo, const CallInfoList &callInfoList);
240 
241 private:
242     ImsConnectionMap connectionMap_; // save callConnection map
243 };
244 } // namespace Telephony
245 } // namespace OHOS
246 
247 #endif // CELLULAR_CALL_CONTROL_IMS_H
248