• 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 
InitExtraModule(int32_t slotId)66 int32_t CoreManagerInner::InitExtraModule(int32_t slotId)
67 {
68     TELEPHONY_LOGI("InitExtraModule, slotId: %{public}d", slotId);
69     if (isInitExtraObj_) {
70         TELEPHONY_LOGE("InitExtraModule, has been inited, return!");
71         return TELEPHONY_SUCCESS;
72     }
73     if (SIM_SLOT_COUNT != DUAL_SLOT_COUNT) {
74         TELEPHONY_LOGE("InitExtraModule, can not been inited because of slot number, return!");
75         return TELEPHONY_ERROR;
76     }
77     if (telRilManager_ == nullptr || simManager_ == nullptr || networkSearchManager_ == nullptr) {
78         TELEPHONY_LOGE("InitExtraModule, can not been inited because of nullptr, return!");
79         return TELEPHONY_ERROR;
80     }
81     int resultCode = TELEPHONY_SUCCESS;
82     // Step1. Init ril object.
83     if (telRilManager_ != nullptr) {
84         resultCode = telRilManager_->InitTelExtraModule(slotId);
85     }
86     TELEPHONY_LOGI("InitExtraModule, resultCode of ril: %{public}d", resultCode);
87     if (resultCode != TELEPHONY_SUCCESS) {
88         return TELEPHONY_ERROR;
89     }
90     // Step2. Init sim object.
91     if (simManager_ != nullptr) {
92         resultCode = simManager_->InitTelExtraModule(slotId);
93     }
94     TELEPHONY_LOGI("InitExtraModule, resultCode of sim: %{public}d", resultCode);
95     if (resultCode != TELEPHONY_SUCCESS) {
96         return TELEPHONY_ERROR;
97     }
98     // Step3. Init network search object.
99     if (networkSearchManager_ != nullptr) {
100         resultCode = networkSearchManager_->InitTelExtraModule(slotId);
101         networkSearchManager_->InitAirplaneMode(slotId);
102     }
103     TELEPHONY_LOGI("InitExtraModule, resultCode of network: %{public}d", resultCode);
104     if (resultCode != TELEPHONY_SUCCESS) {
105         return TELEPHONY_ERROR;
106     }
107     // only success set mark true.
108     isInitExtraObj_ = true;
109     return TELEPHONY_SUCCESS;
110 }
111 
GetDefaultSlotId(void)112 int32_t CoreManagerInner::GetDefaultSlotId(void)
113 {
114     return DEFAULT_SIM_SLOT_ID;
115 }
116 
GetMaxSimCount(void)117 int32_t CoreManagerInner::GetMaxSimCount(void)
118 {
119     return SIM_SLOT_COUNT;
120 }
121 
RegisterCoreNotify(int32_t slotId,const std::shared_ptr<AppExecFwk::EventHandler> & handler,int what,int32_t * obj)122 int32_t CoreManagerInner::RegisterCoreNotify(
123     int32_t slotId, const std::shared_ptr<AppExecFwk::EventHandler> &handler, int what, int32_t *obj)
124 {
125     if (what >= RadioEvent::RADIO_PS_CONNECTION_ATTACHED && what <= RadioEvent::RADIO_FACTORY_RESET) {
126         if (networkSearchManager_ == nullptr) {
127             TELEPHONY_LOGE("networkSearchManager is null!");
128             return TELEPHONY_ERR_LOCAL_PTR_NULL;
129         }
130         networkSearchManager_->RegisterCoreNotify(slotId, handler, what);
131     } else if ((what >= RadioEvent::RADIO_SIM_STATE_CHANGE) && (what <= RadioEvent::RADIO_SIM_ACCOUNT_LOADED)) {
132         if (simManager_ == nullptr) {
133             TELEPHONY_LOGE("simManager_ is null");
134             return TELEPHONY_ERR_LOCAL_PTR_NULL;
135         }
136         simManager_->RegisterCoreNotify(slotId, handler, what);
137     } else {
138         if (telRilManager_ == nullptr) {
139             TELEPHONY_LOGE("telRilManager is null!");
140             return TELEPHONY_ERR_LOCAL_PTR_NULL;
141         }
142         return telRilManager_->RegisterCoreNotify(slotId, handler, what, obj);
143     }
144     return TELEPHONY_SUCCESS;
145 }
146 
UnRegisterCoreNotify(int32_t slotId,const std::shared_ptr<AppExecFwk::EventHandler> & observerCallBack,int what)147 int32_t CoreManagerInner::UnRegisterCoreNotify(
148     int32_t slotId, const std::shared_ptr<AppExecFwk::EventHandler> &observerCallBack, int what)
149 {
150     if (what >= RadioEvent::RADIO_PS_CONNECTION_ATTACHED && what <= RadioEvent::RADIO_EMERGENCY_STATE_CLOSE) {
151         if (networkSearchManager_ == nullptr) {
152             TELEPHONY_LOGE("networkSearchManager is null!");
153             return TELEPHONY_ERR_LOCAL_PTR_NULL;
154         }
155         networkSearchManager_->UnRegisterCoreNotify(slotId, observerCallBack, what);
156     } else if (what >= RadioEvent::RADIO_SIM_STATE_CHANGE && what <= RadioEvent::RADIO_SIM_RECORDS_LOADED) {
157         if (simManager_ == nullptr) {
158             TELEPHONY_LOGE("simManager_ is null");
159             return TELEPHONY_ERR_LOCAL_PTR_NULL;
160         }
161         simManager_->UnRegisterCoreNotify(slotId, observerCallBack, what);
162     } else {
163         if (telRilManager_ == nullptr) {
164             TELEPHONY_LOGE("telRilManager is null!");
165             return TELEPHONY_ERR_LOCAL_PTR_NULL;
166         }
167         return telRilManager_->UnRegisterCoreNotify(slotId, observerCallBack, what);
168     }
169     return TELEPHONY_SUCCESS;
170 }
171 
RegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> & callback)172 void CoreManagerInner::RegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> &callback)
173 {
174     if (networkSearchManager_ == nullptr) {
175         TELEPHONY_LOGE("networkSearchManager is null!");
176         return;
177     }
178     networkSearchManager_->RegisterCellularDataObject(callback);
179 }
180 
UnRegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> & callback)181 void CoreManagerInner::UnRegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> &callback)
182 {
183     if (networkSearchManager_ == nullptr) {
184         TELEPHONY_LOGE("networkSearchManager is null!");
185         return;
186     }
187     networkSearchManager_->UnRegisterCellularDataObject(callback);
188 }
189 
RegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> & callback)190 void CoreManagerInner::RegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> &callback)
191 {
192     if (networkSearchManager_ == nullptr) {
193         TELEPHONY_LOGE("networkSearchManager is null!");
194         return;
195     }
196     networkSearchManager_->RegisterCellularCallObject(callback);
197 }
198 
UnRegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> & callback)199 void CoreManagerInner::UnRegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> &callback)
200 {
201     if (networkSearchManager_ == nullptr) {
202         TELEPHONY_LOGE("networkSearchManager is null!");
203         return;
204     }
205     networkSearchManager_->UnRegisterCellularCallObject(callback);
206 }
207 
RegisterSimAccountCallback(const int32_t tokenId,const sptr<SimAccountCallback> & callback)208 int32_t CoreManagerInner::RegisterSimAccountCallback(
209     const int32_t tokenId, const sptr<SimAccountCallback> &callback)
210 {
211     if (simManager_ == nullptr) {
212         TELEPHONY_LOGE("simManager_ is null");
213         return TELEPHONY_ERR_LOCAL_PTR_NULL;
214     }
215     return simManager_->RegisterSimAccountCallback(tokenId, callback);
216 }
217 
UnregisterSimAccountCallback(const sptr<SimAccountCallback> & callback)218 int32_t CoreManagerInner::UnregisterSimAccountCallback(const sptr<SimAccountCallback> &callback)
219 {
220     if (simManager_ == nullptr) {
221         TELEPHONY_LOGE("simManager_ is null");
222         return TELEPHONY_ERR_LOCAL_PTR_NULL;
223     }
224     return simManager_->UnregisterSimAccountCallback(callback);
225 }
226 
227 /******************** telRilManager start *******************/
SetUssd(int32_t slotId,int32_t eventId,const std::string str,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const228 int32_t CoreManagerInner::SetUssd(int32_t slotId, int32_t eventId, const std::string str,
229     const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
230 {
231     if (telRilManager_ == nullptr) {
232         TELEPHONY_LOGE("set ussd telRilManager is null!");
233         return TELEPHONY_ERR_LOCAL_PTR_NULL;
234     }
235     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
236     if (response == nullptr) {
237         TELEPHONY_LOGE("set ussd response is null!");
238         return TELEPHONY_ERR_LOCAL_PTR_NULL;
239     }
240     response->SetOwner(handler);
241     return telRilManager_->SetUssd(slotId, str, response);
242 }
243 
CloseUnFinishedUssd(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const244 int32_t CoreManagerInner::CloseUnFinishedUssd(
245     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
246 {
247     if (telRilManager_ == nullptr) {
248         TELEPHONY_LOGE("close unfinished ussd telRilManager is null!");
249         return TELEPHONY_ERR_LOCAL_PTR_NULL;
250     }
251     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
252     if (response == nullptr) {
253         TELEPHONY_LOGE("close unfinished ussd response is null!");
254         return TELEPHONY_ERR_LOCAL_PTR_NULL;
255     }
256     response->SetOwner(handler);
257     return telRilManager_->CloseUnFinishedUssd(slotId, response);
258 }
259 
GetUssd(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const260 int32_t CoreManagerInner::GetUssd(
261     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
262 {
263     if (telRilManager_ == nullptr) {
264         TELEPHONY_LOGE("get ussd telRilManager is null!");
265         return TELEPHONY_ERR_LOCAL_PTR_NULL;
266     }
267     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
268     if (response == nullptr) {
269         TELEPHONY_LOGE("get ussd response is null!");
270         return TELEPHONY_ERR_LOCAL_PTR_NULL;
271     }
272     response->SetOwner(handler);
273     return telRilManager_->GetUssd(slotId, response);
274 }
275 
GetMute(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const276 int32_t CoreManagerInner::GetMute(
277     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
278 {
279     if (telRilManager_ == nullptr) {
280         TELEPHONY_LOGE("get mute telRilManager is null!");
281         return TELEPHONY_ERR_LOCAL_PTR_NULL;
282     }
283     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
284     if (response == nullptr) {
285         TELEPHONY_LOGE("get mute response is null!");
286         return TELEPHONY_ERR_LOCAL_PTR_NULL;
287     }
288     response->SetOwner(handler);
289     return telRilManager_->GetMute(slotId, response);
290 }
291 
SetMute(int32_t slotId,int32_t eventId,int32_t mute,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const292 int32_t CoreManagerInner::SetMute(
293     int32_t slotId, int32_t eventId, int32_t mute, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
294 {
295     if (telRilManager_ == nullptr) {
296         TELEPHONY_LOGE("set mute telRilManager is null!");
297         return TELEPHONY_ERR_LOCAL_PTR_NULL;
298     }
299     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
300     if (response == nullptr) {
301         TELEPHONY_LOGE("set mute response is null!");
302         return TELEPHONY_ERR_LOCAL_PTR_NULL;
303     }
304     response->SetOwner(handler);
305     return telRilManager_->SetMute(slotId, mute, response);
306 }
307 
GetEmergencyCallList(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const308 int32_t CoreManagerInner::GetEmergencyCallList(
309     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
310 {
311     if (telRilManager_ == nullptr) {
312         TELEPHONY_LOGE("get emergency call list telRilManager is null!");
313         return TELEPHONY_ERR_LOCAL_PTR_NULL;
314     }
315     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
316     if (response == nullptr) {
317         TELEPHONY_LOGE("get emergency call list response is null!");
318         return TELEPHONY_ERR_LOCAL_PTR_NULL;
319     }
320     response->SetOwner(handler);
321     return telRilManager_->GetEmergencyCallList(slotId, response);
322 }
323 
SetEmergencyCallList(int32_t slotId,int32_t eventId,std::vector<EmergencyCall> & eccVec,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const324 int32_t CoreManagerInner::SetEmergencyCallList(int32_t slotId, int32_t eventId, std::vector<EmergencyCall> &eccVec,
325     const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
326 {
327     TELEPHONY_LOGI("SetEmergencyCallList start");
328     if (telRilManager_ == nullptr) {
329         TELEPHONY_LOGE("set emergency call list telRilManager is null!");
330         return TELEPHONY_ERR_LOCAL_PTR_NULL;
331     }
332     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
333     if (response == nullptr) {
334         TELEPHONY_LOGE("set emergency call list response is null!");
335         return TELEPHONY_ERR_LOCAL_PTR_NULL;
336     }
337     response->SetOwner(handler);
338     return telRilManager_->SetEmergencyCallList(slotId, eccVec, response);
339 }
340 
GetCallFailReason(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const341 int32_t CoreManagerInner::GetCallFailReason(
342     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
343 {
344     if (telRilManager_ == nullptr) {
345         TELEPHONY_LOGE("get call fail reason telRilManager is null!");
346         return TELEPHONY_ERR_LOCAL_PTR_NULL;
347     }
348     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
349     if (response == nullptr) {
350         TELEPHONY_LOGE("get call fail reason response is null!");
351         return TELEPHONY_ERR_LOCAL_PTR_NULL;
352     }
353     response->SetOwner(handler);
354     return telRilManager_->GetCallFailReason(slotId, response);
355 }
356 
SetCallPreferenceMode(int32_t slotId,int32_t eventId,int32_t mode,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const357 int32_t CoreManagerInner::SetCallPreferenceMode(
358     int32_t slotId, int32_t eventId, int32_t mode, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
359 {
360     if (telRilManager_ == nullptr) {
361         TELEPHONY_LOGE("set call preference mode telRilManager is null!");
362         return TELEPHONY_ERR_LOCAL_PTR_NULL;
363     }
364     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
365     if (response == nullptr) {
366         TELEPHONY_LOGE("set call preference mode response is null!");
367         return TELEPHONY_ERR_LOCAL_PTR_NULL;
368     }
369     response->SetOwner(handler);
370     return telRilManager_->SetCallPreferenceMode(slotId, mode, response);
371 }
372 
GetCallPreferenceMode(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const373 int32_t CoreManagerInner::GetCallPreferenceMode(
374     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
375 {
376     if (telRilManager_ == nullptr) {
377         TELEPHONY_LOGE("get call preference mode telRilManager is null!");
378         return TELEPHONY_ERR_LOCAL_PTR_NULL;
379     }
380     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
381     if (response == nullptr) {
382         TELEPHONY_LOGE("get call preference mode response is null!");
383         return TELEPHONY_ERR_LOCAL_PTR_NULL;
384     }
385     response->SetOwner(handler);
386     return telRilManager_->GetCallPreferenceMode(slotId, response);
387 }
388 
SetPreferredNetworkPara(int32_t slotId,int32_t eventId,int32_t preferredNetworkType,const std::shared_ptr<AppExecFwk::EventHandler> & handler)389 int32_t CoreManagerInner::SetPreferredNetworkPara(int32_t slotId, int32_t eventId, int32_t preferredNetworkType,
390     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
391 {
392     if (telRilManager_ == nullptr) {
393         TELEPHONY_LOGE("set preferred network telRilManager is null!");
394         return TELEPHONY_ERR_LOCAL_PTR_NULL;
395     }
396     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
397     if (response == nullptr) {
398         TELEPHONY_LOGE("set preferred network response is null!");
399         return TELEPHONY_ERR_LOCAL_PTR_NULL;
400     }
401     response->SetOwner(handler);
402     return telRilManager_->SetPreferredNetwork(slotId, preferredNetworkType, response);
403 }
404 
GetPreferredNetworkPara(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)405 int32_t CoreManagerInner::GetPreferredNetworkPara(
406     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
407 {
408     if (telRilManager_ == nullptr) {
409         TELEPHONY_LOGE("get preferred network telRilManager is null!");
410         return TELEPHONY_ERR_LOCAL_PTR_NULL;
411     }
412     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
413     if (response == nullptr) {
414         TELEPHONY_LOGE("get preferred network response is null!");
415         return TELEPHONY_ERR_LOCAL_PTR_NULL;
416     }
417     response->SetOwner(handler);
418     return telRilManager_->GetPreferredNetwork(slotId, response);
419 }
420 
GetOperatorInfo(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const421 int32_t CoreManagerInner::GetOperatorInfo(
422     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
423 {
424     if (telRilManager_ == nullptr) {
425         TELEPHONY_LOGE("get operator info telRilManager is null!");
426         return TELEPHONY_ERR_LOCAL_PTR_NULL;
427     }
428     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
429     if (response == nullptr) {
430         TELEPHONY_LOGE("get operator info response is null!");
431         return TELEPHONY_ERR_LOCAL_PTR_NULL;
432     }
433     response->SetOwner(handler);
434     return telRilManager_->GetOperatorInfo(slotId, response);
435 }
436 
GetNeighboringCellInfoList(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)437 int32_t CoreManagerInner::GetNeighboringCellInfoList(
438     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
439 {
440     if (telRilManager_ == nullptr) {
441         TELEPHONY_LOGE("get neighboring cell info list telRilManager is null!");
442         return TELEPHONY_ERR_LOCAL_PTR_NULL;
443     }
444     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
445     if (response == nullptr) {
446         TELEPHONY_LOGE("get neighboring cell info list response is null!");
447         return TELEPHONY_ERR_LOCAL_PTR_NULL;
448     }
449     response->SetOwner(handler);
450     return telRilManager_->GetNeighboringCellInfoList(slotId, response);
451 }
452 
GetCurrentCellInfo(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)453 int32_t CoreManagerInner::GetCurrentCellInfo(
454     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
455 {
456     if (telRilManager_ == nullptr) {
457         TELEPHONY_LOGE("get current cell info telRilManager is null!");
458         return TELEPHONY_ERR_LOCAL_PTR_NULL;
459     }
460     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
461     if (response == nullptr) {
462         TELEPHONY_LOGE("get current cell info response is null!");
463         return TELEPHONY_ERR_LOCAL_PTR_NULL;
464     }
465     response->SetOwner(handler);
466     return telRilManager_->GetCurrentCellInfo(slotId, response);
467 }
468 
SendGsmSms(int32_t slotId,int32_t eventId,GsmSimMessageParam & gsmMessage,const std::shared_ptr<AppExecFwk::EventHandler> & handler)469 int32_t CoreManagerInner::SendGsmSms(int32_t slotId, int32_t eventId, GsmSimMessageParam &gsmMessage,
470     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
471 {
472     if (telRilManager_ == nullptr) {
473         TELEPHONY_LOGE("send gsm sms telRilManager is null!");
474         return TELEPHONY_ERR_LOCAL_PTR_NULL;
475     }
476     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, gsmMessage.refId);
477     if (response == nullptr) {
478         TELEPHONY_LOGE("send gsm sms response is null!");
479         return TELEPHONY_ERR_LOCAL_PTR_NULL;
480     }
481     response->SetOwner(handler);
482     return telRilManager_->SendGsmSms(slotId, gsmMessage.smscPdu, gsmMessage.pdu, response);
483 }
484 
SendCdmaSms(int32_t slotId,int32_t eventId,std::string pdu,int64_t refId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)485 int32_t CoreManagerInner::SendCdmaSms(int32_t slotId, int32_t eventId, std::string pdu, int64_t refId,
486     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
487 {
488     if (telRilManager_ == nullptr) {
489         TELEPHONY_LOGE("send cdma sms telRilManager is null!");
490         return TELEPHONY_ERR_LOCAL_PTR_NULL;
491     }
492     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, refId);
493     if (response == nullptr) {
494         TELEPHONY_LOGE("send cdma sms response is null!");
495         return TELEPHONY_ERR_LOCAL_PTR_NULL;
496     }
497     response->SetOwner(handler);
498     return telRilManager_->SendCdmaSms(slotId, pdu, response);
499 }
500 
AddSimMessage(int32_t slotId,int32_t eventId,const SimMessageParam & simMessage,const std::shared_ptr<AppExecFwk::EventHandler> & handler)501 int32_t CoreManagerInner::AddSimMessage(int32_t slotId, int32_t eventId, const SimMessageParam &simMessage,
502     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
503 {
504     if (telRilManager_ == nullptr) {
505         TELEPHONY_LOGE("add sim message telRilManager is null!");
506         return TELEPHONY_ERR_LOCAL_PTR_NULL;
507     }
508     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
509     if (response == nullptr) {
510         TELEPHONY_LOGE("add sim message response is null!");
511         return TELEPHONY_ERR_LOCAL_PTR_NULL;
512     }
513     response->SetOwner(handler);
514     return telRilManager_->AddSimMessage(slotId, simMessage, response);
515 }
516 
DelSimMessage(int32_t slotId,int32_t eventId,int32_t gsmIndex,const std::shared_ptr<AppExecFwk::EventHandler> & handler)517 int32_t CoreManagerInner::DelSimMessage(
518     int32_t slotId, int32_t eventId, int32_t gsmIndex, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
519 {
520     if (telRilManager_ == nullptr) {
521         TELEPHONY_LOGE("delete sim message telRilManager is null!");
522         return TELEPHONY_ERR_LOCAL_PTR_NULL;
523     }
524     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
525     if (response == nullptr) {
526         TELEPHONY_LOGE("delete sim message response is null!");
527         return TELEPHONY_ERR_LOCAL_PTR_NULL;
528     }
529     response->SetOwner(handler);
530     return telRilManager_->DelSimMessage(slotId, gsmIndex, response);
531 }
532 
GetSmscAddr(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const533 int32_t CoreManagerInner::GetSmscAddr(
534     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
535 {
536     if (telRilManager_ == nullptr) {
537         TELEPHONY_LOGE("get smsc address telRilManager is null!");
538         return TELEPHONY_ERR_LOCAL_PTR_NULL;
539     }
540     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
541     if (response == nullptr) {
542         TELEPHONY_LOGE("get smsc address response is null!");
543         return TELEPHONY_ERR_LOCAL_PTR_NULL;
544     }
545     response->SetOwner(handler);
546     return telRilManager_->GetSmscAddr(slotId, response);
547 }
548 
SetSmscAddr(int32_t slotId,int32_t eventId,int32_t tosca,std::string address,const std::shared_ptr<AppExecFwk::EventHandler> & handler)549 int32_t CoreManagerInner::SetSmscAddr(int32_t slotId, int32_t eventId, int32_t tosca, std::string address,
550     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
551 {
552     if (telRilManager_ == nullptr) {
553         TELEPHONY_LOGE("set smsc address telRilManager is null!");
554         return TELEPHONY_ERR_LOCAL_PTR_NULL;
555     }
556     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
557     if (response == nullptr) {
558         TELEPHONY_LOGE("set smsc address response is null!");
559         return TELEPHONY_ERR_LOCAL_PTR_NULL;
560     }
561     response->SetOwner(handler);
562     return telRilManager_->SetSmscAddr(slotId, tosca, address, response);
563 }
564 
SetCBConfig(int32_t slotId,int32_t eventId,const CBConfigParam & cbConfig,const std::shared_ptr<AppExecFwk::EventHandler> & handler)565 int32_t CoreManagerInner::SetCBConfig(int32_t slotId, int32_t eventId, const CBConfigParam &cbConfig,
566     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
567 {
568     if (telRilManager_ == nullptr) {
569         TELEPHONY_LOGE("set CB config telRilManager is null!");
570         return TELEPHONY_ERR_LOCAL_PTR_NULL;
571     }
572     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
573     if (response == nullptr) {
574         TELEPHONY_LOGE("set CB config response is null!");
575         return TELEPHONY_ERR_LOCAL_PTR_NULL;
576     }
577     response->SetOwner(handler);
578     return telRilManager_->SetCBConfig(slotId, cbConfig, response);
579 }
580 
SetCdmaCBConfig(int32_t slotId,int32_t eventId,CdmaCBConfigInfoList & cdmaCBConfigInfoList,const std::shared_ptr<AppExecFwk::EventHandler> & handler)581 int32_t CoreManagerInner::SetCdmaCBConfig(int32_t slotId, int32_t eventId, CdmaCBConfigInfoList &cdmaCBConfigInfoList,
582     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
583 {
584     if (telRilManager_ == nullptr) {
585         TELEPHONY_LOGE("set cdma CB config telRilManager is null!");
586         return TELEPHONY_ERR_LOCAL_PTR_NULL;
587     }
588     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
589     if (response == nullptr) {
590         TELEPHONY_LOGE("set cdma CB config response is null!");
591         return TELEPHONY_ERR_LOCAL_PTR_NULL;
592     }
593     response->SetOwner(handler);
594     return telRilManager_->SetCdmaCBConfig(slotId, cdmaCBConfigInfoList, response);
595 }
596 
GetCBConfig(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)597 int32_t CoreManagerInner::GetCBConfig(
598     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
599 {
600     if (telRilManager_ == nullptr) {
601         TELEPHONY_LOGE("get CB config telRilManager is null!");
602         return TELEPHONY_ERR_LOCAL_PTR_NULL;
603     }
604     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
605     if (response == nullptr) {
606         TELEPHONY_LOGE("get CB config response is null!");
607         return TELEPHONY_ERR_LOCAL_PTR_NULL;
608     }
609     response->SetOwner(handler);
610     return telRilManager_->GetCBConfig(slotId, response);
611 }
612 
GetCdmaCBConfig(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)613 int32_t CoreManagerInner::GetCdmaCBConfig(
614     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
615 {
616     if (telRilManager_ == nullptr) {
617         TELEPHONY_LOGE("get cdma CB config telRilManager is null!");
618         return TELEPHONY_ERR_LOCAL_PTR_NULL;
619     }
620     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
621     if (response == nullptr) {
622         TELEPHONY_LOGE("get cdma CB config response is null!");
623         return TELEPHONY_ERR_LOCAL_PTR_NULL;
624     }
625     response->SetOwner(handler);
626     return telRilManager_->GetCdmaCBConfig(slotId, response);
627 }
628 
SendSmsMoreMode(int32_t slotId,int32_t eventId,GsmSimMessageParam & gsmMessage,const std::shared_ptr<AppExecFwk::EventHandler> & handler)629 int32_t CoreManagerInner::SendSmsMoreMode(int32_t slotId, int32_t eventId, GsmSimMessageParam &gsmMessage,
630     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
631 {
632     if (telRilManager_ == nullptr) {
633         TELEPHONY_LOGE("send sms more mode telRilManager is null!");
634         return TELEPHONY_ERR_LOCAL_PTR_NULL;
635     }
636     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, gsmMessage.refId);
637     if (response == nullptr) {
638         TELEPHONY_LOGE("send sms more mode response is null!");
639         return TELEPHONY_ERR_LOCAL_PTR_NULL;
640     }
641     response->SetOwner(handler);
642     return telRilManager_->SendSmsMoreMode(slotId, gsmMessage.smscPdu, gsmMessage.pdu, response);
643 }
644 
SendSmsAck(int32_t slotId,int32_t eventId,bool success,int32_t cause,const std::shared_ptr<AppExecFwk::EventHandler> & handler)645 int32_t CoreManagerInner::SendSmsAck(int32_t slotId, int32_t eventId, bool success, int32_t cause,
646     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
647 {
648     if (telRilManager_ == nullptr) {
649         TELEPHONY_LOGE("send sms ack telRilManager is null!");
650         return TELEPHONY_ERR_LOCAL_PTR_NULL;
651     }
652     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
653     if (response == nullptr) {
654         TELEPHONY_LOGE("send sms ack response is null!");
655         return TELEPHONY_ERR_LOCAL_PTR_NULL;
656     }
657     response->SetOwner(handler);
658     return telRilManager_->SendSmsAck(slotId, success, cause, response);
659 }
660 
AddCdmaSimMessage(int32_t slotId,int32_t eventId,int32_t status,std::string pdu,const std::shared_ptr<AppExecFwk::EventHandler> & handler)661 int32_t CoreManagerInner::AddCdmaSimMessage(int32_t slotId, int32_t eventId, int32_t status, std::string pdu,
662     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
663 {
664     if (telRilManager_ == nullptr) {
665         TELEPHONY_LOGE("add cdma sim message telRilManager is null!");
666         return TELEPHONY_ERR_LOCAL_PTR_NULL;
667     }
668     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
669     if (response == nullptr) {
670         TELEPHONY_LOGE("add cdma sim message response is null!");
671         return TELEPHONY_ERR_LOCAL_PTR_NULL;
672     }
673     response->SetOwner(handler);
674     return telRilManager_->AddCdmaSimMessage(slotId, status, pdu, response);
675 }
676 
DelCdmaSimMessage(int32_t slotId,int32_t eventId,int32_t cdmaIndex,const std::shared_ptr<AppExecFwk::EventHandler> & handler)677 int32_t CoreManagerInner::DelCdmaSimMessage(
678     int32_t slotId, int32_t eventId, int32_t cdmaIndex, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
679 {
680     if (telRilManager_ == nullptr) {
681         TELEPHONY_LOGE("delete cdma sim message telRilManager is null!");
682         return TELEPHONY_ERR_LOCAL_PTR_NULL;
683     }
684     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
685     if (response == nullptr) {
686         TELEPHONY_LOGE("delete cdma sim message response is null!");
687         return TELEPHONY_ERR_LOCAL_PTR_NULL;
688     }
689     response->SetOwner(handler);
690     return telRilManager_->DelCdmaSimMessage(slotId, cdmaIndex, response);
691 }
692 
UpdateCdmaSimMessage(int32_t slotId,int32_t eventId,const CdmaSimMessageParam & cdmaSimMsg,const std::shared_ptr<AppExecFwk::EventHandler> & handler)693 int32_t CoreManagerInner::UpdateCdmaSimMessage(int32_t slotId, int32_t eventId, const CdmaSimMessageParam &cdmaSimMsg,
694     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
695 {
696     if (telRilManager_ == nullptr) {
697         TELEPHONY_LOGE("update cdma sim message telRilManager is null!");
698         return TELEPHONY_ERR_LOCAL_PTR_NULL;
699     }
700     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
701     if (response == nullptr) {
702         TELEPHONY_LOGE("update cdma sim message response is null!");
703         return TELEPHONY_ERR_LOCAL_PTR_NULL;
704     }
705     response->SetOwner(handler);
706     return telRilManager_->UpdateCdmaSimMessage(slotId, cdmaSimMsg, response);
707 }
708 
GetNetworkSearchInformation(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const709 int32_t CoreManagerInner::GetNetworkSearchInformation(
710     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
711 {
712     if (telRilManager_ == nullptr) {
713         TELEPHONY_LOGE("get network search information telRilManager is null!");
714         return TELEPHONY_ERR_LOCAL_PTR_NULL;
715     }
716     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
717     if (response == nullptr) {
718         TELEPHONY_LOGE("get network search information response is null!");
719         return TELEPHONY_ERR_LOCAL_PTR_NULL;
720     }
721     response->SetOwner(handler);
722     return telRilManager_->GetNetworkSearchInformation(slotId, response);
723 }
724 
GetNetworkSelectionMode(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const725 int32_t CoreManagerInner::GetNetworkSelectionMode(
726     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
727 {
728     if (telRilManager_ == nullptr) {
729         TELEPHONY_LOGE("get network selection mode telRilManager is null!");
730         return TELEPHONY_ERR_LOCAL_PTR_NULL;
731     }
732     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
733     if (response == nullptr) {
734         TELEPHONY_LOGE("get network selection mode response is null!");
735         return TELEPHONY_ERR_LOCAL_PTR_NULL;
736     }
737     response->SetOwner(handler);
738     return telRilManager_->GetNetworkSelectionMode(slotId, response);
739 }
740 
SetNetworkSelectionMode(int32_t slotId,int32_t eventId,int32_t automaticFlag,std::string oper,const std::shared_ptr<AppExecFwk::EventHandler> & handler)741 int32_t CoreManagerInner::SetNetworkSelectionMode(int32_t slotId, int32_t eventId, int32_t automaticFlag,
742     std::string oper, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
743 {
744     if (telRilManager_ == nullptr) {
745         TELEPHONY_LOGE("set network selection mode telRilManager is null!");
746         return TELEPHONY_ERR_LOCAL_PTR_NULL;
747     }
748     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
749     if (response == nullptr) {
750         TELEPHONY_LOGE("set network selection mode response is null!");
751         return TELEPHONY_ERR_LOCAL_PTR_NULL;
752     }
753     response->SetOwner(handler);
754     return telRilManager_->SetNetworkSelectionMode(slotId, automaticFlag, oper, response);
755 }
756 
SetRadioState(int32_t slotId,int32_t eventId,int fun,int rst,const std::shared_ptr<AppExecFwk::EventHandler> & handler)757 int32_t CoreManagerInner::SetRadioState(
758     int32_t slotId, int32_t eventId, int fun, int rst, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
759 {
760     if (telRilManager_ == nullptr) {
761         TELEPHONY_LOGE("set radio state telRilManager is null!");
762         return TELEPHONY_ERR_LOCAL_PTR_NULL;
763     }
764     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
765     if (response == nullptr) {
766         TELEPHONY_LOGE("set radio state response is null!");
767         return TELEPHONY_ERR_LOCAL_PTR_NULL;
768     }
769     response->SetOwner(handler);
770     return telRilManager_->SetRadioState(slotId, fun, rst, response);
771 }
772 
GetRadioState(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const773 int32_t CoreManagerInner::GetRadioState(
774     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
775 {
776     if (telRilManager_ == nullptr) {
777         TELEPHONY_LOGE("get radio state telRilManager is null!");
778         return TELEPHONY_ERR_LOCAL_PTR_NULL;
779     }
780     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
781     if (response == nullptr) {
782         TELEPHONY_LOGE("get radio state response is null!");
783         return TELEPHONY_ERR_LOCAL_PTR_NULL;
784     }
785     response->SetOwner(handler);
786     return telRilManager_->GetRadioState(slotId, response);
787 }
788 
ShutDown(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)789 int32_t CoreManagerInner::ShutDown(
790     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
791 {
792     if (telRilManager_ == nullptr) {
793         TELEPHONY_LOGE("shut down telRilManager is null!");
794         return TELEPHONY_ERR_LOCAL_PTR_NULL;
795     }
796     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
797     if (response == nullptr) {
798         TELEPHONY_LOGE("shut down response is null!");
799         return TELEPHONY_ERR_LOCAL_PTR_NULL;
800     }
801     response->SetOwner(handler);
802     return telRilManager_->ShutDown(slotId, response);
803 }
804 
Dial(int32_t slotId,int32_t eventId,std::string address,int clirMode,const std::shared_ptr<AppExecFwk::EventHandler> & handler)805 int32_t CoreManagerInner::Dial(int32_t slotId, int32_t eventId, std::string address, int clirMode,
806     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
807 {
808     if (telRilManager_ == nullptr) {
809         TELEPHONY_LOGE("dial telRilManager is null!");
810         return TELEPHONY_ERR_LOCAL_PTR_NULL;
811     }
812     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
813     if (response == nullptr) {
814         TELEPHONY_LOGE("dial response is null!");
815         return TELEPHONY_ERR_LOCAL_PTR_NULL;
816     }
817     response->SetOwner(handler);
818     return telRilManager_->Dial(slotId, address, clirMode, response);
819 }
820 
Reject(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)821 int32_t CoreManagerInner::Reject(
822     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
823 {
824     if (telRilManager_ == nullptr) {
825         TELEPHONY_LOGE("reject call telRilManager is null!");
826         return TELEPHONY_ERR_LOCAL_PTR_NULL;
827     }
828     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
829     if (response == nullptr) {
830         TELEPHONY_LOGE("reject call response is null!");
831         return TELEPHONY_ERR_LOCAL_PTR_NULL;
832     }
833     response->SetOwner(handler);
834     return telRilManager_->Reject(slotId, response);
835 }
836 
Hangup(int32_t slotId,int32_t eventId,int32_t gsmIndex,const std::shared_ptr<AppExecFwk::EventHandler> & handler)837 int32_t CoreManagerInner::Hangup(
838     int32_t slotId, int32_t eventId, int32_t gsmIndex, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
839 {
840     if (telRilManager_ == nullptr) {
841         TELEPHONY_LOGE("hung up call telRilManager is null!");
842         return TELEPHONY_ERR_LOCAL_PTR_NULL;
843     }
844     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
845     if (response == nullptr) {
846         TELEPHONY_LOGE("hung up call response is null!");
847         return TELEPHONY_ERR_LOCAL_PTR_NULL;
848     }
849     response->SetOwner(handler);
850     return telRilManager_->Hangup(slotId, gsmIndex, response);
851 }
852 
Answer(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)853 int32_t CoreManagerInner::Answer(
854     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
855 {
856     if (telRilManager_ == nullptr) {
857         TELEPHONY_LOGE("answer call telRilManager is null!");
858         return TELEPHONY_ERR_LOCAL_PTR_NULL;
859     }
860     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
861     if (response == nullptr) {
862         TELEPHONY_LOGE("answer call response is null!");
863         return TELEPHONY_ERR_LOCAL_PTR_NULL;
864     }
865     response->SetOwner(handler);
866     return telRilManager_->Answer(slotId, response);
867 }
868 
GetCallList(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const869 int32_t CoreManagerInner::GetCallList(
870     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
871 {
872     if (telRilManager_ == nullptr) {
873         TELEPHONY_LOGE("get call list telRilManager is null!");
874         return TELEPHONY_ERR_LOCAL_PTR_NULL;
875     }
876     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
877     if (response == nullptr) {
878         TELEPHONY_LOGE("get call list response is null!");
879         return TELEPHONY_ERR_LOCAL_PTR_NULL;
880     }
881     response->SetOwner(handler);
882     return telRilManager_->GetCallList(slotId, response);
883 }
884 
HoldCall(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)885 int32_t CoreManagerInner::HoldCall(
886     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
887 {
888     if (telRilManager_ == nullptr) {
889         TELEPHONY_LOGE("hold call telRilManager is null!");
890         return TELEPHONY_ERR_LOCAL_PTR_NULL;
891     }
892     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
893     if (response == nullptr) {
894         TELEPHONY_LOGE("hold call response is null!");
895         return TELEPHONY_ERR_LOCAL_PTR_NULL;
896     }
897     response->SetOwner(handler);
898     return telRilManager_->HoldCall(slotId, response);
899 }
900 
UnHoldCall(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)901 int32_t CoreManagerInner::UnHoldCall(
902     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
903 {
904     if (telRilManager_ == nullptr) {
905         TELEPHONY_LOGE("unhold call telRilManager is null!");
906         return TELEPHONY_ERR_LOCAL_PTR_NULL;
907     }
908     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
909     if (response == nullptr) {
910         TELEPHONY_LOGE("unhold call response is null!");
911         return TELEPHONY_ERR_LOCAL_PTR_NULL;
912     }
913     response->SetOwner(handler);
914     return telRilManager_->UnHoldCall(slotId, response);
915 }
916 
SwitchCall(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)917 int32_t CoreManagerInner::SwitchCall(
918     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
919 {
920     if (telRilManager_ == nullptr) {
921         TELEPHONY_LOGE("switch call telRilManager is null!");
922         return TELEPHONY_ERR_LOCAL_PTR_NULL;
923     }
924     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
925     if (response == nullptr) {
926         TELEPHONY_LOGE("switch call response is null!");
927         return TELEPHONY_ERR_LOCAL_PTR_NULL;
928     }
929     response->SetOwner(handler);
930     return telRilManager_->SwitchCall(slotId, response);
931 }
932 
CombineConference(int32_t slotId,int32_t eventId,int32_t callType,const std::shared_ptr<AppExecFwk::EventHandler> & handler)933 int32_t CoreManagerInner::CombineConference(
934     int32_t slotId, int32_t eventId, int32_t callType, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
935 {
936     if (telRilManager_ == nullptr) {
937         TELEPHONY_LOGE("combine conference telRilManager is null!");
938         return TELEPHONY_ERR_LOCAL_PTR_NULL;
939     }
940     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
941     if (response == nullptr) {
942         TELEPHONY_LOGE("combine conference response is null!");
943         return TELEPHONY_ERR_LOCAL_PTR_NULL;
944     }
945     response->SetOwner(handler);
946     return telRilManager_->CombineConference(slotId, callType, response);
947 }
948 
SeparateConference(int32_t slotId,int32_t eventId,int32_t callIndex,int32_t callType,const std::shared_ptr<AppExecFwk::EventHandler> & handler)949 int32_t CoreManagerInner::SeparateConference(int32_t slotId, int32_t eventId, int32_t callIndex, int32_t callType,
950     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
951 {
952     if (telRilManager_ == nullptr) {
953         TELEPHONY_LOGE("separate conference telRilManager is null!");
954         return TELEPHONY_ERR_LOCAL_PTR_NULL;
955     }
956     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
957     if (response == nullptr) {
958         TELEPHONY_LOGE("separate conference response is null!");
959         return TELEPHONY_ERR_LOCAL_PTR_NULL;
960     }
961     response->SetOwner(handler);
962     return telRilManager_->SeparateConference(slotId, callIndex, callType, response);
963 }
964 
CallSupplement(int32_t slotId,int32_t eventId,int32_t type,const std::shared_ptr<AppExecFwk::EventHandler> & handler)965 int32_t CoreManagerInner::CallSupplement(
966     int32_t slotId, int32_t eventId, int32_t type, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
967 {
968     if (telRilManager_ == nullptr) {
969         TELEPHONY_LOGE("call supplement telRilManager is null!");
970         return TELEPHONY_ERR_LOCAL_PTR_NULL;
971     }
972     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
973     if (response == nullptr) {
974         TELEPHONY_LOGE("call supplement response is null!");
975         return TELEPHONY_ERR_LOCAL_PTR_NULL;
976     }
977     response->SetOwner(handler);
978     return telRilManager_->CallSupplement(slotId, type, response);
979 }
980 
GetClip(int32_t slotId,const AppExecFwk::InnerEvent::Pointer & response) const981 int32_t CoreManagerInner::GetClip(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) const
982 {
983     if (telRilManager_ == nullptr) {
984         TELEPHONY_LOGE("telRilManager is null!");
985         return TELEPHONY_ERR_LOCAL_PTR_NULL;
986     }
987     return telRilManager_->GetClip(slotId, response);
988 }
989 
SetClip(int32_t slotId,int32_t action,const AppExecFwk::InnerEvent::Pointer & response)990 int32_t CoreManagerInner::SetClip(int32_t slotId, int32_t action, const AppExecFwk::InnerEvent::Pointer &response)
991 {
992     if (telRilManager_ == nullptr) {
993         TELEPHONY_LOGE("telRilManager is null!");
994         return TELEPHONY_ERR_LOCAL_PTR_NULL;
995     }
996     return telRilManager_->SetClip(slotId, action, response);
997 }
998 
GetClir(int32_t slotId,const AppExecFwk::InnerEvent::Pointer & response) const999 int32_t CoreManagerInner::GetClir(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) const
1000 {
1001     if (telRilManager_ == nullptr) {
1002         TELEPHONY_LOGE("telRilManager is null!");
1003         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1004     }
1005     return telRilManager_->GetClir(slotId, response);
1006 }
1007 
SetClir(int32_t slotId,int32_t action,const AppExecFwk::InnerEvent::Pointer & response)1008 int32_t CoreManagerInner::SetClir(int32_t slotId, int32_t action, const AppExecFwk::InnerEvent::Pointer &response)
1009 {
1010     if (telRilManager_ == nullptr) {
1011         TELEPHONY_LOGE("telRilManager is null!");
1012         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1013     }
1014     return telRilManager_->SetClir(slotId, action, response);
1015 }
1016 
SetCallWaiting(int32_t slotId,int32_t activate,const AppExecFwk::InnerEvent::Pointer & response)1017 int32_t CoreManagerInner::SetCallWaiting(
1018     int32_t slotId, int32_t activate, const AppExecFwk::InnerEvent::Pointer &response)
1019 {
1020     if (telRilManager_ == nullptr) {
1021         TELEPHONY_LOGE("telRilManager is null!");
1022         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1023     }
1024     return telRilManager_->SetCallWaiting(slotId, activate, response);
1025 }
1026 
SetCallTransferInfo(int32_t slotId,const CallTransferParam & callTransfer,const AppExecFwk::InnerEvent::Pointer & response)1027 int32_t CoreManagerInner::SetCallTransferInfo(
1028     int32_t slotId, const CallTransferParam &callTransfer, const AppExecFwk::InnerEvent::Pointer &response)
1029 {
1030     if (telRilManager_ == nullptr) {
1031         TELEPHONY_LOGE("telRilManager is null!");
1032         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1033     }
1034     return telRilManager_->SetCallTransferInfo(slotId, callTransfer, response);
1035 }
1036 
GetCallTransferInfo(int32_t slotId,const int32_t reason,const AppExecFwk::InnerEvent::Pointer & response) const1037 int32_t CoreManagerInner::GetCallTransferInfo(
1038     int32_t slotId, const int32_t reason, const AppExecFwk::InnerEvent::Pointer &response) const
1039 {
1040     if (telRilManager_ == nullptr) {
1041         TELEPHONY_LOGE("telRilManager is null!");
1042         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1043     }
1044     return telRilManager_->GetCallTransferInfo(slotId, reason, response);
1045 }
1046 
GetCallWaiting(int32_t slotId,const AppExecFwk::InnerEvent::Pointer & response) const1047 int32_t CoreManagerInner::GetCallWaiting(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) const
1048 {
1049     if (telRilManager_ == nullptr) {
1050         TELEPHONY_LOGE("telRilManager is null!");
1051         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1052     }
1053     return telRilManager_->GetCallWaiting(slotId, response);
1054 }
1055 
GetCallRestriction(int32_t slotId,std::string fac,const AppExecFwk::InnerEvent::Pointer & response) const1056 int32_t CoreManagerInner::GetCallRestriction(
1057     int32_t slotId, std::string fac, const AppExecFwk::InnerEvent::Pointer &response) const
1058 {
1059     if (telRilManager_ == nullptr) {
1060         TELEPHONY_LOGE("telRilManager is null!");
1061         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1062     }
1063     return telRilManager_->GetCallRestriction(slotId, fac, response);
1064 }
1065 
SetCallRestriction(int32_t slotId,const CallRestrictionParam & callRestriction,const AppExecFwk::InnerEvent::Pointer & response)1066 int32_t CoreManagerInner::SetCallRestriction(
1067     int32_t slotId, const CallRestrictionParam &callRestriction, const AppExecFwk::InnerEvent::Pointer &response)
1068 {
1069     if (telRilManager_ == nullptr) {
1070         TELEPHONY_LOGE("telRilManager is null!");
1071         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1072     }
1073     return telRilManager_->SetCallRestriction(slotId, callRestriction, response);
1074 }
1075 
SetBarringPassword(int32_t slotId,const char * oldPassword,const char * newPassword,const std::string & restrictionType,const AppExecFwk::InnerEvent::Pointer & response)1076 int32_t CoreManagerInner::SetBarringPassword(int32_t slotId, const char *oldPassword,
1077     const char *newPassword, const std::string &restrictionType, const AppExecFwk::InnerEvent::Pointer &response)
1078 {
1079     if (telRilManager_ == nullptr) {
1080         TELEPHONY_LOGE("telRilManager is null!");
1081         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1082     }
1083     return telRilManager_->SetBarringPassword(slotId, oldPassword, newPassword, restrictionType, response);
1084 }
1085 
SetVoNRSwitch(int32_t slotId,int32_t state,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1086 int32_t CoreManagerInner::SetVoNRSwitch(
1087     int32_t slotId, int32_t state, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1088 {
1089     if (telRilManager_ == nullptr) {
1090         TELEPHONY_LOGE("set NR voice switch telRilManager is null!");
1091         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1092     }
1093     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1094     if (response == nullptr) {
1095         TELEPHONY_LOGE("set NR voice switch response is null!");
1096         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1097     }
1098     response->SetOwner(handler);
1099     return telRilManager_->SetVoNRSwitch(slotId, state, response);
1100 }
1101 
SendDTMF(int32_t slotId,int32_t eventId,const DtmfParam & dtmfParam,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1102 int32_t CoreManagerInner::SendDTMF(int32_t slotId, int32_t eventId, const DtmfParam &dtmfParam,
1103     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1104 {
1105     if (telRilManager_ == nullptr) {
1106         TELEPHONY_LOGE("send DTMF telRilManager is null!");
1107         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1108     }
1109     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1110     if (response == nullptr) {
1111         TELEPHONY_LOGE("send DTMF response is null!");
1112         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1113     }
1114     response->SetOwner(handler);
1115     return telRilManager_->SendDtmf(slotId, dtmfParam, response);
1116 }
1117 
SendDTMF(int32_t slotId,int32_t eventId,char cDTMFCode,int32_t index,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1118 int32_t CoreManagerInner::SendDTMF(int32_t slotId, int32_t eventId, char cDTMFCode, int32_t index,
1119     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1120 {
1121     if (telRilManager_ == nullptr) {
1122         TELEPHONY_LOGE("send DTMF telRilManager is null!");
1123         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1124     }
1125     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, index);
1126     if (response == nullptr) {
1127         TELEPHONY_LOGE("send DTMF response is null!");
1128         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1129     }
1130     response->SetOwner(handler);
1131     return telRilManager_->SendDtmf(slotId, cDTMFCode, index, response);
1132 }
1133 
StartDTMF(int32_t slotId,int32_t eventId,char cDTMFCode,int32_t index,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1134 int32_t CoreManagerInner::StartDTMF(int32_t slotId, int32_t eventId, char cDTMFCode, int32_t index,
1135     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1136 {
1137     if (telRilManager_ == nullptr) {
1138         TELEPHONY_LOGE("start DTMF telRilManager is null!");
1139         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1140     }
1141     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1142     if (response == nullptr) {
1143         TELEPHONY_LOGE("start DTMF response is null!");
1144         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1145     }
1146     response->SetOwner(handler);
1147     return telRilManager_->StartDtmf(slotId, cDTMFCode, index, response);
1148 }
1149 
StopDTMF(int32_t slotId,int32_t eventId,int32_t index,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1150 int32_t CoreManagerInner::StopDTMF(
1151     int32_t slotId, int32_t eventId, int32_t index, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1152 {
1153     if (telRilManager_ == nullptr) {
1154         TELEPHONY_LOGE("stop DTMF telRilManager is null!");
1155         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1156     }
1157     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1158     if (response == nullptr) {
1159         TELEPHONY_LOGE("stop DTMF response is null!");
1160         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1161     }
1162     response->SetOwner(handler);
1163     return telRilManager_->StopDtmf(slotId, index, response);
1164 }
1165 
SetDataPermitted(int32_t slotId,int32_t eventId,int32_t dataPermitted,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1166 int32_t CoreManagerInner::SetDataPermitted(
1167     int32_t slotId, int32_t eventId, int32_t dataPermitted, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1168 {
1169     if (telRilManager_ == nullptr) {
1170         TELEPHONY_LOGE("set data permitted telRilManager is null!");
1171         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1172     }
1173     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1174     if (response == nullptr) {
1175         TELEPHONY_LOGE("set data permitted response is null!");
1176         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1177     }
1178     response->SetOwner(handler);
1179     return telRilManager_->SetDataPermitted(slotId, dataPermitted, response);
1180 }
1181 
SetInitApnInfo(int32_t slotId,int32_t eventId,const DataProfile & dataProfile,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1182 int32_t CoreManagerInner::SetInitApnInfo(int32_t slotId, int32_t eventId, const DataProfile &dataProfile,
1183     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1184 {
1185     if (telRilManager_ == nullptr) {
1186         TELEPHONY_LOGE("set init apn info telRilManager is null!");
1187         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1188     }
1189     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1190     if (response == nullptr) {
1191         TELEPHONY_LOGE("set init apn info response is null!");
1192         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1193     }
1194     response->SetOwner(handler);
1195     return telRilManager_->SetInitApnInfo(slotId, dataProfile, response);
1196 }
1197 
ActivatePdpContext(int32_t slotId,int32_t eventId,const ActivateDataParam & activateData,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1198 int32_t CoreManagerInner::ActivatePdpContext(int32_t slotId, int32_t eventId, const ActivateDataParam &activateData,
1199     const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1200 {
1201     if (telRilManager_ == nullptr) {
1202         TELEPHONY_LOGE("activate pdp context telRilManager is null!");
1203         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1204     }
1205     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, activateData.param);
1206     if (response == nullptr) {
1207         TELEPHONY_LOGE("activate pdp context response is null!");
1208         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1209     }
1210     response->SetOwner(handler);
1211     return telRilManager_->ActivatePdpContext(slotId, activateData, response);
1212 }
1213 
DeactivatePdpContext(int32_t slotId,int32_t eventId,const DeactivateDataParam & deactivateData,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1214 int32_t CoreManagerInner::DeactivatePdpContext(int32_t slotId, int32_t eventId,
1215     const DeactivateDataParam &deactivateData, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1216 {
1217     if (telRilManager_ == nullptr) {
1218         TELEPHONY_LOGE("deactivate pdp context telRilManager is null!");
1219         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1220     }
1221     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId, deactivateData.param);
1222     if (response == nullptr) {
1223         TELEPHONY_LOGE("deactivate pdp context response is null!");
1224         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1225     }
1226     response->SetOwner(handler);
1227     return telRilManager_->DeactivatePdpContext(slotId, deactivateData.cid, deactivateData.reason, response);
1228 }
1229 
GetPdpContextList(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1230 int32_t CoreManagerInner::GetPdpContextList(
1231     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1232 {
1233     if (telRilManager_ == nullptr) {
1234         TELEPHONY_LOGE("get pdp context list telRilManager is null!");
1235         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1236     }
1237     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1238     if (response == nullptr) {
1239         TELEPHONY_LOGE("get pdp context list response is null!");
1240         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1241     }
1242     response->SetOwner(handler);
1243     return telRilManager_->GetPdpContextList(slotId, response);
1244 }
1245 
SetLinkBandwidthReportingRule(int32_t slotId,int32_t eventId,LinkBandwidthRule linkBandwidth,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1246 int32_t CoreManagerInner::SetLinkBandwidthReportingRule(int32_t slotId, int32_t eventId,
1247     LinkBandwidthRule linkBandwidth, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1248 {
1249     if (telRilManager_ == nullptr) {
1250         TELEPHONY_LOGE("set link bandwidth reporting rule telRilManager is null!");
1251         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1252     }
1253     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1254     if (response == nullptr) {
1255         TELEPHONY_LOGE("set link bandwidth reporting rule response is null!");
1256         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1257     }
1258     response->SetOwner(handler);
1259     return telRilManager_->SetLinkBandwidthReportingRule(slotId, linkBandwidth, response);
1260 }
1261 
GetLinkBandwidthInfo(int32_t slotId,int32_t eventId,const int32_t cid,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1262 int32_t CoreManagerInner::GetLinkBandwidthInfo(
1263     int32_t slotId, int32_t eventId, const int32_t cid, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1264 {
1265     if (telRilManager_ == nullptr) {
1266         TELEPHONY_LOGE("get link bandwidth info telRilManager is null!");
1267         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1268     }
1269     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1270     if (response == nullptr) {
1271         TELEPHONY_LOGE("get link bandwidth info response is null!");
1272         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1273     }
1274     response->SetOwner(handler);
1275     return telRilManager_->GetLinkBandwidthInfo(slotId, cid, response);
1276 }
1277 
GetLinkCapability(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1278 int32_t CoreManagerInner::GetLinkCapability(
1279     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1280 {
1281     if (telRilManager_ == nullptr) {
1282         TELEPHONY_LOGE("get link capability telRilManager is null!");
1283         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1284     }
1285     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1286     if (response == nullptr) {
1287         TELEPHONY_LOGE("get link capability response is null!");
1288         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1289     }
1290     response->SetOwner(handler);
1291     return telRilManager_->GetLinkCapability(slotId, response);
1292 }
1293 
CleanAllConnections(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler)1294 int32_t CoreManagerInner::CleanAllConnections(
1295     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
1296 {
1297     if (telRilManager_ == nullptr) {
1298         TELEPHONY_LOGE("clean all connections telRilManager is null!");
1299         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1300     }
1301     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1302     if (response == nullptr) {
1303         TELEPHONY_LOGE("clean all connections response is null!");
1304         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1305     }
1306     response->SetOwner(handler);
1307     return telRilManager_->CleanAllConnections(slotId, response);
1308 }
1309 
GetSignalStrength(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const1310 int32_t CoreManagerInner::GetSignalStrength(
1311     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
1312 {
1313     if (telRilManager_ == nullptr) {
1314         TELEPHONY_LOGE("get signal strength telRilManager is null!");
1315         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1316     }
1317     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1318     if (response == nullptr) {
1319         TELEPHONY_LOGE("get signal strength response is null!");
1320         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1321     }
1322     response->SetOwner(handler);
1323     return telRilManager_->GetSignalStrength(slotId, response);
1324 }
1325 
GetCsRegStatus(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const1326 int32_t CoreManagerInner::GetCsRegStatus(
1327     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
1328 {
1329     if (telRilManager_ == nullptr) {
1330         TELEPHONY_LOGE("get cs register status telRilManager is null!");
1331         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1332     }
1333     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1334     if (response == nullptr) {
1335         TELEPHONY_LOGE("get cs register status response is null!");
1336         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1337     }
1338     response->SetOwner(handler);
1339     return telRilManager_->GetCsRegStatus(slotId, response);
1340 }
1341 
GetPsRegStatus(int32_t slotId,int32_t eventId,const std::shared_ptr<AppExecFwk::EventHandler> & handler) const1342 int32_t CoreManagerInner::GetPsRegStatus(
1343     int32_t slotId, int32_t eventId, const std::shared_ptr<AppExecFwk::EventHandler> &handler) const
1344 {
1345     if (telRilManager_ == nullptr) {
1346         TELEPHONY_LOGE("get ps register status telRilManager is null!");
1347         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1348     }
1349     AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(eventId);
1350     if (response == nullptr) {
1351         TELEPHONY_LOGE("get ps register status response is null!");
1352         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1353     }
1354     response->SetOwner(handler);
1355     return telRilManager_->GetPsRegStatus(slotId, response);
1356 }
1357 /******************** telRilManager end *******************/
1358 /******************** networkSearchManager start *******************/
GetPsRadioTech(int32_t slotId,int32_t & psRadioTech)1359 int32_t CoreManagerInner::GetPsRadioTech(int32_t slotId, int32_t &psRadioTech)
1360 {
1361     if (networkSearchManager_ == nullptr) {
1362         TELEPHONY_LOGE("networkSearchManager is null!");
1363         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1364     }
1365     return networkSearchManager_->GetPsRadioTech(slotId, psRadioTech);
1366 }
1367 
GetCsRadioTech(int32_t slotId,int32_t & csRadioTech)1368 int32_t CoreManagerInner::GetCsRadioTech(int32_t slotId, int32_t &csRadioTech)
1369 {
1370     if (networkSearchManager_ == nullptr) {
1371         TELEPHONY_LOGE("networkSearchManager is null!");
1372         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1373     }
1374     return networkSearchManager_->GetCsRadioTech(slotId, csRadioTech);
1375 }
1376 
GetPsRegState(int32_t slotId)1377 int32_t CoreManagerInner::GetPsRegState(int32_t slotId)
1378 {
1379     if (networkSearchManager_ == nullptr) {
1380         TELEPHONY_LOGE("networkSearchManager is null!");
1381         return NETWORK_IS_NULL;
1382     }
1383     return networkSearchManager_->GetPsRegState(slotId);
1384 }
1385 
GetCsRegState(int32_t slotId)1386 int32_t CoreManagerInner::GetCsRegState(int32_t slotId)
1387 {
1388     if (networkSearchManager_ == nullptr) {
1389         TELEPHONY_LOGE("networkSearchManager is null!");
1390         return NETWORK_IS_NULL;
1391     }
1392     return networkSearchManager_->GetCsRegState(slotId);
1393 }
1394 
GetPsRoamingState(int32_t slotId)1395 int32_t CoreManagerInner::GetPsRoamingState(int32_t slotId)
1396 {
1397     if (networkSearchManager_ == nullptr) {
1398         TELEPHONY_LOGE("networkSearchManager is null!");
1399         return NETWORK_IS_NULL;
1400     }
1401     return networkSearchManager_->GetPsRoamingState(slotId);
1402 }
1403 
SetNetworkSelectionMode(int32_t slotId,int32_t selectMode,const sptr<NetworkInformation> & networkInformation,bool resumeSelection,const sptr<INetworkSearchCallback> & callback)1404 bool CoreManagerInner::SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
1405     const sptr<NetworkInformation> &networkInformation, bool resumeSelection,
1406     const sptr<INetworkSearchCallback> &callback)
1407 {
1408     if (networkSearchManager_ == nullptr) {
1409         TELEPHONY_LOGE("networkSearchManager is null!");
1410         return false;
1411     }
1412     return networkSearchManager_->SetNetworkSelectionMode(
1413         slotId, selectMode, networkInformation, resumeSelection, callback);
1414 }
1415 
GetSignalInfoList(int32_t slotId,std::vector<sptr<SignalInformation>> & signals)1416 int32_t CoreManagerInner::GetSignalInfoList(int32_t slotId, std::vector<sptr<SignalInformation>> &signals)
1417 {
1418     if (networkSearchManager_ == nullptr) {
1419         TELEPHONY_LOGE("networkSearchManager is null!");
1420         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1421     }
1422     return networkSearchManager_->GetSignalInfoList(slotId, signals);
1423 }
1424 
GetOperatorNumeric(int32_t slotId)1425 std::u16string CoreManagerInner::GetOperatorNumeric(int32_t slotId)
1426 {
1427     if (networkSearchManager_ == nullptr) {
1428         TELEPHONY_LOGE("networkSearchManager is null!");
1429         return std::u16string();
1430     }
1431     return networkSearchManager_->GetOperatorNumeric(slotId);
1432 }
1433 
GetOperatorName(int32_t slotId,std::u16string & operatorName)1434 int32_t CoreManagerInner::GetOperatorName(int32_t slotId, std::u16string &operatorName)
1435 {
1436     if (networkSearchManager_ == nullptr) {
1437         TELEPHONY_LOGE("networkSearchManager is null!");
1438         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1439     }
1440     return networkSearchManager_->GetOperatorName(slotId, operatorName);
1441 }
1442 
GetNetworkStatus(int32_t slotId,sptr<NetworkState> & networkState)1443 int32_t CoreManagerInner::GetNetworkStatus(int32_t slotId, sptr<NetworkState> &networkState)
1444 {
1445     if (networkSearchManager_ == nullptr) {
1446         TELEPHONY_LOGE("networkSearchManager is null!");
1447         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1448     }
1449     return networkSearchManager_->GetNetworkStatus(slotId, networkState);
1450 }
1451 
SetRadioState(int32_t slotId,bool isOn,int32_t rst,const sptr<INetworkSearchCallback> & callback)1452 int32_t CoreManagerInner::SetRadioState(
1453     int32_t slotId, bool isOn, int32_t rst, const sptr<INetworkSearchCallback> &callback)
1454 {
1455     if (networkSearchManager_ == nullptr) {
1456         TELEPHONY_LOGE("networkSearchManager is null!");
1457         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1458     }
1459     return networkSearchManager_->SetRadioState(slotId, isOn, rst, callback);
1460 }
1461 
GetRadioState(int32_t slotId)1462 int32_t CoreManagerInner::GetRadioState(int32_t slotId)
1463 {
1464     if (networkSearchManager_ == nullptr) {
1465         TELEPHONY_LOGE("networkSearchManager is null!");
1466         return NETWORK_IS_NULL;
1467     }
1468     return networkSearchManager_->GetRadioState(slotId);
1469 }
1470 
GetRadioState(int32_t slotId,const sptr<INetworkSearchCallback> & callback)1471 int32_t CoreManagerInner::GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
1472 {
1473     if (networkSearchManager_ == nullptr) {
1474         TELEPHONY_LOGE("networkSearchManager is null!");
1475         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1476     }
1477     return networkSearchManager_->GetRadioState(slotId, callback);
1478 }
1479 
GetIsoCountryCodeForNetwork(int32_t slotId,std::u16string & countryCode)1480 int32_t CoreManagerInner::GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode)
1481 {
1482     if (networkSearchManager_ == nullptr) {
1483         TELEPHONY_LOGE("networkSearchManager is null!");
1484         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1485     }
1486     return networkSearchManager_->GetIsoCountryCodeForNetwork(slotId, countryCode);
1487 }
1488 
GetImei(int32_t slotId,std::u16string & imei)1489 int32_t CoreManagerInner::GetImei(int32_t slotId, std::u16string &imei)
1490 {
1491     if (networkSearchManager_ == nullptr) {
1492         TELEPHONY_LOGE("networkSearchManager is null!");
1493         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1494     }
1495     return networkSearchManager_->GetImei(slotId, imei);
1496 }
1497 
GetImeiSv(int32_t slotId,std::u16string & imeiSv)1498 int32_t CoreManagerInner::GetImeiSv(int32_t slotId, std::u16string &imeiSv)
1499 {
1500     if (networkSearchManager_ == nullptr) {
1501         TELEPHONY_LOGE("networkSearchManager is null!");
1502         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1503     }
1504     return networkSearchManager_->GetImeiSv(slotId, imeiSv);
1505 }
1506 
GetMeid(int32_t slotId,std::u16string & meid)1507 int32_t CoreManagerInner::GetMeid(int32_t slotId, std::u16string &meid)
1508 {
1509     if (networkSearchManager_ == nullptr) {
1510         TELEPHONY_LOGE("networkSearchManager is null!");
1511         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1512     }
1513     return networkSearchManager_->GetMeid(slotId, meid);
1514 }
1515 
GetUniqueDeviceId(int32_t slotId,std::u16string & deviceId)1516 int32_t CoreManagerInner::GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId)
1517 {
1518     if (networkSearchManager_ == nullptr) {
1519         TELEPHONY_LOGE("networkSearchManager is null!");
1520         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1521     }
1522     return networkSearchManager_->GetUniqueDeviceId(slotId, deviceId);
1523 }
1524 
GetPhoneType(int32_t slotId)1525 PhoneType CoreManagerInner::GetPhoneType(int32_t slotId)
1526 {
1527     if (networkSearchManager_ == nullptr) {
1528         TELEPHONY_LOGE("networkSearchManager is null!");
1529         return PhoneType::PHONE_TYPE_IS_NONE;
1530     }
1531     return networkSearchManager_->GetPhoneType(slotId);
1532 }
1533 
GetCellLocation(int32_t slotId)1534 sptr<CellLocation> CoreManagerInner::GetCellLocation(int32_t slotId)
1535 {
1536     if (networkSearchManager_ == nullptr) {
1537         TELEPHONY_LOGE("networkSearchManager is null!");
1538         return nullptr;
1539     }
1540     return networkSearchManager_->GetCellLocation(slotId);
1541 }
1542 
GetNetworkSearchInformation(int32_t slotId,const sptr<INetworkSearchCallback> & callback)1543 int32_t CoreManagerInner::GetNetworkSearchInformation(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
1544 {
1545     if (networkSearchManager_ == nullptr) {
1546         TELEPHONY_LOGE("networkSearchManager is null!");
1547         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1548     }
1549     return networkSearchManager_->GetNetworkSearchInformation(slotId, callback);
1550 }
1551 
GetNetworkSelectionMode(int32_t slotId,const sptr<INetworkSearchCallback> & callback)1552 int32_t CoreManagerInner::GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
1553 {
1554     if (networkSearchManager_ == nullptr) {
1555         TELEPHONY_LOGE("networkSearchManager is null!");
1556         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1557     }
1558     return networkSearchManager_->GetNetworkSelectionMode(slotId, callback);
1559 }
1560 
GetCellInfoList(int32_t slotId,std::vector<sptr<CellInformation>> & cellInfo)1561 int32_t CoreManagerInner::GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo)
1562 {
1563     if (networkSearchManager_ == nullptr) {
1564         TELEPHONY_LOGE("networkSearchManager is null!");
1565         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1566     }
1567     return networkSearchManager_->GetCellInfoList(slotId, cellInfo);
1568 }
1569 
SendUpdateCellLocationRequest(int32_t slotId)1570 int32_t CoreManagerInner::SendUpdateCellLocationRequest(int32_t slotId)
1571 {
1572     if (networkSearchManager_ == nullptr) {
1573         TELEPHONY_LOGE("networkSearchManager is null!");
1574         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1575     }
1576     return networkSearchManager_->SendUpdateCellLocationRequest(slotId);
1577 }
1578 
GetPreferredNetwork(int32_t slotId,const sptr<INetworkSearchCallback> & callback)1579 int32_t CoreManagerInner::GetPreferredNetwork(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
1580 {
1581     if (networkSearchManager_ != nullptr) {
1582         return networkSearchManager_->GetPreferredNetwork(slotId, callback);
1583     }
1584     return TELEPHONY_ERR_LOCAL_PTR_NULL;
1585 }
1586 
SetPreferredNetwork(int32_t slotId,int32_t networkMode,const sptr<INetworkSearchCallback> & callback)1587 int32_t CoreManagerInner::SetPreferredNetwork(
1588     int32_t slotId, int32_t networkMode, const sptr<INetworkSearchCallback> &callback)
1589 {
1590     if (networkSearchManager_ != nullptr) {
1591         return networkSearchManager_->SetPreferredNetwork(slotId, networkMode, callback);
1592     }
1593     return TELEPHONY_ERR_LOCAL_PTR_NULL;
1594 }
1595 
SetPreferredNetwork(int32_t slotId,int32_t networkMode)1596 bool CoreManagerInner::SetPreferredNetwork(
1597     int32_t slotId, int32_t networkMode)
1598 {
1599     if (networkSearchManager_ != nullptr) {
1600         return networkSearchManager_->SetPreferredNetwork(slotId, networkMode);
1601     }
1602     return false;
1603 }
1604 
IsNrSupported(int32_t slotId)1605 bool CoreManagerInner::IsNrSupported(int32_t slotId)
1606 {
1607     if (networkSearchManager_ != nullptr) {
1608         return networkSearchManager_->IsNrSupported(slotId);
1609     }
1610     return false;
1611 }
1612 
IsSatelliteEnabled()1613 bool CoreManagerInner::IsSatelliteEnabled()
1614 {
1615     if (networkSearchManager_ != nullptr) {
1616         return networkSearchManager_->IsSatelliteEnabled();
1617     }
1618     return false;
1619 }
1620 
DcPhysicalLinkActiveUpdate(int32_t slotId,bool isActive)1621 void CoreManagerInner::DcPhysicalLinkActiveUpdate(int32_t slotId, bool isActive)
1622 {
1623     if (networkSearchManager_ != nullptr) {
1624         networkSearchManager_->DcPhysicalLinkActiveUpdate(slotId, isActive);
1625     }
1626 }
1627 
NotifyCallStatusToNetworkSearch(int32_t slotId,int32_t callStatus)1628 int32_t CoreManagerInner::NotifyCallStatusToNetworkSearch(int32_t slotId, int32_t callStatus)
1629 {
1630     if (networkSearchManager_ == nullptr) {
1631         TELEPHONY_LOGE("networkSearchManager is null!");
1632         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1633     }
1634     return networkSearchManager_->NotifyCallStatusToNetworkSearch(slotId, callStatus);
1635 }
1636 
SetNrOptionMode(int32_t slotId,NrMode mode)1637 int32_t CoreManagerInner::SetNrOptionMode(int32_t slotId, NrMode mode)
1638 {
1639     if (networkSearchManager_ != nullptr) {
1640         return networkSearchManager_->SetNrOptionMode(slotId, static_cast<int32_t>(mode));
1641     }
1642     return TELEPHONY_ERR_LOCAL_PTR_NULL;
1643 }
1644 
GetNrOptionMode(int32_t slotId,NrMode & mode)1645 int32_t CoreManagerInner::GetNrOptionMode(int32_t slotId, NrMode &mode)
1646 {
1647     if (networkSearchManager_ != nullptr) {
1648         return networkSearchManager_->GetNrOptionMode(slotId, mode);
1649     }
1650     return TELEPHONY_ERR_LOCAL_PTR_NULL;
1651 }
1652 
GetFrequencyType(int32_t slotId) const1653 FrequencyType CoreManagerInner::GetFrequencyType(int32_t slotId) const
1654 {
1655     if (networkSearchManager_ != nullptr) {
1656         return networkSearchManager_->GetFrequencyType(slotId);
1657     }
1658     return FrequencyType::FREQ_TYPE_UNKNOWN;
1659 }
1660 
GetNrState(int32_t slotId) const1661 NrState CoreManagerInner::GetNrState(int32_t slotId) const
1662 {
1663     if (networkSearchManager_ != nullptr) {
1664         return networkSearchManager_->GetNrState(slotId);
1665     }
1666     return NrState::NR_STATE_NOT_SUPPORT;
1667 }
1668 
GetImsRegStatus(int32_t slotId,ImsServiceType imsSrvType,ImsRegInfo & info) const1669 int32_t CoreManagerInner::GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info) const
1670 {
1671     if (networkSearchManager_ == nullptr) {
1672         TELEPHONY_LOGE("networkSearchManager is null!");
1673         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1674     }
1675     return networkSearchManager_->GetImsRegStatus(slotId, imsSrvType, info);
1676 }
1677 
GetAirplaneMode(bool & airplaneMode)1678 int32_t CoreManagerInner::GetAirplaneMode(bool &airplaneMode)
1679 {
1680     if (networkSearchManager_ == nullptr) {
1681         TELEPHONY_LOGE("networkSearchManager is null!");
1682         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1683     }
1684     return networkSearchManager_->GetAirplaneMode(airplaneMode);
1685 }
1686 
UpdateRadioOn(int32_t slotId)1687 int32_t CoreManagerInner::UpdateRadioOn(int32_t slotId)
1688 {
1689     if (networkSearchManager_ == nullptr) {
1690         TELEPHONY_LOGE("networkSearchManager is null!");
1691         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1692     }
1693     return networkSearchManager_->UpdateRadioOn(slotId);
1694 }
1695 
UpdateOperatorName(int32_t slotId)1696 int32_t CoreManagerInner::UpdateOperatorName(int32_t slotId)
1697 {
1698     if (networkSearchManager_ == nullptr) {
1699         TELEPHONY_LOGE("networkSearchManager is null!");
1700         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1701     }
1702     return networkSearchManager_->UpdateOperatorName(slotId);
1703 }
1704 
1705 /******************** networkSearchManager end ************************/
1706 /******************** simManager_ start *******************/
1707 
ObtainSpnCondition(int32_t slotId,bool roaming,std::string operatorNum)1708 int32_t CoreManagerInner::ObtainSpnCondition(int32_t slotId, bool roaming, std::string operatorNum)
1709 {
1710     if (simManager_ == nullptr) {
1711         TELEPHONY_LOGE("simManager_ is null");
1712         return 0;
1713     }
1714     return simManager_->ObtainSpnCondition(slotId, roaming, operatorNum);
1715 }
1716 
GetSimSpn(int32_t slotId,std::u16string & spn)1717 int32_t CoreManagerInner::GetSimSpn(int32_t slotId, std::u16string &spn)
1718 {
1719     if (simManager_ == nullptr) {
1720         TELEPHONY_LOGE("simManager_ is null");
1721         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1722     }
1723     return simManager_->GetSimSpn(slotId, spn);
1724 }
1725 
GetSimEons(int32_t slotId,const std::string & plmn,int32_t lac,bool longNameRequired)1726 std::u16string CoreManagerInner::GetSimEons(
1727     int32_t slotId, const std::string &plmn, int32_t lac, bool longNameRequired)
1728 {
1729     if (simManager_ == nullptr) {
1730         TELEPHONY_LOGE("simManager_ is null");
1731         return std::u16string();
1732     }
1733     return simManager_->GetSimEons(slotId, plmn, lac, longNameRequired);
1734 }
1735 
SetVoiceMailInfo(int32_t slotId,const std::u16string & mailName,const std::u16string & mailNumber)1736 int32_t CoreManagerInner::SetVoiceMailInfo(
1737     int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber)
1738 {
1739     if (simManager_ == nullptr) {
1740         TELEPHONY_LOGE("simManager_ is null");
1741         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1742     }
1743     return simManager_->SetVoiceMailInfo(slotId, mailName, mailNumber);
1744 }
1745 
QueryIccDiallingNumbers(int slotId,int type,std::vector<std::shared_ptr<DiallingNumbersInfo>> & result)1746 int32_t CoreManagerInner::QueryIccDiallingNumbers(
1747     int slotId, int type, std::vector<std::shared_ptr<DiallingNumbersInfo>> &result)
1748 {
1749     if (simManager_ == nullptr) {
1750         TELEPHONY_LOGE("iccDiallingNumbersManager is null!");
1751         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1752     }
1753     return simManager_->QueryIccDiallingNumbers(slotId, type, result);
1754 }
1755 
AddIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)1756 int32_t CoreManagerInner::AddIccDiallingNumbers(
1757     int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber)
1758 {
1759     if (simManager_ == nullptr) {
1760         TELEPHONY_LOGE("iccDiallingNumbersManager is null!");
1761         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1762     }
1763     return simManager_->AddIccDiallingNumbers(slotId, type, diallingNumber);
1764 }
1765 
DelIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)1766 int32_t CoreManagerInner::DelIccDiallingNumbers(
1767     int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber)
1768 {
1769     if (simManager_ == nullptr) {
1770         TELEPHONY_LOGE("iccDiallingNumbersManager is null!");
1771         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1772     }
1773     return simManager_->DelIccDiallingNumbers(slotId, type, diallingNumber);
1774 }
1775 
UpdateIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)1776 int32_t CoreManagerInner::UpdateIccDiallingNumbers(
1777     int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber)
1778 {
1779     if (simManager_ == nullptr) {
1780         TELEPHONY_LOGE("iccDiallingNumbersManager is null!");
1781         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1782     }
1783     return simManager_->UpdateIccDiallingNumbers(slotId, type, diallingNumber);
1784 }
1785 
AddSmsToIcc(int slotId,int status,std::string & pdu,std::string & smsc)1786 int32_t CoreManagerInner::AddSmsToIcc(int slotId, int status, std::string &pdu, std::string &smsc)
1787 {
1788     if (simManager_ == nullptr) {
1789         TELEPHONY_LOGE("simManager_ is null!");
1790         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1791     }
1792     return simManager_->AddSmsToIcc(slotId, status, pdu, smsc);
1793 }
1794 
UpdateSmsIcc(int slotId,int index,int status,std::string & pduData,std::string & smsc)1795 int32_t CoreManagerInner::UpdateSmsIcc(int slotId, int index, int status, std::string &pduData, std::string &smsc)
1796 {
1797     if (simManager_ == nullptr) {
1798         TELEPHONY_LOGE("simManager_ is null!");
1799         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1800     }
1801     return simManager_->UpdateSmsIcc(slotId, index, status, pduData, smsc);
1802 }
1803 
ObtainAllSmsOfIcc(int slotId)1804 std::vector<std::string> CoreManagerInner::ObtainAllSmsOfIcc(int slotId)
1805 {
1806     if (simManager_ == nullptr) {
1807         TELEPHONY_LOGE("simManager_ is null!");
1808         std::vector<std::string> result;
1809         return result;
1810     }
1811     return simManager_->ObtainAllSmsOfIcc(slotId);
1812 }
1813 
DelSmsIcc(int slotId,int index)1814 int32_t CoreManagerInner::DelSmsIcc(int slotId, int index)
1815 {
1816     if (simManager_ == nullptr) {
1817         TELEPHONY_LOGE("simManager_ is null!");
1818         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1819     }
1820     return simManager_->DelSmsIcc(slotId, index);
1821 }
1822 
IsSimActive(int32_t slotId)1823 bool CoreManagerInner::IsSimActive(int32_t slotId)
1824 {
1825     if (simManager_ == nullptr) {
1826         TELEPHONY_LOGE("simManager_ is null!");
1827         return false;
1828     }
1829     return simManager_->IsSimActive(slotId);
1830 }
1831 
SetActiveSim(int32_t slotId,int32_t enable)1832 int32_t CoreManagerInner::SetActiveSim(int32_t slotId, int32_t enable)
1833 {
1834     if (simManager_ == nullptr) {
1835         TELEPHONY_LOGE("simManager_ is null!");
1836         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1837     }
1838     return simManager_->SetActiveSim(slotId, enable);
1839 }
1840 
ResetSimLoadAccount(int32_t slotId)1841 int32_t CoreManagerInner::ResetSimLoadAccount(int32_t slotId)
1842 {
1843     if (simManager_ == nullptr) {
1844         TELEPHONY_LOGE("simManager_ is null!");
1845         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1846     }
1847     return simManager_->ResetSimLoadAccount(slotId);
1848 }
1849 
GetSimAccountInfo(int32_t slotId,IccAccountInfo & info)1850 int32_t CoreManagerInner::GetSimAccountInfo(int32_t slotId, IccAccountInfo &info)
1851 {
1852     if (simManager_ == nullptr) {
1853         TELEPHONY_LOGE("simManager_ is null!");
1854         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1855     }
1856     return simManager_->GetSimAccountInfo(slotId, false, info);
1857 }
1858 
SetDefaultVoiceSlotId(int32_t slotId)1859 int32_t CoreManagerInner::SetDefaultVoiceSlotId(int32_t slotId)
1860 {
1861     if (simManager_ == nullptr) {
1862         TELEPHONY_LOGE("simManager_ is null!");
1863         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1864     }
1865     return simManager_->SetDefaultVoiceSlotId(slotId);
1866 }
1867 
SetDefaultSmsSlotId(int32_t slotId)1868 int32_t CoreManagerInner::SetDefaultSmsSlotId(int32_t slotId)
1869 {
1870     if (simManager_ == nullptr) {
1871         TELEPHONY_LOGE("simManager_ is null!");
1872         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1873     }
1874     return simManager_->SetDefaultSmsSlotId(slotId);
1875 }
1876 
SetDefaultCellularDataSlotId(int32_t slotId)1877 int32_t CoreManagerInner::SetDefaultCellularDataSlotId(int32_t slotId)
1878 {
1879     if (simManager_ == nullptr) {
1880         TELEPHONY_LOGE("simManager_ is null!");
1881         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1882     }
1883     return simManager_->SetDefaultCellularDataSlotId(slotId);
1884 }
1885 
SetPrimarySlotId(int32_t slotId)1886 int32_t CoreManagerInner::SetPrimarySlotId(int32_t slotId)
1887 {
1888     if (simManager_ == nullptr) {
1889         TELEPHONY_LOGE("simManager_ is null!");
1890         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1891     }
1892     return simManager_->SetPrimarySlotId(slotId);
1893 }
1894 
SetShowNumber(int32_t slotId,const std::u16string & number)1895 int32_t CoreManagerInner::SetShowNumber(int32_t slotId, const std::u16string &number)
1896 {
1897     if (simManager_ == nullptr) {
1898         TELEPHONY_LOGE("simManager_ is null!");
1899         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1900     }
1901     return simManager_->SetShowNumber(slotId, number);
1902 }
1903 
SetShowName(int32_t slotId,const std::u16string & name)1904 int32_t CoreManagerInner::SetShowName(int32_t slotId, const std::u16string &name)
1905 {
1906     if (simManager_ == nullptr) {
1907         TELEPHONY_LOGE("simManager_ is null!");
1908         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1909     }
1910     return simManager_->SetShowName(slotId, name);
1911 }
1912 
GetDefaultVoiceSlotId()1913 int32_t CoreManagerInner::GetDefaultVoiceSlotId()
1914 {
1915     if (simManager_ == nullptr) {
1916         TELEPHONY_LOGE("simManager_ is null!");
1917         return TELEPHONY_ERROR;
1918     }
1919     return simManager_->GetDefaultVoiceSlotId();
1920 }
1921 
GetDefaultVoiceSimId(int32_t & simId)1922 int32_t CoreManagerInner::GetDefaultVoiceSimId(int32_t &simId)
1923 {
1924     if (simManager_ == nullptr) {
1925         TELEPHONY_LOGE("simManager_ is null!");
1926         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1927     }
1928     return simManager_->GetDefaultVoiceSimId(simId);
1929 }
1930 
GetDefaultSmsSlotId()1931 int32_t CoreManagerInner::GetDefaultSmsSlotId()
1932 {
1933     if (simManager_ == nullptr) {
1934         TELEPHONY_LOGE("simManager_ is null!");
1935         return TELEPHONY_ERROR;
1936     }
1937     return simManager_->GetDefaultSmsSlotId();
1938 }
1939 
GetDefaultSmsSimId(int32_t & simId)1940 int32_t CoreManagerInner::GetDefaultSmsSimId(int32_t &simId)
1941 {
1942     if (simManager_ == nullptr) {
1943         TELEPHONY_LOGE("simManager_ is null!");
1944         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1945     }
1946     return simManager_->GetDefaultSmsSimId(simId);
1947 }
1948 
GetDefaultCellularDataSlotId()1949 int32_t CoreManagerInner::GetDefaultCellularDataSlotId()
1950 {
1951     if (simManager_ == nullptr) {
1952         TELEPHONY_LOGE("simManager_ is null!");
1953         return TELEPHONY_ERROR;
1954     }
1955     return simManager_->GetDefaultCellularDataSlotId();
1956 }
1957 
GetDefaultCellularDataSimId(int32_t & simId)1958 int32_t CoreManagerInner::GetDefaultCellularDataSimId(int32_t &simId)
1959 {
1960     if (simManager_ == nullptr) {
1961         TELEPHONY_LOGE("simManager_ is null!");
1962         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1963     }
1964     return simManager_->GetDefaultCellularDataSimId(simId);
1965 }
1966 
GetDsdsMode(int32_t & dsdsMode)1967 int32_t CoreManagerInner::GetDsdsMode(int32_t &dsdsMode)
1968 {
1969     if (simManager_ == nullptr) {
1970         TELEPHONY_LOGE("simManager_ is null!");
1971         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1972     }
1973     return simManager_->GetDsdsMode(dsdsMode);
1974 }
1975 
SetDsdsMode(int32_t dsdsMode)1976 int32_t CoreManagerInner::SetDsdsMode(int32_t dsdsMode)
1977 {
1978     if (simManager_ == nullptr) {
1979         TELEPHONY_LOGE("simManager_ is null!");
1980         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1981     }
1982     return simManager_->SetDsdsMode(dsdsMode);
1983 }
1984 
SendSimMatchedOperatorInfo(int32_t slotId,int32_t state,const std::string & operName,const std::string & operKey)1985 int32_t CoreManagerInner::SendSimMatchedOperatorInfo(
1986     int32_t slotId, int32_t state, const std::string &operName, const std::string &operKey)
1987 {
1988     if (simManager_ == nullptr) {
1989         TELEPHONY_LOGE("simManager_ is null!");
1990         return TELEPHONY_ERR_LOCAL_PTR_NULL;
1991     }
1992     return simManager_->SendSimMatchedOperatorInfo(slotId, state, operName, operKey);
1993 }
1994 
GetPrimarySlotId(int32_t & slotId)1995 int32_t CoreManagerInner::GetPrimarySlotId(int32_t &slotId)
1996 {
1997     if (simManager_ == nullptr) {
1998         TELEPHONY_LOGE("simManager_ is null!");
1999         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2000     }
2001     return simManager_->GetPrimarySlotId(slotId);
2002 }
2003 
GetShowNumber(int32_t slotId,std::u16string & showNumber)2004 int32_t CoreManagerInner::GetShowNumber(int32_t slotId, std::u16string &showNumber)
2005 {
2006     if (simManager_ == nullptr) {
2007         TELEPHONY_LOGE("simManager_ is null!");
2008         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2009     }
2010     return simManager_->GetShowNumber(slotId, showNumber);
2011 }
2012 
GetShowName(int32_t slotId,std::u16string & showName)2013 int32_t CoreManagerInner::GetShowName(int32_t slotId, std::u16string &showName)
2014 {
2015     if (simManager_ == nullptr) {
2016         TELEPHONY_LOGE("simManager_ is null!");
2017         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2018     }
2019     return simManager_->GetShowName(slotId, showName);
2020 }
2021 
GetActiveSimAccountInfoList(std::vector<IccAccountInfo> & iccAccountInfoList)2022 int32_t CoreManagerInner::GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList)
2023 {
2024     if (simManager_ == nullptr) {
2025         TELEPHONY_LOGE("simManager_ is null!");
2026         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2027     }
2028     return simManager_->GetActiveSimAccountInfoList(false, iccAccountInfoList);
2029 }
2030 
GetOperatorConfigs(int32_t slotId,OperatorConfig & poc)2031 int32_t CoreManagerInner::GetOperatorConfigs(int32_t slotId, OperatorConfig &poc)
2032 {
2033     if (simManager_ == nullptr) {
2034         TELEPHONY_LOGE("simManager_ is null!");
2035         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2036     }
2037     return simManager_->GetOperatorConfigs(slotId, poc);
2038 }
2039 
UpdateOperatorConfigs()2040 int32_t CoreManagerInner::UpdateOperatorConfigs()
2041 {
2042     if (simManager_ == nullptr) {
2043         TELEPHONY_LOGE("simManager_ is null!");
2044         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2045     }
2046     int32_t slotCount = SIM_SLOT_COUNT;
2047     int32_t failSlotCount = slotCount;
2048     for (int32_t slotId = 0; slotId < slotCount; slotId++) {
2049         TELEPHONY_LOGD("select slotId %{public}d in slotCount %{public}d", slotId, slotCount);
2050         int32_t err = simManager_->UpdateOperatorConfigs(slotId);
2051         if (err == TELEPHONY_ERR_SUCCESS) {
2052             failSlotCount--;
2053         } else {
2054             TELEPHONY_LOGE("slotId %{public}d return error %{public}d", slotId, err);
2055         }
2056     }
2057     return failSlotCount;
2058 }
2059 
GetSimOperatorNumeric(int32_t slotId,std::u16string & operatorNumeric)2060 int32_t CoreManagerInner::GetSimOperatorNumeric(int32_t slotId, std::u16string &operatorNumeric)
2061 {
2062     if (simManager_ == nullptr) {
2063         TELEPHONY_LOGE("simManager_ is null!");
2064         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2065     }
2066     return simManager_->GetSimOperatorNumeric(slotId, operatorNumeric);
2067 }
2068 
GetISOCountryCodeForSim(int32_t slotId,std::u16string & countryCode)2069 int32_t CoreManagerInner::GetISOCountryCodeForSim(int32_t slotId, std::u16string &countryCode)
2070 {
2071     if (simManager_ == nullptr) {
2072         TELEPHONY_LOGE("simManager_ is null!");
2073         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2074     }
2075     return simManager_->GetISOCountryCodeForSim(slotId, countryCode);
2076 }
2077 
GetSimIccId(int32_t slotId,std::u16string & iccId)2078 int32_t CoreManagerInner::GetSimIccId(int32_t slotId, std::u16string &iccId)
2079 {
2080     if (simManager_ == nullptr) {
2081         TELEPHONY_LOGE("simManager_ is null!");
2082         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2083     }
2084     return simManager_->GetSimIccId(slotId, iccId);
2085 }
2086 
GetIMSI(int32_t slotId,std::u16string & imsi)2087 int32_t CoreManagerInner::GetIMSI(int32_t slotId, std::u16string &imsi)
2088 {
2089     if (simManager_ == nullptr) {
2090         TELEPHONY_LOGE("simManager_ is null!");
2091         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2092     }
2093     return simManager_->GetIMSI(slotId, imsi);
2094 }
2095 
GetLocaleFromDefaultSim(int32_t slotId)2096 std::u16string CoreManagerInner::GetLocaleFromDefaultSim(int32_t slotId)
2097 {
2098     if (simManager_ == nullptr) {
2099         TELEPHONY_LOGE("simManager_ is null!");
2100         return u"";
2101     }
2102     return simManager_->GetLocaleFromDefaultSim(slotId);
2103 }
2104 
GetSlotId(int32_t simId)2105 std::int32_t CoreManagerInner::GetSlotId(int32_t simId)
2106 {
2107     if (simManager_ == nullptr) {
2108         TELEPHONY_LOGE("simManager_ is null!");
2109         return TELEPHONY_ERROR;
2110     }
2111     return simManager_->GetSlotId(simId);
2112 }
2113 
GetSimId(int32_t slotId)2114 std::int32_t CoreManagerInner::GetSimId(int32_t slotId)
2115 {
2116     if (simManager_ == nullptr) {
2117         TELEPHONY_LOGE("simManager_ is null!");
2118         return TELEPHONY_ERROR;
2119     }
2120     return simManager_->GetSimId(slotId);
2121 }
2122 
GetSimGid1(int32_t slotId,std::u16string & gid1)2123 int32_t CoreManagerInner::GetSimGid1(int32_t slotId, std::u16string &gid1)
2124 {
2125     if (simManager_ == nullptr) {
2126         TELEPHONY_LOGE("simManager_ is null!");
2127         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2128     }
2129     return simManager_->GetSimGid1(slotId, gid1);
2130 }
2131 
GetSimGid2(int32_t slotId)2132 std::u16string CoreManagerInner::GetSimGid2(int32_t slotId)
2133 {
2134     if (simManager_ == nullptr) {
2135         TELEPHONY_LOGE("simManager_ is null!");
2136         return u"";
2137     }
2138     return simManager_->GetSimGid2(slotId);
2139 }
2140 
GetOpName(int32_t slotId,std::u16string & opname)2141 int32_t CoreManagerInner::GetOpName(int32_t slotId, std::u16string &opname)
2142 {
2143     if (simManager_ == nullptr) {
2144         TELEPHONY_LOGE("simManager_ is null!");
2145         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2146     }
2147     return simManager_->GetOpName(slotId, opname);
2148 }
2149 
GetOpKeyExt(int32_t slotId,std::u16string & opkeyExt)2150 int32_t CoreManagerInner::GetOpKeyExt(int32_t slotId, std::u16string &opkeyExt)
2151 {
2152     if (simManager_ == nullptr) {
2153         TELEPHONY_LOGE("simManager_ is null!");
2154         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2155     }
2156     return simManager_->GetOpKeyExt(slotId, opkeyExt);
2157 }
2158 
GetOpKey(std::u16string & opkey)2159 int32_t CoreManagerInner::GetOpKey(std::u16string &opkey)
2160 {
2161     if (simManager_ == nullptr) {
2162         TELEPHONY_LOGE("simManager_ is null!");
2163         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2164     }
2165     int32_t slotId = INVALID_VALUE;
2166     simManager_->GetPrimarySlotId(slotId);
2167     return GetOpKey(slotId, opkey);
2168 }
2169 
GetOpKey(int32_t slotId,std::u16string & opkey)2170 int32_t CoreManagerInner::GetOpKey(int32_t slotId, std::u16string &opkey)
2171 {
2172     if (simManager_ == nullptr) {
2173         TELEPHONY_LOGE("simManager_ is null!");
2174         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2175     }
2176     return simManager_->GetOpKey(slotId, opkey);
2177 }
2178 
GetSimTelephoneNumber(int32_t slotId,std::u16string & telephoneNumber)2179 int32_t CoreManagerInner::GetSimTelephoneNumber(int32_t slotId, std::u16string &telephoneNumber)
2180 {
2181     if (simManager_ == nullptr) {
2182         TELEPHONY_LOGE("simManager_ is null!");
2183         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2184     }
2185     return simManager_->GetSimTelephoneNumber(slotId, telephoneNumber);
2186 }
2187 
GetSimTeleNumberIdentifier(const int32_t slotId)2188 std::u16string CoreManagerInner::GetSimTeleNumberIdentifier(const int32_t slotId)
2189 {
2190     if (simManager_ == nullptr) {
2191         TELEPHONY_LOGE("simManager_ is null!");
2192         return u"";
2193     }
2194     return simManager_->GetSimTeleNumberIdentifier(slotId);
2195 }
2196 
GetVoiceMailIdentifier(int32_t slotId,std::u16string & voiceMailIdentifier)2197 int32_t CoreManagerInner::GetVoiceMailIdentifier(int32_t slotId, std::u16string &voiceMailIdentifier)
2198 {
2199     if (simManager_ == nullptr) {
2200         TELEPHONY_LOGE("simManager_ is null!");
2201         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2202     }
2203     return simManager_->GetVoiceMailIdentifier(slotId, voiceMailIdentifier);
2204 }
2205 
GetVoiceMailNumber(int32_t slotId,std::u16string & voiceMailNumber)2206 int32_t CoreManagerInner::GetVoiceMailNumber(int32_t slotId, std::u16string &voiceMailNumber)
2207 {
2208     if (simManager_ == nullptr) {
2209         TELEPHONY_LOGE("simManager_ is null!");
2210         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2211     }
2212     return simManager_->GetVoiceMailNumber(slotId, voiceMailNumber);
2213 }
2214 
GetVoiceMailCount(int32_t slotId,int32_t & voiceMailCount)2215 int32_t CoreManagerInner::GetVoiceMailCount(int32_t slotId, int32_t &voiceMailCount)
2216 {
2217     if (simManager_ == nullptr) {
2218         TELEPHONY_LOGE("simManager_ is null!");
2219         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2220     }
2221     return simManager_->GetVoiceMailCount(slotId, voiceMailCount);
2222 }
2223 
SetVoiceMailCount(int32_t slotId,int32_t voiceMailCount)2224 int32_t CoreManagerInner::SetVoiceMailCount(int32_t slotId, int32_t voiceMailCount)
2225 {
2226     if (simManager_ == nullptr) {
2227         TELEPHONY_LOGE("simManager_ is null!");
2228         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2229     }
2230     return simManager_->SetVoiceMailCount(slotId, voiceMailCount);
2231 }
2232 
SetVoiceCallForwarding(int32_t slotId,bool enable,const std::string & number)2233 int32_t CoreManagerInner::SetVoiceCallForwarding(int32_t slotId, bool enable, const std::string &number)
2234 {
2235     if (simManager_ == nullptr) {
2236         TELEPHONY_LOGE("simManager_ is null!");
2237         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2238     }
2239     return simManager_->SetVoiceCallForwarding(slotId, enable, number);
2240 }
2241 
HasSimCard(int32_t slotId,bool & hasSimCard)2242 int32_t CoreManagerInner::HasSimCard(int32_t slotId, bool &hasSimCard)
2243 {
2244     if (simManager_ == nullptr) {
2245         TELEPHONY_LOGE("simManager_ is null!");
2246         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2247     }
2248     return simManager_->HasSimCard(slotId, hasSimCard);
2249 }
2250 
GetSimState(int32_t slotId,SimState & simState)2251 int32_t CoreManagerInner::GetSimState(int32_t slotId, SimState &simState)
2252 {
2253     if (simManager_ == nullptr) {
2254         TELEPHONY_LOGE("simManager_ is null!");
2255         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2256     }
2257     return simManager_->GetSimState(slotId, simState);
2258 }
2259 
GetSimIccStatus(int32_t slotId,IccSimStatus & iccStatus)2260 int32_t CoreManagerInner::GetSimIccStatus(int32_t slotId, IccSimStatus &iccStatus)
2261 {
2262     if (simManager_ == nullptr) {
2263         TELEPHONY_LOGE("simManager_ is null!");
2264         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2265     }
2266     return simManager_->GetSimIccStatus(slotId, iccStatus);
2267 }
2268 
GetCardType(int32_t slotId,CardType & cardType)2269 int32_t CoreManagerInner::GetCardType(int32_t slotId, CardType &cardType)
2270 {
2271     if (simManager_ == nullptr) {
2272         TELEPHONY_LOGE("simManager_ is null!");
2273         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2274     }
2275     return simManager_->GetCardType(slotId, cardType);
2276 }
2277 
SetModemInit(int32_t slotId,bool state)2278 int32_t CoreManagerInner::SetModemInit(int32_t slotId, bool state)
2279 {
2280     if (simManager_ == nullptr) {
2281         TELEPHONY_LOGE("simManager_ is null!");
2282         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2283     }
2284     return simManager_->SetModemInit(slotId, state);
2285 }
2286 
UnlockPin(int32_t slotId,const std::string & pin,LockStatusResponse & response)2287 int32_t CoreManagerInner::UnlockPin(int32_t slotId, const std::string &pin, LockStatusResponse &response)
2288 {
2289     if (simManager_ == nullptr) {
2290         TELEPHONY_LOGE("simManager_ is null!");
2291         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2292     }
2293     return simManager_->UnlockPin(slotId, pin, response);
2294 }
2295 
UnlockPuk(int32_t slotId,const std::string & newPin,const std::string & puk,LockStatusResponse & response)2296 int32_t CoreManagerInner::UnlockPuk(
2297     int32_t slotId, const std::string &newPin, const std::string &puk, LockStatusResponse &response)
2298 {
2299     if (simManager_ == nullptr) {
2300         TELEPHONY_LOGE("simManager_ is null!");
2301         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2302     }
2303     return simManager_->UnlockPuk(slotId, newPin, puk, response);
2304 }
2305 
AlterPin(int32_t slotId,const std::string & newPin,const std::string & oldPin,LockStatusResponse & response)2306 int32_t CoreManagerInner::AlterPin(
2307     int32_t slotId, const std::string &newPin, const std::string &oldPin, LockStatusResponse &response)
2308 {
2309     if (simManager_ == nullptr) {
2310         TELEPHONY_LOGE("simManager_ is null!");
2311         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2312     }
2313     return simManager_->AlterPin(slotId, newPin, oldPin, response);
2314 }
2315 
SetLockState(int32_t slotId,const LockInfo & options,LockStatusResponse & response)2316 int32_t CoreManagerInner::SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response)
2317 {
2318     if (simManager_ == nullptr) {
2319         TELEPHONY_LOGE("simManager_ is null!");
2320         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2321     }
2322     return simManager_->SetLockState(slotId, options, response);
2323 }
2324 
GetLockState(int32_t slotId,LockType lockType,LockState & lockState)2325 int32_t CoreManagerInner::GetLockState(int32_t slotId, LockType lockType, LockState &lockState)
2326 {
2327     if (simManager_ == nullptr) {
2328         TELEPHONY_LOGE("simManager_ is null!");
2329         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2330     }
2331     return simManager_->GetLockState(slotId, lockType, lockState);
2332 }
2333 
RefreshSimState(int32_t slotId)2334 int32_t CoreManagerInner::RefreshSimState(int32_t slotId)
2335 {
2336     if (simManager_ == nullptr) {
2337         TELEPHONY_LOGE("simManager_ is null!");
2338         return false;
2339     }
2340     return simManager_->RefreshSimState(slotId);
2341 }
2342 
UnlockPin2(int32_t slotId,const std::string & pin2,LockStatusResponse & response)2343 int32_t CoreManagerInner::UnlockPin2(int32_t slotId, const std::string &pin2, LockStatusResponse &response)
2344 {
2345     if (simManager_ == nullptr) {
2346         TELEPHONY_LOGE("simManager_ is null!");
2347         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2348     }
2349     return simManager_->UnlockPin2(slotId, pin2, response);
2350 }
2351 
UnlockPuk2(int32_t slotId,const std::string & newPin2,const std::string & puk2,LockStatusResponse & response)2352 int32_t CoreManagerInner::UnlockPuk2(
2353     int32_t slotId, const std::string &newPin2, const std::string &puk2, LockStatusResponse &response)
2354 {
2355     if (simManager_ == nullptr) {
2356         TELEPHONY_LOGE("simManager_ is null!");
2357         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2358     }
2359     return simManager_->UnlockPuk2(slotId, newPin2, puk2, response);
2360 }
2361 
AlterPin2(int32_t slotId,const std::string & newPin2,const std::string & oldPin2,LockStatusResponse & response)2362 int32_t CoreManagerInner::AlterPin2(
2363     int32_t slotId, const std::string &newPin2, const std::string &oldPin2, LockStatusResponse &response)
2364 {
2365     if (simManager_ == nullptr) {
2366         TELEPHONY_LOGE("simManager_ is null!");
2367         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2368     }
2369     return simManager_->AlterPin2(slotId, newPin2, oldPin2, response);
2370 }
2371 
SendEnvelopeCmd(int32_t slotId,const std::string & cmd)2372 int32_t CoreManagerInner::SendEnvelopeCmd(int32_t slotId, const std::string &cmd)
2373 {
2374     if (simManager_ == nullptr) {
2375         TELEPHONY_LOGE("simManager_ is null!");
2376         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2377     }
2378     return simManager_->SendEnvelopeCmd(slotId, cmd);
2379 }
2380 
SendTerminalResponseCmd(int32_t slotId,const std::string & cmd)2381 int32_t CoreManagerInner::SendTerminalResponseCmd(int32_t slotId, const std::string &cmd)
2382 {
2383     if (simManager_ == nullptr) {
2384         TELEPHONY_LOGE("simManager_ is null!");
2385         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2386     }
2387     return simManager_->SendTerminalResponseCmd(slotId, cmd);
2388 }
2389 
SendCallSetupRequestResult(int32_t slotId,bool accept)2390 int32_t CoreManagerInner::SendCallSetupRequestResult(int32_t slotId, bool accept)
2391 {
2392     if (simManager_ == nullptr) {
2393         TELEPHONY_LOGE("simManager_ is null!");
2394         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2395     }
2396     return simManager_->SendCallSetupRequestResult(slotId, accept);
2397 }
2398 
UnlockSimLock(int32_t slotId,const PersoLockInfo & lockInfo,LockStatusResponse & response)2399 int32_t CoreManagerInner::UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response)
2400 {
2401     if (simManager_ == nullptr) {
2402         TELEPHONY_LOGE("simManager_ is null!");
2403         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2404     }
2405     return simManager_->UnlockSimLock(slotId, lockInfo, response);
2406 }
2407 
HasOperatorPrivileges(const int32_t slotId,bool & hasOperatorPrivileges)2408 int32_t CoreManagerInner::HasOperatorPrivileges(const int32_t slotId, bool &hasOperatorPrivileges)
2409 {
2410     TELEPHONY_LOGI("CoreManagerInner::HasOperatorPrivileges slotId:%{public}d", slotId);
2411     if (simManager_ == nullptr) {
2412         TELEPHONY_LOGE("simManager_ can not be null!");
2413         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2414     }
2415     return simManager_->HasOperatorPrivileges(slotId, hasOperatorPrivileges);
2416 }
2417 
GetSimIst(int32_t slotId)2418 std::u16string CoreManagerInner::GetSimIst(int32_t slotId)
2419 {
2420     if (simManager_ == nullptr) {
2421         TELEPHONY_LOGE("simManager_ is null!");
2422         return u"";
2423     }
2424     return simManager_->GetSimIst(slotId);
2425 }
2426 
SaveImsSwitch(int32_t slotId,int32_t imsSwitchValue)2427 int32_t CoreManagerInner::SaveImsSwitch(int32_t slotId, int32_t imsSwitchValue)
2428 {
2429     if (simManager_ == nullptr) {
2430         TELEPHONY_LOGE("simManager_ is null!");
2431         return TELEPHONY_ERROR;
2432     }
2433     return simManager_->SaveImsSwitch(slotId, imsSwitchValue);
2434 }
2435 
QueryImsSwitch(int32_t slotId,int32_t & imsSwitchValue)2436 int32_t CoreManagerInner::QueryImsSwitch(int32_t slotId, int32_t &imsSwitchValue)
2437 {
2438     if (simManager_ == nullptr) {
2439         TELEPHONY_LOGE("simManager_ is null!");
2440         return TELEPHONY_ERROR;
2441     }
2442     return simManager_->QueryImsSwitch(slotId, imsSwitchValue);
2443 }
2444 
IsCTSimCard(int32_t slotId,bool & isCTSimCard)2445 int32_t CoreManagerInner::IsCTSimCard(int32_t slotId, bool &isCTSimCard)
2446 {
2447     if (simManager_ == nullptr) {
2448         TELEPHONY_LOGE("simManager_ is null!");
2449         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2450     }
2451     return simManager_->IsCTSimCard(slotId, isCTSimCard);
2452 }
2453 
IsGsm(int32_t slotId,bool & isGsm)2454 int32_t CoreManagerInner::IsGsm(int32_t slotId, bool &isGsm)
2455 {
2456     if (networkSearchManager_ == nullptr) {
2457         TELEPHONY_LOGE("networkSearchManager is null!");
2458         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2459     }
2460     return networkSearchManager_->IsGsm(slotId, isGsm);
2461 }
2462 
IsCdma(int32_t slotId,bool & isCdma)2463 int32_t CoreManagerInner::IsCdma(int32_t slotId, bool &isCdma)
2464 {
2465     if (networkSearchManager_ == nullptr) {
2466         TELEPHONY_LOGE("networkSearchManager is null!");
2467         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2468     }
2469     return networkSearchManager_->IsCdma(slotId, isCdma);
2470 }
2471 
ProcessSignalIntensity(int32_t slotId,const Rssi & signalIntensity)2472 int32_t CoreManagerInner::ProcessSignalIntensity(int32_t slotId, const Rssi &signalIntensity)
2473 {
2474     if (networkSearchManager_ == nullptr) {
2475         TELEPHONY_LOGE("networkSearchManager_ is null");
2476         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2477     }
2478     return networkSearchManager_->ProcessSignalIntensity(slotId, signalIntensity);
2479 }
2480 
StartRadioOnState(int32_t slotId)2481 int32_t CoreManagerInner::StartRadioOnState(int32_t slotId)
2482 {
2483     if (networkSearchManager_ == nullptr) {
2484         TELEPHONY_LOGE("networkSearchManager is null!");
2485         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2486     }
2487     return networkSearchManager_->StartRadioOnState(slotId);
2488 }
2489 
StartGetRilSignalIntensity(int32_t slotId)2490 int32_t CoreManagerInner::StartGetRilSignalIntensity(int32_t slotId)
2491 {
2492     if (networkSearchManager_ == nullptr) {
2493         TELEPHONY_LOGE("networkSearchManager is null!");
2494         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2495     }
2496     return networkSearchManager_->StartGetRilSignalIntensity(slotId);
2497 }
2498 
IsSetActiveSimInProgress(int32_t slotId)2499 bool CoreManagerInner::IsSetActiveSimInProgress(int32_t slotId)
2500 {
2501     if (simManager_ == nullptr) {
2502         TELEPHONY_LOGE("simManager_ is null!");
2503         return TELEPHONY_ERROR;
2504     }
2505     return simManager_->IsSetActiveSimInProgress(slotId);
2506 }
2507 
IsSetPrimarySlotIdInProgress()2508 bool CoreManagerInner::IsSetPrimarySlotIdInProgress()
2509 {
2510     if (simManager_ == nullptr) {
2511         TELEPHONY_LOGE("simManager_ is null!");
2512         return TELEPHONY_ERROR;
2513     }
2514     return simManager_->IsSetPrimarySlotIdInProgress();
2515 }
2516 
SavePrimarySlotId(int32_t slotId)2517 int32_t CoreManagerInner::SavePrimarySlotId(int32_t slotId)
2518 {
2519     if (simManager_ == nullptr) {
2520         TELEPHONY_LOGE("simManager_ is null!");
2521         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2522     }
2523     return simManager_->SavePrimarySlotId(slotId);
2524 }
2525 
IsDataShareError()2526 bool CoreManagerInner::IsDataShareError()
2527 {
2528     if (simManager_ == nullptr) {
2529         TELEPHONY_LOGE("simManager_ is null!");
2530         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2531     }
2532     return simManager_->IsDataShareError();
2533 }
2534 
ResetDataShareError()2535 void CoreManagerInner::ResetDataShareError()
2536 {
2537     if (simManager_ == nullptr) {
2538         TELEPHONY_LOGE("simManager_ is null!");
2539         return;
2540     }
2541     simManager_->ResetDataShareError();
2542 }
2543 
UpdateImsCapFromChip(int32_t slotId,const ImsCapFromChip & imsCapFromChip)2544 void CoreManagerInner::UpdateImsCapFromChip(int32_t slotId, const ImsCapFromChip &imsCapFromChip)
2545 {
2546     if (simManager_ == nullptr) {
2547         TELEPHONY_LOGE("simManager_ is null!");
2548         return;
2549     }
2550     return simManager_->UpdateImsCapFromChip(slotId, imsCapFromChip);
2551 }
2552 
GetDefaultMainSlotByIccId()2553 int32_t CoreManagerInner::GetDefaultMainSlotByIccId()
2554 {
2555     if (simManager_ == nullptr) {
2556         TELEPHONY_LOGE("simManager_ is null!");
2557         return INVALID_VALUE;
2558     }
2559     return simManager_->GetDefaultMainSlotByIccId();
2560 }
2561 
2562 #ifdef CORE_SERVICE_SUPPORT_ESIM
GetEid(int32_t slotId,std::u16string & eId)2563 int32_t CoreManagerInner::GetEid(int32_t slotId, std::u16string &eId)
2564 {
2565     if (simManager_ == nullptr) {
2566         TELEPHONY_LOGE("simManager_ is null!");
2567         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2568     }
2569     return simManager_->GetEid(slotId, eId);
2570 }
2571 
GetEuiccProfileInfoList(int32_t slotId,GetEuiccProfileInfoListInnerResult & euiccProfileInfoList)2572 int32_t CoreManagerInner::GetEuiccProfileInfoList(int32_t slotId,
2573     GetEuiccProfileInfoListInnerResult &euiccProfileInfoList)
2574 {
2575     if (simManager_ == nullptr) {
2576         TELEPHONY_LOGE("simManager_ is null!");
2577         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2578     }
2579     return simManager_->GetEuiccProfileInfoList(slotId, euiccProfileInfoList);
2580 }
2581 
GetEuiccInfo(int32_t slotId,EuiccInfo & eUiccInfo)2582 int32_t CoreManagerInner::GetEuiccInfo(int32_t slotId, EuiccInfo &eUiccInfo)
2583 {
2584     if (simManager_ == nullptr) {
2585         TELEPHONY_LOGE("simManager_ is null!");
2586         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2587     }
2588     return simManager_->GetEuiccInfo(slotId, eUiccInfo);
2589 }
2590 
DisableProfile(int32_t slotId,int32_t portIndex,const std::u16string & iccId,bool refresh,int32_t & enumResult)2591 int32_t CoreManagerInner::DisableProfile(
2592     int32_t slotId, int32_t portIndex, const std::u16string &iccId, bool refresh, int32_t &enumResult)
2593 {
2594     if (simManager_ == nullptr) {
2595         TELEPHONY_LOGE("simManager_ is null!");
2596         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2597     }
2598     return simManager_->DisableProfile(slotId, portIndex, iccId, refresh, enumResult);
2599 }
2600 
GetSmdsAddress(int32_t slotId,int32_t portIndex,std::u16string & smdsAddress)2601 int32_t CoreManagerInner::GetSmdsAddress(int32_t slotId, int32_t portIndex, std::u16string &smdsAddress)
2602 {
2603     if (simManager_ == nullptr) {
2604         TELEPHONY_LOGE("simManager_ is null!");
2605         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2606     }
2607     return simManager_->GetSmdsAddress(slotId, portIndex, smdsAddress);
2608 }
2609 
GetRulesAuthTable(int32_t slotId,int32_t portIndex,EuiccRulesAuthTable & eUiccRulesAuthTable)2610 int32_t CoreManagerInner::GetRulesAuthTable(int32_t slotId, int32_t portIndex, EuiccRulesAuthTable &eUiccRulesAuthTable)
2611 {
2612     if (simManager_ == nullptr) {
2613         TELEPHONY_LOGE("simManager_ is null!");
2614         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2615     }
2616     return simManager_->GetRulesAuthTable(slotId, portIndex, eUiccRulesAuthTable);
2617 }
2618 
GetEuiccChallenge(int32_t slotId,int32_t portIndex,ResponseEsimInnerResult & responseResult)2619 int32_t CoreManagerInner::GetEuiccChallenge(int32_t slotId, int32_t portIndex, ResponseEsimInnerResult &responseResult)
2620 {
2621     if (simManager_ == nullptr) {
2622         TELEPHONY_LOGE("simManager_ is null!");
2623         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2624     }
2625     return simManager_->GetEuiccChallenge(slotId, portIndex, responseResult);
2626 }
2627 
GetDefaultSmdpAddress(int32_t slotId,std::u16string & defaultSmdpAddress)2628 int32_t CoreManagerInner::GetDefaultSmdpAddress(int32_t slotId, std::u16string &defaultSmdpAddress)
2629 {
2630     if (simManager_ == nullptr) {
2631         TELEPHONY_LOGE("simManager_ is null!");
2632         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2633     }
2634     return simManager_->GetDefaultSmdpAddress(slotId, defaultSmdpAddress);
2635 }
2636 
CancelSession(int32_t slotId,const std::u16string & transactionId,CancelReason cancelReason,ResponseEsimInnerResult & responseResult)2637 int32_t CoreManagerInner::CancelSession(int32_t slotId, const std::u16string &transactionId,
2638     CancelReason cancelReason, ResponseEsimInnerResult &responseResult)
2639 {
2640     if (simManager_ == nullptr) {
2641         TELEPHONY_LOGE("simManager_ is null!");
2642         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2643     }
2644     return simManager_->CancelSession(slotId, transactionId, cancelReason, responseResult);
2645 }
2646 
GetProfile(int32_t slotId,int32_t portIndex,const std::u16string & iccId,EuiccProfile & eUiccProfile)2647 int32_t CoreManagerInner::GetProfile(
2648     int32_t slotId, int32_t portIndex, const std::u16string &iccId, EuiccProfile &eUiccProfile)
2649 {
2650     if (simManager_ == nullptr) {
2651         TELEPHONY_LOGE("simManager_ is null!");
2652         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2653     }
2654     return simManager_->GetProfile(slotId, portIndex, iccId, eUiccProfile);
2655 }
2656 
ResetMemory(int32_t slotId,ResetOption resetOption,int32_t & enumResult)2657 int32_t CoreManagerInner::ResetMemory(int32_t slotId, ResetOption resetOption, int32_t &enumResult)
2658 {
2659     if (simManager_ == nullptr) {
2660         TELEPHONY_LOGE("simManager_ is null!");
2661         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2662     }
2663     return simManager_->ResetMemory(slotId, resetOption, enumResult);
2664 }
2665 
SetDefaultSmdpAddress(int32_t slotId,const std::u16string & defaultSmdpAddress,int32_t & enumResult)2666 int32_t CoreManagerInner::SetDefaultSmdpAddress(
2667     int32_t slotId, const std::u16string &defaultSmdpAddress, int32_t &enumResult)
2668 {
2669     if (simManager_ == nullptr) {
2670         TELEPHONY_LOGE("simManager_ is null!");
2671         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2672     }
2673     return simManager_->SetDefaultSmdpAddress(slotId, defaultSmdpAddress, enumResult);
2674 }
2675 
IsSupported(int32_t slotId)2676 bool CoreManagerInner::IsSupported(int32_t slotId)
2677 {
2678     if (simManager_ == nullptr) {
2679         TELEPHONY_LOGE("simManager_ is null!");
2680         return false;
2681     }
2682     return simManager_->IsSupported(slotId);
2683 }
2684 
SendApduData(int32_t slotId,const std::u16string & aid,const EsimApduData & apduData,ResponseEsimInnerResult & responseResult)2685 int32_t CoreManagerInner::SendApduData(
2686     int32_t slotId, const std::u16string &aid, const EsimApduData &apduData, ResponseEsimInnerResult &responseResult)
2687 {
2688     if (simManager_ == nullptr) {
2689         TELEPHONY_LOGE("simManager_ is null!");
2690         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2691     }
2692     return simManager_->SendApduData(slotId, aid, apduData, responseResult);
2693 }
2694 
PrepareDownload(int32_t slotId,const DownLoadConfigInfo & downLoadConfigInfo,ResponseEsimInnerResult & responseResult)2695 int32_t CoreManagerInner::PrepareDownload(
2696     int32_t slotId, const DownLoadConfigInfo &downLoadConfigInfo, ResponseEsimInnerResult &responseResult)
2697 {
2698     if (simManager_ == nullptr) {
2699         TELEPHONY_LOGE("simManager_ is null!");
2700         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2701     }
2702     return simManager_->PrepareDownload(slotId, downLoadConfigInfo, responseResult);
2703 }
2704 
LoadBoundProfilePackage(int32_t slotId,int32_t portIndex,const std::u16string & boundProfilePackage,ResponseEsimBppResult & responseResult)2705 int32_t CoreManagerInner::LoadBoundProfilePackage(int32_t slotId, int32_t portIndex,
2706     const std::u16string &boundProfilePackage, ResponseEsimBppResult &responseResult)
2707 {
2708     if (simManager_ == nullptr) {
2709         TELEPHONY_LOGE("simManager_ is null!");
2710         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2711     }
2712     return simManager_->LoadBoundProfilePackage(slotId, portIndex, boundProfilePackage, responseResult);
2713 }
2714 
ListNotifications(int32_t slotId,int32_t portIndex,Event events,EuiccNotificationList & notificationList)2715 int32_t CoreManagerInner::ListNotifications(
2716     int32_t slotId, int32_t portIndex, Event events, EuiccNotificationList &notificationList)
2717 {
2718     if (simManager_ == nullptr) {
2719         TELEPHONY_LOGE("simManager_ is null!");
2720         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2721     }
2722     return simManager_->ListNotifications(slotId, portIndex, events, notificationList);
2723 }
2724 
RetrieveNotificationList(int32_t slotId,int32_t portIndex,Event events,EuiccNotificationList & notificationList)2725 int32_t CoreManagerInner::RetrieveNotificationList(
2726     int32_t slotId, int32_t portIndex, Event events, EuiccNotificationList &notificationList)
2727 {
2728     if (simManager_ == nullptr) {
2729         TELEPHONY_LOGE("simManager_ is null!");
2730         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2731     }
2732     return simManager_->RetrieveNotificationList(slotId, portIndex, events, notificationList);
2733 }
2734 
RetrieveNotification(int32_t slotId,int32_t portIndex,int32_t seqNumber,EuiccNotification & notification)2735 int32_t CoreManagerInner::RetrieveNotification(
2736     int32_t slotId, int32_t portIndex, int32_t seqNumber, EuiccNotification &notification)
2737 {
2738     if (simManager_ == nullptr) {
2739         TELEPHONY_LOGE("simManager_ is null!");
2740         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2741     }
2742     return simManager_->RetrieveNotification(slotId, portIndex, seqNumber, notification);
2743 }
2744 
RemoveNotificationFromList(int32_t slotId,int32_t portIndex,int32_t seqNumber,int32_t & enumResult)2745 int32_t CoreManagerInner::RemoveNotificationFromList(
2746     int32_t slotId, int32_t portIndex, int32_t seqNumber, int32_t &enumResult)
2747 {
2748     if (simManager_ == nullptr) {
2749         TELEPHONY_LOGE("simManager_ is null!");
2750         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2751     }
2752     return simManager_->RemoveNotificationFromList(slotId, portIndex, seqNumber, enumResult);
2753 }
2754 
GetEuiccInfo2(int32_t slotId,int32_t portIndex,EuiccInfo2 & euiccInfo2)2755 int32_t CoreManagerInner::GetEuiccInfo2(int32_t slotId, int32_t portIndex, EuiccInfo2 &euiccInfo2)
2756 {
2757     if (simManager_ == nullptr) {
2758         TELEPHONY_LOGE("simManager_ is null!");
2759         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2760     }
2761     return simManager_->GetEuiccInfo2(slotId, portIndex, euiccInfo2);
2762 }
2763 
AuthenticateServer(int32_t slotId,const AuthenticateConfigInfo & authenticateConfigInfo,ResponseEsimInnerResult & responseResult)2764 int32_t CoreManagerInner::AuthenticateServer(
2765     int32_t slotId, const AuthenticateConfigInfo &authenticateConfigInfo, ResponseEsimInnerResult &responseResult)
2766 {
2767     if (simManager_ == nullptr) {
2768         TELEPHONY_LOGE("simManager_ is null!");
2769         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2770     }
2771     return simManager_->AuthenticateServer(slotId, authenticateConfigInfo, responseResult);
2772 }
2773 
DeleteProfile(int32_t slotId,const std::u16string & iccId,int32_t & enumResult)2774 int32_t CoreManagerInner::DeleteProfile(int32_t slotId, const std::u16string &iccId, int32_t &enumResult)
2775 {
2776     if (simManager_ == nullptr) {
2777         TELEPHONY_LOGE("simManager_ is null!");
2778         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2779     }
2780     return simManager_->DeleteProfile(slotId, iccId, enumResult);
2781 }
2782 
SwitchToProfile(int32_t slotId,int32_t portIndex,const std::u16string & iccId,bool forceDisableProfile,int32_t & enumResult)2783 int32_t CoreManagerInner::SwitchToProfile(int32_t slotId, int32_t portIndex, const std::u16string &iccId,
2784     bool forceDisableProfile, int32_t &enumResult)
2785 {
2786     if (simManager_ == nullptr) {
2787         TELEPHONY_LOGE("simManager_ is null!");
2788         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2789     }
2790     return simManager_->SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, enumResult);
2791 }
2792 
SetProfileNickname(int32_t slotId,const std::u16string & iccId,const std::u16string & nickname,int32_t & enumResult)2793 int32_t CoreManagerInner::SetProfileNickname(
2794     int32_t slotId, const std::u16string &iccId, const std::u16string &nickname, int32_t &enumResult)
2795 {
2796     if (simManager_ == nullptr) {
2797         TELEPHONY_LOGE("simManager_ is null!");
2798         return TELEPHONY_ERR_LOCAL_PTR_NULL;
2799     }
2800     return simManager_->SetProfileNickname(slotId, iccId, nickname, enumResult);
2801 }
2802 #endif
2803 /******************** simManager_ end ************************/
2804 } // namespace Telephony
2805 } // namespace OHOS
2806