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