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