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