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