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