• 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 #include "core_manager_inner.h"
17 
18 #include "network_search_types.h"
19 #include "parameter.h"
20 #include "radio_event.h"
21 #include "string_ex.h"
22 #include "telephony_errors.h"
23 #include "telephony_log_wrapper.h"
24 
25 using namespace OHOS::Telephony;
26 namespace OHOS {
27 namespace Telephony {
28 constexpr int NETWORK_IS_NULL = -1;
29 constexpr int32_t INVALID_VALUE = -1;
30 
CoreManagerInner()31 CoreManagerInner::CoreManagerInner() {}
32 
GetInstance()33 CoreManagerInner &CoreManagerInner::GetInstance()
34 {
35     static CoreManagerInner instance;
36     return instance;
37 }
38 
OnInit(std::shared_ptr<INetworkSearch> networkSearchManager,std::shared_ptr<ISimManager> simManager,std::shared_ptr<ITelRilManager> telRilManager)39 void CoreManagerInner::OnInit(std::shared_ptr<INetworkSearch> networkSearchManager,
40     std::shared_ptr<ISimManager> simManager, std::shared_ptr<ITelRilManager> telRilManager)
41 {
42     networkSearchManager_ = networkSearchManager;
43     simManager_ = simManager;
44     telRilManager_ = telRilManager;
45     isInitAllObj_ = true;
46 }
47 
IsInitFinished(void)48 bool CoreManagerInner::IsInitFinished(void)
49 {
50     return isInitAllObj_;
51 }
52 
SetTelRilMangerObj(std::shared_ptr<ITelRilManager> telRilManager)53 void CoreManagerInner::SetTelRilMangerObj(std::shared_ptr<ITelRilManager> telRilManager)
54 {
55     telRilManager_ = telRilManager;
56 }
57 
IsInitFinishedForTelRil(void)58 bool CoreManagerInner::IsInitFinishedForTelRil(void)
59 {
60     if (telRilManager_ == nullptr) {
61         TELEPHONY_LOGE("telrilmanager is null");
62     }
63     return telRilManager_ != nullptr;
64 }
65 
GetDefaultSlotId(void)66 int32_t CoreManagerInner::GetDefaultSlotId(void)
67 {
68     return DEFAULT_SIM_SLOT_ID;
69 }
70 
GetMaxSimCount(void)71 int32_t CoreManagerInner::GetMaxSimCount(void)
72 {
73     return SIM_SLOT_COUNT;
74 }
75 
RegisterCoreNotify(int32_t slotId,const std::shared_ptr<AppExecFwk::EventHandler> & handler,int what,int32_t * obj)76 int32_t CoreManagerInner::RegisterCoreNotify(
77     int32_t slotId, const std::shared_ptr<AppExecFwk::EventHandler> &handler, int what, int32_t *obj)
78 {
79     if (what >= RadioEvent::RADIO_PS_CONNECTION_ATTACHED && what <= RadioEvent::RADIO_FACTORY_RESET) {
80         if (networkSearchManager_ == nullptr) {
81             TELEPHONY_LOGE("networkSearchManager is null!");
82             return TELEPHONY_ERR_LOCAL_PTR_NULL;
83         }
84         networkSearchManager_->RegisterCoreNotify(slotId, handler, what);
85     } else if ((what >= RadioEvent::RADIO_SIM_STATE_CHANGE) && (what <= RadioEvent::RADIO_SIM_ACCOUNT_LOADED)) {
86         if (simManager_ == nullptr) {
87             TELEPHONY_LOGE("simManager_ is null");
88             return TELEPHONY_ERR_LOCAL_PTR_NULL;
89         }
90         simManager_->RegisterCoreNotify(slotId, handler, what);
91     } else {
92         if (telRilManager_ == nullptr) {
93             TELEPHONY_LOGE("telRilManager is null!");
94             return TELEPHONY_ERR_LOCAL_PTR_NULL;
95         }
96         return telRilManager_->RegisterCoreNotify(slotId, handler, what, obj);
97     }
98     return TELEPHONY_SUCCESS;
99 }
100 
UnRegisterCoreNotify(int32_t slotId,const std::shared_ptr<AppExecFwk::EventHandler> & observerCallBack,int what)101 int32_t CoreManagerInner::UnRegisterCoreNotify(
102     int32_t slotId, const std::shared_ptr<AppExecFwk::EventHandler> &observerCallBack, int what)
103 {
104     if (what >= RadioEvent::RADIO_PS_CONNECTION_ATTACHED && what <= RadioEvent::RADIO_EMERGENCY_STATE_CLOSE) {
105         if (networkSearchManager_ == nullptr) {
106             TELEPHONY_LOGE("networkSearchManager is null!");
107             return TELEPHONY_ERR_LOCAL_PTR_NULL;
108         }
109         networkSearchManager_->UnRegisterCoreNotify(slotId, observerCallBack, what);
110     } else if (what >= RadioEvent::RADIO_SIM_STATE_CHANGE && what <= RadioEvent::RADIO_SIM_RECORDS_LOADED) {
111         if (simManager_ == nullptr) {
112             TELEPHONY_LOGE("simManager_ is null");
113             return TELEPHONY_ERR_LOCAL_PTR_NULL;
114         }
115         simManager_->UnRegisterCoreNotify(slotId, observerCallBack, what);
116     } else {
117         if (telRilManager_ == nullptr) {
118             TELEPHONY_LOGE("telRilManager is null!");
119             return TELEPHONY_ERR_LOCAL_PTR_NULL;
120         }
121         return telRilManager_->UnRegisterCoreNotify(slotId, observerCallBack, what);
122     }
123     return TELEPHONY_SUCCESS;
124 }
125 
RegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> & callback)126 void CoreManagerInner::RegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> &callback)
127 {
128     if (networkSearchManager_ == nullptr) {
129         TELEPHONY_LOGE("networkSearchManager is null!");
130         return;
131     }
132     networkSearchManager_->RegisterCellularDataObject(callback);
133 }
134 
UnRegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> & callback)135 void CoreManagerInner::UnRegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> &callback)
136 {
137     if (networkSearchManager_ == nullptr) {
138         TELEPHONY_LOGE("networkSearchManager is null!");
139         return;
140     }
141     networkSearchManager_->UnRegisterCellularDataObject(callback);
142 }
143 
RegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> & callback)144 void CoreManagerInner::RegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> &callback)
145 {
146     if (networkSearchManager_ == nullptr) {
147         TELEPHONY_LOGE("networkSearchManager is null!");
148         return;
149     }
150     networkSearchManager_->RegisterCellularCallObject(callback);
151 }
152 
UnRegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> & callback)153 void CoreManagerInner::UnRegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> &callback)
154 {
155     if (networkSearchManager_ == nullptr) {
156         TELEPHONY_LOGE("networkSearchManager is null!");
157         return;
158     }
159     networkSearchManager_->UnRegisterCellularCallObject(callback);
160 }
161 
RegisterSimAccountCallback(const std::string & bundleName,const sptr<SimAccountCallback> & callback)162 int32_t CoreManagerInner::RegisterSimAccountCallback(
163     const std::string &bundleName, const sptr<SimAccountCallback> &callback)
164 {
165     if (simManager_ == nullptr) {
166         TELEPHONY_LOGE("simManager_ is null");
167         return TELEPHONY_ERR_LOCAL_PTR_NULL;
168     }
169     return simManager_->RegisterSimAccountCallback(bundleName, callback);
170 }
171 
UnregisterSimAccountCallback(const std::string & bundleName)172 int32_t CoreManagerInner::UnregisterSimAccountCallback(const std::string &bundleName)
173 {
174     if (simManager_ == nullptr) {
175         TELEPHONY_LOGE("simManager_ is null");
176         return TELEPHONY_ERR_LOCAL_PTR_NULL;
177     }
178     return simManager_->UnregisterSimAccountCallback(bundleName);
179 }
180 
181 /******************** telRilManager start *******************/
SetUssd(int32_t slotId,int32_t eventId,const std::string str,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const182 int32_t CoreManagerInner::SetUssd(int32_t slotId, int32_t eventId, const std::string str,
183     const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
184 {
185     if (telRilManager_ == nullptr) {
186         TELEPHONY_LOGE("set ussd telRilManager is null!");
187         return TELEPHONY_ERR_LOCAL_PTR_NULL;
188     }
189     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
190     if (response == nullptr) {
191         TELEPHONY_LOGE("set ussd response is null!");
192         return TELEPHONY_ERR_LOCAL_PTR_NULL;
193     }
194     response->SetOwner(handler);
195     return telRilManager_->SetUssd(slotId, str, response);
196 }
197 
CloseUnFinishedUssd(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const198 int32_t CoreManagerInner::CloseUnFinishedUssd(
199     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
200 {
201     if (telRilManager_ == nullptr) {
202         TELEPHONY_LOGE("close unfinished ussd telRilManager is null!");
203         return TELEPHONY_ERR_LOCAL_PTR_NULL;
204     }
205     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
206     if (response == nullptr) {
207         TELEPHONY_LOGE("close unfinished ussd response is null!");
208         return TELEPHONY_ERR_LOCAL_PTR_NULL;
209     }
210     response->SetOwner(handler);
211     return telRilManager_->CloseUnFinishedUssd(slotId, response);
212 }
213 
GetUssd(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const214 int32_t CoreManagerInner::GetUssd(
215     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
216 {
217     if (telRilManager_ == nullptr) {
218         TELEPHONY_LOGE("get ussd telRilManager is null!");
219         return TELEPHONY_ERR_LOCAL_PTR_NULL;
220     }
221     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
222     if (response == nullptr) {
223         TELEPHONY_LOGE("get ussd response is null!");
224         return TELEPHONY_ERR_LOCAL_PTR_NULL;
225     }
226     response->SetOwner(handler);
227     return telRilManager_->GetUssd(slotId, response);
228 }
229 
GetMute(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const230 int32_t CoreManagerInner::GetMute(
231     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
232 {
233     if (telRilManager_ == nullptr) {
234         TELEPHONY_LOGE("get mute telRilManager is null!");
235         return TELEPHONY_ERR_LOCAL_PTR_NULL;
236     }
237     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
238     if (response == nullptr) {
239         TELEPHONY_LOGE("get mute response is null!");
240         return TELEPHONY_ERR_LOCAL_PTR_NULL;
241     }
242     response->SetOwner(handler);
243     return telRilManager_->GetMute(slotId, response);
244 }
245 
SetMute(int32_t slotId,int32_t eventId,int32_t mute,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const246 int32_t CoreManagerInner::SetMute(
247     int32_t slotId, int32_t eventId, int32_t mute, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
248 {
249     if (telRilManager_ == nullptr) {
250         TELEPHONY_LOGE("set mute telRilManager is null!");
251         return TELEPHONY_ERR_LOCAL_PTR_NULL;
252     }
253     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
254     if (response == nullptr) {
255         TELEPHONY_LOGE("set mute response is null!");
256         return TELEPHONY_ERR_LOCAL_PTR_NULL;
257     }
258     response->SetOwner(handler);
259     return telRilManager_->SetMute(slotId, mute, response);
260 }
261 
GetEmergencyCallList(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const262 int32_t CoreManagerInner::GetEmergencyCallList(
263     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
264 {
265     if (telRilManager_ == nullptr) {
266         TELEPHONY_LOGE("get emergency call list telRilManager is null!");
267         return TELEPHONY_ERR_LOCAL_PTR_NULL;
268     }
269     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
270     if (response == nullptr) {
271         TELEPHONY_LOGE("get emergency call list response is null!");
272         return TELEPHONY_ERR_LOCAL_PTR_NULL;
273     }
274     response->SetOwner(handler);
275     return telRilManager_->GetEmergencyCallList(slotId, response);
276 }
277 
SetEmergencyCallList(int32_t slotId,int32_t eventId,std::vector<EmergencyCall> & eccVec,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const278 int32_t CoreManagerInner::SetEmergencyCallList(int32_t slotId, int32_t eventId, std::vector<EmergencyCall> &eccVec,
279     const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
280 {
281     TELEPHONY_LOGI("SetEmergencyCallList start");
282     if (telRilManager_ == nullptr) {
283         TELEPHONY_LOGE("set emergency call list telRilManager is null!");
284         return TELEPHONY_ERR_LOCAL_PTR_NULL;
285     }
286     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
287     if (response == nullptr) {
288         TELEPHONY_LOGE("set emergency call list response is null!");
289         return TELEPHONY_ERR_LOCAL_PTR_NULL;
290     }
291     response->SetOwner(handler);
292     return telRilManager_->SetEmergencyCallList(slotId, eccVec, response);
293 }
294 
GetCallFailReason(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const295 int32_t CoreManagerInner::GetCallFailReason(
296     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
297 {
298     if (telRilManager_ == nullptr) {
299         TELEPHONY_LOGE("get call fail reason telRilManager is null!");
300         return TELEPHONY_ERR_LOCAL_PTR_NULL;
301     }
302     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
303     if (response == nullptr) {
304         TELEPHONY_LOGE("get call fail reason response is null!");
305         return TELEPHONY_ERR_LOCAL_PTR_NULL;
306     }
307     response->SetOwner(handler);
308     return telRilManager_->GetCallFailReason(slotId, response);
309 }
310 
SetCallPreferenceMode(int32_t slotId,int32_t eventId,int32_t mode,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const311 int32_t CoreManagerInner::SetCallPreferenceMode(
312     int32_t slotId, int32_t eventId, int32_t mode, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
313 {
314     if (telRilManager_ == nullptr) {
315         TELEPHONY_LOGE("set call preference mode telRilManager is null!");
316         return TELEPHONY_ERR_LOCAL_PTR_NULL;
317     }
318     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
319     if (response == nullptr) {
320         TELEPHONY_LOGE("set call preference mode response is null!");
321         return TELEPHONY_ERR_LOCAL_PTR_NULL;
322     }
323     response->SetOwner(handler);
324     return telRilManager_->SetCallPreferenceMode(slotId, mode, response);
325 }
326 
GetCallPreferenceMode(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const327 int32_t CoreManagerInner::GetCallPreferenceMode(
328     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
329 {
330     if (telRilManager_ == nullptr) {
331         TELEPHONY_LOGE("get call preference mode telRilManager is null!");
332         return TELEPHONY_ERR_LOCAL_PTR_NULL;
333     }
334     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
335     if (response == nullptr) {
336         TELEPHONY_LOGE("get call preference mode response is null!");
337         return TELEPHONY_ERR_LOCAL_PTR_NULL;
338     }
339     response->SetOwner(handler);
340     return telRilManager_->GetCallPreferenceMode(slotId, response);
341 }
342 
SetPreferredNetworkPara(int32_t slotId,int32_t eventId,int32_t preferredNetworkType,const std::shared_ptr<AppExecFwk::EventHandler> & handler)343 int32_t CoreManagerInner::SetPreferredNetworkPara(int32_t slotId, int32_t eventId, int32_t preferredNetworkType,
344     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
345 {
346     if (telRilManager_ == nullptr) {
347         TELEPHONY_LOGE("set preferred network telRilManager is null!");
348         return TELEPHONY_ERR_LOCAL_PTR_NULL;
349     }
350     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
351     if (response == nullptr) {
352         TELEPHONY_LOGE("set preferred network response is null!");
353         return TELEPHONY_ERR_LOCAL_PTR_NULL;
354     }
355     response->SetOwner(handler);
356     return telRilManager_->SetPreferredNetwork(slotId, preferredNetworkType, response);
357 }
358 
GetPreferredNetworkPara(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)359 int32_t CoreManagerInner::GetPreferredNetworkPara(
360     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
361 {
362     if (telRilManager_ == nullptr) {
363         TELEPHONY_LOGE("get preferred network telRilManager is null!");
364         return TELEPHONY_ERR_LOCAL_PTR_NULL;
365     }
366     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
367     if (response == nullptr) {
368         TELEPHONY_LOGE("get preferred network response is null!");
369         return TELEPHONY_ERR_LOCAL_PTR_NULL;
370     }
371     response->SetOwner(handler);
372     return telRilManager_->GetPreferredNetwork(slotId, response);
373 }
374 
GetOperatorInfo(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const375 int32_t CoreManagerInner::GetOperatorInfo(
376     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
377 {
378     if (telRilManager_ == nullptr) {
379         TELEPHONY_LOGE("get operator info telRilManager is null!");
380         return TELEPHONY_ERR_LOCAL_PTR_NULL;
381     }
382     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
383     if (response == nullptr) {
384         TELEPHONY_LOGE("get operator info response is null!");
385         return TELEPHONY_ERR_LOCAL_PTR_NULL;
386     }
387     response->SetOwner(handler);
388     return telRilManager_->GetOperatorInfo(slotId, response);
389 }
390 
GetCellInfoList(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)391 int32_t CoreManagerInner::GetCellInfoList(
392     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
393 {
394     if (telRilManager_ == nullptr) {
395         TELEPHONY_LOGE("get cell info list telRilManager is null!");
396         return TELEPHONY_ERR_LOCAL_PTR_NULL;
397     }
398     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
399     if (response == nullptr) {
400         TELEPHONY_LOGE("get cell info list response is null!");
401         return TELEPHONY_ERR_LOCAL_PTR_NULL;
402     }
403     response->SetOwner(handler);
404     return telRilManager_->GetCellInfoList(slotId, response);
405 }
406 
GetCurrentCellInfo(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)407 int32_t CoreManagerInner::GetCurrentCellInfo(
408     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
409 {
410     if (telRilManager_ == nullptr) {
411         TELEPHONY_LOGE("get current cell info telRilManager is null!");
412         return TELEPHONY_ERR_LOCAL_PTR_NULL;
413     }
414     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
415     if (response == nullptr) {
416         TELEPHONY_LOGE("get current cell info response is null!");
417         return TELEPHONY_ERR_LOCAL_PTR_NULL;
418     }
419     response->SetOwner(handler);
420     return telRilManager_->GetCurrentCellInfo(slotId, response);
421 }
422 
SendGsmSms(int32_t slotId,int32_t eventId,GsmSimMessageParam & gsmMessage,const std::shared_ptr<AppExecFwk::EventHandler> & handler)423 int32_t CoreManagerInner::SendGsmSms(int32_t slotId, int32_t eventId, GsmSimMessageParam &gsmMessage,
424     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
425 {
426     if (telRilManager_ == nullptr) {
427         TELEPHONY_LOGE("send gsm sms telRilManager is null!");
428         return TELEPHONY_ERR_LOCAL_PTR_NULL;
429     }
430     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, gsmMessage.refId);
431     if (response == nullptr) {
432         TELEPHONY_LOGE("send gsm sms response is null!");
433         return TELEPHONY_ERR_LOCAL_PTR_NULL;
434     }
435     response->SetOwner(handler);
436     return telRilManager_->SendGsmSms(slotId, gsmMessage.smscPdu, gsmMessage.pdu, response);
437 }
438 
SendCdmaSms(int32_t slotId,int32_t eventId,std::string pdu,int64_t refId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)439 int32_t CoreManagerInner::SendCdmaSms(int32_t slotId, int32_t eventId, std::string pdu, int64_t refId,
440     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
441 {
442     if (telRilManager_ == nullptr) {
443         TELEPHONY_LOGE("send cdma sms telRilManager is null!");
444         return TELEPHONY_ERR_LOCAL_PTR_NULL;
445     }
446     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, refId);
447     if (response == nullptr) {
448         TELEPHONY_LOGE("send cdma sms response is null!");
449         return TELEPHONY_ERR_LOCAL_PTR_NULL;
450     }
451     response->SetOwner(handler);
452     return telRilManager_->SendCdmaSms(slotId, pdu, response);
453 }
454 
AddSimMessage(int32_t slotId,int32_t eventId,const SimMessageParam & simMessage,const std::shared_ptr<AppExecFwk::EventHandler> & handler)455 int32_t CoreManagerInner::AddSimMessage(int32_t slotId, int32_t eventId, const SimMessageParam &simMessage,
456     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
457 {
458     if (telRilManager_ == nullptr) {
459         TELEPHONY_LOGE("add sim message telRilManager is null!");
460         return TELEPHONY_ERR_LOCAL_PTR_NULL;
461     }
462     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
463     if (response == nullptr) {
464         TELEPHONY_LOGE("add sim message response is null!");
465         return TELEPHONY_ERR_LOCAL_PTR_NULL;
466     }
467     response->SetOwner(handler);
468     return telRilManager_->AddSimMessage(slotId, simMessage, response);
469 }
470 
DelSimMessage(int32_t slotId,int32_t eventId,int32_t gsmIndex,const std::shared_ptr<AppExecFwk::EventHandler> & handler)471 int32_t CoreManagerInner::DelSimMessage(
472     int32_t slotId, int32_t eventId, int32_t gsmIndex, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
473 {
474     if (telRilManager_ == nullptr) {
475         TELEPHONY_LOGE("delete sim message telRilManager is null!");
476         return TELEPHONY_ERR_LOCAL_PTR_NULL;
477     }
478     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
479     if (response == nullptr) {
480         TELEPHONY_LOGE("delete sim message response is null!");
481         return TELEPHONY_ERR_LOCAL_PTR_NULL;
482     }
483     response->SetOwner(handler);
484     return telRilManager_->DelSimMessage(slotId, gsmIndex, response);
485 }
486 
GetSmscAddr(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const487 int32_t CoreManagerInner::GetSmscAddr(
488     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
489 {
490     if (telRilManager_ == nullptr) {
491         TELEPHONY_LOGE("get smsc address telRilManager is null!");
492         return TELEPHONY_ERR_LOCAL_PTR_NULL;
493     }
494     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
495     if (response == nullptr) {
496         TELEPHONY_LOGE("get smsc address response is null!");
497         return TELEPHONY_ERR_LOCAL_PTR_NULL;
498     }
499     response->SetOwner(handler);
500     return telRilManager_->GetSmscAddr(slotId, response);
501 }
502 
SetSmscAddr(int32_t slotId,int32_t eventId,int32_t tosca,std::string address,const std::shared_ptr<AppExecFwk::EventHandler> & handler)503 int32_t CoreManagerInner::SetSmscAddr(int32_t slotId, int32_t eventId, int32_t tosca, std::string address,
504     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
505 {
506     if (telRilManager_ == nullptr) {
507         TELEPHONY_LOGE("set smsc address telRilManager is null!");
508         return TELEPHONY_ERR_LOCAL_PTR_NULL;
509     }
510     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
511     if (response == nullptr) {
512         TELEPHONY_LOGE("set smsc address response is null!");
513         return TELEPHONY_ERR_LOCAL_PTR_NULL;
514     }
515     response->SetOwner(handler);
516     return telRilManager_->SetSmscAddr(slotId, tosca, address, response);
517 }
518 
SetCBConfig(int32_t slotId,int32_t eventId,const CBConfigParam & cbConfig,const std::shared_ptr<AppExecFwk::EventHandler> & handler)519 int32_t CoreManagerInner::SetCBConfig(int32_t slotId, int32_t eventId, const CBConfigParam &cbConfig,
520     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
521 {
522     if (telRilManager_ == nullptr) {
523         TELEPHONY_LOGE("set CB config telRilManager is null!");
524         return TELEPHONY_ERR_LOCAL_PTR_NULL;
525     }
526     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
527     if (response == nullptr) {
528         TELEPHONY_LOGE("set CB config response is null!");
529         return TELEPHONY_ERR_LOCAL_PTR_NULL;
530     }
531     response->SetOwner(handler);
532     return telRilManager_->SetCBConfig(slotId, cbConfig, response);
533 }
534 
SetCdmaCBConfig(int32_t slotId,int32_t eventId,CdmaCBConfigInfoList & cdmaCBConfigInfoList,const std::shared_ptr<AppExecFwk::EventHandler> & handler)535 int32_t CoreManagerInner::SetCdmaCBConfig(int32_t slotId, int32_t eventId, CdmaCBConfigInfoList &cdmaCBConfigInfoList,
536     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
537 {
538     if (telRilManager_ == nullptr) {
539         TELEPHONY_LOGE("set cdma CB config telRilManager is null!");
540         return TELEPHONY_ERR_LOCAL_PTR_NULL;
541     }
542     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
543     if (response == nullptr) {
544         TELEPHONY_LOGE("set cdma CB config response is null!");
545         return TELEPHONY_ERR_LOCAL_PTR_NULL;
546     }
547     response->SetOwner(handler);
548     return telRilManager_->SetCdmaCBConfig(slotId, cdmaCBConfigInfoList, response);
549 }
550 
GetCBConfig(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)551 int32_t CoreManagerInner::GetCBConfig(
552     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
553 {
554     if (telRilManager_ == nullptr) {
555         TELEPHONY_LOGE("get CB config telRilManager is null!");
556         return TELEPHONY_ERR_LOCAL_PTR_NULL;
557     }
558     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
559     if (response == nullptr) {
560         TELEPHONY_LOGE("get CB config response is null!");
561         return TELEPHONY_ERR_LOCAL_PTR_NULL;
562     }
563     response->SetOwner(handler);
564     return telRilManager_->GetCBConfig(slotId, response);
565 }
566 
GetCdmaCBConfig(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)567 int32_t CoreManagerInner::GetCdmaCBConfig(
568     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
569 {
570     if (telRilManager_ == nullptr) {
571         TELEPHONY_LOGE("get cdma CB config telRilManager is null!");
572         return TELEPHONY_ERR_LOCAL_PTR_NULL;
573     }
574     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
575     if (response == nullptr) {
576         TELEPHONY_LOGE("get cdma CB config response is null!");
577         return TELEPHONY_ERR_LOCAL_PTR_NULL;
578     }
579     response->SetOwner(handler);
580     return telRilManager_->GetCdmaCBConfig(slotId, response);
581 }
582 
SendSmsMoreMode(int32_t slotId,int32_t eventId,GsmSimMessageParam & gsmMessage,const std::shared_ptr<AppExecFwk::EventHandler> & handler)583 int32_t CoreManagerInner::SendSmsMoreMode(int32_t slotId, int32_t eventId, GsmSimMessageParam &gsmMessage,
584     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
585 {
586     if (telRilManager_ == nullptr) {
587         TELEPHONY_LOGE("send sms more mode telRilManager is null!");
588         return TELEPHONY_ERR_LOCAL_PTR_NULL;
589     }
590     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, gsmMessage.refId);
591     if (response == nullptr) {
592         TELEPHONY_LOGE("send sms more mode response is null!");
593         return TELEPHONY_ERR_LOCAL_PTR_NULL;
594     }
595     response->SetOwner(handler);
596     return telRilManager_->SendSmsMoreMode(slotId, gsmMessage.smscPdu, gsmMessage.pdu, response);
597 }
598 
SendSmsAck(int32_t slotId,int32_t eventId,bool success,int32_t cause,const std::shared_ptr<AppExecFwk::EventHandler> & handler)599 int32_t CoreManagerInner::SendSmsAck(int32_t slotId, int32_t eventId, bool success, int32_t cause,
600     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
601 {
602     if (telRilManager_ == nullptr) {
603         TELEPHONY_LOGE("send sms ack telRilManager is null!");
604         return TELEPHONY_ERR_LOCAL_PTR_NULL;
605     }
606     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
607     if (response == nullptr) {
608         TELEPHONY_LOGE("send sms ack response is null!");
609         return TELEPHONY_ERR_LOCAL_PTR_NULL;
610     }
611     response->SetOwner(handler);
612     return telRilManager_->SendSmsAck(slotId, success, cause, response);
613 }
614 
AddCdmaSimMessage(int32_t slotId,int32_t eventId,int32_t status,std::string pdu,const std::shared_ptr<AppExecFwk::EventHandler> & handler)615 int32_t CoreManagerInner::AddCdmaSimMessage(int32_t slotId, int32_t eventId, int32_t status, std::string pdu,
616     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
617 {
618     if (telRilManager_ == nullptr) {
619         TELEPHONY_LOGE("add cdma sim message telRilManager is null!");
620         return TELEPHONY_ERR_LOCAL_PTR_NULL;
621     }
622     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
623     if (response == nullptr) {
624         TELEPHONY_LOGE("add cdma sim message response is null!");
625         return TELEPHONY_ERR_LOCAL_PTR_NULL;
626     }
627     response->SetOwner(handler);
628     return telRilManager_->AddCdmaSimMessage(slotId, status, pdu, response);
629 }
630 
DelCdmaSimMessage(int32_t slotId,int32_t eventId,int32_t cdmaIndex,const std::shared_ptr<AppExecFwk::EventHandler> & handler)631 int32_t CoreManagerInner::DelCdmaSimMessage(
632     int32_t slotId, int32_t eventId, int32_t cdmaIndex, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
633 {
634     if (telRilManager_ == nullptr) {
635         TELEPHONY_LOGE("delete cdma sim message telRilManager is null!");
636         return TELEPHONY_ERR_LOCAL_PTR_NULL;
637     }
638     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
639     if (response == nullptr) {
640         TELEPHONY_LOGE("delete cdma sim message response is null!");
641         return TELEPHONY_ERR_LOCAL_PTR_NULL;
642     }
643     response->SetOwner(handler);
644     return telRilManager_->DelCdmaSimMessage(slotId, cdmaIndex, response);
645 }
646 
UpdateCdmaSimMessage(int32_t slotId,int32_t eventId,const CdmaSimMessageParam & cdmaSimMsg,const std::shared_ptr<AppExecFwk::EventHandler> & handler)647 int32_t CoreManagerInner::UpdateCdmaSimMessage(int32_t slotId, int32_t eventId, const CdmaSimMessageParam &cdmaSimMsg,
648     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
649 {
650     if (telRilManager_ == nullptr) {
651         TELEPHONY_LOGE("update cdma sim message telRilManager is null!");
652         return TELEPHONY_ERR_LOCAL_PTR_NULL;
653     }
654     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
655     if (response == nullptr) {
656         TELEPHONY_LOGE("update cdma sim message response is null!");
657         return TELEPHONY_ERR_LOCAL_PTR_NULL;
658     }
659     response->SetOwner(handler);
660     return telRilManager_->UpdateCdmaSimMessage(slotId, cdmaSimMsg, response);
661 }
662 
GetNetworkSearchInformation(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const663 int32_t CoreManagerInner::GetNetworkSearchInformation(
664     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
665 {
666     if (telRilManager_ == nullptr) {
667         TELEPHONY_LOGE("get network search information telRilManager is null!");
668         return TELEPHONY_ERR_LOCAL_PTR_NULL;
669     }
670     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
671     if (response == nullptr) {
672         TELEPHONY_LOGE("get network search information response is null!");
673         return TELEPHONY_ERR_LOCAL_PTR_NULL;
674     }
675     response->SetOwner(handler);
676     return telRilManager_->GetNetworkSearchInformation(slotId, response);
677 }
678 
GetNetworkSelectionMode(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const679 int32_t CoreManagerInner::GetNetworkSelectionMode(
680     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
681 {
682     if (telRilManager_ == nullptr) {
683         TELEPHONY_LOGE("get network selection mode telRilManager is null!");
684         return TELEPHONY_ERR_LOCAL_PTR_NULL;
685     }
686     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
687     if (response == nullptr) {
688         TELEPHONY_LOGE("get network selection mode response is null!");
689         return TELEPHONY_ERR_LOCAL_PTR_NULL;
690     }
691     response->SetOwner(handler);
692     return telRilManager_->GetNetworkSelectionMode(slotId, response);
693 }
694 
SetNetworkSelectionMode(int32_t slotId,int32_t eventId,int32_t automaticFlag,std::string oper,const std::shared_ptr<AppExecFwk::EventHandler> & handler)695 int32_t CoreManagerInner::SetNetworkSelectionMode(int32_t slotId, int32_t eventId, int32_t automaticFlag,
696     std::string oper, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
697 {
698     if (telRilManager_ == nullptr) {
699         TELEPHONY_LOGE("set network selection mode telRilManager is null!");
700         return TELEPHONY_ERR_LOCAL_PTR_NULL;
701     }
702     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
703     if (response == nullptr) {
704         TELEPHONY_LOGE("set network selection mode response is null!");
705         return TELEPHONY_ERR_LOCAL_PTR_NULL;
706     }
707     response->SetOwner(handler);
708     return telRilManager_->SetNetworkSelectionMode(slotId, automaticFlag, oper, response);
709 }
710 
SetRadioState(int32_t slotId,int32_t eventId,int fun,int rst,const std::shared_ptr<AppExecFwk::EventHandler> & handler)711 int32_t CoreManagerInner::SetRadioState(
712     int32_t slotId, int32_t eventId, int fun, int rst, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
713 {
714     if (telRilManager_ == nullptr) {
715         TELEPHONY_LOGE("set radio state telRilManager is null!");
716         return TELEPHONY_ERR_LOCAL_PTR_NULL;
717     }
718     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
719     if (response == nullptr) {
720         TELEPHONY_LOGE("set radio state response is null!");
721         return TELEPHONY_ERR_LOCAL_PTR_NULL;
722     }
723     response->SetOwner(handler);
724     return telRilManager_->SetRadioState(slotId, fun, rst, response);
725 }
726 
GetRadioState(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const727 int32_t CoreManagerInner::GetRadioState(
728     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
729 {
730     if (telRilManager_ == nullptr) {
731         TELEPHONY_LOGE("get radio state telRilManager is null!");
732         return TELEPHONY_ERR_LOCAL_PTR_NULL;
733     }
734     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
735     if (response == nullptr) {
736         TELEPHONY_LOGE("get radio state response is null!");
737         return TELEPHONY_ERR_LOCAL_PTR_NULL;
738     }
739     response->SetOwner(handler);
740     return telRilManager_->GetRadioState(slotId, response);
741 }
742 
ShutDown(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)743 int32_t CoreManagerInner::ShutDown(
744     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
745 {
746     if (telRilManager_ == nullptr) {
747         TELEPHONY_LOGE("shut down telRilManager is null!");
748         return TELEPHONY_ERR_LOCAL_PTR_NULL;
749     }
750     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
751     if (response == nullptr) {
752         TELEPHONY_LOGE("shut down response is null!");
753         return TELEPHONY_ERR_LOCAL_PTR_NULL;
754     }
755     response->SetOwner(handler);
756     return telRilManager_->ShutDown(slotId, response);
757 }
758 
Dial(int32_t slotId,int32_t eventId,std::string address,int clirMode,const std::shared_ptr<AppExecFwk::EventHandler> & handler)759 int32_t CoreManagerInner::Dial(int32_t slotId, int32_t eventId, std::string address, int clirMode,
760     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
761 {
762     if (telRilManager_ == nullptr) {
763         TELEPHONY_LOGE("dial telRilManager is null!");
764         return TELEPHONY_ERR_LOCAL_PTR_NULL;
765     }
766     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
767     if (response == nullptr) {
768         TELEPHONY_LOGE("dial response is null!");
769         return TELEPHONY_ERR_LOCAL_PTR_NULL;
770     }
771     response->SetOwner(handler);
772     return telRilManager_->Dial(slotId, address, clirMode, response);
773 }
774 
Reject(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)775 int32_t CoreManagerInner::Reject(
776     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
777 {
778     if (telRilManager_ == nullptr) {
779         TELEPHONY_LOGE("reject call telRilManager is null!");
780         return TELEPHONY_ERR_LOCAL_PTR_NULL;
781     }
782     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
783     if (response == nullptr) {
784         TELEPHONY_LOGE("reject call response is null!");
785         return TELEPHONY_ERR_LOCAL_PTR_NULL;
786     }
787     response->SetOwner(handler);
788     return telRilManager_->Reject(slotId, response);
789 }
790 
Hangup(int32_t slotId,int32_t eventId,int32_t gsmIndex,const std::shared_ptr<AppExecFwk::EventHandler> & handler)791 int32_t CoreManagerInner::Hangup(
792     int32_t slotId, int32_t eventId, int32_t gsmIndex, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
793 {
794     if (telRilManager_ == nullptr) {
795         TELEPHONY_LOGE("hung up call telRilManager is null!");
796         return TELEPHONY_ERR_LOCAL_PTR_NULL;
797     }
798     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
799     if (response == nullptr) {
800         TELEPHONY_LOGE("hung up call response is null!");
801         return TELEPHONY_ERR_LOCAL_PTR_NULL;
802     }
803     response->SetOwner(handler);
804     return telRilManager_->Hangup(slotId, gsmIndex, response);
805 }
806 
Answer(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)807 int32_t CoreManagerInner::Answer(
808     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
809 {
810     if (telRilManager_ == nullptr) {
811         TELEPHONY_LOGE("answer call telRilManager is null!");
812         return TELEPHONY_ERR_LOCAL_PTR_NULL;
813     }
814     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
815     if (response == nullptr) {
816         TELEPHONY_LOGE("answer call response is null!");
817         return TELEPHONY_ERR_LOCAL_PTR_NULL;
818     }
819     response->SetOwner(handler);
820     return telRilManager_->Answer(slotId, response);
821 }
822 
GetCallList(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const823 int32_t CoreManagerInner::GetCallList(
824     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
825 {
826     if (telRilManager_ == nullptr) {
827         TELEPHONY_LOGE("get call list telRilManager is null!");
828         return TELEPHONY_ERR_LOCAL_PTR_NULL;
829     }
830     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
831     if (response == nullptr) {
832         TELEPHONY_LOGE("get call list response is null!");
833         return TELEPHONY_ERR_LOCAL_PTR_NULL;
834     }
835     response->SetOwner(handler);
836     return telRilManager_->GetCallList(slotId, response);
837 }
838 
HoldCall(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)839 int32_t CoreManagerInner::HoldCall(
840     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
841 {
842     if (telRilManager_ == nullptr) {
843         TELEPHONY_LOGE("hold call telRilManager is null!");
844         return TELEPHONY_ERR_LOCAL_PTR_NULL;
845     }
846     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
847     if (response == nullptr) {
848         TELEPHONY_LOGE("hold call response is null!");
849         return TELEPHONY_ERR_LOCAL_PTR_NULL;
850     }
851     response->SetOwner(handler);
852     return telRilManager_->HoldCall(slotId, response);
853 }
854 
UnHoldCall(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)855 int32_t CoreManagerInner::UnHoldCall(
856     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
857 {
858     if (telRilManager_ == nullptr) {
859         TELEPHONY_LOGE("unhold call telRilManager is null!");
860         return TELEPHONY_ERR_LOCAL_PTR_NULL;
861     }
862     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
863     if (response == nullptr) {
864         TELEPHONY_LOGE("unhold call response is null!");
865         return TELEPHONY_ERR_LOCAL_PTR_NULL;
866     }
867     response->SetOwner(handler);
868     return telRilManager_->UnHoldCall(slotId, response);
869 }
870 
SwitchCall(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)871 int32_t CoreManagerInner::SwitchCall(
872     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
873 {
874     if (telRilManager_ == nullptr) {
875         TELEPHONY_LOGE("switch call telRilManager is null!");
876         return TELEPHONY_ERR_LOCAL_PTR_NULL;
877     }
878     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
879     if (response == nullptr) {
880         TELEPHONY_LOGE("switch call response is null!");
881         return TELEPHONY_ERR_LOCAL_PTR_NULL;
882     }
883     response->SetOwner(handler);
884     return telRilManager_->SwitchCall(slotId, response);
885 }
886 
CombineConference(int32_t slotId,int32_t eventId,int32_t callType,const std::shared_ptr<AppExecFwk::EventHandler> & handler)887 int32_t CoreManagerInner::CombineConference(
888     int32_t slotId, int32_t eventId, int32_t callType, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
889 {
890     if (telRilManager_ == nullptr) {
891         TELEPHONY_LOGE("combine conference telRilManager is null!");
892         return TELEPHONY_ERR_LOCAL_PTR_NULL;
893     }
894     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
895     if (response == nullptr) {
896         TELEPHONY_LOGE("combine conference response is null!");
897         return TELEPHONY_ERR_LOCAL_PTR_NULL;
898     }
899     response->SetOwner(handler);
900     return telRilManager_->CombineConference(slotId, callType, response);
901 }
902 
SeparateConference(int32_t slotId,int32_t eventId,int32_t callIndex,int32_t callType,const std::shared_ptr<AppExecFwk::EventHandler> & handler)903 int32_t CoreManagerInner::SeparateConference(int32_t slotId, int32_t eventId, int32_t callIndex, int32_t callType,
904     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
905 {
906     if (telRilManager_ == nullptr) {
907         TELEPHONY_LOGE("separate conference telRilManager is null!");
908         return TELEPHONY_ERR_LOCAL_PTR_NULL;
909     }
910     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
911     if (response == nullptr) {
912         TELEPHONY_LOGE("separate conference response is null!");
913         return TELEPHONY_ERR_LOCAL_PTR_NULL;
914     }
915     response->SetOwner(handler);
916     return telRilManager_->SeparateConference(slotId, callIndex, callType, response);
917 }
918 
CallSupplement(int32_t slotId,int32_t eventId,int32_t type,const std::shared_ptr<AppExecFwk::EventHandler> & handler)919 int32_t CoreManagerInner::CallSupplement(
920     int32_t slotId, int32_t eventId, int32_t type, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
921 {
922     if (telRilManager_ == nullptr) {
923         TELEPHONY_LOGE("call supplement telRilManager is null!");
924         return TELEPHONY_ERR_LOCAL_PTR_NULL;
925     }
926     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
927     if (response == nullptr) {
928         TELEPHONY_LOGE("call supplement response is null!");
929         return TELEPHONY_ERR_LOCAL_PTR_NULL;
930     }
931     response->SetOwner(handler);
932     return telRilManager_->CallSupplement(slotId, type, response);
933 }
934 
GetClip(int32_t slotId,const AppExecFwk::InnerEvent::Pointer & response) const935 int32_t CoreManagerInner::GetClip(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) const
936 {
937     if (telRilManager_ == nullptr) {
938         TELEPHONY_LOGE("telRilManager is null!");
939         return TELEPHONY_ERR_LOCAL_PTR_NULL;
940     }
941     return telRilManager_->GetClip(slotId, response);
942 }
943 
SetClip(int32_t slotId,int32_t action,const AppExecFwk::InnerEvent::Pointer & response)944 int32_t CoreManagerInner::SetClip(int32_t slotId, int32_t action, const AppExecFwk::InnerEvent::Pointer &response)
945 {
946     if (telRilManager_ == nullptr) {
947         TELEPHONY_LOGE("telRilManager is null!");
948         return TELEPHONY_ERR_LOCAL_PTR_NULL;
949     }
950     return telRilManager_->SetClip(slotId, action, response);
951 }
952 
GetClir(int32_t slotId,const AppExecFwk::InnerEvent::Pointer & response) const953 int32_t CoreManagerInner::GetClir(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) const
954 {
955     if (telRilManager_ == nullptr) {
956         TELEPHONY_LOGE("telRilManager is null!");
957         return TELEPHONY_ERR_LOCAL_PTR_NULL;
958     }
959     return telRilManager_->GetClir(slotId, response);
960 }
961 
SetClir(int32_t slotId,int32_t action,const AppExecFwk::InnerEvent::Pointer & response)962 int32_t CoreManagerInner::SetClir(int32_t slotId, int32_t action, const AppExecFwk::InnerEvent::Pointer &response)
963 {
964     if (telRilManager_ == nullptr) {
965         TELEPHONY_LOGE("telRilManager is null!");
966         return TELEPHONY_ERR_LOCAL_PTR_NULL;
967     }
968     return telRilManager_->SetClir(slotId, action, response);
969 }
970 
SetCallWaiting(int32_t slotId,int32_t activate,const AppExecFwk::InnerEvent::Pointer & response)971 int32_t CoreManagerInner::SetCallWaiting(
972     int32_t slotId, int32_t activate, const AppExecFwk::InnerEvent::Pointer &response)
973 {
974     if (telRilManager_ == nullptr) {
975         TELEPHONY_LOGE("telRilManager is null!");
976         return TELEPHONY_ERR_LOCAL_PTR_NULL;
977     }
978     return telRilManager_->SetCallWaiting(slotId, activate, response);
979 }
980 
SetCallTransferInfo(int32_t slotId,const CallTransferParam & callTransfer,const AppExecFwk::InnerEvent::Pointer & response)981 int32_t CoreManagerInner::SetCallTransferInfo(
982     int32_t slotId, const CallTransferParam &callTransfer, const AppExecFwk::InnerEvent::Pointer &response)
983 {
984     if (telRilManager_ == nullptr) {
985         TELEPHONY_LOGE("telRilManager is null!");
986         return TELEPHONY_ERR_LOCAL_PTR_NULL;
987     }
988     return telRilManager_->SetCallTransferInfo(slotId, callTransfer, response);
989 }
990 
GetCallTransferInfo(int32_t slotId,const int32_t reason,const AppExecFwk::InnerEvent::Pointer & response) const991 int32_t CoreManagerInner::GetCallTransferInfo(
992     int32_t slotId, const int32_t reason, const AppExecFwk::InnerEvent::Pointer &response) const
993 {
994     if (telRilManager_ == nullptr) {
995         TELEPHONY_LOGE("telRilManager is null!");
996         return TELEPHONY_ERR_LOCAL_PTR_NULL;
997     }
998     return telRilManager_->GetCallTransferInfo(slotId, reason, response);
999 }
1000 
GetCallWaiting(int32_t slotId,const AppExecFwk::InnerEvent::Pointer & response) const1001 int32_t CoreManagerInner::GetCallWaiting(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) const
1002 {
1003     if (telRilManager_ == nullptr) {
1004         TELEPHONY_LOGE("telRilManager is null!");
1005         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1006     }
1007     return telRilManager_->GetCallWaiting(slotId, response);
1008 }
1009 
GetCallRestriction(int32_t slotId,std::string fac,const AppExecFwk::InnerEvent::Pointer & response) const1010 int32_t CoreManagerInner::GetCallRestriction(
1011     int32_t slotId, std::string fac, const AppExecFwk::InnerEvent::Pointer &response) const
1012 {
1013     if (telRilManager_ == nullptr) {
1014         TELEPHONY_LOGE("telRilManager is null!");
1015         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1016     }
1017     return telRilManager_->GetCallRestriction(slotId, fac, response);
1018 }
1019 
SetCallRestriction(int32_t slotId,const CallRestrictionParam & callRestriction,const AppExecFwk::InnerEvent::Pointer & response)1020 int32_t CoreManagerInner::SetCallRestriction(
1021     int32_t slotId, const CallRestrictionParam &callRestriction, const AppExecFwk::InnerEvent::Pointer &response)
1022 {
1023     if (telRilManager_ == nullptr) {
1024         TELEPHONY_LOGE("telRilManager is null!");
1025         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1026     }
1027     return telRilManager_->SetCallRestriction(slotId, callRestriction, response);
1028 }
1029 
SetBarringPassword(int32_t slotId,const char * oldPassword,const char * newPassword,const std::string & restrictionType,const AppExecFwk::InnerEvent::Pointer & response)1030 int32_t CoreManagerInner::SetBarringPassword(int32_t slotId, const char *oldPassword,
1031     const char *newPassword, const std::string &restrictionType, const AppExecFwk::InnerEvent::Pointer &response)
1032 {
1033     if (telRilManager_ == nullptr) {
1034         TELEPHONY_LOGE("telRilManager is null!");
1035         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1036     }
1037     return telRilManager_->SetBarringPassword(slotId, oldPassword, newPassword, restrictionType, response);
1038 }
1039 
SetVoNRSwitch(int32_t slotId,int32_t state,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1040 int32_t CoreManagerInner::SetVoNRSwitch(
1041     int32_t slotId, int32_t state, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1042 {
1043     if (telRilManager_ == nullptr) {
1044         TELEPHONY_LOGE("set NR voice switch telRilManager is null!");
1045         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1046     }
1047     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1048     if (response == nullptr) {
1049         TELEPHONY_LOGE("set NR voice switch response is null!");
1050         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1051     }
1052     response->SetOwner(handler);
1053     return telRilManager_->SetVoNRSwitch(slotId, state, response);
1054 }
1055 
SendDTMF(int32_t slotId,int32_t eventId,const DtmfParam & dtmfParam,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1056 int32_t CoreManagerInner::SendDTMF(int32_t slotId, int32_t eventId, const DtmfParam &dtmfParam,
1057     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1058 {
1059     if (telRilManager_ == nullptr) {
1060         TELEPHONY_LOGE("send DTMF telRilManager is null!");
1061         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1062     }
1063     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1064     if (response == nullptr) {
1065         TELEPHONY_LOGE("send DTMF response is null!");
1066         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1067     }
1068     response->SetOwner(handler);
1069     return telRilManager_->SendDtmf(slotId, dtmfParam, response);
1070 }
1071 
SendDTMF(int32_t slotId,int32_t eventId,char cDTMFCode,int32_t index,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1072 int32_t CoreManagerInner::SendDTMF(int32_t slotId, int32_t eventId, char cDTMFCode, int32_t index,
1073     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1074 {
1075     if (telRilManager_ == nullptr) {
1076         TELEPHONY_LOGE("send DTMF telRilManager is null!");
1077         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1078     }
1079     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, index);
1080     if (response == nullptr) {
1081         TELEPHONY_LOGE("send DTMF response is null!");
1082         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1083     }
1084     response->SetOwner(handler);
1085     return telRilManager_->SendDtmf(slotId, cDTMFCode, index, response);
1086 }
1087 
StartDTMF(int32_t slotId,int32_t eventId,char cDTMFCode,int32_t index,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1088 int32_t CoreManagerInner::StartDTMF(int32_t slotId, int32_t eventId, char cDTMFCode, int32_t index,
1089     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1090 {
1091     if (telRilManager_ == nullptr) {
1092         TELEPHONY_LOGE("start DTMF telRilManager is null!");
1093         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1094     }
1095     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1096     if (response == nullptr) {
1097         TELEPHONY_LOGE("start DTMF response is null!");
1098         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1099     }
1100     response->SetOwner(handler);
1101     return telRilManager_->StartDtmf(slotId, cDTMFCode, index, response);
1102 }
1103 
StopDTMF(int32_t slotId,int32_t eventId,int32_t index,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1104 int32_t CoreManagerInner::StopDTMF(
1105     int32_t slotId, int32_t eventId, int32_t index, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1106 {
1107     if (telRilManager_ == nullptr) {
1108         TELEPHONY_LOGE("stop DTMF telRilManager is null!");
1109         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1110     }
1111     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1112     if (response == nullptr) {
1113         TELEPHONY_LOGE("stop DTMF response is null!");
1114         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1115     }
1116     response->SetOwner(handler);
1117     return telRilManager_->StopDtmf(slotId, index, response);
1118 }
1119 
SetDataPermitted(int32_t slotId,int32_t eventId,int32_t dataPermitted,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1120 int32_t CoreManagerInner::SetDataPermitted(
1121     int32_t slotId, int32_t eventId, int32_t dataPermitted, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1122 {
1123     if (telRilManager_ == nullptr) {
1124         TELEPHONY_LOGE("set data permitted telRilManager is null!");
1125         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1126     }
1127     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1128     if (response == nullptr) {
1129         TELEPHONY_LOGE("set data permitted response is null!");
1130         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1131     }
1132     response->SetOwner(handler);
1133     return telRilManager_->SetDataPermitted(slotId, dataPermitted, response);
1134 }
1135 
SetInitApnInfo(int32_t slotId,int32_t eventId,const DataProfile & dataProfile,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1136 int32_t CoreManagerInner::SetInitApnInfo(int32_t slotId, int32_t eventId, const DataProfile &dataProfile,
1137     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1138 {
1139     if (telRilManager_ == nullptr) {
1140         TELEPHONY_LOGE("set init apn info telRilManager is null!");
1141         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1142     }
1143     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1144     if (response == nullptr) {
1145         TELEPHONY_LOGE("set init apn info response is null!");
1146         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1147     }
1148     response->SetOwner(handler);
1149     return telRilManager_->SetInitApnInfo(slotId, dataProfile, response);
1150 }
1151 
ActivatePdpContext(int32_t slotId,int32_t eventId,const ActivateDataParam & activateData,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1152 int32_t CoreManagerInner::ActivatePdpContext(int32_t slotId, int32_t eventId, const ActivateDataParam &activateData,
1153     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1154 {
1155     if (telRilManager_ == nullptr) {
1156         TELEPHONY_LOGE("activate pdp context telRilManager is null!");
1157         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1158     }
1159     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, activateData.param);
1160     if (response == nullptr) {
1161         TELEPHONY_LOGE("activate pdp context response is null!");
1162         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1163     }
1164     response->SetOwner(handler);
1165     return telRilManager_->ActivatePdpContext(slotId, activateData, response);
1166 }
1167 
DeactivatePdpContext(int32_t slotId,int32_t eventId,const DeactivateDataParam & deactivateData,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1168 int32_t CoreManagerInner::DeactivatePdpContext(int32_t slotId, int32_t eventId,
1169     const DeactivateDataParam &deactivateData, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1170 {
1171     if (telRilManager_ == nullptr) {
1172         TELEPHONY_LOGE("deactivate pdp context telRilManager is null!");
1173         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1174     }
1175     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, deactivateData.param);
1176     if (response == nullptr) {
1177         TELEPHONY_LOGE("deactivate pdp context response is null!");
1178         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1179     }
1180     response->SetOwner(handler);
1181     return telRilManager_->DeactivatePdpContext(slotId, deactivateData.cid, deactivateData.reason, response);
1182 }
1183 
GetPdpContextList(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1184 int32_t CoreManagerInner::GetPdpContextList(
1185     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1186 {
1187     if (telRilManager_ == nullptr) {
1188         TELEPHONY_LOGE("get pdp context list telRilManager is null!");
1189         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1190     }
1191     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1192     if (response == nullptr) {
1193         TELEPHONY_LOGE("get pdp context list response is null!");
1194         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1195     }
1196     response->SetOwner(handler);
1197     return telRilManager_->GetPdpContextList(slotId, response);
1198 }
1199 
SetLinkBandwidthReportingRule(int32_t slotId,int32_t eventId,LinkBandwidthRule linkBandwidth,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1200 int32_t CoreManagerInner::SetLinkBandwidthReportingRule(int32_t slotId, int32_t eventId,
1201     LinkBandwidthRule linkBandwidth, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1202 {
1203     if (telRilManager_ == nullptr) {
1204         TELEPHONY_LOGE("set link bandwidth reporting rule telRilManager is null!");
1205         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1206     }
1207     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1208     if (response == nullptr) {
1209         TELEPHONY_LOGE("set link bandwidth reporting rule response is null!");
1210         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1211     }
1212     response->SetOwner(handler);
1213     return telRilManager_->SetLinkBandwidthReportingRule(slotId, linkBandwidth, response);
1214 }
1215 
GetLinkBandwidthInfo(int32_t slotId,int32_t eventId,const int32_t cid,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1216 int32_t CoreManagerInner::GetLinkBandwidthInfo(
1217     int32_t slotId, int32_t eventId, const int32_t cid, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1218 {
1219     if (telRilManager_ == nullptr) {
1220         TELEPHONY_LOGE("get link bandwidth info telRilManager is null!");
1221         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1222     }
1223     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1224     if (response == nullptr) {
1225         TELEPHONY_LOGE("get link bandwidth info response is null!");
1226         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1227     }
1228     response->SetOwner(handler);
1229     return telRilManager_->GetLinkBandwidthInfo(slotId, cid, response);
1230 }
1231 
GetLinkCapability(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1232 int32_t CoreManagerInner::GetLinkCapability(
1233     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1234 {
1235     if (telRilManager_ == nullptr) {
1236         TELEPHONY_LOGE("get link capability telRilManager is null!");
1237         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1238     }
1239     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1240     if (response == nullptr) {
1241         TELEPHONY_LOGE("get link capability response is null!");
1242         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1243     }
1244     response->SetOwner(handler);
1245     return telRilManager_->GetLinkCapability(slotId, response);
1246 }
1247 
CleanAllConnections(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1248 int32_t CoreManagerInner::CleanAllConnections(
1249     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1250 {
1251     if (telRilManager_ == nullptr) {
1252         TELEPHONY_LOGE("clean all connections telRilManager is null!");
1253         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1254     }
1255     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1256     if (response == nullptr) {
1257         TELEPHONY_LOGE("clean all connections response is null!");
1258         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1259     }
1260     response->SetOwner(handler);
1261     return telRilManager_->CleanAllConnections(slotId, response);
1262 }
1263 
GetSignalStrength(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const1264 int32_t CoreManagerInner::GetSignalStrength(
1265     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
1266 {
1267     if (telRilManager_ == nullptr) {
1268         TELEPHONY_LOGE("get signal strength telRilManager is null!");
1269         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1270     }
1271     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1272     if (response == nullptr) {
1273         TELEPHONY_LOGE("get signal strength response is null!");
1274         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1275     }
1276     response->SetOwner(handler);
1277     return telRilManager_->GetSignalStrength(slotId, response);
1278 }
1279 
GetCsRegStatus(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const1280 int32_t CoreManagerInner::GetCsRegStatus(
1281     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
1282 {
1283     if (telRilManager_ == nullptr) {
1284         TELEPHONY_LOGE("get cs register status telRilManager is null!");
1285         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1286     }
1287     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1288     if (response == nullptr) {
1289         TELEPHONY_LOGE("get cs register status response is null!");
1290         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1291     }
1292     response->SetOwner(handler);
1293     return telRilManager_->GetCsRegStatus(slotId, response);
1294 }
1295 
GetPsRegStatus(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const1296 int32_t CoreManagerInner::GetPsRegStatus(
1297     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
1298 {
1299     if (telRilManager_ == nullptr) {
1300         TELEPHONY_LOGE("get ps register status telRilManager is null!");
1301         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1302     }
1303     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1304     if (response == nullptr) {
1305         TELEPHONY_LOGE("get ps register status response is null!");
1306         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1307     }
1308     response->SetOwner(handler);
1309     return telRilManager_->GetPsRegStatus(slotId, response);
1310 }
1311 /******************** telRilManager end *******************/
1312 /******************** networkSearchManager start *******************/
GetPsRadioTech(int32_t slotId,int32_t & psRadioTech)1313 int32_t CoreManagerInner::GetPsRadioTech(int32_t slotId, int32_t &psRadioTech)
1314 {
1315     if (networkSearchManager_ == nullptr) {
1316         TELEPHONY_LOGE("networkSearchManager is null!");
1317         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1318     }
1319     return networkSearchManager_->GetPsRadioTech(slotId, psRadioTech);
1320 }
1321 
GetCsRadioTech(int32_t slotId,int32_t & csRadioTech)1322 int32_t CoreManagerInner::GetCsRadioTech(int32_t slotId, int32_t &csRadioTech)
1323 {
1324     if (networkSearchManager_ == nullptr) {
1325         TELEPHONY_LOGE("networkSearchManager is null!");
1326         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1327     }
1328     return networkSearchManager_->GetCsRadioTech(slotId, csRadioTech);
1329 }
1330 
GetPsRegState(int32_t slotId)1331 int32_t CoreManagerInner::GetPsRegState(int32_t slotId)
1332 {
1333     if (networkSearchManager_ == nullptr) {
1334         TELEPHONY_LOGE("networkSearchManager is null!");
1335         return NETWORK_IS_NULL;
1336     }
1337     return networkSearchManager_->GetPsRegState(slotId);
1338 }
1339 
GetCsRegState(int32_t slotId)1340 int32_t CoreManagerInner::GetCsRegState(int32_t slotId)
1341 {
1342     if (networkSearchManager_ == nullptr) {
1343         TELEPHONY_LOGE("networkSearchManager is null!");
1344         return NETWORK_IS_NULL;
1345     }
1346     return networkSearchManager_->GetCsRegState(slotId);
1347 }
1348 
GetPsRoamingState(int32_t slotId)1349 int32_t CoreManagerInner::GetPsRoamingState(int32_t slotId)
1350 {
1351     if (networkSearchManager_ == nullptr) {
1352         TELEPHONY_LOGE("networkSearchManager is null!");
1353         return NETWORK_IS_NULL;
1354     }
1355     return networkSearchManager_->GetPsRoamingState(slotId);
1356 }
1357 
SetNetworkSelectionMode(int32_t slotId,int32_t selectMode,const sptr<NetworkInformation> & networkInformation,bool resumeSelection,const sptr<INetworkSearchCallback> & callback)1358 bool CoreManagerInner::SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
1359     const sptr<NetworkInformation> &networkInformation, bool resumeSelection,
1360     const sptr<INetworkSearchCallback> &callback)
1361 {
1362     if (networkSearchManager_ == nullptr) {
1363         TELEPHONY_LOGE("networkSearchManager is null!");
1364         return false;
1365     }
1366     return networkSearchManager_->SetNetworkSelectionMode(
1367         slotId, selectMode, networkInformation, resumeSelection, callback);
1368 }
1369 
GetSignalInfoList(int32_t slotId,std::vector<sptr<SignalInformation>> & signals)1370 int32_t CoreManagerInner::GetSignalInfoList(int32_t slotId, std::vector<sptr<SignalInformation>> &signals)
1371 {
1372     if (networkSearchManager_ == nullptr) {
1373         TELEPHONY_LOGE("networkSearchManager is null!");
1374         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1375     }
1376     return networkSearchManager_->GetSignalInfoList(slotId, signals);
1377 }
1378 
GetOperatorNumeric(int32_t slotId)1379 std::u16string CoreManagerInner::GetOperatorNumeric(int32_t slotId)
1380 {
1381     if (networkSearchManager_ == nullptr) {
1382         TELEPHONY_LOGE("networkSearchManager is null!");
1383         return std::u16string();
1384     }
1385     return networkSearchManager_->GetOperatorNumeric(slotId);
1386 }
1387 
GetOperatorName(int32_t slotId,std::u16string & operatorName)1388 int32_t CoreManagerInner::GetOperatorName(int32_t slotId, std::u16string &operatorName)
1389 {
1390     if (networkSearchManager_ == nullptr) {
1391         TELEPHONY_LOGE("networkSearchManager is null!");
1392         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1393     }
1394     return networkSearchManager_->GetOperatorName(slotId, operatorName);
1395 }
1396 
GetNetworkStatus(int32_t slotId,sptr<NetworkState> & networkState)1397 int32_t CoreManagerInner::GetNetworkStatus(int32_t slotId, sptr<NetworkState> &networkState)
1398 {
1399     if (networkSearchManager_ == nullptr) {
1400         TELEPHONY_LOGE("networkSearchManager is null!");
1401         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1402     }
1403     return networkSearchManager_->GetNetworkStatus(slotId, networkState);
1404 }
1405 
SetRadioState(int32_t slotId,bool isOn,int32_t rst,const sptr<INetworkSearchCallback> & callback)1406 int32_t CoreManagerInner::SetRadioState(
1407     int32_t slotId, bool isOn, int32_t rst, const sptr<INetworkSearchCallback> &callback)
1408 {
1409     if (networkSearchManager_ == nullptr) {
1410         TELEPHONY_LOGE("networkSearchManager is null!");
1411         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1412     }
1413     return networkSearchManager_->SetRadioState(slotId, isOn, rst, callback);
1414 }
1415 
GetRadioState(int32_t slotId)1416 int32_t CoreManagerInner::GetRadioState(int32_t slotId)
1417 {
1418     if (networkSearchManager_ == nullptr) {
1419         TELEPHONY_LOGE("networkSearchManager is null!");
1420         return NETWORK_IS_NULL;
1421     }
1422     return networkSearchManager_->GetRadioState(slotId);
1423 }
1424 
GetRadioState(int32_t slotId,const sptr<INetworkSearchCallback> & callback)1425 int32_t CoreManagerInner::GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
1426 {
1427     if (networkSearchManager_ == nullptr) {
1428         TELEPHONY_LOGE("networkSearchManager is null!");
1429         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1430     }
1431     return networkSearchManager_->GetRadioState(slotId, callback);
1432 }
1433 
GetIsoCountryCodeForNetwork(int32_t slotId,std::u16string & countryCode)1434 int32_t CoreManagerInner::GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode)
1435 {
1436     if (networkSearchManager_ == nullptr) {
1437         TELEPHONY_LOGE("networkSearchManager is null!");
1438         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1439     }
1440     return networkSearchManager_->GetIsoCountryCodeForNetwork(slotId, countryCode);
1441 }
1442 
GetImei(int32_t slotId,std::u16string & imei)1443 int32_t CoreManagerInner::GetImei(int32_t slotId, std::u16string &imei)
1444 {
1445     if (networkSearchManager_ == nullptr) {
1446         TELEPHONY_LOGE("networkSearchManager is null!");
1447         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1448     }
1449     return networkSearchManager_->GetImei(slotId, imei);
1450 }
1451 
GetMeid(int32_t slotId,std::u16string & meid)1452 int32_t CoreManagerInner::GetMeid(int32_t slotId, std::u16string &meid)
1453 {
1454     if (networkSearchManager_ == nullptr) {
1455         TELEPHONY_LOGE("networkSearchManager is null!");
1456         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1457     }
1458     return networkSearchManager_->GetMeid(slotId, meid);
1459 }
1460 
GetUniqueDeviceId(int32_t slotId,std::u16string & deviceId)1461 int32_t CoreManagerInner::GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId)
1462 {
1463     if (networkSearchManager_ == nullptr) {
1464         TELEPHONY_LOGE("networkSearchManager is null!");
1465         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1466     }
1467     return networkSearchManager_->GetUniqueDeviceId(slotId, deviceId);
1468 }
1469 
GetPhoneType(int32_t slotId)1470 PhoneType CoreManagerInner::GetPhoneType(int32_t slotId)
1471 {
1472     if (networkSearchManager_ == nullptr) {
1473         TELEPHONY_LOGE("networkSearchManager is null!");
1474         return PhoneType::PHONE_TYPE_IS_NONE;
1475     }
1476     return networkSearchManager_->GetPhoneType(slotId);
1477 }
1478 
GetCellLocation(int32_t slotId)1479 sptr<CellLocation> CoreManagerInner::GetCellLocation(int32_t slotId)
1480 {
1481     if (networkSearchManager_ == nullptr) {
1482         TELEPHONY_LOGE("networkSearchManager is null!");
1483         return nullptr;
1484     }
1485     return networkSearchManager_->GetCellLocation(slotId);
1486 }
1487 
GetNetworkSearchInformation(int32_t slotId,const sptr<INetworkSearchCallback> & callback)1488 int32_t CoreManagerInner::GetNetworkSearchInformation(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
1489 {
1490     if (networkSearchManager_ == nullptr) {
1491         TELEPHONY_LOGE("networkSearchManager is null!");
1492         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1493     }
1494     return networkSearchManager_->GetNetworkSearchInformation(slotId, callback);
1495 }
1496 
GetNetworkSelectionMode(int32_t slotId,const sptr<INetworkSearchCallback> & callback)1497 int32_t CoreManagerInner::GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
1498 {
1499     if (networkSearchManager_ == nullptr) {
1500         TELEPHONY_LOGE("networkSearchManager is null!");
1501         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1502     }
1503     return networkSearchManager_->GetNetworkSelectionMode(slotId, callback);
1504 }
1505 
GetCellInfoList(int32_t slotId,std::vector<sptr<CellInformation>> & cellInfo)1506 int32_t CoreManagerInner::GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo)
1507 {
1508     if (networkSearchManager_ == nullptr) {
1509         TELEPHONY_LOGE("networkSearchManager is null!");
1510         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1511     }
1512     return networkSearchManager_->GetCellInfoList(slotId, cellInfo);
1513 }
1514 
SendUpdateCellLocationRequest(int32_t slotId)1515 int32_t CoreManagerInner::SendUpdateCellLocationRequest(int32_t slotId)
1516 {
1517     if (networkSearchManager_ == nullptr) {
1518         TELEPHONY_LOGE("networkSearchManager is null!");
1519         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1520     }
1521     return networkSearchManager_->SendUpdateCellLocationRequest(slotId);
1522 }
1523 
GetPreferredNetwork(int32_t slotId,const sptr<INetworkSearchCallback> & callback)1524 int32_t CoreManagerInner::GetPreferredNetwork(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
1525 {
1526     if (networkSearchManager_ != nullptr) {
1527         return networkSearchManager_->GetPreferredNetwork(slotId, callback);
1528     }
1529     return TELEPHONY_ERR_LOCAL_PTR_NULL;
1530 }
1531 
SetPreferredNetwork(int32_t slotId,int32_t networkMode,const sptr<INetworkSearchCallback> & callback)1532 int32_t CoreManagerInner::SetPreferredNetwork(
1533     int32_t slotId, int32_t networkMode, const sptr<INetworkSearchCallback> &callback)
1534 {
1535     if (networkSearchManager_ != nullptr) {
1536         return networkSearchManager_->SetPreferredNetwork(slotId, networkMode, callback);
1537     }
1538     return TELEPHONY_ERR_LOCAL_PTR_NULL;
1539 }
1540 
IsNrSupported(int32_t slotId)1541 bool CoreManagerInner::IsNrSupported(int32_t slotId)
1542 {
1543     if (networkSearchManager_ != nullptr) {
1544         return networkSearchManager_->IsNrSupported(slotId);
1545     }
1546     return false;
1547 }
1548 
IsSatelliteEnabled()1549 bool CoreManagerInner::IsSatelliteEnabled()
1550 {
1551     if (networkSearchManager_ != nullptr) {
1552         return networkSearchManager_->IsSatelliteEnabled();
1553     }
1554     return false;
1555 }
1556 
DcPhysicalLinkActiveUpdate(int32_t slotId,bool isActive)1557 void CoreManagerInner::DcPhysicalLinkActiveUpdate(int32_t slotId, bool isActive)
1558 {
1559     if (networkSearchManager_ != nullptr) {
1560         networkSearchManager_->DcPhysicalLinkActiveUpdate(slotId, isActive);
1561     }
1562 }
1563 
NotifyCallStatusToNetworkSearch(int32_t slotId,int32_t callStatus)1564 int32_t CoreManagerInner::NotifyCallStatusToNetworkSearch(int32_t slotId, int32_t callStatus)
1565 {
1566     if (networkSearchManager_ == nullptr) {
1567         TELEPHONY_LOGE("networkSearchManager is null!");
1568         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1569     }
1570     return networkSearchManager_->NotifyCallStatusToNetworkSearch(slotId, callStatus);
1571 }
1572 
GetNrOptionMode(int32_t slotId,NrMode & mode)1573 int32_t CoreManagerInner::GetNrOptionMode(int32_t slotId, NrMode &mode)
1574 {
1575     if (networkSearchManager_ != nullptr) {
1576         return networkSearchManager_->GetNrOptionMode(slotId, mode);
1577     }
1578     return TELEPHONY_ERR_LOCAL_PTR_NULL;
1579 }
1580 
GetFrequencyType(int32_t slotId) const1581 FrequencyType CoreManagerInner::GetFrequencyType(int32_t slotId) const
1582 {
1583     if (networkSearchManager_ != nullptr) {
1584         return networkSearchManager_->GetFrequencyType(slotId);
1585     }
1586     return FrequencyType::FREQ_TYPE_UNKNOWN;
1587 }
1588 
GetNrState(int32_t slotId) const1589 NrState CoreManagerInner::GetNrState(int32_t slotId) const
1590 {
1591     if (networkSearchManager_ != nullptr) {
1592         return networkSearchManager_->GetNrState(slotId);
1593     }
1594     return NrState::NR_STATE_NOT_SUPPORT;
1595 }
1596 
GetImsRegStatus(int32_t slotId,ImsServiceType imsSrvType,ImsRegInfo & info) const1597 int32_t CoreManagerInner::GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info) const
1598 {
1599     if (networkSearchManager_ == nullptr) {
1600         TELEPHONY_LOGE("networkSearchManager is null!");
1601         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1602     }
1603     return networkSearchManager_->GetImsRegStatus(slotId, imsSrvType, info);
1604 }
1605 
GetAirplaneMode(bool & airplaneMode)1606 int32_t CoreManagerInner::GetAirplaneMode(bool &airplaneMode)
1607 {
1608     if (networkSearchManager_ == nullptr) {
1609         TELEPHONY_LOGE("networkSearchManager is null!");
1610         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1611     }
1612     return networkSearchManager_->GetAirplaneMode(airplaneMode);
1613 }
1614 
UpdateRadioOn(int32_t slotId)1615 int32_t CoreManagerInner::UpdateRadioOn(int32_t slotId)
1616 {
1617     if (networkSearchManager_ == nullptr) {
1618         TELEPHONY_LOGE("networkSearchManager is null!");
1619         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1620     }
1621     return networkSearchManager_->UpdateRadioOn(slotId);
1622 }
1623 
1624 /******************** networkSearchManager end ************************/
1625 /******************** simManager_ start *******************/
1626 
ObtainSpnCondition(int32_t slotId,bool roaming,std::string operatorNum)1627 int32_t CoreManagerInner::ObtainSpnCondition(int32_t slotId, bool roaming, std::string operatorNum)
1628 {
1629     if (simManager_ == nullptr) {
1630         TELEPHONY_LOGE("simManager_ is null");
1631         return 0;
1632     }
1633     return simManager_->ObtainSpnCondition(slotId, roaming, operatorNum);
1634 }
1635 
GetSimSpn(int32_t slotId,std::u16string & spn)1636 int32_t CoreManagerInner::GetSimSpn(int32_t slotId, std::u16string &spn)
1637 {
1638     if (simManager_ == nullptr) {
1639         TELEPHONY_LOGE("simManager_ is null");
1640         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1641     }
1642     return simManager_->GetSimSpn(slotId, spn);
1643 }
1644 
SetVoiceMailInfo(int32_t slotId,const std::u16string & mailName,const std::u16string & mailNumber)1645 int32_t CoreManagerInner::SetVoiceMailInfo(
1646     int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber)
1647 {
1648     if (simManager_ == nullptr) {
1649         TELEPHONY_LOGE("simManager_ is null");
1650         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1651     }
1652     return simManager_->SetVoiceMailInfo(slotId, mailName, mailNumber);
1653 }
1654 
QueryIccDiallingNumbers(int slotId,int type,std::vector<std::shared_ptr<DiallingNumbersInfo>> & result)1655 int32_t CoreManagerInner::QueryIccDiallingNumbers(
1656     int slotId, int type, std::vector<std::shared_ptr<DiallingNumbersInfo>> &result)
1657 {
1658     if (simManager_ == nullptr) {
1659         TELEPHONY_LOGE("iccDiallingNumbersManager is null!");
1660         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1661     }
1662     return simManager_->QueryIccDiallingNumbers(slotId, type, result);
1663 }
1664 
AddIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)1665 int32_t CoreManagerInner::AddIccDiallingNumbers(
1666     int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber)
1667 {
1668     if (simManager_ == nullptr) {
1669         TELEPHONY_LOGE("iccDiallingNumbersManager is null!");
1670         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1671     }
1672     return simManager_->AddIccDiallingNumbers(slotId, type, diallingNumber);
1673 }
1674 
DelIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)1675 int32_t CoreManagerInner::DelIccDiallingNumbers(
1676     int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber)
1677 {
1678     if (simManager_ == nullptr) {
1679         TELEPHONY_LOGE("iccDiallingNumbersManager is null!");
1680         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1681     }
1682     return simManager_->DelIccDiallingNumbers(slotId, type, diallingNumber);
1683 }
1684 
UpdateIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)1685 int32_t CoreManagerInner::UpdateIccDiallingNumbers(
1686     int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber)
1687 {
1688     if (simManager_ == nullptr) {
1689         TELEPHONY_LOGE("iccDiallingNumbersManager is null!");
1690         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1691     }
1692     return simManager_->UpdateIccDiallingNumbers(slotId, type, diallingNumber);
1693 }
1694 
AddSmsToIcc(int slotId,int status,std::string & pdu,std::string & smsc)1695 int32_t CoreManagerInner::AddSmsToIcc(int slotId, int status, std::string &pdu, std::string &smsc)
1696 {
1697     if (simManager_ == nullptr) {
1698         TELEPHONY_LOGE("simManager_ is null!");
1699         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1700     }
1701     return simManager_->AddSmsToIcc(slotId, status, pdu, smsc);
1702 }
1703 
UpdateSmsIcc(int slotId,int index,int status,std::string & pduData,std::string & smsc)1704 int32_t CoreManagerInner::UpdateSmsIcc(int slotId, int index, int status, std::string &pduData, std::string &smsc)
1705 {
1706     if (simManager_ == nullptr) {
1707         TELEPHONY_LOGE("simManager_ is null!");
1708         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1709     }
1710     return simManager_->UpdateSmsIcc(slotId, index, status, pduData, smsc);
1711 }
1712 
ObtainAllSmsOfIcc(int slotId)1713 std::vector<std::string> CoreManagerInner::ObtainAllSmsOfIcc(int slotId)
1714 {
1715     if (simManager_ == nullptr) {
1716         TELEPHONY_LOGE("simManager_ is null!");
1717         std::vector<std::string> result;
1718         return result;
1719     }
1720     return simManager_->ObtainAllSmsOfIcc(slotId);
1721 }
1722 
DelSmsIcc(int slotId,int index)1723 int32_t CoreManagerInner::DelSmsIcc(int slotId, int index)
1724 {
1725     if (simManager_ == nullptr) {
1726         TELEPHONY_LOGE("simManager_ is null!");
1727         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1728     }
1729     return simManager_->DelSmsIcc(slotId, index);
1730 }
1731 
IsSimActive(int32_t slotId)1732 bool CoreManagerInner::IsSimActive(int32_t slotId)
1733 {
1734     if (simManager_ == nullptr) {
1735         TELEPHONY_LOGE("simManager_ is null!");
1736         return false;
1737     }
1738     return simManager_->IsSimActive(slotId);
1739 }
1740 
SetActiveSim(int32_t slotId,int32_t enable)1741 int32_t CoreManagerInner::SetActiveSim(int32_t slotId, int32_t enable)
1742 {
1743     if (simManager_ == nullptr) {
1744         TELEPHONY_LOGE("simManager_ is null!");
1745         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1746     }
1747     return simManager_->SetActiveSim(slotId, enable);
1748 }
1749 
GetSimAccountInfo(int32_t slotId,IccAccountInfo & info)1750 int32_t CoreManagerInner::GetSimAccountInfo(int32_t slotId, IccAccountInfo &info)
1751 {
1752     if (simManager_ == nullptr) {
1753         TELEPHONY_LOGE("simManager_ is null!");
1754         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1755     }
1756     return simManager_->GetSimAccountInfo(slotId, false, info);
1757 }
1758 
SetDefaultVoiceSlotId(int32_t slotId)1759 int32_t CoreManagerInner::SetDefaultVoiceSlotId(int32_t slotId)
1760 {
1761     if (simManager_ == nullptr) {
1762         TELEPHONY_LOGE("simManager_ is null!");
1763         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1764     }
1765     return simManager_->SetDefaultVoiceSlotId(slotId);
1766 }
1767 
SetDefaultSmsSlotId(int32_t slotId)1768 int32_t CoreManagerInner::SetDefaultSmsSlotId(int32_t slotId)
1769 {
1770     if (simManager_ == nullptr) {
1771         TELEPHONY_LOGE("simManager_ is null!");
1772         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1773     }
1774     return simManager_->SetDefaultSmsSlotId(slotId);
1775 }
1776 
SetDefaultCellularDataSlotId(int32_t slotId)1777 int32_t CoreManagerInner::SetDefaultCellularDataSlotId(int32_t slotId)
1778 {
1779     if (simManager_ == nullptr) {
1780         TELEPHONY_LOGE("simManager_ is null!");
1781         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1782     }
1783     return simManager_->SetDefaultCellularDataSlotId(slotId);
1784 }
1785 
SetPrimarySlotId(int32_t slotId)1786 int32_t CoreManagerInner::SetPrimarySlotId(int32_t slotId)
1787 {
1788     if (simManager_ == nullptr) {
1789         TELEPHONY_LOGE("simManager_ is null!");
1790         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1791     }
1792     return simManager_->SetPrimarySlotId(slotId);
1793 }
1794 
SetShowNumber(int32_t slotId,const std::u16string & number)1795 int32_t CoreManagerInner::SetShowNumber(int32_t slotId, const std::u16string &number)
1796 {
1797     if (simManager_ == nullptr) {
1798         TELEPHONY_LOGE("simManager_ is null!");
1799         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1800     }
1801     return simManager_->SetShowNumber(slotId, number);
1802 }
1803 
SetShowName(int32_t slotId,const std::u16string & name)1804 int32_t CoreManagerInner::SetShowName(int32_t slotId, const std::u16string &name)
1805 {
1806     if (simManager_ == nullptr) {
1807         TELEPHONY_LOGE("simManager_ is null!");
1808         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1809     }
1810     return simManager_->SetShowName(slotId, name);
1811 }
1812 
GetDefaultVoiceSlotId()1813 int32_t CoreManagerInner::GetDefaultVoiceSlotId()
1814 {
1815     if (simManager_ == nullptr) {
1816         TELEPHONY_LOGE("simManager_ is null!");
1817         return TELEPHONY_ERROR;
1818     }
1819     return simManager_->GetDefaultVoiceSlotId();
1820 }
1821 
GetDefaultVoiceSimId(int32_t & simId)1822 int32_t CoreManagerInner::GetDefaultVoiceSimId(int32_t &simId)
1823 {
1824     if (simManager_ == nullptr) {
1825         TELEPHONY_LOGE("simManager_ is null!");
1826         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1827     }
1828     return simManager_->GetDefaultVoiceSimId(simId);
1829 }
1830 
GetDefaultSmsSlotId()1831 int32_t CoreManagerInner::GetDefaultSmsSlotId()
1832 {
1833     if (simManager_ == nullptr) {
1834         TELEPHONY_LOGE("simManager_ is null!");
1835         return TELEPHONY_ERROR;
1836     }
1837     return simManager_->GetDefaultSmsSlotId();
1838 }
1839 
GetDefaultSmsSimId(int32_t & simId)1840 int32_t CoreManagerInner::GetDefaultSmsSimId(int32_t &simId)
1841 {
1842     if (simManager_ == nullptr) {
1843         TELEPHONY_LOGE("simManager_ is null!");
1844         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1845     }
1846     return simManager_->GetDefaultSmsSimId(simId);
1847 }
1848 
GetDefaultCellularDataSlotId()1849 int32_t CoreManagerInner::GetDefaultCellularDataSlotId()
1850 {
1851     if (simManager_ == nullptr) {
1852         TELEPHONY_LOGE("simManager_ is null!");
1853         return TELEPHONY_ERROR;
1854     }
1855     return simManager_->GetDefaultCellularDataSlotId();
1856 }
1857 
GetDefaultCellularDataSimId(int32_t & simId)1858 int32_t CoreManagerInner::GetDefaultCellularDataSimId(int32_t &simId)
1859 {
1860     if (simManager_ == nullptr) {
1861         TELEPHONY_LOGE("simManager_ is null!");
1862         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1863     }
1864     return simManager_->GetDefaultCellularDataSimId(simId);
1865 }
1866 
GetDsdsMode(int32_t & dsdsMode)1867 int32_t CoreManagerInner::GetDsdsMode(int32_t &dsdsMode)
1868 {
1869     if (simManager_ == nullptr) {
1870         TELEPHONY_LOGE("simManager_ is null!");
1871         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1872     }
1873     return simManager_->GetDsdsMode(dsdsMode);
1874 }
1875 
SetDsdsMode(int32_t dsdsMode)1876 int32_t CoreManagerInner::SetDsdsMode(int32_t dsdsMode)
1877 {
1878     if (simManager_ == nullptr) {
1879         TELEPHONY_LOGE("simManager_ is null!");
1880         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1881     }
1882     return simManager_->SetDsdsMode(dsdsMode);
1883 }
1884 
SendSimMatchedOperatorInfo(int32_t slotId,int32_t state,const std::string & operName,const std::string & operKey)1885 int32_t CoreManagerInner::SendSimMatchedOperatorInfo(
1886     int32_t slotId, int32_t state, const std::string &operName, const std::string &operKey)
1887 {
1888     if (simManager_ == nullptr) {
1889         TELEPHONY_LOGE("simManager_ is null!");
1890         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1891     }
1892     return simManager_->SendSimMatchedOperatorInfo(slotId, state, operName, operKey);
1893 }
1894 
GetPrimarySlotId(int32_t & slotId)1895 int32_t CoreManagerInner::GetPrimarySlotId(int32_t &slotId)
1896 {
1897     if (simManager_ == nullptr) {
1898         TELEPHONY_LOGE("simManager_ is null!");
1899         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1900     }
1901     return simManager_->GetPrimarySlotId(slotId);
1902 }
1903 
GetShowNumber(int32_t slotId,std::u16string & showNumber)1904 int32_t CoreManagerInner::GetShowNumber(int32_t slotId, std::u16string &showNumber)
1905 {
1906     if (simManager_ == nullptr) {
1907         TELEPHONY_LOGE("simManager_ is null!");
1908         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1909     }
1910     return simManager_->GetShowNumber(slotId, showNumber);
1911 }
1912 
GetShowName(int32_t slotId,std::u16string & showName)1913 int32_t CoreManagerInner::GetShowName(int32_t slotId, std::u16string &showName)
1914 {
1915     if (simManager_ == nullptr) {
1916         TELEPHONY_LOGE("simManager_ is null!");
1917         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1918     }
1919     return simManager_->GetShowName(slotId, showName);
1920 }
1921 
GetActiveSimAccountInfoList(std::vector<IccAccountInfo> & iccAccountInfoList)1922 int32_t CoreManagerInner::GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList)
1923 {
1924     if (simManager_ == nullptr) {
1925         TELEPHONY_LOGE("simManager_ is null!");
1926         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1927     }
1928     return simManager_->GetActiveSimAccountInfoList(false, iccAccountInfoList);
1929 }
1930 
GetOperatorConfigs(int32_t slotId,OperatorConfig & poc)1931 int32_t CoreManagerInner::GetOperatorConfigs(int32_t slotId, OperatorConfig &poc)
1932 {
1933     if (simManager_ == nullptr) {
1934         TELEPHONY_LOGE("simManager_ is null!");
1935         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1936     }
1937     return simManager_->GetOperatorConfigs(slotId, poc);
1938 }
1939 
GetSimOperatorNumeric(int32_t slotId,std::u16string & operatorNumeric)1940 int32_t CoreManagerInner::GetSimOperatorNumeric(int32_t slotId, std::u16string &operatorNumeric)
1941 {
1942     if (simManager_ == nullptr) {
1943         TELEPHONY_LOGE("simManager_ is null!");
1944         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1945     }
1946     return simManager_->GetSimOperatorNumeric(slotId, operatorNumeric);
1947 }
1948 
GetISOCountryCodeForSim(int32_t slotId,std::u16string & countryCode)1949 int32_t CoreManagerInner::GetISOCountryCodeForSim(int32_t slotId, std::u16string &countryCode)
1950 {
1951     if (simManager_ == nullptr) {
1952         TELEPHONY_LOGE("simManager_ is null!");
1953         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1954     }
1955     return simManager_->GetISOCountryCodeForSim(slotId, countryCode);
1956 }
1957 
GetSimIccId(int32_t slotId,std::u16string & iccId)1958 int32_t CoreManagerInner::GetSimIccId(int32_t slotId, std::u16string &iccId)
1959 {
1960     if (simManager_ == nullptr) {
1961         TELEPHONY_LOGE("simManager_ is null!");
1962         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1963     }
1964     return simManager_->GetSimIccId(slotId, iccId);
1965 }
1966 
GetIMSI(int32_t slotId,std::u16string & imsi)1967 int32_t CoreManagerInner::GetIMSI(int32_t slotId, std::u16string &imsi)
1968 {
1969     if (simManager_ == nullptr) {
1970         TELEPHONY_LOGE("simManager_ is null!");
1971         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1972     }
1973     return simManager_->GetIMSI(slotId, imsi);
1974 }
1975 
GetLocaleFromDefaultSim(int32_t slotId)1976 std::u16string CoreManagerInner::GetLocaleFromDefaultSim(int32_t slotId)
1977 {
1978     if (simManager_ == nullptr) {
1979         TELEPHONY_LOGE("simManager_ is null!");
1980         return u"";
1981     }
1982     return simManager_->GetLocaleFromDefaultSim(slotId);
1983 }
1984 
GetSlotId(int32_t simId)1985 std::int32_t CoreManagerInner::GetSlotId(int32_t simId)
1986 {
1987     if (simManager_ == nullptr) {
1988         TELEPHONY_LOGE("simManager_ is null!");
1989         return TELEPHONY_ERROR;
1990     }
1991     return simManager_->GetSlotId(simId);
1992 }
1993 
GetSimId(int32_t slotId)1994 std::int32_t CoreManagerInner::GetSimId(int32_t slotId)
1995 {
1996     if (simManager_ == nullptr) {
1997         TELEPHONY_LOGE("simManager_ is null!");
1998         return TELEPHONY_ERROR;
1999     }
2000     return simManager_->GetSimId(slotId);
2001 }
2002 
GetSimGid1(int32_t slotId,std::u16string & gid1)2003 int32_t CoreManagerInner::GetSimGid1(int32_t slotId, std::u16string &gid1)
2004 {
2005     if (simManager_ == nullptr) {
2006         TELEPHONY_LOGE("simManager_ is null!");
2007         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2008     }
2009     return simManager_->GetSimGid1(slotId, gid1);
2010 }
2011 
GetSimGid2(int32_t slotId)2012 std::u16string CoreManagerInner::GetSimGid2(int32_t slotId)
2013 {
2014     if (simManager_ == nullptr) {
2015         TELEPHONY_LOGE("simManager_ is null!");
2016         return u"";
2017     }
2018     return simManager_->GetSimGid2(slotId);
2019 }
2020 
GetOpName(int32_t slotId,std::u16string & opname)2021 int32_t CoreManagerInner::GetOpName(int32_t slotId, std::u16string &opname)
2022 {
2023     if (simManager_ == nullptr) {
2024         TELEPHONY_LOGE("simManager_ is null!");
2025         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2026     }
2027     return simManager_->GetOpName(slotId, opname);
2028 }
2029 
GetOpKeyExt(int32_t slotId,std::u16string & opkeyExt)2030 int32_t CoreManagerInner::GetOpKeyExt(int32_t slotId, std::u16string &opkeyExt)
2031 {
2032     if (simManager_ == nullptr) {
2033         TELEPHONY_LOGE("simManager_ is null!");
2034         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2035     }
2036     return simManager_->GetOpKeyExt(slotId, opkeyExt);
2037 }
2038 
GetOpKey(std::u16string & opkey)2039 int32_t CoreManagerInner::GetOpKey(std::u16string &opkey)
2040 {
2041     if (simManager_ == nullptr) {
2042         TELEPHONY_LOGE("simManager_ is null!");
2043         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2044     }
2045     int32_t slotId = INVALID_VALUE;
2046     simManager_->GetPrimarySlotId(slotId);
2047     return GetOpKey(slotId, opkey);
2048 }
2049 
GetOpKey(int32_t slotId,std::u16string & opkey)2050 int32_t CoreManagerInner::GetOpKey(int32_t slotId, std::u16string &opkey)
2051 {
2052     if (simManager_ == nullptr) {
2053         TELEPHONY_LOGE("simManager_ is null!");
2054         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2055     }
2056     return simManager_->GetOpKey(slotId, opkey);
2057 }
2058 
GetSimTelephoneNumber(int32_t slotId,std::u16string & telephoneNumber)2059 int32_t CoreManagerInner::GetSimTelephoneNumber(int32_t slotId, std::u16string &telephoneNumber)
2060 {
2061     if (simManager_ == nullptr) {
2062         TELEPHONY_LOGE("simManager_ is null!");
2063         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2064     }
2065     return simManager_->GetSimTelephoneNumber(slotId, telephoneNumber);
2066 }
2067 
GetSimTeleNumberIdentifier(const int32_t slotId)2068 std::u16string CoreManagerInner::GetSimTeleNumberIdentifier(const int32_t slotId)
2069 {
2070     if (simManager_ == nullptr) {
2071         TELEPHONY_LOGE("simManager_ is null!");
2072         return u"";
2073     }
2074     return simManager_->GetSimTeleNumberIdentifier(slotId);
2075 }
2076 
GetVoiceMailIdentifier(int32_t slotId,std::u16string & voiceMailIdentifier)2077 int32_t CoreManagerInner::GetVoiceMailIdentifier(int32_t slotId, std::u16string &voiceMailIdentifier)
2078 {
2079     if (simManager_ == nullptr) {
2080         TELEPHONY_LOGE("simManager_ is null!");
2081         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2082     }
2083     return simManager_->GetVoiceMailIdentifier(slotId, voiceMailIdentifier);
2084 }
2085 
GetVoiceMailNumber(int32_t slotId,std::u16string & voiceMailNumber)2086 int32_t CoreManagerInner::GetVoiceMailNumber(int32_t slotId, std::u16string &voiceMailNumber)
2087 {
2088     if (simManager_ == nullptr) {
2089         TELEPHONY_LOGE("simManager_ is null!");
2090         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2091     }
2092     return simManager_->GetVoiceMailNumber(slotId, voiceMailNumber);
2093 }
2094 
GetVoiceMailCount(int32_t slotId,int32_t & voiceMailCount)2095 int32_t CoreManagerInner::GetVoiceMailCount(int32_t slotId, int32_t &voiceMailCount)
2096 {
2097     if (simManager_ == nullptr) {
2098         TELEPHONY_LOGE("simManager_ is null!");
2099         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2100     }
2101     return simManager_->GetVoiceMailCount(slotId, voiceMailCount);
2102 }
2103 
SetVoiceMailCount(int32_t slotId,int32_t voiceMailCount)2104 int32_t CoreManagerInner::SetVoiceMailCount(int32_t slotId, int32_t voiceMailCount)
2105 {
2106     if (simManager_ == nullptr) {
2107         TELEPHONY_LOGE("simManager_ is null!");
2108         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2109     }
2110     return simManager_->SetVoiceMailCount(slotId, voiceMailCount);
2111 }
2112 
SetVoiceCallForwarding(int32_t slotId,bool enable,const std::string & number)2113 int32_t CoreManagerInner::SetVoiceCallForwarding(int32_t slotId, bool enable, const std::string &number)
2114 {
2115     if (simManager_ == nullptr) {
2116         TELEPHONY_LOGE("simManager_ is null!");
2117         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2118     }
2119     return simManager_->SetVoiceCallForwarding(slotId, enable, number);
2120 }
2121 
HasSimCard(int32_t slotId,bool & hasSimCard)2122 int32_t CoreManagerInner::HasSimCard(int32_t slotId, bool &hasSimCard)
2123 {
2124     if (simManager_ == nullptr) {
2125         TELEPHONY_LOGE("simManager_ is null!");
2126         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2127     }
2128     return simManager_->HasSimCard(slotId, hasSimCard);
2129 }
2130 
GetSimState(int32_t slotId,SimState & simState)2131 int32_t CoreManagerInner::GetSimState(int32_t slotId, SimState &simState)
2132 {
2133     if (simManager_ == nullptr) {
2134         TELEPHONY_LOGE("simManager_ is null!");
2135         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2136     }
2137     return simManager_->GetSimState(slotId, simState);
2138 }
2139 
GetCardType(int32_t slotId,CardType & cardType)2140 int32_t CoreManagerInner::GetCardType(int32_t slotId, CardType &cardType)
2141 {
2142     if (simManager_ == nullptr) {
2143         TELEPHONY_LOGE("simManager_ is null!");
2144         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2145     }
2146     return simManager_->GetCardType(slotId, cardType);
2147 }
2148 
UnlockPin(int32_t slotId,const std::string & pin,LockStatusResponse & response)2149 int32_t CoreManagerInner::UnlockPin(int32_t slotId, const std::string &pin, LockStatusResponse &response)
2150 {
2151     if (simManager_ == nullptr) {
2152         TELEPHONY_LOGE("simManager_ is null!");
2153         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2154     }
2155     return simManager_->UnlockPin(slotId, pin, response);
2156 }
2157 
UnlockPuk(int32_t slotId,const std::string & newPin,const std::string & puk,LockStatusResponse & response)2158 int32_t CoreManagerInner::UnlockPuk(
2159     int32_t slotId, const std::string &newPin, const std::string &puk, LockStatusResponse &response)
2160 {
2161     if (simManager_ == nullptr) {
2162         TELEPHONY_LOGE("simManager_ is null!");
2163         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2164     }
2165     return simManager_->UnlockPuk(slotId, newPin, puk, response);
2166 }
2167 
AlterPin(int32_t slotId,const std::string & newPin,const std::string & oldPin,LockStatusResponse & response)2168 int32_t CoreManagerInner::AlterPin(
2169     int32_t slotId, const std::string &newPin, const std::string &oldPin, LockStatusResponse &response)
2170 {
2171     if (simManager_ == nullptr) {
2172         TELEPHONY_LOGE("simManager_ is null!");
2173         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2174     }
2175     return simManager_->AlterPin(slotId, newPin, oldPin, response);
2176 }
2177 
SetLockState(int32_t slotId,const LockInfo & options,LockStatusResponse & response)2178 int32_t CoreManagerInner::SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response)
2179 {
2180     if (simManager_ == nullptr) {
2181         TELEPHONY_LOGE("simManager_ is null!");
2182         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2183     }
2184     return simManager_->SetLockState(slotId, options, response);
2185 }
2186 
GetLockState(int32_t slotId,LockType lockType,LockState & lockState)2187 int32_t CoreManagerInner::GetLockState(int32_t slotId, LockType lockType, LockState &lockState)
2188 {
2189     if (simManager_ == nullptr) {
2190         TELEPHONY_LOGE("simManager_ is null!");
2191         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2192     }
2193     return simManager_->GetLockState(slotId, lockType, lockState);
2194 }
2195 
RefreshSimState(int32_t slotId)2196 int32_t CoreManagerInner::RefreshSimState(int32_t slotId)
2197 {
2198     if (simManager_ == nullptr) {
2199         TELEPHONY_LOGE("simManager_ is null!");
2200         return false;
2201     }
2202     return simManager_->RefreshSimState(slotId);
2203 }
2204 
UnlockPin2(int32_t slotId,const std::string & pin2,LockStatusResponse & response)2205 int32_t CoreManagerInner::UnlockPin2(int32_t slotId, const std::string &pin2, LockStatusResponse &response)
2206 {
2207     if (simManager_ == nullptr) {
2208         TELEPHONY_LOGE("simManager_ is null!");
2209         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2210     }
2211     return simManager_->UnlockPin2(slotId, pin2, response);
2212 }
2213 
UnlockPuk2(int32_t slotId,const std::string & newPin2,const std::string & puk2,LockStatusResponse & response)2214 int32_t CoreManagerInner::UnlockPuk2(
2215     int32_t slotId, const std::string &newPin2, const std::string &puk2, LockStatusResponse &response)
2216 {
2217     if (simManager_ == nullptr) {
2218         TELEPHONY_LOGE("simManager_ is null!");
2219         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2220     }
2221     return simManager_->UnlockPuk2(slotId, newPin2, puk2, response);
2222 }
2223 
AlterPin2(int32_t slotId,const std::string & newPin2,const std::string & oldPin2,LockStatusResponse & response)2224 int32_t CoreManagerInner::AlterPin2(
2225     int32_t slotId, const std::string &newPin2, const std::string &oldPin2, LockStatusResponse &response)
2226 {
2227     if (simManager_ == nullptr) {
2228         TELEPHONY_LOGE("simManager_ is null!");
2229         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2230     }
2231     return simManager_->AlterPin2(slotId, newPin2, oldPin2, response);
2232 }
2233 
SendEnvelopeCmd(int32_t slotId,const std::string & cmd)2234 int32_t CoreManagerInner::SendEnvelopeCmd(int32_t slotId, const std::string &cmd)
2235 {
2236     if (simManager_ == nullptr) {
2237         TELEPHONY_LOGE("simManager_ is null!");
2238         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2239     }
2240     return simManager_->SendEnvelopeCmd(slotId, cmd);
2241 }
2242 
SendTerminalResponseCmd(int32_t slotId,const std::string & cmd)2243 int32_t CoreManagerInner::SendTerminalResponseCmd(int32_t slotId, const std::string &cmd)
2244 {
2245     if (simManager_ == nullptr) {
2246         TELEPHONY_LOGE("simManager_ is null!");
2247         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2248     }
2249     return simManager_->SendTerminalResponseCmd(slotId, cmd);
2250 }
2251 
SendCallSetupRequestResult(int32_t slotId,bool accept)2252 int32_t CoreManagerInner::SendCallSetupRequestResult(int32_t slotId, bool accept)
2253 {
2254     if (simManager_ == nullptr) {
2255         TELEPHONY_LOGE("simManager_ is null!");
2256         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2257     }
2258     return simManager_->SendCallSetupRequestResult(slotId, accept);
2259 }
2260 
UnlockSimLock(int32_t slotId,const PersoLockInfo & lockInfo,LockStatusResponse & response)2261 int32_t CoreManagerInner::UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response)
2262 {
2263     if (simManager_ == nullptr) {
2264         TELEPHONY_LOGE("simManager_ is null!");
2265         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2266     }
2267     return simManager_->UnlockSimLock(slotId, lockInfo, response);
2268 }
2269 
HasOperatorPrivileges(const int32_t slotId,bool & hasOperatorPrivileges)2270 int32_t CoreManagerInner::HasOperatorPrivileges(const int32_t slotId, bool &hasOperatorPrivileges)
2271 {
2272     TELEPHONY_LOGI("CoreManagerInner::HasOperatorPrivileges slotId:%{public}d", slotId);
2273     if (simManager_ == nullptr) {
2274         TELEPHONY_LOGE("simManager_ can not be null!");
2275         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2276     }
2277     return simManager_->HasOperatorPrivileges(slotId, hasOperatorPrivileges);
2278 }
2279 
GetSimIst(int32_t slotId)2280 std::u16string CoreManagerInner::GetSimIst(int32_t slotId)
2281 {
2282     if (simManager_ == nullptr) {
2283         TELEPHONY_LOGE("simManager_ is null!");
2284         return u"";
2285     }
2286     return simManager_->GetSimIst(slotId);
2287 }
2288 
SaveImsSwitch(int32_t slotId,int32_t imsSwitchValue)2289 int32_t CoreManagerInner::SaveImsSwitch(int32_t slotId, int32_t imsSwitchValue)
2290 {
2291     if (simManager_ == nullptr) {
2292         TELEPHONY_LOGE("simManager_ is null!");
2293         return TELEPHONY_ERROR;
2294     }
2295     return simManager_->SaveImsSwitch(slotId, imsSwitchValue);
2296 }
2297 
QueryImsSwitch(int32_t slotId,int32_t & imsSwitchValue)2298 int32_t CoreManagerInner::QueryImsSwitch(int32_t slotId, int32_t &imsSwitchValue)
2299 {
2300     if (simManager_ == nullptr) {
2301         TELEPHONY_LOGE("simManager_ is null!");
2302         return TELEPHONY_ERROR;
2303     }
2304     return simManager_->QueryImsSwitch(slotId, imsSwitchValue);
2305 }
2306 
IsCTSimCard(int32_t slotId,bool & isCTSimCard)2307 int32_t CoreManagerInner::IsCTSimCard(int32_t slotId, bool &isCTSimCard)
2308 {
2309     if (simManager_ == nullptr) {
2310         TELEPHONY_LOGE("simManager_ is null!");
2311         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2312     }
2313     return simManager_->IsCTSimCard(slotId, isCTSimCard);
2314 }
2315 /******************** simManager_ end ************************/
2316 } // namespace Telephony
2317 } // namespace OHOS
2318