• 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_SUPPLEMENT_H
17 #define CELLULAR_CALL_SUPPLEMENT_H
18 
19 #include <string>
20 
21 #include "cellular_call_data_struct.h"
22 #include "hril_types.h"
23 #include "hril_call_parcel.h"
24 #include "module_service_utils.h"
25 #include "supplement_request.h"
26 #include "telephony_log_wrapper.h"
27 
28 namespace OHOS {
29 namespace Telephony {
30 class CellularCallSupplement {
31 public:
32     /**
33      * Deal Clip
34      *
35      * 3GPP TS 22.030 V4.0.0 (2001-03)  6.5.6.2	Calling Line Identification Presentation (CLIP)
36      * The CLIP Supplementary Service is defined in GSM 02.81[12]
37      * 3GPP TS 22.030 V4.0.0 (2001-03) Annex B (normative):Codes for defined Supplementary Services
38      *
39      * @param slotId
40      * @param MMIData
41      */
42     void GetClip(int32_t slotId, const MMIData &mmiData);
43 
44     /**
45      * Deal Clir
46      *
47      * 3GPP TS 22.081 V4.0.0 (2001-03) 2 Calling Line Identification Restriction (CLIR)
48      * 3GPP TS 22.030 V4.0.0 (2001-03) Annex B (normative):Codes for defined Supplementary Services
49      *
50      * @param slotId
51      * @param MMIData
52      */
53     void GetClir(int32_t slotId, const MMIData &mmiData);
54 
55     /**
56      * Deal Call Transfer
57      *
58      * 3GPP TS 22.030 V4.0.0 (2001-03)
59      * 3GPP TS 22.030 V4.0.0 (2001-03) Annex B (normative):Codes for defined Supplementary Services
60      *
61      * @param slotId
62      * @param MMIData
63      */
64     void DealCallTransfer(int32_t slotId, const MMIData &mmiData);
65 
66     /**
67      * Set Call Transfer
68      *
69      * 27007-430_2001 7.11 Call forwarding number and conditions +CCFC
70      * 3GPP TS 22.082 [4]
71      * Control of the call forwarding supplementary service
72      *
73      * @param slotId
74      * @param CallTransferInfo
75      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
76      */
77     int32_t SetCallTransferInfo(int32_t slotId, const CallTransferInfo &cTInfo);
78 
79     /**
80      * Inquire Call Transfer
81      *
82      * 27007-430_2001 7.11 Call forwarding number and conditions +CCFC
83      * 3GPP TS 22.082 [4]
84      * Control of the call forwarding supplementary service
85      *
86      * @param slotId
87      * @param CallTransferType
88      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
89      */
90     int32_t GetCallTransferInfo(int32_t slotId, CallTransferType type);
91 
92     /**
93      * Deal Call Restriction
94      *
95      * 3GPP TS 22.088 [6] 1	Barring of outgoing calls
96      * 3GPP TS 22.088 [6] 2	Barring of incoming calls
97      *
98      * @param slotId
99      * @param MMIData
100      */
101     void DealCallRestriction(int32_t slotId, const MMIData &mmiData);
102 
103     /**
104      * Set Call Restriction
105      *
106      * 27007-430_2001 7.4	Facility lock +CLCK
107      * 3GPP TS 22.088 [6] 1	Barring of outgoing calls
108      * 3GPP TS 22.088 [6] 2	Barring of incoming calls
109      *
110      * Control of the call barring supplementary service
111      *
112      * @param slotId
113      * @param CallRestrictionInfo
114      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
115      */
116     int32_t SetCallRestriction(int32_t slotId, const CallRestrictionInfo &cRInfo);
117 
118     /**
119      * Inquire Call Restriction
120      *
121      * 27007-430_2001 7.4	Facility lock +CLCK
122      * 3GPP TS 22.088 [6] 1	Barring of outgoing calls
123      * 3GPP TS 22.088 [6] 2	Barring of incoming calls
124      *
125      * Control of the call barring supplementary service
126      *
127      * @param slotId
128      * @param CallRestrictionType
129      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
130      */
131     int32_t GetCallRestriction(int32_t slotId, CallRestrictionType facType);
132 
133     /**
134      * Deal Call Waiting
135      *
136      * 27007-430_2001 7.12	Call waiting +CCWA
137      * 3GPP TS 22.083 [5] 1	Call waiting (CW)
138      *
139      * @param slotId
140      * Deal Call Waiting
141      * @param MMIData
142      */
143     void DealCallWaiting(int32_t slotId, const MMIData &mmiData);
144 
145     /**
146      * Set Call Waiting
147      *
148      * 27007-430_2001 7.12	Call waiting +CCWA
149      * 3GPP TS 22.083 [5] 1	Call waiting (CW)
150      *
151      * Control of the Call Waiting supplementary service
152      *
153      * @param slotId
154      * @param activate
155      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
156      */
157     int32_t SetCallWaiting(int32_t slotId, bool activate);
158 
159     /**
160      * Inquire Call Waiting
161      *
162      * 27007-430_2001 7.12	Call waiting +CCWA
163      * 3GPP TS 22.083 [5] 1	Call waiting (CW)
164      *
165      * Control of the Call Waiting supplementary service
166      *
167      * @param slotId
168      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
169      */
170     int32_t GetCallWaiting(int32_t slotId);
171 
172     /**
173      * Send Ussd msg
174      *
175      * 22.090 Unstructured Supplementary Service Data (USSD); Stage 1
176      * 23.090 Unstructured Supplementary Service Data (USSD); Stage 2
177      * 24.090 Unstructured Supplementary Service Data (USSD); Stage 3
178      *
179      * Control of the Ussd supplementary service
180      *
181      * @param slotId
182      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
183      */
184     int32_t SendUssd(int32_t slotId, const std::string &msg);
185 
186     /**
187      * Event Deal clip Mmi
188      *
189      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.6	Calling line identification presentation +CLIP
190      *
191      * @param GetClipResult
192      */
193     void EventGetClip(GetClipResult &getClipResult);
194 
195     /**
196      * Event Deal Clir Mmi
197      *
198      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.7	Calling line identification restriction +CLIR
199      *
200      * @param GetClirResult
201      */
202     void EventGetClir(GetClirResult &result);
203 
204     /**
205      * Event set Clir Mmi
206      *
207      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.7	Calling line identification restriction +CLIR
208      *
209      * @param HRilRadioResponseInfo
210      */
211     void EventSetClir(HRilRadioResponseInfo &info);
212 
213     /**
214      * GetCallRestriction result
215      *
216      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.4	Facility lock +CLCK
217      *
218      * @param CallRestrictionResult
219      */
220     void EventGetCallRestriction(const CallRestrictionResult &result);
221 
222     /**
223      * SetCallRestriction result
224      *
225      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.4	Facility lock +CLCK
226      *
227      * @param HRilRadioResponseInfo
228      */
229     void EventSetCallRestriction(HRilRadioResponseInfo &info);
230 
231     /**
232      * Call Waiting result
233      *
234      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.12	Call waiting +CCWA
235      * status: 0	not active;  1	active
236      *
237      * @param CallWaitResult waitingInfo
238      */
239     void EventGetCallWaiting(CallWaitResult &waitingInfo);
240 
241     /**
242      * Event Set CallWaiting
243      *
244      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.12	Call waiting +CCWA
245      *
246      * @param HRilRadioResponseInfo
247      */
248     void EventSetCallWaiting(HRilRadioResponseInfo &responseInfo);
249 
250     /**
251      * Event Inquire Call Transfer
252      *
253      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.11	Call forwarding number and conditions +CCFC
254      *
255      * @param CallForwardQueryResult
256      */
257     void EventGetCallTransferInfo(CallForwardQueryResult &queryResult);
258 
259     /**
260      * Event Set Call Transfer
261      *
262      * 3GPP TS 27.007 V3.9.0 (2001-06) 7.11	Call forwarding number and conditions +CCFC
263      *
264      * @param HRilRadioResponseInfo
265      */
266     void EventSetCallTransferInfo(HRilRadioResponseInfo &responseInfo);
267 
268     /**
269      * Event Send Ussd
270      *
271      * 3GPP TS 3GPP TS 22.030 V16.0.0 (2020-07) 6.5	Supplementary Services Control
272      *
273      * @param HRilRadioResponseInfo
274      */
275     void EventSendUssd(HRilRadioResponseInfo &responseInfo);
276 
277 private:
278     /**
279      * Obtain ServiceCode
280      *
281      * @param serviceInfoB
282      * @return CFInformation
283      */
284     int32_t ObtainServiceCode(const std::string &serviceInfoB);
285 
286     /**
287      * Obtain Cause
288      *
289      * 3GPP TS 22.030 V4.0.0 (2001-03) Annex B (normative): Codes for defined Supplementary Services
290      *
291      * @param basicString
292      * @return CallTransferType
293      */
294     int32_t ObtainCause(const std::string &serviceInfoC);
295 
296     /**
297      * Obtain Barring Installation
298      *
299      * 27007-430_2001 7.4	Facility lock +CLCK
300      * 3GPP TS 22.088 [6] 1	Barring of outgoing calls
301      * 3GPP TS 22.088 [6] 2	Barring of incoming calls
302      *
303      * @param serviceInfoC
304      * @return Barring type
305      */
306     std::string ObtainBarringInstallation(const std::string &serviceInfoC);
307 
308     /**
309      * Is Phone Gsm Type
310      *
311      * @param slotId
312      * @return bool
313      */
314     bool PhoneTypeGsmOrNot(int32_t slotId);
315 
316 private:
317     const int32_t ACTIVATE_ACTION = 1;
318     const int32_t DEACTIVATE_ACTION = 2;
319     SupplementRequest supplementRequest_;
320     ModuleServiceUtils moduleServiceUtils_;
321     const std::string BARR_ALL_OUTGOING_CALLS = "AO";
322     const std::string BARR_OUTGOING_INTERNATIONAL_CALLS = "OI";
323     const std::string BARR_OUTGOING_INTERNATIONAL_CALLS_EXCLUDING_HOME = "OX";
324     const std::string BARR_ALL_INCOMING_CALLS = "AI";
325     const std::string BARR_INCOMING_CALLS_OUTSIDE_HOME = "IR";
326     const std::string ALL_BARRING_SERVICES = "AB";
327     const std::string ALL_OUTGOING_BARRING_SERVICES = "AG";
328     const std::string ALL_INCOMING_BARRING_SERVICES = "AC";
329 };
330 } // namespace Telephony
331 } // namespace OHOS
332 #endif // CELLULAR_CALL_SUPPLEMENT_H
333