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 I_TEL_RIL_MANAGER_H
17 #define I_TEL_RIL_MANAGER_H
18 
19 #include "event_runner.h"
20 #include "tel_ril_network_parcel.h"
21 #include "tel_ril_sim_parcel.h"
22 #include "tel_ril_sms_parcel.h"
23 #include "tel_ril_types.h"
24 #include "telephony_types.h"
25 
26 namespace OHOS {
27 namespace Telephony {
28 class ITelRilManager {
29 public:
30     virtual bool OnInit() = 0;
31     virtual ~ITelRilManager() = default;
32 
33     virtual int32_t RegisterCoreNotify(
34         int32_t slotId, const std::shared_ptr<AppExecFwk::EventHandler> &handler, int32_t what, int32_t *obj) = 0;
35     virtual int32_t UnRegisterCoreNotify(
36         int32_t slotId, const std::shared_ptr<AppExecFwk::EventHandler> &observerCallBack, int32_t what) = 0;
37 
38     virtual int32_t InitTelExtraModule(int32_t slotId) = 0;
39 
40     virtual int32_t SetRadioState(
41         int32_t slotId, int32_t fun, int32_t rst, const AppExecFwk::InnerEvent::Pointer &response) = 0;
42     virtual int32_t GetRadioState(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
43 
44     virtual int32_t ShutDown(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
45 
46     virtual int32_t GetCallList(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
47 
48     virtual int32_t Dial(
49         int32_t slotId, std::string address, int32_t clirMode, const AppExecFwk::InnerEvent::Pointer &result) = 0;
50 
51     virtual int32_t Reject(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
52 
53     virtual int32_t Hangup(int32_t slotId, int32_t gsmIndex, const AppExecFwk::InnerEvent::Pointer &result) = 0;
54 
55     virtual int32_t Answer(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
56 
57     virtual int32_t HoldCall(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
58 
59     virtual int32_t UnHoldCall(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
60 
61     virtual int32_t SwitchCall(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
62 
63     virtual int32_t CombineConference(
64         int32_t slotId, int32_t callType, const AppExecFwk::InnerEvent::Pointer &result) = 0;
65 
66     virtual int32_t SeparateConference(
67         int32_t slotId, int32_t callIndex, int32_t callType, const AppExecFwk::InnerEvent::Pointer &result) = 0;
68 
69     virtual int32_t CallSupplement(int32_t slotId, int32_t type, const AppExecFwk::InnerEvent::Pointer &result) = 0;
70 
71     virtual int32_t GetCallWaiting(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
72 
73     virtual int32_t SetCallWaiting(
74         int32_t slotId, const int32_t activate, const AppExecFwk::InnerEvent::Pointer &result) = 0;
75 
76     virtual int32_t GetCallTransferInfo(
77         int32_t slotId, const int32_t reason, const AppExecFwk::InnerEvent::Pointer &result) = 0;
78 
79     virtual int32_t SetCallTransferInfo(
80         int32_t slotId, const CallTransferParam &callTransfer, const AppExecFwk::InnerEvent::Pointer &result) = 0;
81 
82     virtual int32_t GetClip(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
83 
84     virtual int32_t SetClip(int32_t slotId, const int32_t action, const AppExecFwk::InnerEvent::Pointer &result) = 0;
85 
86     virtual int32_t GetClir(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
87 
88     virtual int32_t SetClir(int32_t slotId, const int32_t action, const AppExecFwk::InnerEvent::Pointer &result) = 0;
89 
90     virtual int32_t GetCallRestriction(
91         int32_t slotId, std::string fac, const AppExecFwk::InnerEvent::Pointer &result) = 0;
92 
93     virtual int32_t SetCallRestriction(
94         int32_t slotId, const CallRestrictionParam &callrestriction, const AppExecFwk::InnerEvent::Pointer &result) = 0;
95 
96     virtual int32_t SetBarringPassword(int32_t slotId, const char *oldPassword, const char *newPassword,
97         const std::string &restrictionType, const AppExecFwk::InnerEvent::Pointer &response) = 0;
98 
99     virtual int32_t SendDtmf(
100         int32_t slotId, const DtmfParam &dtmfParam, const AppExecFwk::InnerEvent::Pointer &result) = 0;
101     virtual int32_t SendDtmf(
102         int32_t slotId, char cDTMFCode, int32_t index, const AppExecFwk::InnerEvent::Pointer &result) = 0;
103     virtual int32_t StartDtmf(
104         int32_t slotId, char cDTMFCode, int32_t index, const AppExecFwk::InnerEvent::Pointer &result) = 0;
105     virtual int32_t StopDtmf(int32_t slotId, int32_t index, const AppExecFwk::InnerEvent::Pointer &result) = 0;
106 
107     virtual int32_t SetVoNRSwitch(
108         int32_t slotId, int32_t state, const AppExecFwk::InnerEvent::Pointer &result) = 0;
109 
110     virtual int32_t GetSignalStrength(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
111 
112     virtual int32_t GetCsRegStatus(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
113 
114     virtual int32_t GetPsRegStatus(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
115 
116     virtual int32_t GetOperatorInfo(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
117 
118     virtual int32_t GetCellInfoList(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
119 
120     virtual int32_t GetCurrentCellInfo(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
121 
122     virtual int32_t GetImei(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
123 
124     virtual int32_t GetImeiSv(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
125 
126     virtual int32_t GetMeid(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
127 
128     virtual int32_t GetVoiceRadioTechnology(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
129 
130     virtual int32_t GetPhysicalChannelConfig(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
131 
132     virtual int32_t GetBasebandVersion(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
133 
134     virtual int32_t SetLocateUpdates(
135         int32_t slotId, RegNotifyMode mode, const AppExecFwk::InnerEvent::Pointer &response) = 0;
136 
137     virtual int32_t SendGsmSms(
138         int32_t slotId, std::string smscPdu, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response) = 0;
139 
140     virtual int32_t SendCdmaSms(int32_t slotId, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response) = 0;
141 
142     virtual int32_t AddSimMessage(
143         int32_t slotId, const SimMessageParam &simMessage, const AppExecFwk::InnerEvent::Pointer &response) = 0;
144 
145     virtual int32_t DelSimMessage(
146         int32_t slotId, int32_t gsmIndex, const AppExecFwk::InnerEvent::Pointer &response) = 0;
147 
148     virtual int32_t UpdateSimMessage(
149         int32_t slotId, const SimMessageParam &simMessage, const AppExecFwk::InnerEvent::Pointer &response) = 0;
150 
151     virtual int32_t GetSmscAddr(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
152 
153     virtual int32_t GetCdmaCBConfig(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
154 
155     virtual int32_t SetSmscAddr(
156         int32_t slotId, int32_t tosca, std::string address, const AppExecFwk::InnerEvent::Pointer &response) = 0;
157 
158     virtual int32_t SetCBConfig(
159         int32_t slotId, const CBConfigParam &cbConfig, const AppExecFwk::InnerEvent::Pointer &response) = 0;
160 
161     virtual int32_t SetCdmaCBConfig(int32_t slotId, CdmaCBConfigInfoList &cdmaCBConfigInfoList,
162         const AppExecFwk::InnerEvent::Pointer &response) = 0;
163 
164     virtual int32_t GetCBConfig(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
165 
166     virtual int32_t SendSmsMoreMode(
167         int32_t slotId, std::string smscPdu, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response) = 0;
168 
169     virtual int32_t SendSmsAck(
170         int32_t slotId, bool success, int32_t cause, const AppExecFwk::InnerEvent::Pointer &response) = 0;
171     virtual int32_t AddCdmaSimMessage(
172         int32_t slotId, int32_t status, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response) = 0;
173     virtual int32_t DelCdmaSimMessage(
174         int32_t slotId, int32_t cdmaIndex, const AppExecFwk::InnerEvent::Pointer &response) = 0;
175     virtual int32_t UpdateCdmaSimMessage(
176         int32_t slotId, const CdmaSimMessageParam &cdmaSimMsg, const AppExecFwk::InnerEvent::Pointer &response) = 0;
177 
178     /* PDP start */
179     virtual int32_t SetInitApnInfo(
180         int32_t slotId, const DataProfile &dataProfile, const AppExecFwk::InnerEvent::Pointer &response) = 0;
181     virtual int32_t ActivatePdpContext(
182         int32_t slotId, const ActivateDataParam &activeData, const AppExecFwk::InnerEvent::Pointer &response) = 0;
183     virtual int32_t DeactivatePdpContext(
184         int32_t slotId, int32_t cid, int32_t reason, const AppExecFwk::InnerEvent::Pointer &response) = 0;
185     virtual int32_t GetPdpContextList(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
186     virtual int32_t GetLinkBandwidthInfo(
187         int32_t slotId, const int32_t cid, const AppExecFwk::InnerEvent::Pointer &response) = 0;
188     virtual int32_t SetLinkBandwidthReportingRule(
189         int32_t slotId, LinkBandwidthRule linkBandwidth, const AppExecFwk::InnerEvent::Pointer &response) = 0;
190     virtual int32_t SetDataPermitted(
191         int32_t slotId, int32_t dataPermitted, const AppExecFwk::InnerEvent::Pointer &response) = 0;
192     virtual int32_t GetLinkCapability(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
193     virtual int32_t CleanAllConnections(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
194 
195     /* PDP end */
196 
197     virtual int32_t GetSimStatus(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
198     virtual int32_t GetSimIO(
199         int32_t slotId, SimIoRequestInfo data, const AppExecFwk::InnerEvent::Pointer &response) = 0;
200     virtual int32_t GetImsi(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
201     virtual int32_t GetSimLockStatus(
202         int32_t slotId, std::string fac, const AppExecFwk::InnerEvent::Pointer &result) = 0;
203     virtual int32_t SetSimLock(
204         int32_t slotId, const SimLockParam &simLock, const AppExecFwk::InnerEvent::Pointer &result) = 0;
205     virtual int32_t ChangeSimPassword(
206         int32_t slotId, const SimPasswordParam &simPassword, const AppExecFwk::InnerEvent::Pointer &result) = 0;
207     virtual int32_t UnlockPin(
208         int32_t slotId, const std::string &pin, const AppExecFwk::InnerEvent::Pointer &result) = 0;
209     virtual int32_t UnlockPuk(int32_t slotId, const std::string &puk, const std::string &pin,
210         const AppExecFwk::InnerEvent::Pointer &result) = 0;
211     virtual int32_t UnlockPin2(
212         int32_t slotId, const std::string &pin2, const AppExecFwk::InnerEvent::Pointer &result) = 0;
213     virtual int32_t UnlockPuk2(int32_t slotId, const std::string &puk2, const std::string &pin2,
214         const AppExecFwk::InnerEvent::Pointer &result) = 0;
215     virtual int32_t SetActiveSim(
216         int32_t slotId, int32_t index, int32_t enable, const AppExecFwk::InnerEvent::Pointer &result) = 0;
217     virtual int32_t SendTerminalResponseCmd(
218         int32_t slotId, const std::string &strCmd, const AppExecFwk::InnerEvent::Pointer &response) = 0;
219     virtual int32_t SendEnvelopeCmd(
220         int32_t slotId, const std::string &strCmd, const AppExecFwk::InnerEvent::Pointer &response) = 0;
221     virtual int32_t SendCallSetupRequestResult(
222         int32_t slotId, bool accept, const AppExecFwk::InnerEvent::Pointer &response) = 0;
223     virtual int32_t SimStkIsReady(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
224     virtual int32_t UnlockSimLock(
225         int32_t slotId, int32_t lockType, std::string password, const AppExecFwk::InnerEvent::Pointer &response) = 0;
226     virtual int32_t GetRadioProtocol(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
227     virtual int32_t SetRadioProtocol(
228         int32_t slotId, RadioProtocol radioProtocol, const AppExecFwk::InnerEvent::Pointer &response) = 0;
229 
230     virtual int32_t GetNetworkSearchInformation(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
231     virtual int32_t GetNetworkSelectionMode(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &result) = 0;
232     virtual int32_t SetNetworkSelectionMode(
233         int32_t slotId, int32_t automaticFlag, std::string oper, const AppExecFwk::InnerEvent::Pointer &result) = 0;
234     virtual int32_t SetPreferredNetwork(
235         int32_t slotId, int32_t preferredNetworkType, const AppExecFwk::InnerEvent::Pointer &response) = 0;
236     virtual int32_t GetPreferredNetwork(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
237 
238     virtual int32_t SetCallPreferenceMode(
239         int32_t slotId, const int32_t mode, const AppExecFwk::InnerEvent::Pointer &response) = 0;
240     virtual int32_t GetCallPreferenceMode(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
241     virtual int32_t SetUssd(int32_t slotId, const std::string str, const AppExecFwk::InnerEvent::Pointer &response) = 0;
242     virtual int32_t GetUssd(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
243     virtual int32_t CloseUnFinishedUssd(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
244     virtual int32_t SetMute(int32_t slotId, const int32_t mute, const AppExecFwk::InnerEvent::Pointer &response) = 0;
245     virtual int32_t GetMute(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
246     virtual int32_t GetEmergencyCallList(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
247     virtual int32_t SetEmergencyCallList(
248         int32_t slotId, const std::vector<EmergencyCall> &eccVec, const AppExecFwk::InnerEvent::Pointer &response) = 0;
249     virtual int32_t GetCallFailReason(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
250     virtual int32_t SimOpenLogicalChannel(int32_t slotId, const std::string &appID, const int32_t p2,
251         const AppExecFwk::InnerEvent::Pointer &response) = 0;
252     virtual int32_t SimCloseLogicalChannel(
253         int32_t slotId, const int32_t channelId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
254     virtual int32_t SimTransmitApduLogicalChannel(
255         int32_t slotId, const ApduSimIORequestInfo &reqInfo, const AppExecFwk::InnerEvent::Pointer &response) = 0;
256     virtual int32_t SimTransmitApduBasicChannel(
257         int32_t slotId, const ApduSimIORequestInfo &reqInfo, const AppExecFwk::InnerEvent::Pointer &response) = 0;
258     virtual int32_t SimAuthentication(int32_t slotId, const SimAuthenticationRequestInfo &reqInfo,
259         const AppExecFwk::InnerEvent::Pointer &response) = 0;
260     virtual int32_t SendSimMatchedOperatorInfo(int32_t slotId, const NcfgOperatorInfo &reqInfo,
261         const AppExecFwk::InnerEvent::Pointer &response) = 0;
262 
263     virtual int32_t SetNotificationFilter(
264         int32_t slotId, int32_t newFilter, const AppExecFwk::InnerEvent::Pointer &response) = 0;
265     virtual int32_t SetDeviceState(int32_t slotId, int32_t deviceStateType, bool deviceStateOn,
266         const AppExecFwk::InnerEvent::Pointer &response) = 0;
267     virtual int32_t SetNrOptionMode(int32_t slotId, int32_t mode, const AppExecFwk::InnerEvent::Pointer &response) = 0;
268     virtual int32_t GetNrOptionMode(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
269     virtual int32_t GetRrcConnectionState(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
270     virtual int32_t GetNrSsbId(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
271 };
272 } // namespace Telephony
273 } // namespace OHOS
274 #endif // I_TEL_RIL_MANAGER_H
275