111fccf17Sopenharmony_ci/* 211fccf17Sopenharmony_ci * Copyright (C) 2021 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_modem.h" 1711fccf17Sopenharmony_ci 1811fccf17Sopenharmony_ci#include "hril_notification.h" 1911fccf17Sopenharmony_ci#include "hril_request.h" 2011fccf17Sopenharmony_ci 2111fccf17Sopenharmony_cinamespace OHOS { 2211fccf17Sopenharmony_cinamespace Telephony { 2311fccf17Sopenharmony_ciHRilModem::HRilModem(int32_t slotId) : HRilBase(slotId) 2411fccf17Sopenharmony_ci{ 2511fccf17Sopenharmony_ci AddHandlerToMap(); 2611fccf17Sopenharmony_ci} 2711fccf17Sopenharmony_ci 2811fccf17Sopenharmony_ciint32_t HRilModem::ShutDown(int32_t serialId) 2911fccf17Sopenharmony_ci{ 3011fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_MODEM_SHUT_DOWN, modemFuncs_, &HRilModemReq::ShutDown); 3111fccf17Sopenharmony_ci} 3211fccf17Sopenharmony_ci 3311fccf17Sopenharmony_ciint32_t HRilModem::SetRadioState(int32_t serialId, int32_t fun, int32_t rst) 3411fccf17Sopenharmony_ci{ 3511fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_MODEM_SET_RADIO_STATUS, modemFuncs_, &HRilModemReq::SetRadioState, fun, rst); 3611fccf17Sopenharmony_ci} 3711fccf17Sopenharmony_ci 3811fccf17Sopenharmony_ciint32_t HRilModem::GetRadioState(int32_t serialId) 3911fccf17Sopenharmony_ci{ 4011fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_MODEM_GET_RADIO_STATUS, modemFuncs_, &HRilModemReq::GetRadioState); 4111fccf17Sopenharmony_ci} 4211fccf17Sopenharmony_ci 4311fccf17Sopenharmony_ciint32_t HRilModem::GetImei(int32_t serialId) 4411fccf17Sopenharmony_ci{ 4511fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_MODEM_GET_IMEI, modemFuncs_, &HRilModemReq::GetImei); 4611fccf17Sopenharmony_ci} 4711fccf17Sopenharmony_ci 4811fccf17Sopenharmony_ciint32_t HRilModem::GetImeiSv(int32_t serialId) 4911fccf17Sopenharmony_ci{ 5011fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_MODEM_GET_IMEISV, modemFuncs_, &HRilModemReq::GetImeiSv); 5111fccf17Sopenharmony_ci} 5211fccf17Sopenharmony_ci 5311fccf17Sopenharmony_ciint32_t HRilModem::GetMeid(int32_t serialId) 5411fccf17Sopenharmony_ci{ 5511fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_MODEM_GET_MEID, modemFuncs_, &HRilModemReq::GetMeid); 5611fccf17Sopenharmony_ci} 5711fccf17Sopenharmony_ci 5811fccf17Sopenharmony_ciint32_t HRilModem::GetVoiceRadioTechnology(int32_t serialId) 5911fccf17Sopenharmony_ci{ 6011fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_MODEM_GET_VOICE_RADIO, modemFuncs_, &HRilModemReq::GetVoiceRadioTechnology); 6111fccf17Sopenharmony_ci} 6211fccf17Sopenharmony_ci 6311fccf17Sopenharmony_ciint32_t HRilModem::GetBasebandVersion(int32_t serialId) 6411fccf17Sopenharmony_ci{ 6511fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_MODEM_GET_BASEBAND_VERSION, modemFuncs_, &HRilModemReq::GetBasebandVersion); 6611fccf17Sopenharmony_ci} 6711fccf17Sopenharmony_ci 6811fccf17Sopenharmony_ciint32_t HRilModem::RadioStateUpdated( 6911fccf17Sopenharmony_ci const int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 7011fccf17Sopenharmony_ci{ 7111fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(int32_t)) != 0) { 7211fccf17Sopenharmony_ci TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen); 7311fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 7411fccf17Sopenharmony_ci } 7511fccf17Sopenharmony_ci if (response == nullptr) { 7611fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 7711fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 7811fccf17Sopenharmony_ci } 7911fccf17Sopenharmony_ci radioState_ = *(const int32_t *)response; 8011fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::RadioStateUpdated, radioState_); 8111fccf17Sopenharmony_ci} 8211fccf17Sopenharmony_ci 8311fccf17Sopenharmony_ciint32_t HRilModem::VoiceRadioTechUpdated( 8411fccf17Sopenharmony_ci const int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 8511fccf17Sopenharmony_ci{ 8611fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(HRilVoiceRadioInfo)) != 0) { 8711fccf17Sopenharmony_ci TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen); 8811fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 8911fccf17Sopenharmony_ci } 9011fccf17Sopenharmony_ci if (response == nullptr) { 9111fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 9211fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 9311fccf17Sopenharmony_ci } 9411fccf17Sopenharmony_ci HDI::Ril::V1_1::VoiceRadioTechnology voiceRadioTech = {}; 9511fccf17Sopenharmony_ci BuildIVoiceRadioTechnology(voiceRadioTech, *(const HRilVoiceRadioInfo *)response); 9611fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::VoiceRadioTechUpdated, voiceRadioTech); 9711fccf17Sopenharmony_ci} 9811fccf17Sopenharmony_ci 9911fccf17Sopenharmony_ciint32_t HRilModem::DsdsModeUpdated( 10011fccf17Sopenharmony_ci const int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 10111fccf17Sopenharmony_ci{ 10211fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(int32_t)) != 0) { 10311fccf17Sopenharmony_ci TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen); 10411fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 10511fccf17Sopenharmony_ci } 10611fccf17Sopenharmony_ci if (response == nullptr) { 10711fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 10811fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 10911fccf17Sopenharmony_ci } 11011fccf17Sopenharmony_ci return Notify( 11111fccf17Sopenharmony_ci indType, error, &HDI::Ril::V1_1::IRilCallback::DsdsModeUpdated, *(static_cast<const int32_t *>(response))); 11211fccf17Sopenharmony_ci} 11311fccf17Sopenharmony_ci 11411fccf17Sopenharmony_ciint32_t HRilModem::NcfgFinishedResult( 11511fccf17Sopenharmony_ci int32_t indType, HRilErrNumber error, const void *response, size_t responseLen) 11611fccf17Sopenharmony_ci{ 11711fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(int32_t)) != 0) { 11811fccf17Sopenharmony_ci TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen); 11911fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 12011fccf17Sopenharmony_ci } 12111fccf17Sopenharmony_ci if (response == nullptr) { 12211fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 12311fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 12411fccf17Sopenharmony_ci } 12511fccf17Sopenharmony_ci return Notify( 12611fccf17Sopenharmony_ci indType, error, &HDI::Ril::V1_3::IRilCallback::NcfgFinishedResult, *(static_cast<const int32_t *>(response))); 12711fccf17Sopenharmony_ci} 12811fccf17Sopenharmony_ci 12911fccf17Sopenharmony_ciint32_t HRilModem::RestartRildNvMatch( 13011fccf17Sopenharmony_ci int32_t indType, HRilErrNumber error, const void *response, size_t responseLen) 13111fccf17Sopenharmony_ci{ 13211fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(int32_t)) != 0) { 13311fccf17Sopenharmony_ci TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen); 13411fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 13511fccf17Sopenharmony_ci } 13611fccf17Sopenharmony_ci if (response == nullptr) { 13711fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 13811fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 13911fccf17Sopenharmony_ci } 14011fccf17Sopenharmony_ci return Notify( 14111fccf17Sopenharmony_ci indType, error, &HDI::Ril::V1_3::IRilCallback::RestartRildNvMatch, *(static_cast<const int32_t *>(response))); 14211fccf17Sopenharmony_ci} 14311fccf17Sopenharmony_ci 14411fccf17Sopenharmony_ciint32_t HRilModem::ShutDownResponse( 14511fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 14611fccf17Sopenharmony_ci{ 14711fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::ShutDownResponse); 14811fccf17Sopenharmony_ci} 14911fccf17Sopenharmony_ci 15011fccf17Sopenharmony_ciint32_t HRilModem::SetRadioStateResponse( 15111fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 15211fccf17Sopenharmony_ci{ 15311fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetRadioStateResponse); 15411fccf17Sopenharmony_ci} 15511fccf17Sopenharmony_ci 15611fccf17Sopenharmony_ciint32_t HRilModem::GetRadioStateResponse( 15711fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 15811fccf17Sopenharmony_ci{ 15911fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(int32_t)) != 0) { 16011fccf17Sopenharmony_ci TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen); 16111fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 16211fccf17Sopenharmony_ci } 16311fccf17Sopenharmony_ci if (response == nullptr) { 16411fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 16511fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 16611fccf17Sopenharmony_ci } 16711fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetRadioStateResponse, *(const int32_t *)response); 16811fccf17Sopenharmony_ci} 16911fccf17Sopenharmony_ci 17011fccf17Sopenharmony_ciint32_t HRilModem::GetImeiResponse( 17111fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 17211fccf17Sopenharmony_ci{ 17311fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(char)) != 0) { 17411fccf17Sopenharmony_ci TELEPHONY_LOGE("GetImeiResponse:Invalid parameter, responseLen:%{public}zu", responseLen); 17511fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 17611fccf17Sopenharmony_ci } 17711fccf17Sopenharmony_ci if (response == nullptr) { 17811fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 17911fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 18011fccf17Sopenharmony_ci } 18111fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetImeiResponse, std::string((const char *)response)); 18211fccf17Sopenharmony_ci} 18311fccf17Sopenharmony_ci 18411fccf17Sopenharmony_ciint32_t HRilModem::GetImeiSvResponse( 18511fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 18611fccf17Sopenharmony_ci{ 18711fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(char)) != 0) { 18811fccf17Sopenharmony_ci TELEPHONY_LOGE("GetImeiSvResponse:Invalid parameter, responseLen:%{public}zu", responseLen); 18911fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 19011fccf17Sopenharmony_ci } 19111fccf17Sopenharmony_ci if (response == nullptr) { 19211fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 19311fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 19411fccf17Sopenharmony_ci } 19511fccf17Sopenharmony_ci return Response( 19611fccf17Sopenharmony_ci responseInfo, &HDI::Ril::V1_3::IRilCallback::GetImeiSvResponse, std::string((const char *)response)); 19711fccf17Sopenharmony_ci} 19811fccf17Sopenharmony_ci 19911fccf17Sopenharmony_ciint32_t HRilModem::GetMeidResponse( 20011fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 20111fccf17Sopenharmony_ci{ 20211fccf17Sopenharmony_ci std::string meidResponse = ""; 20311fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(char)) != 0) { 20411fccf17Sopenharmony_ci TELEPHONY_LOGE("GetMeidResponse:Invalid parameter, responseLen:%{public}zu", responseLen); 20511fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 20611fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 20711fccf17Sopenharmony_ci } 20811fccf17Sopenharmony_ci } 20911fccf17Sopenharmony_ci if (response == nullptr) { 21011fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 21111fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 21211fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_NULL_POINT; 21311fccf17Sopenharmony_ci } 21411fccf17Sopenharmony_ci } else { 21511fccf17Sopenharmony_ci meidResponse = std::string((const char *)response); 21611fccf17Sopenharmony_ci } 21711fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetMeidResponse, meidResponse); 21811fccf17Sopenharmony_ci} 21911fccf17Sopenharmony_ci 22011fccf17Sopenharmony_ciint32_t HRilModem::GetVoiceRadioTechnologyResponse( 22111fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 22211fccf17Sopenharmony_ci{ 22311fccf17Sopenharmony_ci HDI::Ril::V1_1::VoiceRadioTechnology voiceRadioTech = {}; 22411fccf17Sopenharmony_ci if (response == nullptr) { 22511fccf17Sopenharmony_ci TELEPHONY_LOGE("GetVoiceRadioTechnologyResponse Invalid response: nullptr"); 22611fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 22711fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 22811fccf17Sopenharmony_ci } 22911fccf17Sopenharmony_ci } else { 23011fccf17Sopenharmony_ci BuildIVoiceRadioTechnology(voiceRadioTech, *(const HRilVoiceRadioInfo *)response); 23111fccf17Sopenharmony_ci } 23211fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetVoiceRadioTechnologyResponse, voiceRadioTech); 23311fccf17Sopenharmony_ci} 23411fccf17Sopenharmony_ci 23511fccf17Sopenharmony_civoid HRilModem::BuildIVoiceRadioTechnology( 23611fccf17Sopenharmony_ci HDI::Ril::V1_1::VoiceRadioTechnology &voiceRadioTech, const HRilVoiceRadioInfo &hRiadioInfo) 23711fccf17Sopenharmony_ci{ 23811fccf17Sopenharmony_ci voiceRadioTech.srvStatus = static_cast<OHOS::HDI::Ril::V1_1::RilSrvStatus>(hRiadioInfo.srvStatus); 23911fccf17Sopenharmony_ci voiceRadioTech.srvDomain = static_cast<OHOS::HDI::Ril::V1_1::RilSrvDomain>(hRiadioInfo.srvDomain); 24011fccf17Sopenharmony_ci voiceRadioTech.roamStatus = static_cast<OHOS::HDI::Ril::V1_1::RilRoamStatus>(hRiadioInfo.roamStatus); 24111fccf17Sopenharmony_ci voiceRadioTech.simStatus = static_cast<OHOS::HDI::Ril::V1_1::RilSimStatus>(hRiadioInfo.simStatus); 24211fccf17Sopenharmony_ci voiceRadioTech.lockStatus = static_cast<OHOS::HDI::Ril::V1_1::RilSimLockStatus>(hRiadioInfo.lockStatus); 24311fccf17Sopenharmony_ci voiceRadioTech.sysMode = static_cast<OHOS::HDI::Ril::V1_1::RilSysMode>(hRiadioInfo.sysMode); 24411fccf17Sopenharmony_ci voiceRadioTech.sysModeName = (hRiadioInfo.sysModeName == nullptr) ? "" : hRiadioInfo.sysModeName; 24511fccf17Sopenharmony_ci voiceRadioTech.actType = static_cast<OHOS::HDI::Ril::V1_1::RilRadioTech>(hRiadioInfo.actType); 24611fccf17Sopenharmony_ci voiceRadioTech.actName = (hRiadioInfo.actName == nullptr) ? "" : hRiadioInfo.actName; 24711fccf17Sopenharmony_ci} 24811fccf17Sopenharmony_ci 24911fccf17Sopenharmony_ciint32_t HRilModem::GetBasebandVersionResponse( 25011fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 25111fccf17Sopenharmony_ci{ 25211fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(char)) != 0) { 25311fccf17Sopenharmony_ci TELEPHONY_LOGE("GetBasebandVersionResponse:Invalid parameter, responseLen:%{public}zu", responseLen); 25411fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 25511fccf17Sopenharmony_ci } 25611fccf17Sopenharmony_ci if (response == nullptr) { 25711fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 25811fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 25911fccf17Sopenharmony_ci } 26011fccf17Sopenharmony_ci return Response( 26111fccf17Sopenharmony_ci responseInfo, &HDI::Ril::V1_1::IRilCallback::GetBasebandVersionResponse, std::string((const char *)response)); 26211fccf17Sopenharmony_ci} 26311fccf17Sopenharmony_ci 26411fccf17Sopenharmony_cibool HRilModem::IsModemResponse(uint32_t code) 26511fccf17Sopenharmony_ci{ 26611fccf17Sopenharmony_ci return ((code >= HREQ_COMMON_BASE) && (code <= HREQ_MODEM_GET_VOICE_RADIO)); 26711fccf17Sopenharmony_ci} 26811fccf17Sopenharmony_ci 26911fccf17Sopenharmony_cibool HRilModem::IsModemNotification(uint32_t code) 27011fccf17Sopenharmony_ci{ 27111fccf17Sopenharmony_ci return ((code >= HNOTI_COMMON_BASE) && (code <= HNOTI_COMMON_END)); 27211fccf17Sopenharmony_ci} 27311fccf17Sopenharmony_ci 27411fccf17Sopenharmony_cibool HRilModem::IsModemRespOrNotify(uint32_t code) 27511fccf17Sopenharmony_ci{ 27611fccf17Sopenharmony_ci return IsModemResponse(code) || IsModemNotification(code); 27711fccf17Sopenharmony_ci} 27811fccf17Sopenharmony_ci 27911fccf17Sopenharmony_ciint32_t HRilModem::SetActiveSimResponse( 28011fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 28111fccf17Sopenharmony_ci{ 28211fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetActiveSimResponse); 28311fccf17Sopenharmony_ci} 28411fccf17Sopenharmony_ci 28511fccf17Sopenharmony_civoid HRilModem::AddHandlerToMap() 28611fccf17Sopenharmony_ci{ 28711fccf17Sopenharmony_ci // indication 28811fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_MODEM_RADIO_STATE_UPDATED] = 28911fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 29011fccf17Sopenharmony_ci size_t responseLen) { return RadioStateUpdated(notifyType, error, response, responseLen); }; 29111fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_MODEM_VOICE_TECH_UPDATED] = 29211fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 29311fccf17Sopenharmony_ci size_t responseLen) { return VoiceRadioTechUpdated(notifyType, error, response, responseLen); }; 29411fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_MODEM_DSDS_MODE_UPDATED] = 29511fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 29611fccf17Sopenharmony_ci size_t responseLen) { return DsdsModeUpdated(notifyType, error, response, responseLen); }; 29711fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_MODEM_NCFG_FINISHED_RESULT] = 29811fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 29911fccf17Sopenharmony_ci size_t responseLen) { return NcfgFinishedResult(notifyType, error, response, responseLen); }; 30011fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_MODEM_RESTART_RILD_NV_MATCH] = 30111fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 30211fccf17Sopenharmony_ci size_t responseLen) { return RestartRildNvMatch(notifyType, error, response, responseLen); }; 30311fccf17Sopenharmony_ci // response 30411fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_MODEM_SHUT_DOWN] = 30511fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 30611fccf17Sopenharmony_ci size_t responseLen) { return ShutDownResponse(requestNum, responseInfo, response, responseLen); }; 30711fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_MODEM_SET_RADIO_STATUS] = 30811fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 30911fccf17Sopenharmony_ci size_t responseLen) { return SetRadioStateResponse(requestNum, responseInfo, response, responseLen); }; 31011fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_SIM_SET_ACTIVE_SIM] = 31111fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 31211fccf17Sopenharmony_ci size_t responseLen) { return SetActiveSimResponse(requestNum, responseInfo, response, responseLen); }; 31311fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_MODEM_GET_RADIO_STATUS] = 31411fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 31511fccf17Sopenharmony_ci size_t responseLen) { return GetRadioStateResponse(requestNum, responseInfo, response, responseLen); }; 31611fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_MODEM_GET_IMEI] = 31711fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 31811fccf17Sopenharmony_ci size_t responseLen) { return GetImeiResponse(requestNum, responseInfo, response, responseLen); }; 31911fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_MODEM_GET_IMEISV] = 32011fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 32111fccf17Sopenharmony_ci size_t responseLen) { return GetImeiSvResponse(requestNum, responseInfo, response, responseLen); }; 32211fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_MODEM_GET_MEID] = 32311fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 32411fccf17Sopenharmony_ci size_t responseLen) { return GetMeidResponse(requestNum, responseInfo, response, responseLen); }; 32511fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_MODEM_GET_VOICE_RADIO] = [this](int32_t requestNum, 32611fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) { 32711fccf17Sopenharmony_ci return GetVoiceRadioTechnologyResponse(requestNum, responseInfo, response, responseLen); 32811fccf17Sopenharmony_ci }; 32911fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_MODEM_GET_BASEBAND_VERSION] = 33011fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 33111fccf17Sopenharmony_ci size_t responseLen) { return GetBasebandVersionResponse(requestNum, responseInfo, response, responseLen); }; 33211fccf17Sopenharmony_ci} 33311fccf17Sopenharmony_ci 33411fccf17Sopenharmony_civoid HRilModem::RegisterModemFuncs(const HRilModemReq *modemFuncs) 33511fccf17Sopenharmony_ci{ 33611fccf17Sopenharmony_ci modemFuncs_ = modemFuncs; 33711fccf17Sopenharmony_ci} 33811fccf17Sopenharmony_ci 33911fccf17Sopenharmony_ciint32_t HRilModem::GetLastRadioState() 34011fccf17Sopenharmony_ci{ 34111fccf17Sopenharmony_ci return radioState_; 34211fccf17Sopenharmony_ci} 34311fccf17Sopenharmony_ci} // namespace Telephony 34411fccf17Sopenharmony_ci} // namespace OHOS