• 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_SUPPLEMENT_REQUEST_H
17 #define CELLULAR_CALL_SUPPLEMENT_REQUEST_H
18 
19 #include "base_request.h"
20 #include "cellular_call_handler.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 class SupplementRequest : BaseRequest {
25 public:
26     /**
27      * @brief SetClipRequest Set Clip Request
28      *
29      * @param slotId Indicates the card slot index number,
30      * ranging from {@code 0} to the maximum card slot index number supported by the device.
31      * @param action Indicates the action for SetClip,
32      * 1, means turn on clip; 0, means turn off clip.
33      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
34      */
35     int32_t SetClipRequest(int32_t slotId, int32_t action);
36 
37     /**
38      * @brief GetClipRequest Get Clip Request
39      *
40      * @param slotId Indicates the card slot index number,
41      * ranging from {@code 0} to the maximum card slot index number supported by the device.
42      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
43      */
44     int32_t GetClipRequest(int32_t slotId);
45 
46     /**
47      * @brief SetClirRequest Set Clir Request
48      *
49      * @param slotId Indicates the card slot index number,
50      * ranging from {@code 0} to the maximum card slot index number supported by the device.
51      * @param action Indicates the action for SetClir,
52      * 1, means turn on clir; 0, means turn off clir.
53      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
54      */
55     int32_t SetClirRequest(int32_t slotId, int32_t action);
56 
57     /**
58      * @brief GetClirRequest Get Clir Request
59      *
60      * @param slotId Indicates the card slot index number,
61      * ranging from {@code 0} to the maximum card slot index number supported by the device.
62      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
63      */
64     int32_t GetClirRequest(int32_t slotId);
65 
66     /**
67      * @brief GetCallTransferRequest Get Call Transfer Request
68      *
69      * @param slotId Indicates the card slot index number,
70      * ranging from {@code 0} to the maximum card slot index number supported by the device.
71      * @param reason Indicates the reason of the get call transfer.
72      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
73      */
74     int32_t GetCallTransferRequest(int32_t slotId, int32_t reason);
75 
76     /**
77      * @brief SetCallTransferRequest Set Call Transfer Request
78      *
79      * @param slotId Indicates the card slot index number,
80      * ranging from {@code 0} to the maximum card slot index number supported by the device.
81      * @param reason Indicates the reason of the set call transfer.
82      * @param mode Indicates the mode of the set call transfer.
83      * @param transferNum Indicates the target phone number to transfer calls to.
84      * @param classType Indicates a sum of service class for setting call transfer.
85      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
86      */
87     int32_t SetCallTransferRequest(
88         int32_t slotId, int32_t action, int32_t reason, const std::string &transferNum, int32_t classType);
89 
90     /**
91      * @brief GetCallRestrictionRequest Get Call Restriction Request
92      *
93      * @param slotId Indicates the card slot index number,
94      * ranging from {@code 0} to the maximum card slot index number supported by the device.
95      * @param fac Indicates the facility of the get call restriction.
96      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
97      */
98     int32_t GetCallRestrictionRequest(int32_t slotId, const std::string &fac);
99 
100     /**
101      * @brief SetCallRestrictionRequest Set Call Restriction Request
102      *
103      * @param slotId Indicates the card slot index number,
104      * ranging from {@code 0} to the maximum card slot index number supported by the device.
105      * @param fac Indicates the facility of the set call restriction.
106      * @param mode Indicates the mode of the set call restriction.
107      * @param pw Indicates password or "" if not required.
108      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
109      */
110     int32_t SetCallRestrictionRequest(int32_t slotId, std::string &fac, int32_t mode, std::string &pw);
111 
112     /**
113      * @brief SetCallWaitingRequest Set CallWaiting Request
114      *
115      * @param slotId Indicates the card slot index number,
116      * ranging from {@code 0} to the maximum card slot index number supported by the device.
117      * @param activate Indicates the action for SetCallWaiting,
118      * true, means turn on CallWaiting; false, means turn off CallWaiting.
119      * @param classType Call waiting and conditions +CCWA,
120      * the value was {@code ServiceClassType}, See 3GPP TS 22.083.
121      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
122      */
123     int32_t SetCallWaitingRequest(int32_t slotId, bool activate, int32_t classType);
124 
125     /**
126      * @brief GetCallWaitingRequest Get Call Waiting Request
127      *
128      * @param slotId Indicates the card slot index number,
129      * ranging from {@code 0} to the maximum card slot index number supported by the device.
130      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
131      */
132     int32_t GetCallWaitingRequest(int32_t slotId);
133 
134     /**
135      * @brief SetColrRequest Set Colr Request
136      *
137      * @param slotId Indicates the card slot index number,
138      * ranging from {@code 0} to the maximum card slot index number supported by the device.
139      * @param presentation Indicates the action for SetClir,
140      * 1, means turn on colr; 0, means turn off colr.
141      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
142      */
143     int32_t SetColrRequest(int32_t slotId, int32_t presentation);
144 
145     /**
146      * @brief GetColrRequest Get Colr Request
147      *
148      * @param slotId Indicates the card slot index number,
149      * ranging from {@code 0} to the maximum card slot index number supported by the device.
150      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
151      */
152     int32_t GetColrRequest(int32_t slotId);
153 
154     /**
155      * @brief SetColpRequest Set Colp Request
156      *
157      * @param slotId Indicates the card slot index number,
158      * ranging from {@code 0} to the maximum card slot index number supported by the device.
159      * @param action Indicates the action for SetClir,
160      * 1, means turn on colp; 0, means turn off colp.
161      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
162      */
163     int32_t SetColpRequest(int32_t slotId, int32_t action);
164 
165     /**
166      * @brief GetColpRequest Get Colp Request
167      *
168      * @param slotId Indicates the card slot index number,
169      * ranging from {@code 0} to the maximum card slot index number supported by the device.
170      * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure.
171      */
172     int32_t GetColpRequest(int32_t slotId);
173 
174     /**
175      * Send ussd Request
176      *
177      * @param msg
178      * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure.
179      */
180     int32_t SendUssdRequest(int32_t slotId, const std::string &msg);
181 
182     /*
183      * SIM PIN unlock
184      *
185      * @param slotId The ID of SIM slot
186      * @param newPin The new pin code for unlock SIM
187      * @param oldPin The old pin code for unlock SIM
188      * @return Returns true on success.
189      */
190     int32_t AlterPinPassword(int32_t slotId, std::string newPin, std::string oldPin);
191 
192     /**
193      * SIM PUK unlock
194      *
195      * @param slotId The ID of SIM slot
196      * @param newPin  The new pin code for unlock SIM
197      * @param puk The puk code for unlock SIM
198      * @return Returns true on success.
199      */
200     int32_t UnlockPuk(int32_t slotId, std::string newPin, std::string puk);
201 
202     /**
203      * SIM PIN2 unlock
204      *
205      * @param slotId The ID of SIM slot
206      * @param newPin2 The new pin2 code for unlock SIM
207      * @param oldPin2 The old pin2 code for unlock SIM
208      * @return Returns true on success.
209      */
210     int32_t AlterPin2Password(int32_t slotId, std::string newPin2, std::string oldPin2);
211 
212     /**
213      * SIM PUK2 unlock
214      *
215      * @param slotId The ID of SIM slot
216      * @param newPin2 The new pin2 code for unlock SIM
217      * @param puk2 The puk2 code for unlock SIM
218      * @return Returns true on success.
219      */
220     int32_t UnlockPuk2(int32_t slotId, std::string newPin2, std::string puk2);
221 
222 private:
223     /**
224      * GetMMIHandler
225      *
226      * @return std::shared_ptr<MMIHandler>
227      */
228     std::shared_ptr<CellularCallHandler> GetMMIHandler(int32_t slotId) const;
229 
230 private:
231     ModuleServiceUtils moduleUtils_;
232 };
233 } // namespace Telephony
234 } // namespace OHOS
235 #endif // CELLULAR_CALL_SUPPLEMENT_REQUEST_H
236