111fccf17Sopenharmony_ci/* 211fccf17Sopenharmony_ci * Copyright (C) 2021-2024 Huawei Device Co., Ltd. 311fccf17Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 411fccf17Sopenharmony_ci * you may not use this file except in compliance with the License. 511fccf17Sopenharmony_ci * You may obtain a copy of the License at 611fccf17Sopenharmony_ci * 711fccf17Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 811fccf17Sopenharmony_ci * 911fccf17Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1011fccf17Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1111fccf17Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1211fccf17Sopenharmony_ci * See the License for the specific language governing permissions and 1311fccf17Sopenharmony_ci * limitations under the License. 1411fccf17Sopenharmony_ci */ 1511fccf17Sopenharmony_ci 1611fccf17Sopenharmony_ci#include "hril_manager.h" 1711fccf17Sopenharmony_ci 1811fccf17Sopenharmony_ci#include <cstring> 1911fccf17Sopenharmony_ci#include "hril_base.h" 2011fccf17Sopenharmony_ci#include "hril_event_map.h" 2111fccf17Sopenharmony_ci#include "hril_notification.h" 2211fccf17Sopenharmony_ci#include "hril_request.h" 2311fccf17Sopenharmony_ci#include "parameter.h" 2411fccf17Sopenharmony_ci 2511fccf17Sopenharmony_cinamespace OHOS { 2611fccf17Sopenharmony_cinamespace Telephony { 2711fccf17Sopenharmony_ciconstexpr const char *MODULE_HRIL_CALL = "hrilCall"; 2811fccf17Sopenharmony_ciconstexpr const char *MODULE_HRIL_DATA = "hrilData"; 2911fccf17Sopenharmony_ciconstexpr const char *MODULE_HRIL_MODEM = "hrilModem"; 3011fccf17Sopenharmony_ciconstexpr const char *MODULE_HRIL_SIM = "hrilSim"; 3111fccf17Sopenharmony_ciconstexpr const char *MODULE_HRIL_NETWORK = "hrilNetwork"; 3211fccf17Sopenharmony_ciconstexpr const char *MODULE_HRIL_SMS = "hrilSms"; 3311fccf17Sopenharmony_ciconst std::string RUNNINGLOCK_NAME = "HRilRunningLock"; 3411fccf17Sopenharmony_cistatic bool g_isHrilManagerDestory = false; 3511fccf17Sopenharmony_cistatic std::shared_ptr<HRilManager> g_manager = std::make_shared<HRilManager>(); 3611fccf17Sopenharmony_cistatic pthread_mutex_t dispatchMutex = PTHREAD_MUTEX_INITIALIZER; 3711fccf17Sopenharmony_cistd::shared_ptr<HRilManager> HRilManager::manager_ = g_manager; 3811fccf17Sopenharmony_cistd::unordered_map<int32_t, int32_t> HRilManager::notificationMap_ = { 3911fccf17Sopenharmony_ci#include "hril_notification_map.h" 4011fccf17Sopenharmony_ci}; 4111fccf17Sopenharmony_ci 4211fccf17Sopenharmony_ci#ifdef ABILITY_POWER_SUPPORT 4311fccf17Sopenharmony_ciconstexpr int32_t RUNNINGLOCK_TIMEOUTMS_LASTING = -1; 4411fccf17Sopenharmony_ciusing namespace OHOS::HDI::Power::V1_2; 4511fccf17Sopenharmony_ci#endif 4611fccf17Sopenharmony_ci 4711fccf17Sopenharmony_cistatic bool IsHrilManagerValid() 4811fccf17Sopenharmony_ci{ 4911fccf17Sopenharmony_ci if (g_isHrilManagerDestory || g_manager == nullptr) { 5011fccf17Sopenharmony_ci return false; 5111fccf17Sopenharmony_ci } 5211fccf17Sopenharmony_ci return true; 5311fccf17Sopenharmony_ci} 5411fccf17Sopenharmony_ci 5511fccf17Sopenharmony_ciint32_t HRilManager::GetMaxSimSlotCount() 5611fccf17Sopenharmony_ci{ 5711fccf17Sopenharmony_ci return hrilSimSlotCount_; 5811fccf17Sopenharmony_ci} 5911fccf17Sopenharmony_ci 6011fccf17Sopenharmony_ciReqDataInfo *HRilManager::CreateHRilRequest(int32_t serial, int32_t slotId, int32_t request) 6111fccf17Sopenharmony_ci{ 6211fccf17Sopenharmony_ci ReqDataInfo *requestInfo = nullptr; 6311fccf17Sopenharmony_ci HRilSimSlotId simSlotId = (HRilSimSlotId)slotId; 6411fccf17Sopenharmony_ci requestInfo = (ReqDataInfo *)malloc(sizeof(ReqDataInfo)); 6511fccf17Sopenharmony_ci if (requestInfo == nullptr) { 6611fccf17Sopenharmony_ci return nullptr; 6711fccf17Sopenharmony_ci } 6811fccf17Sopenharmony_ci requestInfo->slotId = simSlotId; 6911fccf17Sopenharmony_ci requestInfo->request = request; 7011fccf17Sopenharmony_ci requestInfo->serial = serial; 7111fccf17Sopenharmony_ci std::lock_guard<std::mutex> lockRequest(requestListLock_); 7211fccf17Sopenharmony_ci auto iter = requestList_.find(request); 7311fccf17Sopenharmony_ci if (iter != requestList_.end()) { 7411fccf17Sopenharmony_ci std::list<ReqDataInfo *> &reqDataSet = iter->second; 7511fccf17Sopenharmony_ci reqDataSet.push_back(requestInfo); 7611fccf17Sopenharmony_ci TELEPHONY_LOGD("CreateHRilRequest requestId=%{public}d, list size: %{public}zu", request, reqDataSet.size()); 7711fccf17Sopenharmony_ci } else { 7811fccf17Sopenharmony_ci TELEPHONY_LOGD("CreateHRilRequest create requestList, requestId=%{public}d", request); 7911fccf17Sopenharmony_ci std::list<ReqDataInfo *> reqDataSet; 8011fccf17Sopenharmony_ci reqDataSet.push_back(requestInfo); 8111fccf17Sopenharmony_ci requestList_.emplace(request, reqDataSet); 8211fccf17Sopenharmony_ci } 8311fccf17Sopenharmony_ci return requestInfo; 8411fccf17Sopenharmony_ci} 8511fccf17Sopenharmony_ci 8611fccf17Sopenharmony_civoid HRilManager::ReleaseHRilRequest(int32_t request, ReqDataInfo *requestInfo) 8711fccf17Sopenharmony_ci{ 8811fccf17Sopenharmony_ci std::lock_guard<std::mutex> lockRequest(requestListLock_); 8911fccf17Sopenharmony_ci auto iter = requestList_.find(request); 9011fccf17Sopenharmony_ci if (iter != requestList_.end()) { 9111fccf17Sopenharmony_ci std::list<ReqDataInfo *> &reqDataSet = iter->second; 9211fccf17Sopenharmony_ci auto it = find(reqDataSet.begin(), reqDataSet.end(), requestInfo); 9311fccf17Sopenharmony_ci if (it != reqDataSet.end()) { 9411fccf17Sopenharmony_ci if (*it != nullptr) { 9511fccf17Sopenharmony_ci free(*it); 9611fccf17Sopenharmony_ci } 9711fccf17Sopenharmony_ci reqDataSet.erase(it); 9811fccf17Sopenharmony_ci } 9911fccf17Sopenharmony_ci } 10011fccf17Sopenharmony_ci} 10111fccf17Sopenharmony_ci 10211fccf17Sopenharmony_citemplate<typename ClassTypePtr, typename FuncType, typename... ParamTypes> 10311fccf17Sopenharmony_ciinline int32_t HRilManager::TaskSchedule( 10411fccf17Sopenharmony_ci const std::string module, ClassTypePtr &_obj, FuncType &&_func, ParamTypes &&... _args) 10511fccf17Sopenharmony_ci{ 10611fccf17Sopenharmony_ci pthread_mutex_lock(&dispatchMutex); 10711fccf17Sopenharmony_ci if (_func == nullptr || _obj == nullptr || g_isHrilManagerDestory) { 10811fccf17Sopenharmony_ci TELEPHONY_LOGE( 10911fccf17Sopenharmony_ci "%{public}s func or obj is null pointer or destroy %{public}d", module.c_str(), g_isHrilManagerDestory); 11011fccf17Sopenharmony_ci pthread_mutex_unlock(&dispatchMutex); 11111fccf17Sopenharmony_ci return HDF_FAILURE; 11211fccf17Sopenharmony_ci } 11311fccf17Sopenharmony_ci int32_t ret = (_obj.get()->*(_func))(std::forward<ParamTypes>(_args)...); 11411fccf17Sopenharmony_ci pthread_mutex_unlock(&dispatchMutex); 11511fccf17Sopenharmony_ci return ret; 11611fccf17Sopenharmony_ci} 11711fccf17Sopenharmony_ci 11811fccf17Sopenharmony_civoid HRilManager::RegisterCallFuncs(int32_t slotId, const HRilCallReq *callFuncs) 11911fccf17Sopenharmony_ci{ 12011fccf17Sopenharmony_ci if (hrilCall_[slotId] != nullptr) { 12111fccf17Sopenharmony_ci hrilCall_[slotId]->RegisterCallFuncs(callFuncs); 12211fccf17Sopenharmony_ci } 12311fccf17Sopenharmony_ci} 12411fccf17Sopenharmony_ci 12511fccf17Sopenharmony_civoid HRilManager::RegisterDataFuncs(int32_t slotId, const HRilDataReq *dataFuncs) 12611fccf17Sopenharmony_ci{ 12711fccf17Sopenharmony_ci if (hrilData_[slotId] != nullptr) { 12811fccf17Sopenharmony_ci hrilData_[slotId]->RegisterDataFuncs(dataFuncs); 12911fccf17Sopenharmony_ci } 13011fccf17Sopenharmony_ci} 13111fccf17Sopenharmony_ci 13211fccf17Sopenharmony_civoid HRilManager::RegisterModemFuncs(int32_t slotId, const HRilModemReq *modemFuncs) 13311fccf17Sopenharmony_ci{ 13411fccf17Sopenharmony_ci if (hrilModem_[slotId] != nullptr) { 13511fccf17Sopenharmony_ci hrilModem_[slotId]->RegisterModemFuncs(modemFuncs); 13611fccf17Sopenharmony_ci } 13711fccf17Sopenharmony_ci} 13811fccf17Sopenharmony_ci 13911fccf17Sopenharmony_civoid HRilManager::RegisterNetworkFuncs(int32_t slotId, const HRilNetworkReq *networkFuncs) 14011fccf17Sopenharmony_ci{ 14111fccf17Sopenharmony_ci if (hrilNetwork_[slotId] != nullptr) { 14211fccf17Sopenharmony_ci hrilNetwork_[slotId]->RegisterNetworkFuncs(networkFuncs); 14311fccf17Sopenharmony_ci } 14411fccf17Sopenharmony_ci} 14511fccf17Sopenharmony_ci 14611fccf17Sopenharmony_civoid HRilManager::RegisterSimFuncs(int32_t slotId, const HRilSimReq *simFuncs) 14711fccf17Sopenharmony_ci{ 14811fccf17Sopenharmony_ci if (hrilSim_[slotId] != nullptr) { 14911fccf17Sopenharmony_ci hrilSim_[slotId]->RegisterSimFuncs(simFuncs); 15011fccf17Sopenharmony_ci } 15111fccf17Sopenharmony_ci} 15211fccf17Sopenharmony_ci 15311fccf17Sopenharmony_civoid HRilManager::RegisterSmsFuncs(int32_t slotId, const HRilSmsReq *smsFuncs) 15411fccf17Sopenharmony_ci{ 15511fccf17Sopenharmony_ci if (hrilSms_[slotId] != nullptr) { 15611fccf17Sopenharmony_ci hrilSms_[slotId]->RegisterSmsFuncs(smsFuncs); 15711fccf17Sopenharmony_ci } 15811fccf17Sopenharmony_ci} 15911fccf17Sopenharmony_ci 16011fccf17Sopenharmony_ci#ifdef ABILITY_POWER_SUPPORT 16111fccf17Sopenharmony_cistatic OHOS::HDI::Power::V1_2::RunningLockInfo FillRunningLockInfo(const std::string &name, int32_t timeoutMs) 16211fccf17Sopenharmony_ci{ 16311fccf17Sopenharmony_ci OHOS::HDI::Power::V1_2::RunningLockInfo filledInfo {}; 16411fccf17Sopenharmony_ci filledInfo.name = name; 16511fccf17Sopenharmony_ci filledInfo.type = OHOS::HDI::Power::V1_2::RunningLockType::RUNNINGLOCK_BACKGROUND_PHONE; 16611fccf17Sopenharmony_ci filledInfo.timeoutMs = timeoutMs; 16711fccf17Sopenharmony_ci filledInfo.uid = static_cast<int32_t>(getuid()); 16811fccf17Sopenharmony_ci filledInfo.pid = static_cast<int32_t>(getpid()); 16911fccf17Sopenharmony_ci return filledInfo; 17011fccf17Sopenharmony_ci} 17111fccf17Sopenharmony_ci 17211fccf17Sopenharmony_cistatic void RunningLockCallback(uint8_t *param) 17311fccf17Sopenharmony_ci{ 17411fccf17Sopenharmony_ci if (!IsHrilManagerValid() || param == nullptr) { 17511fccf17Sopenharmony_ci TELEPHONY_LOGE("check nullptr fail."); 17611fccf17Sopenharmony_ci return; 17711fccf17Sopenharmony_ci } 17811fccf17Sopenharmony_ci int serialNum = *reinterpret_cast<int *>(param); 17911fccf17Sopenharmony_ci delete param; 18011fccf17Sopenharmony_ci param = nullptr; 18111fccf17Sopenharmony_ci std::lock_guard<std::mutex> lockRequest(g_manager->mutexRunningLock_); 18211fccf17Sopenharmony_ci TELEPHONY_LOGD("RunningLockCallback, serialNum:%{public}d, runningSerialNum_:%{public}d", serialNum, 18311fccf17Sopenharmony_ci static_cast<int>(g_manager->runningSerialNum_)); 18411fccf17Sopenharmony_ci if (g_manager->powerInterface_ == nullptr || serialNum != static_cast<int>(g_manager->runningSerialNum_)) { 18511fccf17Sopenharmony_ci return; 18611fccf17Sopenharmony_ci } 18711fccf17Sopenharmony_ci g_manager->runningLockCount_ = 0; 18811fccf17Sopenharmony_ci OHOS::HDI::Power::V1_2::RunningLockInfo filledInfo = FillRunningLockInfo( 18911fccf17Sopenharmony_ci RUNNINGLOCK_NAME, RUNNINGLOCK_TIMEOUTMS_LASTING); 19011fccf17Sopenharmony_ci g_manager->powerInterface_->UnholdRunningLock(filledInfo); 19111fccf17Sopenharmony_ci TELEPHONY_LOGD("RunningLockCallback, UnLock"); 19211fccf17Sopenharmony_ci} 19311fccf17Sopenharmony_ci#endif 19411fccf17Sopenharmony_ci 19511fccf17Sopenharmony_civoid HRilManager::ApplyRunningLock(void) 19611fccf17Sopenharmony_ci{ 19711fccf17Sopenharmony_ci#ifdef ABILITY_POWER_SUPPORT 19811fccf17Sopenharmony_ci if (!IsHrilManagerValid() || timerCallback_ == nullptr) { 19911fccf17Sopenharmony_ci TELEPHONY_LOGE("check nullptr fail."); 20011fccf17Sopenharmony_ci return; 20111fccf17Sopenharmony_ci } 20211fccf17Sopenharmony_ci 20311fccf17Sopenharmony_ci std::lock_guard<std::mutex> lockRequest(mutexRunningLock_); 20411fccf17Sopenharmony_ci if (powerInterface_ != nullptr) { 20511fccf17Sopenharmony_ci OHOS::HDI::Power::V1_2::RunningLockInfo filledInfo = FillRunningLockInfo( 20611fccf17Sopenharmony_ci RUNNINGLOCK_NAME, RUNNINGLOCK_TIMEOUTMS_LASTING); 20711fccf17Sopenharmony_ci powerInterface_->HoldRunningLock(filledInfo); 20811fccf17Sopenharmony_ci struct timeval tv = { 0, RUNNING_LOCK_DEFAULT_TIMEOUT_US }; 20911fccf17Sopenharmony_ci runningLockCount_++; 21011fccf17Sopenharmony_ci runningSerialNum_++; 21111fccf17Sopenharmony_ci uint8_t *serialNum = reinterpret_cast<uint8_t *>(new int(runningSerialNum_)); 21211fccf17Sopenharmony_ci timerCallback_->HRilSetTimerCallbackInfo(RunningLockCallback, serialNum, &tv); 21311fccf17Sopenharmony_ci TELEPHONY_LOGD("ApplyRunningLock, runningLockCount_:%{public}d, runningSerialNum_:%{public}d", 21411fccf17Sopenharmony_ci static_cast<int>(runningLockCount_), static_cast<int>(runningSerialNum_)); 21511fccf17Sopenharmony_ci } else { 21611fccf17Sopenharmony_ci /* Since the power management subsystem starts slower than the RilAdapter, 21711fccf17Sopenharmony_ci * the wakelock needs to be recreated. 21811fccf17Sopenharmony_ci */ 21911fccf17Sopenharmony_ci TELEPHONY_LOGW("The powerInterface_ is nullptr, needs to be recreated."); 22011fccf17Sopenharmony_ci powerInterface_ = IPowerInterface::Get(); 22111fccf17Sopenharmony_ci if (powerInterface_ == nullptr) { 22211fccf17Sopenharmony_ci TELEPHONY_LOGE("failed to get power hdi interface"); 22311fccf17Sopenharmony_ci } 22411fccf17Sopenharmony_ci } 22511fccf17Sopenharmony_ci#endif 22611fccf17Sopenharmony_ci} 22711fccf17Sopenharmony_ci 22811fccf17Sopenharmony_civoid HRilManager::ReleaseRunningLock(void) 22911fccf17Sopenharmony_ci{ 23011fccf17Sopenharmony_ci#ifdef ABILITY_POWER_SUPPORT 23111fccf17Sopenharmony_ci std::lock_guard<std::mutex> lockRequest(mutexRunningLock_); 23211fccf17Sopenharmony_ci TELEPHONY_LOGD("ReleaseRunningLock, runningLockCount_:%{public}d", static_cast<int>(runningLockCount_)); 23311fccf17Sopenharmony_ci if (powerInterface_ == nullptr) { 23411fccf17Sopenharmony_ci TELEPHONY_LOGE("powerInterface_ is nullptr"); 23511fccf17Sopenharmony_ci return; 23611fccf17Sopenharmony_ci } 23711fccf17Sopenharmony_ci if (runningLockCount_ > 1) { 23811fccf17Sopenharmony_ci runningLockCount_--; 23911fccf17Sopenharmony_ci } else { 24011fccf17Sopenharmony_ci runningLockCount_ = 0; 24111fccf17Sopenharmony_ci OHOS::HDI::Power::V1_2::RunningLockInfo filledInfo = FillRunningLockInfo( 24211fccf17Sopenharmony_ci RUNNINGLOCK_NAME, RUNNINGLOCK_TIMEOUTMS_LASTING); 24311fccf17Sopenharmony_ci powerInterface_->UnholdRunningLock(filledInfo); 24411fccf17Sopenharmony_ci TELEPHONY_LOGD("ReleaseRunningLock UnLock"); 24511fccf17Sopenharmony_ci } 24611fccf17Sopenharmony_ci#endif 24711fccf17Sopenharmony_ci} 24811fccf17Sopenharmony_ci 24911fccf17Sopenharmony_citemplate<typename T> 25011fccf17Sopenharmony_civoid HRilManager::OnReport(std::vector<std::unique_ptr<T>> &subModules, int32_t slotId, const ReportInfo *reportInfo, 25111fccf17Sopenharmony_ci const uint8_t *response, size_t responseLen) 25211fccf17Sopenharmony_ci{ 25311fccf17Sopenharmony_ci if (reportInfo == nullptr) { 25411fccf17Sopenharmony_ci TELEPHONY_LOGE("OnReport reportInfo is null!!!"); 25511fccf17Sopenharmony_ci return; 25611fccf17Sopenharmony_ci } 25711fccf17Sopenharmony_ci if (slotId < 0 || static_cast<uint32_t>(slotId) >= subModules.size()) { 25811fccf17Sopenharmony_ci TELEPHONY_LOGE("OnReport subModules out of bounds!!!"); 25911fccf17Sopenharmony_ci return; 26011fccf17Sopenharmony_ci } 26111fccf17Sopenharmony_ci switch (reportInfo->type) { 26211fccf17Sopenharmony_ci case static_cast<int32_t>(ReportType::HRIL_RESPONSE): 26311fccf17Sopenharmony_ci ReportResponse(subModules, slotId, reportInfo, response, responseLen); 26411fccf17Sopenharmony_ci break; 26511fccf17Sopenharmony_ci case static_cast<int32_t>(ReportType::HRIL_NOTIFICATION): 26611fccf17Sopenharmony_ci ReportNotification(subModules, slotId, reportInfo, response, responseLen); 26711fccf17Sopenharmony_ci break; 26811fccf17Sopenharmony_ci default: 26911fccf17Sopenharmony_ci break; 27011fccf17Sopenharmony_ci } 27111fccf17Sopenharmony_ci} 27211fccf17Sopenharmony_ci 27311fccf17Sopenharmony_citemplate<typename T> 27411fccf17Sopenharmony_civoid HRilManager::ReportResponse(std::vector<std::unique_ptr<T>> &subModules, int32_t slotId, 27511fccf17Sopenharmony_ci const ReportInfo *reportInfo, const uint8_t *response, size_t responseLen) 27611fccf17Sopenharmony_ci{ 27711fccf17Sopenharmony_ci ReqDataInfo *reqInfo = (ReqDataInfo *)reportInfo->requestInfo; 27811fccf17Sopenharmony_ci if (reqInfo == nullptr) { 27911fccf17Sopenharmony_ci TELEPHONY_LOGE("reqInfo is null!!!"); 28011fccf17Sopenharmony_ci return; 28111fccf17Sopenharmony_ci } 28211fccf17Sopenharmony_ci auto iter = requestEventMap_.find(reqInfo->request); 28311fccf17Sopenharmony_ci if (iter != requestEventMap_.end()) { 28411fccf17Sopenharmony_ci TELEPHONY_LOGI("requestId:%{public}d, event:%{public}s", reqInfo->request, iter->second.c_str()); 28511fccf17Sopenharmony_ci } else { 28611fccf17Sopenharmony_ci TELEPHONY_LOGD("requestId:%{public}d", reqInfo->request); 28711fccf17Sopenharmony_ci } 28811fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo responseInfo = {}; 28911fccf17Sopenharmony_ci responseInfo.serial = reqInfo->serial; 29011fccf17Sopenharmony_ci responseInfo.error = (HDI::Ril::V1_1::RilErrType)reportInfo->error; 29111fccf17Sopenharmony_ci responseInfo.type = HDI::Ril::V1_1::RIL_RESPONSE_REQUEST; 29211fccf17Sopenharmony_ci if (HRIL_NEED_ACK == reportInfo->ack) { 29311fccf17Sopenharmony_ci ApplyRunningLock(); 29411fccf17Sopenharmony_ci responseInfo.type = HDI::Ril::V1_1::RIL_RESPONSE_REQUEST_MUST_ACK; 29511fccf17Sopenharmony_ci } 29611fccf17Sopenharmony_ci int32_t requestId = reqInfo->request; 29711fccf17Sopenharmony_ci ReleaseHRilRequest(requestId, reqInfo); 29811fccf17Sopenharmony_ci subModules[slotId]->template ProcessResponse<T>(requestId, responseInfo, response, responseLen); 29911fccf17Sopenharmony_ci} 30011fccf17Sopenharmony_ci 30111fccf17Sopenharmony_citemplate<typename T> 30211fccf17Sopenharmony_civoid HRilManager::ReportNotification(std::vector<std::unique_ptr<T>> &subModules, int32_t slotId, 30311fccf17Sopenharmony_ci const ReportInfo *reportInfo, const uint8_t *response, size_t responseLen) 30411fccf17Sopenharmony_ci{ 30511fccf17Sopenharmony_ci int32_t notifyType = HDI::Ril::V1_1::RIL_RESPONSE_NOTICE; 30611fccf17Sopenharmony_ci auto iter = notificationMap_.find(reportInfo->notifyId); 30711fccf17Sopenharmony_ci auto event = notificationEventMap_.find(reportInfo->notifyId); 30811fccf17Sopenharmony_ci if (iter != notificationMap_.end()) { 30911fccf17Sopenharmony_ci if (reportInfo->notifyId == HNOTI_NETWORK_CS_REG_STATUS_UPDATED || 31011fccf17Sopenharmony_ci reportInfo->notifyId == HNOTI_NETWORK_SIGNAL_STRENGTH_UPDATED || 31111fccf17Sopenharmony_ci reportInfo->notifyId == HNOTI_CALL_EMERGENCY_NUMBER_REPORT || 31211fccf17Sopenharmony_ci reportInfo->notifyId == HNOTI_MODEM_DSDS_MODE_UPDATED) { 31311fccf17Sopenharmony_ci TELEPHONY_LOGD("notifyId:%{public}d, event:%{public}s", reportInfo->notifyId, event->second.c_str()); 31411fccf17Sopenharmony_ci } else { 31511fccf17Sopenharmony_ci TELEPHONY_LOGI("notifyId:%{public}d, event:%{public}s", reportInfo->notifyId, event->second.c_str()); 31611fccf17Sopenharmony_ci } 31711fccf17Sopenharmony_ci if (NEED_LOCK == iter->second) { 31811fccf17Sopenharmony_ci ApplyRunningLock(); 31911fccf17Sopenharmony_ci notifyType = HDI::Ril::V1_1::RIL_RESPONSE_NOTICE_MUST_ACK; 32011fccf17Sopenharmony_ci } 32111fccf17Sopenharmony_ci } 32211fccf17Sopenharmony_ci subModules[slotId]->template ProcessNotify<T>(notifyType, reportInfo, response, responseLen); 32311fccf17Sopenharmony_ci} 32411fccf17Sopenharmony_ci 32511fccf17Sopenharmony_civoid HRilManager::OnCallReport( 32611fccf17Sopenharmony_ci int32_t slotId, const ReportInfo *reportInfo, const uint8_t *response, size_t responseLen) 32711fccf17Sopenharmony_ci{ 32811fccf17Sopenharmony_ci OnReport(hrilCall_, slotId, reportInfo, response, responseLen); 32911fccf17Sopenharmony_ci} 33011fccf17Sopenharmony_ci 33111fccf17Sopenharmony_civoid HRilManager::OnDataReport( 33211fccf17Sopenharmony_ci int32_t slotId, const ReportInfo *reportInfo, const uint8_t *response, size_t responseLen) 33311fccf17Sopenharmony_ci{ 33411fccf17Sopenharmony_ci OnReport(hrilData_, slotId, reportInfo, response, responseLen); 33511fccf17Sopenharmony_ci} 33611fccf17Sopenharmony_ci 33711fccf17Sopenharmony_civoid HRilManager::OnModemReport( 33811fccf17Sopenharmony_ci int32_t slotId, const ReportInfo *reportInfo, const uint8_t *response, size_t responseLen) 33911fccf17Sopenharmony_ci{ 34011fccf17Sopenharmony_ci OnReport(hrilModem_, slotId, reportInfo, response, responseLen); 34111fccf17Sopenharmony_ci} 34211fccf17Sopenharmony_ci 34311fccf17Sopenharmony_civoid HRilManager::OnNetworkReport( 34411fccf17Sopenharmony_ci int32_t slotId, const ReportInfo *reportInfo, const uint8_t *response, size_t responseLen) 34511fccf17Sopenharmony_ci{ 34611fccf17Sopenharmony_ci OnReport(hrilNetwork_, slotId, reportInfo, response, responseLen); 34711fccf17Sopenharmony_ci} 34811fccf17Sopenharmony_ci 34911fccf17Sopenharmony_civoid HRilManager::OnSimReport(int32_t slotId, const ReportInfo *reportInfo, const uint8_t *response, size_t responseLen) 35011fccf17Sopenharmony_ci{ 35111fccf17Sopenharmony_ci OnReport(hrilSim_, slotId, reportInfo, response, responseLen); 35211fccf17Sopenharmony_ci} 35311fccf17Sopenharmony_ci 35411fccf17Sopenharmony_civoid HRilManager::OnSmsReport(int32_t slotId, const ReportInfo *reportInfo, const uint8_t *response, size_t responseLen) 35511fccf17Sopenharmony_ci{ 35611fccf17Sopenharmony_ci OnReport(hrilSms_, slotId, reportInfo, response, responseLen); 35711fccf17Sopenharmony_ci} 35811fccf17Sopenharmony_ci 35911fccf17Sopenharmony_ciHRilManager::HRilManager() : hrilSimSlotCount_(GetSimSlotCount()) 36011fccf17Sopenharmony_ci{ 36111fccf17Sopenharmony_ci for (int32_t slotId = HRIL_SIM_SLOT_0; slotId < hrilSimSlotCount_; slotId++) { 36211fccf17Sopenharmony_ci hrilCall_.push_back(std::make_unique<HRilCall>(slotId)); 36311fccf17Sopenharmony_ci hrilModem_.push_back(std::make_unique<HRilModem>(slotId)); 36411fccf17Sopenharmony_ci hrilNetwork_.push_back(std::make_unique<HRilNetwork>(slotId)); 36511fccf17Sopenharmony_ci hrilSim_.push_back(std::make_unique<HRilSim>(slotId)); 36611fccf17Sopenharmony_ci hrilSms_.push_back(std::make_unique<HRilSms>(slotId)); 36711fccf17Sopenharmony_ci hrilData_.push_back(std::make_unique<HRilData>(slotId)); 36811fccf17Sopenharmony_ci } 36911fccf17Sopenharmony_ci timerCallback_ = std::make_unique<HRilTimerCallback>(); 37011fccf17Sopenharmony_ci} 37111fccf17Sopenharmony_ci 37211fccf17Sopenharmony_civoid HRilManager::SetRilCallback(sptr<OHOS::HDI::Ril::V1_3::IRilCallback> callback) 37311fccf17Sopenharmony_ci{ 37411fccf17Sopenharmony_ci TELEPHONY_LOGD("SetRilCallback"); 37511fccf17Sopenharmony_ci for (int32_t slotId = HRIL_SIM_SLOT_0; slotId < hrilSimSlotCount_; slotId++) { 37611fccf17Sopenharmony_ci hrilCall_[slotId]->SetRilCallback(callback); 37711fccf17Sopenharmony_ci hrilModem_[slotId]->SetRilCallback(callback); 37811fccf17Sopenharmony_ci hrilNetwork_[slotId]->SetRilCallback(callback); 37911fccf17Sopenharmony_ci hrilSim_[slotId]->SetRilCallback(callback); 38011fccf17Sopenharmony_ci hrilSms_[slotId]->SetRilCallback(callback); 38111fccf17Sopenharmony_ci hrilData_[slotId]->SetRilCallback(callback); 38211fccf17Sopenharmony_ci if (callback == nullptr) { 38311fccf17Sopenharmony_ci continue; 38411fccf17Sopenharmony_ci } 38511fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo responseInfo = { 0 }; 38611fccf17Sopenharmony_ci responseInfo.slotId = slotId; 38711fccf17Sopenharmony_ci responseInfo.type = HDI::Ril::V1_1::RIL_RESPONSE_NOTICE; 38811fccf17Sopenharmony_ci callback->RadioStateUpdated(responseInfo, hrilModem_[slotId]->GetLastRadioState()); 38911fccf17Sopenharmony_ci } 39011fccf17Sopenharmony_ci} 39111fccf17Sopenharmony_ci 39211fccf17Sopenharmony_ci// Call 39311fccf17Sopenharmony_ciint32_t HRilManager::SetEmergencyCallList( 39411fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::EmergencyInfoList &emergencyInfoList) 39511fccf17Sopenharmony_ci{ 39611fccf17Sopenharmony_ci return TaskSchedule( 39711fccf17Sopenharmony_ci MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetEmergencyCallList, serialId, emergencyInfoList); 39811fccf17Sopenharmony_ci} 39911fccf17Sopenharmony_ci 40011fccf17Sopenharmony_ciint32_t HRilManager::GetEmergencyCallList(int32_t slotId, int32_t serialId) 40111fccf17Sopenharmony_ci{ 40211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetEmergencyCallList, serialId); 40311fccf17Sopenharmony_ci} 40411fccf17Sopenharmony_ci 40511fccf17Sopenharmony_ciint32_t HRilManager::GetCallList(int32_t slotId, int32_t serialId) 40611fccf17Sopenharmony_ci{ 40711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetCallList, serialId); 40811fccf17Sopenharmony_ci} 40911fccf17Sopenharmony_ci 41011fccf17Sopenharmony_ciint32_t HRilManager::Dial(int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DialInfo &dialInfo) 41111fccf17Sopenharmony_ci{ 41211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::Dial, serialId, dialInfo); 41311fccf17Sopenharmony_ci} 41411fccf17Sopenharmony_ci 41511fccf17Sopenharmony_ciint32_t HRilManager::Reject(int32_t slotId, int32_t serialId) 41611fccf17Sopenharmony_ci{ 41711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::Reject, serialId); 41811fccf17Sopenharmony_ci} 41911fccf17Sopenharmony_ci 42011fccf17Sopenharmony_ciint32_t HRilManager::Hangup(int32_t slotId, int32_t serialId, int32_t gsmIndex) 42111fccf17Sopenharmony_ci{ 42211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::Hangup, serialId, gsmIndex); 42311fccf17Sopenharmony_ci} 42411fccf17Sopenharmony_ci 42511fccf17Sopenharmony_ciint32_t HRilManager::Answer(int32_t slotId, int32_t serialId) 42611fccf17Sopenharmony_ci{ 42711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::Answer, serialId); 42811fccf17Sopenharmony_ci} 42911fccf17Sopenharmony_ci 43011fccf17Sopenharmony_ciint32_t HRilManager::HoldCall(int32_t slotId, int32_t serialId) 43111fccf17Sopenharmony_ci{ 43211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::HoldCall, serialId); 43311fccf17Sopenharmony_ci} 43411fccf17Sopenharmony_ci 43511fccf17Sopenharmony_ciint32_t HRilManager::UnHoldCall(int32_t slotId, int32_t serialId) 43611fccf17Sopenharmony_ci{ 43711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::UnHoldCall, serialId); 43811fccf17Sopenharmony_ci} 43911fccf17Sopenharmony_ci 44011fccf17Sopenharmony_ciint32_t HRilManager::SwitchCall(int32_t slotId, int32_t serialId) 44111fccf17Sopenharmony_ci{ 44211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SwitchCall, serialId); 44311fccf17Sopenharmony_ci} 44411fccf17Sopenharmony_ci 44511fccf17Sopenharmony_ciint32_t HRilManager::CombineConference(int32_t slotId, int32_t serialId, int32_t callType) 44611fccf17Sopenharmony_ci{ 44711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::CombineConference, serialId, callType); 44811fccf17Sopenharmony_ci} 44911fccf17Sopenharmony_ci 45011fccf17Sopenharmony_ciint32_t HRilManager::SeparateConference(int32_t slotId, int32_t serialId, int32_t callIndex, int32_t callType) 45111fccf17Sopenharmony_ci{ 45211fccf17Sopenharmony_ci return TaskSchedule( 45311fccf17Sopenharmony_ci MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SeparateConference, serialId, callIndex, callType); 45411fccf17Sopenharmony_ci} 45511fccf17Sopenharmony_ci 45611fccf17Sopenharmony_ciint32_t HRilManager::GetCallWaiting(int32_t slotId, int32_t serialId) 45711fccf17Sopenharmony_ci{ 45811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetCallWaiting, serialId); 45911fccf17Sopenharmony_ci} 46011fccf17Sopenharmony_ci 46111fccf17Sopenharmony_ciint32_t HRilManager::SetCallWaiting(int32_t slotId, int32_t serialId, int32_t activate) 46211fccf17Sopenharmony_ci{ 46311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetCallWaiting, serialId, activate); 46411fccf17Sopenharmony_ci} 46511fccf17Sopenharmony_ci 46611fccf17Sopenharmony_ciint32_t HRilManager::GetCallTransferInfo(int32_t slotId, int32_t serialId, int32_t reason) 46711fccf17Sopenharmony_ci{ 46811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetCallTransferInfo, serialId, reason); 46911fccf17Sopenharmony_ci} 47011fccf17Sopenharmony_ci 47111fccf17Sopenharmony_ciint32_t HRilManager::SetCallTransferInfo( 47211fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::CallForwardSetInfo &callForwardSetInfo) 47311fccf17Sopenharmony_ci{ 47411fccf17Sopenharmony_ci return TaskSchedule( 47511fccf17Sopenharmony_ci MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetCallTransferInfo, serialId, callForwardSetInfo); 47611fccf17Sopenharmony_ci} 47711fccf17Sopenharmony_ci 47811fccf17Sopenharmony_ciint32_t HRilManager::GetCallRestriction(int32_t slotId, int32_t serialId, const std::string &fac) 47911fccf17Sopenharmony_ci{ 48011fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetCallRestriction, serialId, fac); 48111fccf17Sopenharmony_ci} 48211fccf17Sopenharmony_ci 48311fccf17Sopenharmony_ciint32_t HRilManager::SetCallRestriction( 48411fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::CallRestrictionInfo &callRestrictionInfo) 48511fccf17Sopenharmony_ci{ 48611fccf17Sopenharmony_ci return TaskSchedule( 48711fccf17Sopenharmony_ci MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetCallRestriction, serialId, callRestrictionInfo); 48811fccf17Sopenharmony_ci} 48911fccf17Sopenharmony_ci 49011fccf17Sopenharmony_ciint32_t HRilManager::GetClip(int32_t slotId, int32_t serialId) 49111fccf17Sopenharmony_ci{ 49211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetClip, serialId); 49311fccf17Sopenharmony_ci} 49411fccf17Sopenharmony_ci 49511fccf17Sopenharmony_ciint32_t HRilManager::SetClip(int32_t slotId, int32_t serialId, int32_t action) 49611fccf17Sopenharmony_ci{ 49711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetClip, serialId, action); 49811fccf17Sopenharmony_ci} 49911fccf17Sopenharmony_ci 50011fccf17Sopenharmony_ciint32_t HRilManager::GetClir(int32_t slotId, int32_t serialId) 50111fccf17Sopenharmony_ci{ 50211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetClir, serialId); 50311fccf17Sopenharmony_ci} 50411fccf17Sopenharmony_ci 50511fccf17Sopenharmony_ciint32_t HRilManager::SetClir(int32_t slotId, int32_t serialId, int32_t action) 50611fccf17Sopenharmony_ci{ 50711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetClir, serialId, action); 50811fccf17Sopenharmony_ci} 50911fccf17Sopenharmony_ci 51011fccf17Sopenharmony_ciint32_t HRilManager::SetCallPreferenceMode(int32_t slotId, int32_t serialId, int32_t mode) 51111fccf17Sopenharmony_ci{ 51211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetCallPreferenceMode, serialId, mode); 51311fccf17Sopenharmony_ci} 51411fccf17Sopenharmony_ci 51511fccf17Sopenharmony_ciint32_t HRilManager::GetCallPreferenceMode(int32_t slotId, int32_t serialId) 51611fccf17Sopenharmony_ci{ 51711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetCallPreferenceMode, serialId); 51811fccf17Sopenharmony_ci} 51911fccf17Sopenharmony_ci 52011fccf17Sopenharmony_ciint32_t HRilManager::SetUssd(int32_t slotId, int32_t serialId, const std::string &str) 52111fccf17Sopenharmony_ci{ 52211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetUssd, serialId, str); 52311fccf17Sopenharmony_ci} 52411fccf17Sopenharmony_ci 52511fccf17Sopenharmony_ciint32_t HRilManager::GetUssd(int32_t slotId, int32_t serialId) 52611fccf17Sopenharmony_ci{ 52711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetUssd, serialId); 52811fccf17Sopenharmony_ci} 52911fccf17Sopenharmony_ci 53011fccf17Sopenharmony_ciint32_t HRilManager::SetMute(int32_t slotId, int32_t serialId, int32_t mute) 53111fccf17Sopenharmony_ci{ 53211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetMute, serialId, mute); 53311fccf17Sopenharmony_ci} 53411fccf17Sopenharmony_ci 53511fccf17Sopenharmony_ciint32_t HRilManager::GetMute(int32_t slotId, int32_t serialId) 53611fccf17Sopenharmony_ci{ 53711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetMute, serialId); 53811fccf17Sopenharmony_ci} 53911fccf17Sopenharmony_ci 54011fccf17Sopenharmony_ciint32_t HRilManager::GetCallFailReason(int32_t slotId, int32_t serialId) 54111fccf17Sopenharmony_ci{ 54211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::GetCallFailReason, serialId); 54311fccf17Sopenharmony_ci} 54411fccf17Sopenharmony_ci 54511fccf17Sopenharmony_ciint32_t HRilManager::CallSupplement(int32_t slotId, int32_t serialId, int32_t type) 54611fccf17Sopenharmony_ci{ 54711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::CallSupplement, serialId, type); 54811fccf17Sopenharmony_ci} 54911fccf17Sopenharmony_ci 55011fccf17Sopenharmony_ciint32_t HRilManager::SendDtmf(int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DtmfInfo &dtmfInfo) 55111fccf17Sopenharmony_ci{ 55211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SendDtmf, serialId, dtmfInfo); 55311fccf17Sopenharmony_ci} 55411fccf17Sopenharmony_ci 55511fccf17Sopenharmony_ciint32_t HRilManager::StartDtmf(int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DtmfInfo &dtmfInfo) 55611fccf17Sopenharmony_ci{ 55711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::StartDtmf, serialId, dtmfInfo); 55811fccf17Sopenharmony_ci} 55911fccf17Sopenharmony_ci 56011fccf17Sopenharmony_ciint32_t HRilManager::StopDtmf(int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DtmfInfo &dtmfInfo) 56111fccf17Sopenharmony_ci{ 56211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::StopDtmf, serialId, dtmfInfo); 56311fccf17Sopenharmony_ci} 56411fccf17Sopenharmony_ci 56511fccf17Sopenharmony_ciint32_t HRilManager::SetBarringPassword( 56611fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SetBarringInfo &setBarringInfo) 56711fccf17Sopenharmony_ci{ 56811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetBarringPassword, serialId, setBarringInfo); 56911fccf17Sopenharmony_ci} 57011fccf17Sopenharmony_ci 57111fccf17Sopenharmony_ciint32_t HRilManager::CloseUnFinishedUssd(int32_t slotId, int32_t serialId) 57211fccf17Sopenharmony_ci{ 57311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::CloseUnFinishedUssd, serialId); 57411fccf17Sopenharmony_ci} 57511fccf17Sopenharmony_ci 57611fccf17Sopenharmony_ciint32_t HRilManager::SetVonrSwitch(int32_t slotId, int32_t serialId, int32_t status) 57711fccf17Sopenharmony_ci{ 57811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_CALL, hrilCall_[slotId], &HRilCall::SetVonrSwitch, serialId, status); 57911fccf17Sopenharmony_ci} 58011fccf17Sopenharmony_ci 58111fccf17Sopenharmony_ci// Data 58211fccf17Sopenharmony_ciint32_t HRilManager::ActivatePdpContext( 58311fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DataCallInfo &dataCallInfo) 58411fccf17Sopenharmony_ci{ 58511fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::ActivatePdpContext, serialId, dataCallInfo); 58611fccf17Sopenharmony_ci} 58711fccf17Sopenharmony_ci 58811fccf17Sopenharmony_ciint32_t HRilManager::ActivatePdpContextWithApnTypes( 58911fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_3::DataCallInfoWithApnTypes &dataCallInfo) 59011fccf17Sopenharmony_ci{ 59111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::ActivatePdpContextWithApnTypes, 59211fccf17Sopenharmony_ci serialId, dataCallInfo, hrilOpsVersion_); 59311fccf17Sopenharmony_ci} 59411fccf17Sopenharmony_ci 59511fccf17Sopenharmony_ciint32_t HRilManager::DeactivatePdpContext( 59611fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::UniInfo &uniInfo) 59711fccf17Sopenharmony_ci{ 59811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::DeactivatePdpContext, serialId, uniInfo); 59911fccf17Sopenharmony_ci} 60011fccf17Sopenharmony_ci 60111fccf17Sopenharmony_ciint32_t HRilManager::GetPdpContextList(int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::UniInfo &uniInfo) 60211fccf17Sopenharmony_ci{ 60311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::GetPdpContextList, serialId, uniInfo); 60411fccf17Sopenharmony_ci} 60511fccf17Sopenharmony_ci 60611fccf17Sopenharmony_ciint32_t HRilManager::SetInitApnInfo( 60711fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DataProfileDataInfo &dataProfileDataInfo) 60811fccf17Sopenharmony_ci{ 60911fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::SetInitApnInfo, serialId, dataProfileDataInfo); 61011fccf17Sopenharmony_ci} 61111fccf17Sopenharmony_ci 61211fccf17Sopenharmony_ciint32_t HRilManager::GetLinkBandwidthInfo(int32_t slotId, int32_t serialId, int32_t cid) 61311fccf17Sopenharmony_ci{ 61411fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::GetLinkBandwidthInfo, serialId, cid); 61511fccf17Sopenharmony_ci} 61611fccf17Sopenharmony_ci 61711fccf17Sopenharmony_ciint32_t HRilManager::GetLinkCapability(int32_t slotId, int32_t serialId) 61811fccf17Sopenharmony_ci{ 61911fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::GetLinkCapability, serialId); 62011fccf17Sopenharmony_ci} 62111fccf17Sopenharmony_ci 62211fccf17Sopenharmony_ciint32_t HRilManager::SetLinkBandwidthReportingRule(int32_t slotId, int32_t serialId, 62311fccf17Sopenharmony_ci const OHOS::HDI::Ril::V1_1::DataLinkBandwidthReportingRule &dataLinkBandwidthReportingRule) 62411fccf17Sopenharmony_ci{ 62511fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::SetLinkBandwidthReportingRule, serialId, 62611fccf17Sopenharmony_ci dataLinkBandwidthReportingRule); 62711fccf17Sopenharmony_ci} 62811fccf17Sopenharmony_ci 62911fccf17Sopenharmony_ciint32_t HRilManager::SetDataPermitted(int32_t slotId, int32_t serialId, int32_t dataPermitted) 63011fccf17Sopenharmony_ci{ 63111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::SetDataPermitted, serialId, dataPermitted); 63211fccf17Sopenharmony_ci} 63311fccf17Sopenharmony_ci 63411fccf17Sopenharmony_ciint32_t HRilManager::SetDataProfileInfo( 63511fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DataProfilesInfo &dataProfilesInfo) 63611fccf17Sopenharmony_ci{ 63711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::SetDataProfileInfo, serialId, dataProfilesInfo); 63811fccf17Sopenharmony_ci} 63911fccf17Sopenharmony_ci 64011fccf17Sopenharmony_ciint32_t HRilManager::SendDataPerformanceMode( 64111fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DataPerformanceInfo &dataPerformanceInfo) 64211fccf17Sopenharmony_ci{ 64311fccf17Sopenharmony_ci return TaskSchedule( 64411fccf17Sopenharmony_ci MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::SendDataPerformanceMode, serialId, dataPerformanceInfo); 64511fccf17Sopenharmony_ci} 64611fccf17Sopenharmony_ci 64711fccf17Sopenharmony_ciint32_t HRilManager::SendDataSleepMode( 64811fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::DataSleepInfo &dataSleepInfo) 64911fccf17Sopenharmony_ci{ 65011fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::SendDataSleepMode, serialId, dataSleepInfo); 65111fccf17Sopenharmony_ci} 65211fccf17Sopenharmony_ci 65311fccf17Sopenharmony_ciint32_t HRilManager::CleanAllConnections(int32_t slotId, int32_t serialId) 65411fccf17Sopenharmony_ci{ 65511fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_DATA, hrilData_[slotId], &HRilData::CleanAllConnections, serialId); 65611fccf17Sopenharmony_ci} 65711fccf17Sopenharmony_ci 65811fccf17Sopenharmony_ci// Modem 65911fccf17Sopenharmony_ciint32_t HRilManager::SetRadioState(int32_t slotId, int32_t serialId, int32_t fun, int32_t rst) 66011fccf17Sopenharmony_ci{ 66111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_MODEM, hrilModem_[slotId], &HRilModem::SetRadioState, serialId, fun, rst); 66211fccf17Sopenharmony_ci} 66311fccf17Sopenharmony_ci 66411fccf17Sopenharmony_ciint32_t HRilManager::GetRadioState(int32_t slotId, int32_t serialId) 66511fccf17Sopenharmony_ci{ 66611fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_MODEM, hrilModem_[slotId], &HRilModem::GetRadioState, serialId); 66711fccf17Sopenharmony_ci} 66811fccf17Sopenharmony_ci 66911fccf17Sopenharmony_ciint32_t HRilManager::GetImei(int32_t slotId, int32_t serialId) 67011fccf17Sopenharmony_ci{ 67111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_MODEM, hrilModem_[slotId], &HRilModem::GetImei, serialId); 67211fccf17Sopenharmony_ci} 67311fccf17Sopenharmony_ci 67411fccf17Sopenharmony_ciint32_t HRilManager::GetImeiSv(int32_t slotId, int32_t serialId) 67511fccf17Sopenharmony_ci{ 67611fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_MODEM, hrilModem_[slotId], &HRilModem::GetImeiSv, serialId); 67711fccf17Sopenharmony_ci} 67811fccf17Sopenharmony_ci 67911fccf17Sopenharmony_ciint32_t HRilManager::GetMeid(int32_t slotId, int32_t serialId) 68011fccf17Sopenharmony_ci{ 68111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_MODEM, hrilModem_[slotId], &HRilModem::GetMeid, serialId); 68211fccf17Sopenharmony_ci} 68311fccf17Sopenharmony_ci 68411fccf17Sopenharmony_ciint32_t HRilManager::GetVoiceRadioTechnology(int32_t slotId, int32_t serialId) 68511fccf17Sopenharmony_ci{ 68611fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_MODEM, hrilModem_[slotId], &HRilModem::GetVoiceRadioTechnology, serialId); 68711fccf17Sopenharmony_ci} 68811fccf17Sopenharmony_ci 68911fccf17Sopenharmony_ciint32_t HRilManager::GetBasebandVersion(int32_t slotId, int32_t serialId) 69011fccf17Sopenharmony_ci{ 69111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_MODEM, hrilModem_[slotId], &HRilModem::GetBasebandVersion, serialId); 69211fccf17Sopenharmony_ci} 69311fccf17Sopenharmony_ci 69411fccf17Sopenharmony_ciint32_t HRilManager::ShutDown(int32_t slotId, int32_t serialId) 69511fccf17Sopenharmony_ci{ 69611fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_MODEM, hrilModem_[slotId], &HRilModem::ShutDown, serialId); 69711fccf17Sopenharmony_ci} 69811fccf17Sopenharmony_ci 69911fccf17Sopenharmony_ciint32_t HRilManager::GetSimIO(int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SimIoRequestInfo &simIO) 70011fccf17Sopenharmony_ci{ 70111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::GetSimIO, serialId, simIO); 70211fccf17Sopenharmony_ci} 70311fccf17Sopenharmony_ci 70411fccf17Sopenharmony_ciint32_t HRilManager::GetSimStatus(int32_t slotId, int32_t serialId) 70511fccf17Sopenharmony_ci{ 70611fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::GetSimStatus, serialId); 70711fccf17Sopenharmony_ci} 70811fccf17Sopenharmony_ci 70911fccf17Sopenharmony_ciint32_t HRilManager::GetImsi(int32_t slotId, int32_t serialId) 71011fccf17Sopenharmony_ci{ 71111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::GetImsi, serialId); 71211fccf17Sopenharmony_ci} 71311fccf17Sopenharmony_ci 71411fccf17Sopenharmony_ciint32_t HRilManager::GetSimLockStatus( 71511fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SimLockInfo &simLockInfo) 71611fccf17Sopenharmony_ci{ 71711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::GetSimLockStatus, serialId, simLockInfo); 71811fccf17Sopenharmony_ci} 71911fccf17Sopenharmony_ci 72011fccf17Sopenharmony_ciint32_t HRilManager::SetSimLock(int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SimLockInfo &simLockInfo) 72111fccf17Sopenharmony_ci{ 72211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SetSimLock, serialId, simLockInfo); 72311fccf17Sopenharmony_ci} 72411fccf17Sopenharmony_ci 72511fccf17Sopenharmony_ciint32_t HRilManager::ChangeSimPassword( 72611fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SimPasswordInfo &simPassword) 72711fccf17Sopenharmony_ci{ 72811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::ChangeSimPassword, serialId, simPassword); 72911fccf17Sopenharmony_ci} 73011fccf17Sopenharmony_ci 73111fccf17Sopenharmony_ciint32_t HRilManager::UnlockPin(int32_t slotId, int32_t serialId, const std::string &pin) 73211fccf17Sopenharmony_ci{ 73311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::UnlockPin, serialId, pin); 73411fccf17Sopenharmony_ci} 73511fccf17Sopenharmony_ci 73611fccf17Sopenharmony_ciint32_t HRilManager::UnlockPuk(int32_t slotId, int32_t serialId, const std::string &puk, const std::string &pin) 73711fccf17Sopenharmony_ci{ 73811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::UnlockPuk, serialId, puk, pin); 73911fccf17Sopenharmony_ci} 74011fccf17Sopenharmony_ci 74111fccf17Sopenharmony_ciint32_t HRilManager::UnlockPin2(int32_t slotId, int32_t serialId, const std::string &pin2) 74211fccf17Sopenharmony_ci{ 74311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::UnlockPin2, serialId, pin2); 74411fccf17Sopenharmony_ci} 74511fccf17Sopenharmony_ci 74611fccf17Sopenharmony_ciint32_t HRilManager::UnlockPuk2(int32_t slotId, int32_t serialId, const std::string &puk2, const std::string &pin2) 74711fccf17Sopenharmony_ci{ 74811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::UnlockPuk2, serialId, puk2, pin2); 74911fccf17Sopenharmony_ci} 75011fccf17Sopenharmony_ci 75111fccf17Sopenharmony_ciint32_t HRilManager::SetActiveSim(int32_t slotId, int32_t serialId, int32_t index, int32_t enable) 75211fccf17Sopenharmony_ci{ 75311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SetActiveSim, serialId, index, enable); 75411fccf17Sopenharmony_ci} 75511fccf17Sopenharmony_ci 75611fccf17Sopenharmony_ciint32_t HRilManager::SimStkSendTerminalResponse(int32_t slotId, int32_t serialId, const std::string &strCmd) 75711fccf17Sopenharmony_ci{ 75811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimStkSendTerminalResponse, serialId, strCmd); 75911fccf17Sopenharmony_ci} 76011fccf17Sopenharmony_ci 76111fccf17Sopenharmony_ciint32_t HRilManager::SimStkSendEnvelope(int32_t slotId, int32_t serialId, const std::string &strCmd) 76211fccf17Sopenharmony_ci{ 76311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimStkSendEnvelope, serialId, strCmd); 76411fccf17Sopenharmony_ci} 76511fccf17Sopenharmony_ci 76611fccf17Sopenharmony_ciint32_t HRilManager::SimStkSendCallSetupRequestResult(int32_t slotId, int32_t serialId, int32_t accept) 76711fccf17Sopenharmony_ci{ 76811fccf17Sopenharmony_ci return TaskSchedule( 76911fccf17Sopenharmony_ci MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimStkSendCallSetupRequestResult, serialId, accept); 77011fccf17Sopenharmony_ci} 77111fccf17Sopenharmony_ci 77211fccf17Sopenharmony_ciint32_t HRilManager::SimStkIsReady(int32_t slotId, int32_t serialId) 77311fccf17Sopenharmony_ci{ 77411fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimStkIsReady, serialId); 77511fccf17Sopenharmony_ci} 77611fccf17Sopenharmony_ci 77711fccf17Sopenharmony_ciint32_t HRilManager::GetRadioProtocol(int32_t slotId, int32_t serialId) 77811fccf17Sopenharmony_ci{ 77911fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::GetRadioProtocol, serialId); 78011fccf17Sopenharmony_ci} 78111fccf17Sopenharmony_ci 78211fccf17Sopenharmony_ciint32_t HRilManager::SetRadioProtocol( 78311fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const HDI::Ril::V1_1::RadioProtocol &radioProtocol) 78411fccf17Sopenharmony_ci{ 78511fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SetRadioProtocol, serialId, radioProtocol); 78611fccf17Sopenharmony_ci} 78711fccf17Sopenharmony_ci 78811fccf17Sopenharmony_ciint32_t HRilManager::SimOpenLogicalChannel(int32_t slotId, int32_t serialId, const std::string &appID, int32_t p2) 78911fccf17Sopenharmony_ci{ 79011fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimOpenLogicalChannel, serialId, appID, p2); 79111fccf17Sopenharmony_ci} 79211fccf17Sopenharmony_ci 79311fccf17Sopenharmony_ciint32_t HRilManager::SimCloseLogicalChannel(int32_t slotId, int32_t serialId, int32_t channelId) 79411fccf17Sopenharmony_ci{ 79511fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimCloseLogicalChannel, serialId, channelId); 79611fccf17Sopenharmony_ci} 79711fccf17Sopenharmony_ci 79811fccf17Sopenharmony_ciint32_t HRilManager::SimTransmitApduLogicalChannel( 79911fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::ApduSimIORequestInfo &apduSimIO) 80011fccf17Sopenharmony_ci{ 80111fccf17Sopenharmony_ci return TaskSchedule( 80211fccf17Sopenharmony_ci MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimTransmitApduLogicalChannel, serialId, apduSimIO); 80311fccf17Sopenharmony_ci} 80411fccf17Sopenharmony_ci 80511fccf17Sopenharmony_ciint32_t HRilManager::SimTransmitApduBasicChannel( 80611fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::ApduSimIORequestInfo &apduSimIO) 80711fccf17Sopenharmony_ci{ 80811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimTransmitApduBasicChannel, serialId, apduSimIO); 80911fccf17Sopenharmony_ci} 81011fccf17Sopenharmony_ci 81111fccf17Sopenharmony_ciint32_t HRilManager::SimAuthentication( 81211fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SimAuthenticationRequestInfo &simAuthInfo) 81311fccf17Sopenharmony_ci{ 81411fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SimAuthentication, serialId, simAuthInfo); 81511fccf17Sopenharmony_ci} 81611fccf17Sopenharmony_ci 81711fccf17Sopenharmony_ciint32_t HRilManager::UnlockSimLock(int32_t slotId, int32_t serialId, int32_t lockType, const std::string &key) 81811fccf17Sopenharmony_ci{ 81911fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::UnlockSimLock, serialId, lockType, key); 82011fccf17Sopenharmony_ci} 82111fccf17Sopenharmony_ci 82211fccf17Sopenharmony_ciint32_t HRilManager::SendSimMatchedOperatorInfo( 82311fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_2::NcfgOperatorInfo &ncfgOperatorInfo) 82411fccf17Sopenharmony_ci{ 82511fccf17Sopenharmony_ci return TaskSchedule( 82611fccf17Sopenharmony_ci MODULE_HRIL_SIM, hrilSim_[slotId], &HRilSim::SendSimMatchedOperatorInfo, serialId, ncfgOperatorInfo); 82711fccf17Sopenharmony_ci} 82811fccf17Sopenharmony_ci 82911fccf17Sopenharmony_ci// Network 83011fccf17Sopenharmony_ciint32_t HRilManager::GetSignalStrength(int32_t slotId, int32_t serialId) 83111fccf17Sopenharmony_ci{ 83211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetSignalStrength, serialId); 83311fccf17Sopenharmony_ci} 83411fccf17Sopenharmony_ci 83511fccf17Sopenharmony_ciint32_t HRilManager::GetCsRegStatus(int32_t slotId, int32_t serialId) 83611fccf17Sopenharmony_ci{ 83711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetCsRegStatus, serialId); 83811fccf17Sopenharmony_ci} 83911fccf17Sopenharmony_ci 84011fccf17Sopenharmony_ciint32_t HRilManager::GetPsRegStatus(int32_t slotId, int32_t serialId) 84111fccf17Sopenharmony_ci{ 84211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetPsRegStatus, serialId); 84311fccf17Sopenharmony_ci} 84411fccf17Sopenharmony_ci 84511fccf17Sopenharmony_ciint32_t HRilManager::GetOperatorInfo(int32_t slotId, int32_t serialId) 84611fccf17Sopenharmony_ci{ 84711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetOperatorInfo, serialId); 84811fccf17Sopenharmony_ci} 84911fccf17Sopenharmony_ci 85011fccf17Sopenharmony_ciint32_t HRilManager::GetNetworkSearchInformation(int32_t slotId, int32_t serialId) 85111fccf17Sopenharmony_ci{ 85211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetNetworkSearchInformation, serialId); 85311fccf17Sopenharmony_ci} 85411fccf17Sopenharmony_ci 85511fccf17Sopenharmony_ciint32_t HRilManager::GetNetworkSelectionMode(int32_t slotId, int32_t serialId) 85611fccf17Sopenharmony_ci{ 85711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetNetworkSelectionMode, serialId); 85811fccf17Sopenharmony_ci} 85911fccf17Sopenharmony_ci 86011fccf17Sopenharmony_ciint32_t HRilManager::SetNetworkSelectionMode( 86111fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const HDI::Ril::V1_1::SetNetworkModeInfo &networkModeInfo) 86211fccf17Sopenharmony_ci{ 86311fccf17Sopenharmony_ci return TaskSchedule( 86411fccf17Sopenharmony_ci MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::SetNetworkSelectionMode, serialId, networkModeInfo); 86511fccf17Sopenharmony_ci} 86611fccf17Sopenharmony_ci 86711fccf17Sopenharmony_ciint32_t HRilManager::GetNeighboringCellInfoList(int32_t slotId, int32_t serialId) 86811fccf17Sopenharmony_ci{ 86911fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetNeighboringCellInfoList, serialId); 87011fccf17Sopenharmony_ci} 87111fccf17Sopenharmony_ci 87211fccf17Sopenharmony_ciint32_t HRilManager::GetCurrentCellInfo(int32_t slotId, int32_t serialId) 87311fccf17Sopenharmony_ci{ 87411fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetCurrentCellInfo, serialId); 87511fccf17Sopenharmony_ci} 87611fccf17Sopenharmony_ci 87711fccf17Sopenharmony_ciint32_t HRilManager::SetPreferredNetwork(int32_t slotId, int32_t serialId, int32_t preferredNetworkType) 87811fccf17Sopenharmony_ci{ 87911fccf17Sopenharmony_ci return TaskSchedule( 88011fccf17Sopenharmony_ci MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::SetPreferredNetwork, serialId, preferredNetworkType); 88111fccf17Sopenharmony_ci} 88211fccf17Sopenharmony_ci 88311fccf17Sopenharmony_ciint32_t HRilManager::GetPreferredNetwork(int32_t slotId, int32_t serialId) 88411fccf17Sopenharmony_ci{ 88511fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetPreferredNetwork, serialId); 88611fccf17Sopenharmony_ci} 88711fccf17Sopenharmony_ci 88811fccf17Sopenharmony_ciint32_t HRilManager::GetPhysicalChannelConfig(int32_t slotId, int32_t serialId) 88911fccf17Sopenharmony_ci{ 89011fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetPhysicalChannelConfig, serialId); 89111fccf17Sopenharmony_ci} 89211fccf17Sopenharmony_ci 89311fccf17Sopenharmony_ciint32_t HRilManager::SetLocateUpdates(int32_t slotId, int32_t serialId, const HDI::Ril::V1_1::RilRegNotifyMode mode) 89411fccf17Sopenharmony_ci{ 89511fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::SetLocateUpdates, serialId, mode); 89611fccf17Sopenharmony_ci} 89711fccf17Sopenharmony_ci 89811fccf17Sopenharmony_ciint32_t HRilManager::SetNotificationFilter(int32_t slotId, int32_t serialId, int32_t newFilter) 89911fccf17Sopenharmony_ci{ 90011fccf17Sopenharmony_ci return TaskSchedule( 90111fccf17Sopenharmony_ci MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::SetNotificationFilter, serialId, newFilter); 90211fccf17Sopenharmony_ci} 90311fccf17Sopenharmony_ci 90411fccf17Sopenharmony_ciint32_t HRilManager::SetDeviceState(int32_t slotId, int32_t serialId, int32_t deviceStateType, int32_t deviceStateOn) 90511fccf17Sopenharmony_ci{ 90611fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::SetDeviceState, serialId, 90711fccf17Sopenharmony_ci deviceStateType, deviceStateOn); 90811fccf17Sopenharmony_ci} 90911fccf17Sopenharmony_ci 91011fccf17Sopenharmony_ciint32_t HRilManager::SetNrOptionMode(int32_t slotId, int32_t serialId, int32_t mode) 91111fccf17Sopenharmony_ci{ 91211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::SetNrOptionMode, serialId, mode); 91311fccf17Sopenharmony_ci} 91411fccf17Sopenharmony_ci 91511fccf17Sopenharmony_ciint32_t HRilManager::GetNrOptionMode(int32_t slotId, int32_t serialId) 91611fccf17Sopenharmony_ci{ 91711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetNrOptionMode, serialId); 91811fccf17Sopenharmony_ci} 91911fccf17Sopenharmony_ci 92011fccf17Sopenharmony_ciint32_t HRilManager::GetRrcConnectionState(int32_t slotId, int32_t serialId) 92111fccf17Sopenharmony_ci{ 92211fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetRrcConnectionState, serialId); 92311fccf17Sopenharmony_ci} 92411fccf17Sopenharmony_ci 92511fccf17Sopenharmony_ciint32_t HRilManager::GetNrSsbId(int32_t slotId, int32_t serialId) 92611fccf17Sopenharmony_ci{ 92711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_NETWORK, hrilNetwork_[slotId], &HRilNetwork::GetNrSsbId, serialId); 92811fccf17Sopenharmony_ci} 92911fccf17Sopenharmony_ci 93011fccf17Sopenharmony_ci// Sms 93111fccf17Sopenharmony_ciint32_t HRilManager::SendGsmSms( 93211fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::GsmSmsMessageInfo &gsmSmsMessageInfo) 93311fccf17Sopenharmony_ci{ 93411fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::SendGsmSms, serialId, gsmSmsMessageInfo); 93511fccf17Sopenharmony_ci} 93611fccf17Sopenharmony_ci 93711fccf17Sopenharmony_ciint32_t HRilManager::SendCdmaSms( 93811fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SendCdmaSmsMessageInfo &cdmaSmsMessageInfo) 93911fccf17Sopenharmony_ci{ 94011fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::SendCdmaSms, serialId, cdmaSmsMessageInfo); 94111fccf17Sopenharmony_ci} 94211fccf17Sopenharmony_ci 94311fccf17Sopenharmony_ciint32_t HRilManager::AddSimMessage( 94411fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SmsMessageIOInfo &smsMessageIOInfo) 94511fccf17Sopenharmony_ci{ 94611fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::AddSimMessage, serialId, smsMessageIOInfo); 94711fccf17Sopenharmony_ci} 94811fccf17Sopenharmony_ci 94911fccf17Sopenharmony_ciint32_t HRilManager::DelSimMessage(int32_t slotId, int32_t serialId, int32_t index) 95011fccf17Sopenharmony_ci{ 95111fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::DelSimMessage, serialId, index); 95211fccf17Sopenharmony_ci} 95311fccf17Sopenharmony_ci 95411fccf17Sopenharmony_ciint32_t HRilManager::UpdateSimMessage( 95511fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SmsMessageIOInfo &smsMessageIOInfo) 95611fccf17Sopenharmony_ci{ 95711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::UpdateSimMessage, serialId, smsMessageIOInfo); 95811fccf17Sopenharmony_ci} 95911fccf17Sopenharmony_ci 96011fccf17Sopenharmony_ciint32_t HRilManager::AddCdmaSimMessage( 96111fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SmsMessageIOInfo &smsMessageIOInfo) 96211fccf17Sopenharmony_ci{ 96311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::AddCdmaSimMessage, serialId, smsMessageIOInfo); 96411fccf17Sopenharmony_ci} 96511fccf17Sopenharmony_ci 96611fccf17Sopenharmony_ciint32_t HRilManager::DelCdmaSimMessage(int32_t slotId, int32_t serialId, int32_t index) 96711fccf17Sopenharmony_ci{ 96811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::DelCdmaSimMessage, serialId, index); 96911fccf17Sopenharmony_ci} 97011fccf17Sopenharmony_ci 97111fccf17Sopenharmony_ciint32_t HRilManager::UpdateCdmaSimMessage( 97211fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::SmsMessageIOInfo &smsMessageIOInfo) 97311fccf17Sopenharmony_ci{ 97411fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::UpdateCdmaSimMessage, serialId, smsMessageIOInfo); 97511fccf17Sopenharmony_ci} 97611fccf17Sopenharmony_ci 97711fccf17Sopenharmony_ciint32_t HRilManager::SetSmscAddr( 97811fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::ServiceCenterAddress &serviceCenterAddress) 97911fccf17Sopenharmony_ci{ 98011fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::SetSmscAddr, serialId, serviceCenterAddress); 98111fccf17Sopenharmony_ci} 98211fccf17Sopenharmony_ci 98311fccf17Sopenharmony_ciint32_t HRilManager::GetSmscAddr(int32_t slotId, int32_t serialId) 98411fccf17Sopenharmony_ci{ 98511fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::GetSmscAddr, serialId); 98611fccf17Sopenharmony_ci} 98711fccf17Sopenharmony_ci 98811fccf17Sopenharmony_ciint32_t HRilManager::SetCBConfig( 98911fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::CBConfigInfo &cellBroadcastInfo) 99011fccf17Sopenharmony_ci{ 99111fccf17Sopenharmony_ci return HRilManager::TaskSchedule( 99211fccf17Sopenharmony_ci MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::SetCBConfig, serialId, cellBroadcastInfo); 99311fccf17Sopenharmony_ci} 99411fccf17Sopenharmony_ci 99511fccf17Sopenharmony_ciint32_t HRilManager::GetCBConfig(int32_t slotId, int32_t serialId) 99611fccf17Sopenharmony_ci{ 99711fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::GetCBConfig, serialId); 99811fccf17Sopenharmony_ci} 99911fccf17Sopenharmony_ci 100011fccf17Sopenharmony_ciint32_t HRilManager::SetCdmaCBConfig( 100111fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::CdmaCBConfigInfoList &cdmaCBConfigInfoList) 100211fccf17Sopenharmony_ci{ 100311fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::SetCdmaCBConfig, serialId, cdmaCBConfigInfoList); 100411fccf17Sopenharmony_ci} 100511fccf17Sopenharmony_ci 100611fccf17Sopenharmony_ciint32_t HRilManager::GetCdmaCBConfig(int32_t slotId, int32_t serialId) 100711fccf17Sopenharmony_ci{ 100811fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::GetCdmaCBConfig, serialId); 100911fccf17Sopenharmony_ci} 101011fccf17Sopenharmony_ci 101111fccf17Sopenharmony_ciint32_t HRilManager::SendSmsMoreMode( 101211fccf17Sopenharmony_ci int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::GsmSmsMessageInfo &gsmSmsMessageInfo) 101311fccf17Sopenharmony_ci{ 101411fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::SendSmsMoreMode, serialId, gsmSmsMessageInfo); 101511fccf17Sopenharmony_ci} 101611fccf17Sopenharmony_ci 101711fccf17Sopenharmony_ciint32_t HRilManager::SendSmsAck(int32_t slotId, int32_t serialId, const OHOS::HDI::Ril::V1_1::ModeData &modeData) 101811fccf17Sopenharmony_ci{ 101911fccf17Sopenharmony_ci return TaskSchedule(MODULE_HRIL_SMS, hrilSms_[slotId], &HRilSms::SendSmsAck, serialId, modeData); 102011fccf17Sopenharmony_ci} 102111fccf17Sopenharmony_ci 102211fccf17Sopenharmony_ciint32_t HRilManager::SendRilAck() 102311fccf17Sopenharmony_ci{ 102411fccf17Sopenharmony_ci ReleaseRunningLock(); 102511fccf17Sopenharmony_ci return HRIL_ERR_SUCCESS; 102611fccf17Sopenharmony_ci} 102711fccf17Sopenharmony_ci 102811fccf17Sopenharmony_ciHRilManager::~HRilManager() 102911fccf17Sopenharmony_ci{ 103011fccf17Sopenharmony_ci SetHrilManagerDestroy(); 103111fccf17Sopenharmony_ci if (timerCallback_ == nullptr || timerCallback_->event_ == nullptr || 103211fccf17Sopenharmony_ci timerCallback_->event_->IsNormalDestory()) { 103311fccf17Sopenharmony_ci return; 103411fccf17Sopenharmony_ci } 103511fccf17Sopenharmony_ci timerCallback_->event_->SetNormalDestory(true); 103611fccf17Sopenharmony_ci timerCallback_->OnTriggerEvent(); 103711fccf17Sopenharmony_ci if (eventLoop_ == nullptr || !eventLoop_->joinable()) { 103811fccf17Sopenharmony_ci return; 103911fccf17Sopenharmony_ci } 104011fccf17Sopenharmony_ci eventLoop_->join(); 104111fccf17Sopenharmony_ci TELEPHONY_LOGI("~HRilManager end"); 104211fccf17Sopenharmony_ci} 104311fccf17Sopenharmony_ci 104411fccf17Sopenharmony_civoid HRilManager::SetHrilManagerDestroy() 104511fccf17Sopenharmony_ci{ 104611fccf17Sopenharmony_ci pthread_mutex_lock(&dispatchMutex); 104711fccf17Sopenharmony_ci g_isHrilManagerDestory = true; 104811fccf17Sopenharmony_ci pthread_mutex_unlock(&dispatchMutex); 104911fccf17Sopenharmony_ci} 105011fccf17Sopenharmony_ci 105111fccf17Sopenharmony_ci#ifdef __cplusplus 105211fccf17Sopenharmony_ciextern "C" { 105311fccf17Sopenharmony_ci#endif 105411fccf17Sopenharmony_ci 105511fccf17Sopenharmony_ciint32_t GetSimSlotCount() 105611fccf17Sopenharmony_ci{ 105711fccf17Sopenharmony_ci char simSlotCount[HRIL_SYSPARA_SIZE] = { 0 }; 105811fccf17Sopenharmony_ci GetParameter(HRIL_TEL_SIM_SLOT_COUNT, HRIL_DEFAULT_SLOT_COUNT, simSlotCount, HRIL_SYSPARA_SIZE); 105911fccf17Sopenharmony_ci int32_t simSlotCountNumber = std::atoi(simSlotCount); 106011fccf17Sopenharmony_ci char virtualModemSwitch[HRIL_SYSPARA_SIZE] = {0}; 106111fccf17Sopenharmony_ci GetParameter(HRIL_VIRTUAL_MODEM_SWITCH, HRIL_VIRTUAL_MODEM_DEFAULT_SWITCH, virtualModemSwitch, 106211fccf17Sopenharmony_ci HRIL_SYSPARA_SIZE); 106311fccf17Sopenharmony_ci if (strcmp(virtualModemSwitch, "true") == 0 && simSlotCountNumber == 0) { 106411fccf17Sopenharmony_ci TELEPHONY_LOGI("virtualModemSwitch on. set simSlotCountNumber 1"); 106511fccf17Sopenharmony_ci simSlotCountNumber = 1; 106611fccf17Sopenharmony_ci } 106711fccf17Sopenharmony_ci char vSimModemCount[HRIL_SYSPARA_SIZE] = { 0 }; 106811fccf17Sopenharmony_ci GetParameter(HRIL_VSIM_MODEM_COUNT_STR, HRIL_DEFAULT_VSIM_MODEM_COUNT, vSimModemCount, HRIL_SYSPARA_SIZE); 106911fccf17Sopenharmony_ci int32_t vSimModemCountNumber = std::atoi(vSimModemCount); 107011fccf17Sopenharmony_ci if (simSlotCountNumber == DUAL_SLOT_COUNT && vSimModemCountNumber == MAX_SLOT_COUNT) { 107111fccf17Sopenharmony_ci simSlotCountNumber = MAX_SLOT_COUNT; 107211fccf17Sopenharmony_ci } 107311fccf17Sopenharmony_ci TELEPHONY_LOGI("GetSimSlotCount, %{public}d", simSlotCountNumber); 107411fccf17Sopenharmony_ci return simSlotCountNumber; 107511fccf17Sopenharmony_ci} 107611fccf17Sopenharmony_ci 107711fccf17Sopenharmony_cistatic void HRilBootUpEventLoop() 107811fccf17Sopenharmony_ci{ 107911fccf17Sopenharmony_ci if (!IsHrilManagerValid() || g_manager->timerCallback_ == nullptr) { 108011fccf17Sopenharmony_ci return; 108111fccf17Sopenharmony_ci } 108211fccf17Sopenharmony_ci g_manager->timerCallback_->EventLoop(); 108311fccf17Sopenharmony_ci} 108411fccf17Sopenharmony_ci 108511fccf17Sopenharmony_civoid HRilInit(void) 108611fccf17Sopenharmony_ci{ 108711fccf17Sopenharmony_ci if (!IsHrilManagerValid()) { 108811fccf17Sopenharmony_ci TELEPHONY_LOGE("HRilInit: g_manager is nullptr"); 108911fccf17Sopenharmony_ci return; 109011fccf17Sopenharmony_ci } 109111fccf17Sopenharmony_ci#ifdef ABILITY_POWER_SUPPORT 109211fccf17Sopenharmony_ci if (g_manager->powerInterface_ == nullptr) { 109311fccf17Sopenharmony_ci g_manager->powerInterface_ = IPowerInterface::Get(); 109411fccf17Sopenharmony_ci if (g_manager->powerInterface_ == nullptr) { 109511fccf17Sopenharmony_ci TELEPHONY_LOGE("failed to get power hdi interface"); 109611fccf17Sopenharmony_ci } 109711fccf17Sopenharmony_ci } 109811fccf17Sopenharmony_ci#endif 109911fccf17Sopenharmony_ci if (g_manager->eventLoop_ != nullptr) { 110011fccf17Sopenharmony_ci TELEPHONY_LOGD("eventLoop_ has exit"); 110111fccf17Sopenharmony_ci return; 110211fccf17Sopenharmony_ci } 110311fccf17Sopenharmony_ci g_manager->eventLoop_ = std::make_unique<std::thread>(HRilBootUpEventLoop); 110411fccf17Sopenharmony_ci pthread_setname_np(g_manager->eventLoop_.get()->native_handle(), "hril_eventLoop"); 110511fccf17Sopenharmony_ci} 110611fccf17Sopenharmony_ci 110711fccf17Sopenharmony_civoid HRilRegOps(const HRilOps *hrilOps) 110811fccf17Sopenharmony_ci{ 110911fccf17Sopenharmony_ci static HRilOps callBacks = { 0 }; 111011fccf17Sopenharmony_ci static RegisterState rilRegisterStatus = RIL_REGISTER_IS_NONE; 111111fccf17Sopenharmony_ci 111211fccf17Sopenharmony_ci if (hrilOps == nullptr || !IsHrilManagerValid()) { 111311fccf17Sopenharmony_ci TELEPHONY_LOGE("HRilRegOps: param is nullptr"); 111411fccf17Sopenharmony_ci return; 111511fccf17Sopenharmony_ci } 111611fccf17Sopenharmony_ci if (rilRegisterStatus > RIL_REGISTER_IS_NONE) { 111711fccf17Sopenharmony_ci TELEPHONY_LOGE("HRilRegOps is running!!!!"); 111811fccf17Sopenharmony_ci return; 111911fccf17Sopenharmony_ci } 112011fccf17Sopenharmony_ci rilRegisterStatus = RIL_REGISTER_IS_RUNNING; 112111fccf17Sopenharmony_ci g_manager->hrilOpsVersion_ = hrilOps->version; 112211fccf17Sopenharmony_ci (void)memcpy_s(&callBacks, sizeof(HRilOps), hrilOps, sizeof(HRilOps)); 112311fccf17Sopenharmony_ci for (int32_t slotId = HRIL_SIM_SLOT_0; slotId < g_manager->GetMaxSimSlotCount(); slotId++) { 112411fccf17Sopenharmony_ci if (callBacks.smsOps != nullptr) { 112511fccf17Sopenharmony_ci g_manager->RegisterSmsFuncs(slotId, callBacks.smsOps); 112611fccf17Sopenharmony_ci } 112711fccf17Sopenharmony_ci if (callBacks.callOps != nullptr) { 112811fccf17Sopenharmony_ci g_manager->RegisterCallFuncs(slotId, callBacks.callOps); 112911fccf17Sopenharmony_ci } 113011fccf17Sopenharmony_ci if (callBacks.dataOps != nullptr) { 113111fccf17Sopenharmony_ci g_manager->RegisterDataFuncs(slotId, callBacks.dataOps); 113211fccf17Sopenharmony_ci } 113311fccf17Sopenharmony_ci if (callBacks.modemOps != nullptr) { 113411fccf17Sopenharmony_ci g_manager->RegisterModemFuncs(slotId, callBacks.modemOps); 113511fccf17Sopenharmony_ci } 113611fccf17Sopenharmony_ci if (callBacks.networkOps != nullptr) { 113711fccf17Sopenharmony_ci g_manager->RegisterNetworkFuncs(slotId, callBacks.networkOps); 113811fccf17Sopenharmony_ci } 113911fccf17Sopenharmony_ci if (callBacks.simOps != nullptr) { 114011fccf17Sopenharmony_ci g_manager->RegisterSimFuncs(slotId, callBacks.simOps); 114111fccf17Sopenharmony_ci } 114211fccf17Sopenharmony_ci } 114311fccf17Sopenharmony_ci} 114411fccf17Sopenharmony_ci 114511fccf17Sopenharmony_civoid OnCallReport(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *response, size_t responseLen) 114611fccf17Sopenharmony_ci{ 114711fccf17Sopenharmony_ci if (!IsHrilManagerValid()) { 114811fccf17Sopenharmony_ci TELEPHONY_LOGE("HrilManager is nullptr, id:%{public}d", slotId); 114911fccf17Sopenharmony_ci return; 115011fccf17Sopenharmony_ci } 115111fccf17Sopenharmony_ci g_manager->OnCallReport(slotId, &reportInfo, response, responseLen); 115211fccf17Sopenharmony_ci} 115311fccf17Sopenharmony_ci 115411fccf17Sopenharmony_civoid OnDataReport(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *response, size_t responseLen) 115511fccf17Sopenharmony_ci{ 115611fccf17Sopenharmony_ci if (!IsHrilManagerValid()) { 115711fccf17Sopenharmony_ci TELEPHONY_LOGE("HrilManager is nullptr, id:%{public}d", slotId); 115811fccf17Sopenharmony_ci return; 115911fccf17Sopenharmony_ci } 116011fccf17Sopenharmony_ci g_manager->OnDataReport(slotId, &reportInfo, response, responseLen); 116111fccf17Sopenharmony_ci} 116211fccf17Sopenharmony_ci 116311fccf17Sopenharmony_civoid OnModemReport(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *response, size_t responseLen) 116411fccf17Sopenharmony_ci{ 116511fccf17Sopenharmony_ci if (!IsHrilManagerValid()) { 116611fccf17Sopenharmony_ci TELEPHONY_LOGE("HrilManager is nullptr, id:%{public}d", slotId); 116711fccf17Sopenharmony_ci return; 116811fccf17Sopenharmony_ci } 116911fccf17Sopenharmony_ci g_manager->OnModemReport(slotId, &reportInfo, response, responseLen); 117011fccf17Sopenharmony_ci} 117111fccf17Sopenharmony_ci 117211fccf17Sopenharmony_civoid OnNetworkReport(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *response, size_t responseLen) 117311fccf17Sopenharmony_ci{ 117411fccf17Sopenharmony_ci if (!IsHrilManagerValid()) { 117511fccf17Sopenharmony_ci TELEPHONY_LOGE("HrilManager is nullptr, id:%{public}d", slotId); 117611fccf17Sopenharmony_ci return; 117711fccf17Sopenharmony_ci } 117811fccf17Sopenharmony_ci g_manager->OnNetworkReport(slotId, &reportInfo, response, responseLen); 117911fccf17Sopenharmony_ci} 118011fccf17Sopenharmony_ci 118111fccf17Sopenharmony_civoid OnSimReport(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *response, size_t responseLen) 118211fccf17Sopenharmony_ci{ 118311fccf17Sopenharmony_ci if (!IsHrilManagerValid()) { 118411fccf17Sopenharmony_ci TELEPHONY_LOGE("HrilManager is nullptr, id:%{public}d", slotId); 118511fccf17Sopenharmony_ci return; 118611fccf17Sopenharmony_ci } 118711fccf17Sopenharmony_ci g_manager->OnSimReport(slotId, &reportInfo, response, responseLen); 118811fccf17Sopenharmony_ci} 118911fccf17Sopenharmony_ci 119011fccf17Sopenharmony_civoid OnSmsReport(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *response, size_t responseLen) 119111fccf17Sopenharmony_ci{ 119211fccf17Sopenharmony_ci if (!IsHrilManagerValid()) { 119311fccf17Sopenharmony_ci TELEPHONY_LOGE("HrilManager is nullptr, id:%{public}d", slotId); 119411fccf17Sopenharmony_ci return; 119511fccf17Sopenharmony_ci } 119611fccf17Sopenharmony_ci g_manager->OnSmsReport(slotId, &reportInfo, response, responseLen); 119711fccf17Sopenharmony_ci} 119811fccf17Sopenharmony_ci 119911fccf17Sopenharmony_civoid OnTimerCallback(HRilCallbackFun func, uint8_t *param, const struct timeval *tv) 120011fccf17Sopenharmony_ci{ 120111fccf17Sopenharmony_ci if (!IsHrilManagerValid() || g_manager->timerCallback_ == nullptr) { 120211fccf17Sopenharmony_ci TELEPHONY_LOGE("HrilManager or timerCallback is nullptr"); 120311fccf17Sopenharmony_ci return; 120411fccf17Sopenharmony_ci } 120511fccf17Sopenharmony_ci g_manager->timerCallback_->HRilSetTimerCallbackInfo(func, param, tv); 120611fccf17Sopenharmony_ci} 120711fccf17Sopenharmony_ci 120811fccf17Sopenharmony_ci#ifdef __cplusplus 120911fccf17Sopenharmony_ci} 121011fccf17Sopenharmony_ci#endif 121111fccf17Sopenharmony_ci} // namespace Telephony 121211fccf17Sopenharmony_ci} // namespace OHOS 1213