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_network.h" 1711fccf17Sopenharmony_ci 1811fccf17Sopenharmony_ci#include <sys/time.h> 1911fccf17Sopenharmony_ci 2011fccf17Sopenharmony_ci#include "hril_notification.h" 2111fccf17Sopenharmony_ci#include "hril_request.h" 2211fccf17Sopenharmony_ci 2311fccf17Sopenharmony_cinamespace OHOS { 2411fccf17Sopenharmony_cinamespace Telephony { 2511fccf17Sopenharmony_cienum class NetworkParameter : int32_t { 2611fccf17Sopenharmony_ci RESPONSE_VALUE = 3, 2711fccf17Sopenharmony_ci INVALID_RESPONSE_VALUE = 11, 2811fccf17Sopenharmony_ci}; 2911fccf17Sopenharmony_ciconst int64_t NANO_TO_SECOND = 1000000000; 3011fccf17Sopenharmony_ci 3111fccf17Sopenharmony_ciHRilNetwork::HRilNetwork(int32_t slotId) : HRilBase(slotId) 3211fccf17Sopenharmony_ci{ 3311fccf17Sopenharmony_ci AddNotificationToMap(); 3411fccf17Sopenharmony_ci AddBasicHandlerToMap(); 3511fccf17Sopenharmony_ci AddNetworkSearchHandlerToMap(); 3611fccf17Sopenharmony_ci} 3711fccf17Sopenharmony_ci 3811fccf17Sopenharmony_civoid HRilNetwork::AddNotificationToMap() 3911fccf17Sopenharmony_ci{ 4011fccf17Sopenharmony_ci // indication 4111fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_CS_REG_STATUS_UPDATED] = 4211fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 4311fccf17Sopenharmony_ci size_t responseLen) { return NetworkCsRegStatusUpdated(notifyType, error, response, responseLen); }; 4411fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_SIGNAL_STRENGTH_UPDATED] = 4511fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 4611fccf17Sopenharmony_ci size_t responseLen) { return SignalStrengthUpdated(notifyType, error, response, responseLen); }; 4711fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_TIME_UPDATED] = 4811fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 4911fccf17Sopenharmony_ci size_t responseLen) { return NetworkTimeUpdated(notifyType, error, response, responseLen); }; 5011fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_TIME_ZONE_UPDATED] = 5111fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 5211fccf17Sopenharmony_ci size_t responseLen) { return NetworkTimeZoneUpdated(notifyType, error, response, responseLen); }; 5311fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_PS_REG_STATUS_UPDATED] = 5411fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 5511fccf17Sopenharmony_ci size_t responseLen) { return NetworkPsRegStatusUpdated(notifyType, error, response, responseLen); }; 5611fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_PHY_CHNL_CFG_UPDATED] = 5711fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 5811fccf17Sopenharmony_ci size_t responseLen) { return NetworkPhyChnlCfgUpdated(notifyType, error, response, responseLen); }; 5911fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_CURRENT_CELL_UPDATED] = 6011fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 6111fccf17Sopenharmony_ci size_t responseLen) { return NetworkCurrentCellUpdated_1_2(notifyType, error, response, responseLen); }; 6211fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_RRC_CONNECTION_STATE_UPDATED] = 6311fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 6411fccf17Sopenharmony_ci size_t responseLen) { return GetRrcConnectionStateUpdated(notifyType, error, response, responseLen); }; 6511fccf17Sopenharmony_ci notiMemberFuncMap_[HNOTI_NETWORK_RESIDENT_NETWORK_UPDATED] = 6611fccf17Sopenharmony_ci [this](int32_t notifyType, HRilErrNumber error, const void *response, 6711fccf17Sopenharmony_ci size_t responseLen) { return ResidentNetworkUpdated(notifyType, error, response, responseLen); }; 6811fccf17Sopenharmony_ci} 6911fccf17Sopenharmony_ci 7011fccf17Sopenharmony_civoid HRilNetwork::AddBasicHandlerToMap() 7111fccf17Sopenharmony_ci{ 7211fccf17Sopenharmony_ci // Response 7311fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_SIGNAL_STRENGTH] = 7411fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 7511fccf17Sopenharmony_ci size_t responseLen) { return GetSignalStrengthResponse(requestNum, responseInfo, response, responseLen); }; 7611fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_CS_REG_STATUS] = 7711fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 7811fccf17Sopenharmony_ci size_t responseLen) { return GetCsRegStatusResponse(requestNum, responseInfo, response, responseLen); }; 7911fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_PS_REG_STATUS] = 8011fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 8111fccf17Sopenharmony_ci size_t responseLen) { return GetPsRegStatusResponse(requestNum, responseInfo, response, responseLen); }; 8211fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_OPERATOR_INFO] = 8311fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 8411fccf17Sopenharmony_ci size_t responseLen) { return GetOperatorInfoResponse(requestNum, responseInfo, response, responseLen); }; 8511fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_SET_LOCATE_UPDATES] = 8611fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 8711fccf17Sopenharmony_ci size_t responseLen) { return SetLocateUpdatesResponse(requestNum, responseInfo, response, responseLen); }; 8811fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_SET_NOTIFICATION_FILTER] = 8911fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 9011fccf17Sopenharmony_ci size_t responseLen) { return SetNotificationFilterResponse(requestNum, responseInfo, response, responseLen); }; 9111fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_SET_DEVICE_STATE] = 9211fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 9311fccf17Sopenharmony_ci size_t responseLen) { return SetDeviceStateResponse(requestNum, responseInfo, response, responseLen); }; 9411fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_SET_NR_OPTION_MODE] = 9511fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 9611fccf17Sopenharmony_ci size_t responseLen) { return SetNrOptionModeResponse(requestNum, responseInfo, response, responseLen); }; 9711fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_NR_OPTION_MODE] = 9811fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 9911fccf17Sopenharmony_ci size_t responseLen) { return GetNrOptionModeResponse(requestNum, responseInfo, response, responseLen); }; 10011fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_RRC_CONNECTION_STATE] = 10111fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 10211fccf17Sopenharmony_ci size_t responseLen) { return GetRrcConnectionStateResponse(requestNum, responseInfo, response, responseLen); }; 10311fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_NR_SSBID_INFO] = 10411fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 10511fccf17Sopenharmony_ci size_t responseLen) { return GetNrSsbIdResponse(requestNum, responseInfo, response, responseLen); }; 10611fccf17Sopenharmony_ci} 10711fccf17Sopenharmony_ci 10811fccf17Sopenharmony_civoid HRilNetwork::AddNetworkSearchHandlerToMap() 10911fccf17Sopenharmony_ci{ 11011fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION] = [this](int32_t requestNum, 11111fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) { 11211fccf17Sopenharmony_ci return GetNetworkSearchInformationResponse(requestNum, responseInfo, response, responseLen); 11311fccf17Sopenharmony_ci }; 11411fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_NETWORK_SELECTION_MODE] = [this](int32_t requestNum, 11511fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) { 11611fccf17Sopenharmony_ci return GetNetworkSelectionModeResponse(requestNum, responseInfo, response, responseLen); 11711fccf17Sopenharmony_ci }; 11811fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_SET_NETWORK_SELECTION_MODE] = [this](int32_t requestNum, 11911fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) { 12011fccf17Sopenharmony_ci return SetNetworkSelectionModeResponse(requestNum, responseInfo, response, responseLen); 12111fccf17Sopenharmony_ci }; 12211fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_SET_PREFERRED_NETWORK] = 12311fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 12411fccf17Sopenharmony_ci size_t responseLen) { return SetPreferredNetworkResponse(requestNum, responseInfo, response, responseLen); }; 12511fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_PREFERRED_NETWORK] = 12611fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 12711fccf17Sopenharmony_ci size_t responseLen) { return GetPreferredNetworkResponse(requestNum, responseInfo, response, responseLen); }; 12811fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST] = [this](int32_t requestNum, 12911fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) { 13011fccf17Sopenharmony_ci return GetNeighboringCellInfoListResponse_1_2(requestNum, responseInfo, response, responseLen); 13111fccf17Sopenharmony_ci }; 13211fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_CURRENT_CELL_INFO] = 13311fccf17Sopenharmony_ci [this](int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, 13411fccf17Sopenharmony_ci size_t responseLen) { return GetCurrentCellInfoResponse_1_2(requestNum, responseInfo, response, responseLen); }; 13511fccf17Sopenharmony_ci respMemberFuncMap_[HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG] = [this](int32_t requestNum, 13611fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) { 13711fccf17Sopenharmony_ci return GetPhysicalChannelConfigResponse(requestNum, responseInfo, response, responseLen); 13811fccf17Sopenharmony_ci }; 13911fccf17Sopenharmony_ci} 14011fccf17Sopenharmony_ci 14111fccf17Sopenharmony_ciint32_t HRilNetwork::GetSignalStrength(int32_t serialId) 14211fccf17Sopenharmony_ci{ 14311fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_SIGNAL_STRENGTH, networkFuncs_, &HRilNetworkReq::GetSignalStrength); 14411fccf17Sopenharmony_ci} 14511fccf17Sopenharmony_ci 14611fccf17Sopenharmony_ciint32_t HRilNetwork::GetCsRegStatus(int32_t serialId) 14711fccf17Sopenharmony_ci{ 14811fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_CS_REG_STATUS, networkFuncs_, &HRilNetworkReq::GetCsRegStatus); 14911fccf17Sopenharmony_ci} 15011fccf17Sopenharmony_ci 15111fccf17Sopenharmony_ciint32_t HRilNetwork::GetPsRegStatus(int32_t serialId) 15211fccf17Sopenharmony_ci{ 15311fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_PS_REG_STATUS, networkFuncs_, &HRilNetworkReq::GetPsRegStatus); 15411fccf17Sopenharmony_ci} 15511fccf17Sopenharmony_ci 15611fccf17Sopenharmony_ciint32_t HRilNetwork::GetOperatorInfo(int32_t serialId) 15711fccf17Sopenharmony_ci{ 15811fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_OPERATOR_INFO, networkFuncs_, &HRilNetworkReq::GetOperatorInfo); 15911fccf17Sopenharmony_ci} 16011fccf17Sopenharmony_ci 16111fccf17Sopenharmony_ciint32_t HRilNetwork::GetNeighboringCellInfoList(int32_t serialId) 16211fccf17Sopenharmony_ci{ 16311fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST, networkFuncs_, 16411fccf17Sopenharmony_ci &HRilNetworkReq::GetNeighboringCellInfoList); 16511fccf17Sopenharmony_ci} 16611fccf17Sopenharmony_ci 16711fccf17Sopenharmony_ciint32_t HRilNetwork::GetCurrentCellInfo(int32_t serialId) 16811fccf17Sopenharmony_ci{ 16911fccf17Sopenharmony_ci return RequestVendor( 17011fccf17Sopenharmony_ci serialId, HREQ_NETWORK_GET_CURRENT_CELL_INFO, networkFuncs_, &HRilNetworkReq::GetCurrentCellInfo); 17111fccf17Sopenharmony_ci} 17211fccf17Sopenharmony_ci 17311fccf17Sopenharmony_ciint32_t HRilNetwork::GetNetworkSearchInformation(int32_t serialId) 17411fccf17Sopenharmony_ci{ 17511fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION, networkFuncs_, 17611fccf17Sopenharmony_ci &HRilNetworkReq::GetNetworkSearchInformation); 17711fccf17Sopenharmony_ci} 17811fccf17Sopenharmony_ci 17911fccf17Sopenharmony_ciint32_t HRilNetwork::GetNetworkSelectionMode(int32_t serialId) 18011fccf17Sopenharmony_ci{ 18111fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_NETWORK_SELECTION_MODE, networkFuncs_, 18211fccf17Sopenharmony_ci &HRilNetworkReq::GetNetworkSelectionMode); 18311fccf17Sopenharmony_ci} 18411fccf17Sopenharmony_ci 18511fccf17Sopenharmony_ciint32_t HRilNetwork::SetNetworkSelectionMode( 18611fccf17Sopenharmony_ci int32_t serialId, const HDI::Ril::V1_1::SetNetworkModeInfo &networkModeInfo) 18711fccf17Sopenharmony_ci{ 18811fccf17Sopenharmony_ci HRilSetNetworkModeInfo setNetworkModeInfo = {}; 18911fccf17Sopenharmony_ci setNetworkModeInfo.selectMode = networkModeInfo.selectMode; 19011fccf17Sopenharmony_ci ConvertToString(&setNetworkModeInfo.oper, networkModeInfo.oper); 19111fccf17Sopenharmony_ci TELEPHONY_LOGI("HRilNetwork::SetNetworkSelectionMode selectMode = %{public}d", setNetworkModeInfo.selectMode); 19211fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_SET_NETWORK_SELECTION_MODE, networkFuncs_, 19311fccf17Sopenharmony_ci &HRilNetworkReq::SetNetworkSelectionMode, &setNetworkModeInfo); 19411fccf17Sopenharmony_ci} 19511fccf17Sopenharmony_ci 19611fccf17Sopenharmony_ciint32_t HRilNetwork::SetPreferredNetwork(int32_t serialId, int32_t preferredNetworkType) 19711fccf17Sopenharmony_ci{ 19811fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_SET_PREFERRED_NETWORK, networkFuncs_, 19911fccf17Sopenharmony_ci &HRilNetworkReq::SetPreferredNetwork, &preferredNetworkType); 20011fccf17Sopenharmony_ci} 20111fccf17Sopenharmony_ci 20211fccf17Sopenharmony_ciint32_t HRilNetwork::GetPreferredNetwork(int32_t serialId) 20311fccf17Sopenharmony_ci{ 20411fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_PREFERRED_NETWORK, networkFuncs_, 20511fccf17Sopenharmony_ci &HRilNetworkReq::GetPreferredNetwork); 20611fccf17Sopenharmony_ci} 20711fccf17Sopenharmony_ci 20811fccf17Sopenharmony_ciint32_t HRilNetwork::GetPhysicalChannelConfig(int32_t serialId) 20911fccf17Sopenharmony_ci{ 21011fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG, networkFuncs_, 21111fccf17Sopenharmony_ci &HRilNetworkReq::GetPhysicalChannelConfig); 21211fccf17Sopenharmony_ci} 21311fccf17Sopenharmony_ci 21411fccf17Sopenharmony_ciint32_t HRilNetwork::SetLocateUpdates(int32_t serialId, const HDI::Ril::V1_1::RilRegNotifyMode mode) 21511fccf17Sopenharmony_ci{ 21611fccf17Sopenharmony_ci HRilRegNotifyMode regNotifyMode = static_cast<HRilRegNotifyMode>(mode); 21711fccf17Sopenharmony_ci if ((regNotifyMode < REG_NOT_NOTIFY) || (regNotifyMode > REG_NOTIFY_STAT_LAC_CELLID)) { 21811fccf17Sopenharmony_ci TELEPHONY_LOGE("SetLocateUpdates Invalid regNotifyMode parameter"); 21911fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 22011fccf17Sopenharmony_ci } 22111fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_SET_LOCATE_UPDATES, networkFuncs_, 22211fccf17Sopenharmony_ci &HRilNetworkReq::SetLocateUpdates, static_cast<HRilRegNotifyMode>(mode)); 22311fccf17Sopenharmony_ci} 22411fccf17Sopenharmony_ci 22511fccf17Sopenharmony_ciint32_t HRilNetwork::SetNotificationFilter(int32_t serialId, int32_t newFilter) 22611fccf17Sopenharmony_ci{ 22711fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_SET_NOTIFICATION_FILTER, networkFuncs_, 22811fccf17Sopenharmony_ci &HRilNetworkReq::SetNotificationFilter, &newFilter); 22911fccf17Sopenharmony_ci} 23011fccf17Sopenharmony_ci 23111fccf17Sopenharmony_ciint32_t HRilNetwork::SetDeviceState(int32_t serialId, int32_t deviceStateType, int32_t deviceStateOn) 23211fccf17Sopenharmony_ci{ 23311fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_SET_DEVICE_STATE, networkFuncs_, 23411fccf17Sopenharmony_ci &HRilNetworkReq::SetDeviceState, &deviceStateType, &deviceStateOn); 23511fccf17Sopenharmony_ci} 23611fccf17Sopenharmony_ci 23711fccf17Sopenharmony_ciint32_t HRilNetwork::SetNrOptionMode(int32_t serialId, int32_t mode) 23811fccf17Sopenharmony_ci{ 23911fccf17Sopenharmony_ci return RequestVendor( 24011fccf17Sopenharmony_ci serialId, HREQ_NETWORK_SET_NR_OPTION_MODE, networkFuncs_, &HRilNetworkReq::SetNrOptionMode, &mode); 24111fccf17Sopenharmony_ci} 24211fccf17Sopenharmony_ci 24311fccf17Sopenharmony_ciint32_t HRilNetwork::GetNrOptionMode(int32_t serialId) 24411fccf17Sopenharmony_ci{ 24511fccf17Sopenharmony_ci return RequestVendor(serialId, HREQ_NETWORK_GET_NR_OPTION_MODE, networkFuncs_, &HRilNetworkReq::GetNrOptionMode); 24611fccf17Sopenharmony_ci} 24711fccf17Sopenharmony_ci 24811fccf17Sopenharmony_ciint32_t HRilNetwork::GetRrcConnectionState(int32_t serialId) 24911fccf17Sopenharmony_ci{ 25011fccf17Sopenharmony_ci return RequestVendor( 25111fccf17Sopenharmony_ci serialId, HREQ_NETWORK_GET_RRC_CONNECTION_STATE, networkFuncs_, &HRilNetworkReq::GetRrcConnectionState); 25211fccf17Sopenharmony_ci} 25311fccf17Sopenharmony_ci 25411fccf17Sopenharmony_ciint32_t HRilNetwork::GetNrSsbId(int32_t serialId) 25511fccf17Sopenharmony_ci{ 25611fccf17Sopenharmony_ci return RequestVendor( 25711fccf17Sopenharmony_ci serialId, HREQ_NETWORK_GET_NR_SSBID_INFO, networkFuncs_, &HRilNetworkReq::GetNrSsbId); 25811fccf17Sopenharmony_ci} 25911fccf17Sopenharmony_ci 26011fccf17Sopenharmony_ciint32_t HRilNetwork::GetSignalStrengthResponse( 26111fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 26211fccf17Sopenharmony_ci{ 26311fccf17Sopenharmony_ci HDI::Ril::V1_1::Rssi rssi = {}; 26411fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilRssi)) { 26511fccf17Sopenharmony_ci TELEPHONY_LOGE("GetSignalStrengthResponse response is invalid"); 26611fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 26711fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 26811fccf17Sopenharmony_ci } 26911fccf17Sopenharmony_ci } else { 27011fccf17Sopenharmony_ci ExchangeRilRssiToHdf(response, rssi); 27111fccf17Sopenharmony_ci } 27211fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetSignalStrengthResponse, rssi); 27311fccf17Sopenharmony_ci} 27411fccf17Sopenharmony_ci 27511fccf17Sopenharmony_ciint32_t HRilNetwork::GetCsRegStatusResponse( 27611fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 27711fccf17Sopenharmony_ci{ 27811fccf17Sopenharmony_ci HDI::Ril::V1_1::CsRegStatusInfo csRegStatusInfo = {}; 27911fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilRegStatusInfo)) { 28011fccf17Sopenharmony_ci TELEPHONY_LOGE("GetCsRegStatusResponse response is invalid"); 28111fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 28211fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 28311fccf17Sopenharmony_ci } 28411fccf17Sopenharmony_ci } else { 28511fccf17Sopenharmony_ci const HRilRegStatusInfo *hrilRegStatusInfo = static_cast<const HRilRegStatusInfo *>(response); 28611fccf17Sopenharmony_ci csRegStatusInfo.notifyType = hrilRegStatusInfo->notifyMode; 28711fccf17Sopenharmony_ci csRegStatusInfo.regStatus = static_cast<HDI::Ril::V1_1::RilRegStatus>(hrilRegStatusInfo->regStatus); 28811fccf17Sopenharmony_ci csRegStatusInfo.lacCode = hrilRegStatusInfo->lacCode; 28911fccf17Sopenharmony_ci csRegStatusInfo.cellId = hrilRegStatusInfo->cellId; 29011fccf17Sopenharmony_ci csRegStatusInfo.radioTechnology = static_cast<HDI::Ril::V1_1::RilRadioTech>(hrilRegStatusInfo->actType); 29111fccf17Sopenharmony_ci TELEPHONY_LOGD("GetCsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, " 29211fccf17Sopenharmony_ci "lacCode:%{private}d, cellId:%{private}d, radioTechnology:%{public}d", 29311fccf17Sopenharmony_ci csRegStatusInfo.notifyType, csRegStatusInfo.regStatus, csRegStatusInfo.lacCode, csRegStatusInfo.cellId, 29411fccf17Sopenharmony_ci csRegStatusInfo.radioTechnology); 29511fccf17Sopenharmony_ci } 29611fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetCsRegStatusResponse, csRegStatusInfo); 29711fccf17Sopenharmony_ci} 29811fccf17Sopenharmony_ci 29911fccf17Sopenharmony_ciint32_t HRilNetwork::GetPsRegStatusResponse( 30011fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 30111fccf17Sopenharmony_ci{ 30211fccf17Sopenharmony_ci HDI::Ril::V1_1::PsRegStatusInfo psRegStatusInfo = {}; 30311fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilRegStatusInfo)) { 30411fccf17Sopenharmony_ci TELEPHONY_LOGE("GetPsRegStatusResponse response is invalid"); 30511fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 30611fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 30711fccf17Sopenharmony_ci } 30811fccf17Sopenharmony_ci } else { 30911fccf17Sopenharmony_ci const HRilRegStatusInfo *hrilRegStatusInfo = static_cast<const HRilRegStatusInfo *>(response); 31011fccf17Sopenharmony_ci psRegStatusInfo.notifyType = hrilRegStatusInfo->notifyMode; 31111fccf17Sopenharmony_ci psRegStatusInfo.regStatus = static_cast<HDI::Ril::V1_1::RilRegStatus>(hrilRegStatusInfo->regStatus); 31211fccf17Sopenharmony_ci psRegStatusInfo.lacCode = hrilRegStatusInfo->lacCode; 31311fccf17Sopenharmony_ci psRegStatusInfo.cellId = hrilRegStatusInfo->cellId; 31411fccf17Sopenharmony_ci psRegStatusInfo.radioTechnology = static_cast<HDI::Ril::V1_1::RilRadioTech>(hrilRegStatusInfo->actType); 31511fccf17Sopenharmony_ci psRegStatusInfo.isDcNrRestricted = hrilRegStatusInfo->isDcNrRestricted; 31611fccf17Sopenharmony_ci psRegStatusInfo.isNrAvailable = hrilRegStatusInfo->isNrAvailable; 31711fccf17Sopenharmony_ci psRegStatusInfo.isEnDcAvailable = hrilRegStatusInfo->isEnDcAvailable; 31811fccf17Sopenharmony_ci TELEPHONY_LOGD( 31911fccf17Sopenharmony_ci "GetPsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, lacCode:%{private}d, " 32011fccf17Sopenharmony_ci "cellId:%{private}d, technology:%{public}d, isDcNrRestricted:%{private}d, isNrAvailable:%{private}d, " 32111fccf17Sopenharmony_ci "isEnDcAvailable:%{private}d", 32211fccf17Sopenharmony_ci psRegStatusInfo.notifyType, psRegStatusInfo.regStatus, psRegStatusInfo.lacCode, psRegStatusInfo.cellId, 32311fccf17Sopenharmony_ci psRegStatusInfo.radioTechnology, psRegStatusInfo.isDcNrRestricted, psRegStatusInfo.isNrAvailable, 32411fccf17Sopenharmony_ci psRegStatusInfo.isEnDcAvailable); 32511fccf17Sopenharmony_ci } 32611fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetPsRegStatusResponse, psRegStatusInfo); 32711fccf17Sopenharmony_ci} 32811fccf17Sopenharmony_ci 32911fccf17Sopenharmony_ciint32_t HRilNetwork::GetOperatorInfoResponse( 33011fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 33111fccf17Sopenharmony_ci{ 33211fccf17Sopenharmony_ci HDI::Ril::V1_1::OperatorInfo operatorInfoResult = {}; 33311fccf17Sopenharmony_ci if (response == nullptr || responseLen == 0) { 33411fccf17Sopenharmony_ci TELEPHONY_LOGE("GetOperatorInfoResponse response is invalid"); 33511fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 33611fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 33711fccf17Sopenharmony_ci } 33811fccf17Sopenharmony_ci } else { 33911fccf17Sopenharmony_ci char **resp = static_cast<char **>(const_cast<void *>(response)); 34011fccf17Sopenharmony_ci operatorInfoResult.longName = (resp[HRIL_LONE_NAME] == nullptr) ? "" : resp[HRIL_LONE_NAME]; 34111fccf17Sopenharmony_ci operatorInfoResult.shortName = (resp[HRIL_SHORT_NAME] == nullptr) ? "" : resp[HRIL_SHORT_NAME]; 34211fccf17Sopenharmony_ci operatorInfoResult.numeric = (resp[HRIL_NUMERIC] == nullptr) ? "" : resp[HRIL_NUMERIC]; 34311fccf17Sopenharmony_ci TELEPHONY_LOGD("GetOperatorInfoResponse longName:%{public}s, shortName:%{public}s, numeric:%{public}s", 34411fccf17Sopenharmony_ci operatorInfoResult.longName.c_str(), operatorInfoResult.shortName.c_str(), 34511fccf17Sopenharmony_ci operatorInfoResult.numeric.c_str()); 34611fccf17Sopenharmony_ci } 34711fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetOperatorInfoResponse, operatorInfoResult); 34811fccf17Sopenharmony_ci} 34911fccf17Sopenharmony_ci 35011fccf17Sopenharmony_ciint32_t HRilNetwork::GetNetworkSearchInformationResponse( 35111fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 35211fccf17Sopenharmony_ci{ 35311fccf17Sopenharmony_ci HDI::Ril::V1_1::AvailableNetworkList availableNetworkList = {}; 35411fccf17Sopenharmony_ci if (response == nullptr || responseLen == 0) { 35511fccf17Sopenharmony_ci TELEPHONY_LOGE("GetNetworkSearchInformationResponse response is invalid"); 35611fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 35711fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 35811fccf17Sopenharmony_ci } 35911fccf17Sopenharmony_ci } else { 36011fccf17Sopenharmony_ci availableNetworkList.itemNum = 0; 36111fccf17Sopenharmony_ci BuildOperatorList(availableNetworkList, response, responseLen); 36211fccf17Sopenharmony_ci } 36311fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetNetworkSearchInformationResponse, 36411fccf17Sopenharmony_ci availableNetworkList); 36511fccf17Sopenharmony_ci} 36611fccf17Sopenharmony_ci 36711fccf17Sopenharmony_ciint32_t HRilNetwork::GetNetworkSelectionModeResponse( 36811fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 36911fccf17Sopenharmony_ci{ 37011fccf17Sopenharmony_ci HDI::Ril::V1_1::SetNetworkModeInfo selectModeInfo = {}; 37111fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(int32_t)) { 37211fccf17Sopenharmony_ci TELEPHONY_LOGE("GetNetworkSelectionModeResponse response is invalid"); 37311fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 37411fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 37511fccf17Sopenharmony_ci } 37611fccf17Sopenharmony_ci } else { 37711fccf17Sopenharmony_ci int32_t *resp = static_cast<int32_t *>(const_cast<void *>(response)); 37811fccf17Sopenharmony_ci selectModeInfo.selectMode = *resp; 37911fccf17Sopenharmony_ci TELEPHONY_LOGI("GetNetworkSelectionModeResponse selectMode: %{public}d", selectModeInfo.selectMode); 38011fccf17Sopenharmony_ci } 38111fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetNetworkSelectionModeResponse, selectModeInfo); 38211fccf17Sopenharmony_ci} 38311fccf17Sopenharmony_ci 38411fccf17Sopenharmony_ciint32_t HRilNetwork::SetNetworkSelectionModeResponse( 38511fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 38611fccf17Sopenharmony_ci{ 38711fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetNetworkSelectionModeResponse); 38811fccf17Sopenharmony_ci} 38911fccf17Sopenharmony_ci 39011fccf17Sopenharmony_ciint32_t HRilNetwork::SetPreferredNetworkResponse( 39111fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 39211fccf17Sopenharmony_ci{ 39311fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetPreferredNetworkResponse); 39411fccf17Sopenharmony_ci} 39511fccf17Sopenharmony_ci 39611fccf17Sopenharmony_ciint32_t HRilNetwork::GetPreferredNetworkResponse( 39711fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 39811fccf17Sopenharmony_ci{ 39911fccf17Sopenharmony_ci HDI::Ril::V1_1::PreferredNetworkTypeInfo preferredNetworkTypeInfo = {}; 40011fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(int32_t)) { 40111fccf17Sopenharmony_ci TELEPHONY_LOGE("GetPreferredNetworkResponse response is invalid"); 40211fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 40311fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 40411fccf17Sopenharmony_ci } 40511fccf17Sopenharmony_ci } else { 40611fccf17Sopenharmony_ci int32_t *resp = static_cast<int32_t *>(const_cast<void *>(response)); 40711fccf17Sopenharmony_ci preferredNetworkTypeInfo.preferredNetworkType = *resp; 40811fccf17Sopenharmony_ci TELEPHONY_LOGI("GetPreferredNetworkResponse preferredNetworkType: %{public}d", *resp); 40911fccf17Sopenharmony_ci } 41011fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetPreferredNetworkResponse, preferredNetworkTypeInfo); 41111fccf17Sopenharmony_ci} 41211fccf17Sopenharmony_ci 41311fccf17Sopenharmony_ciint32_t HRilNetwork::GetNeighboringCellInfoListResponse( 41411fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 41511fccf17Sopenharmony_ci{ 41611fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListNearbyInfo cellInfoList; 41711fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(CellInfoList)) { 41811fccf17Sopenharmony_ci TELEPHONY_LOGE("GetNeighboringCellInfoListResponse response is invalid"); 41911fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 42011fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 42111fccf17Sopenharmony_ci } 42211fccf17Sopenharmony_ci } else { 42311fccf17Sopenharmony_ci cellInfoList.itemNum = 0; 42411fccf17Sopenharmony_ci cellInfoList.cellNearbyInfo.clear(); 42511fccf17Sopenharmony_ci if (BuildNeighboringCellList(cellInfoList, response, responseLen) != 0) { 42611fccf17Sopenharmony_ci TELEPHONY_LOGE("GetNeighboringCellInfoListResponse BuildNeighboringCellList failed"); 42711fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 42811fccf17Sopenharmony_ci } 42911fccf17Sopenharmony_ci } 43011fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetNeighboringCellInfoListResponse, cellInfoList); 43111fccf17Sopenharmony_ci} 43211fccf17Sopenharmony_ci 43311fccf17Sopenharmony_ciint32_t HRilNetwork::GetNeighboringCellInfoListResponse_1_2( 43411fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 43511fccf17Sopenharmony_ci{ 43611fccf17Sopenharmony_ci HDI::Ril::V1_2::CellListNearbyInfo_1_2 cellInfoList; 43711fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(CellInfoList)) { 43811fccf17Sopenharmony_ci TELEPHONY_LOGE("response is invalid"); 43911fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 44011fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 44111fccf17Sopenharmony_ci } 44211fccf17Sopenharmony_ci } else { 44311fccf17Sopenharmony_ci cellInfoList.itemNum = 0; 44411fccf17Sopenharmony_ci cellInfoList.cellNearbyInfo.clear(); 44511fccf17Sopenharmony_ci if (BuildNeighboringCellList(cellInfoList, response, responseLen) != 0) { 44611fccf17Sopenharmony_ci TELEPHONY_LOGE("BuildNeighboringCellList failed"); 44711fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 44811fccf17Sopenharmony_ci } 44911fccf17Sopenharmony_ci } 45011fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_2::IRilCallback::GetNeighboringCellInfoListResponse_1_2, cellInfoList); 45111fccf17Sopenharmony_ci} 45211fccf17Sopenharmony_ci 45311fccf17Sopenharmony_ciint32_t HRilNetwork::GetCurrentCellInfoResponse( 45411fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 45511fccf17Sopenharmony_ci{ 45611fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListCurrentInfo cellList; 45711fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(CurrentCellInfoList)) { 45811fccf17Sopenharmony_ci TELEPHONY_LOGE("GetCurrentCellInfoResponse response is invalid"); 45911fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 46011fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 46111fccf17Sopenharmony_ci } 46211fccf17Sopenharmony_ci } else { 46311fccf17Sopenharmony_ci cellList.itemNum = 0; 46411fccf17Sopenharmony_ci cellList.cellCurrentInfo.clear(); 46511fccf17Sopenharmony_ci if (BuildCurrentCellList(cellList, response, responseLen) != 0) { 46611fccf17Sopenharmony_ci TELEPHONY_LOGE("GetCurrentCellInfoResponse BuildCurrentCellList failed"); 46711fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 46811fccf17Sopenharmony_ci } 46911fccf17Sopenharmony_ci } 47011fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetCurrentCellInfoResponse, cellList); 47111fccf17Sopenharmony_ci} 47211fccf17Sopenharmony_ci 47311fccf17Sopenharmony_ciint32_t HRilNetwork::GetCurrentCellInfoResponse_1_1( 47411fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 47511fccf17Sopenharmony_ci{ 47611fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListCurrentInfo_1_1 cellList; 47711fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(CurrentCellInfoList)) { 47811fccf17Sopenharmony_ci TELEPHONY_LOGE("response is invalid"); 47911fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 48011fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 48111fccf17Sopenharmony_ci } 48211fccf17Sopenharmony_ci } else { 48311fccf17Sopenharmony_ci cellList.itemNum = 0; 48411fccf17Sopenharmony_ci cellList.cellCurrentInfo.clear(); 48511fccf17Sopenharmony_ci if (BuildCurrentCellList(cellList, response, responseLen) != 0) { 48611fccf17Sopenharmony_ci TELEPHONY_LOGE("BuildCurrentCellList failed"); 48711fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 48811fccf17Sopenharmony_ci } 48911fccf17Sopenharmony_ci } 49011fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetCurrentCellInfoResponse_1_1, cellList); 49111fccf17Sopenharmony_ci} 49211fccf17Sopenharmony_ci 49311fccf17Sopenharmony_ciint32_t HRilNetwork::GetCurrentCellInfoResponse_1_2( 49411fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 49511fccf17Sopenharmony_ci{ 49611fccf17Sopenharmony_ci HDI::Ril::V1_2::CellListCurrentInfo_1_2 cellList; 49711fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(CurrentCellInfoList)) { 49811fccf17Sopenharmony_ci TELEPHONY_LOGE("response is invalid"); 49911fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 50011fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 50111fccf17Sopenharmony_ci } 50211fccf17Sopenharmony_ci } else { 50311fccf17Sopenharmony_ci cellList.itemNum = 0; 50411fccf17Sopenharmony_ci cellList.cellCurrentInfo.clear(); 50511fccf17Sopenharmony_ci if (BuildCurrentCellList(cellList, response, responseLen) != 0) { 50611fccf17Sopenharmony_ci TELEPHONY_LOGE("BuildCurrentCellList failed"); 50711fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 50811fccf17Sopenharmony_ci } 50911fccf17Sopenharmony_ci } 51011fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_2::IRilCallback::GetCurrentCellInfoResponse_1_2, cellList); 51111fccf17Sopenharmony_ci} 51211fccf17Sopenharmony_ci 51311fccf17Sopenharmony_ciint32_t HRilNetwork::GetPhysicalChannelConfigResponse( 51411fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 51511fccf17Sopenharmony_ci{ 51611fccf17Sopenharmony_ci HDI::Ril::V1_1::ChannelConfigInfoList phyChnlCfgList = {}; 51711fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilChannelConfigList)) { 51811fccf17Sopenharmony_ci TELEPHONY_LOGE("GetPhysicalChannelConfigResponse response is invalid"); 51911fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 52011fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 52111fccf17Sopenharmony_ci } 52211fccf17Sopenharmony_ci } else { 52311fccf17Sopenharmony_ci phyChnlCfgList.itemNum = 0; 52411fccf17Sopenharmony_ci phyChnlCfgList.channelConfigInfos.clear(); 52511fccf17Sopenharmony_ci const HRilChannelConfigList *hrilChannelConfigList = static_cast<const HRilChannelConfigList *>(response); 52611fccf17Sopenharmony_ci phyChnlCfgList.itemNum = hrilChannelConfigList->itemNum; 52711fccf17Sopenharmony_ci for (int32_t i = 0; i < phyChnlCfgList.itemNum; i++) { 52811fccf17Sopenharmony_ci HDI::Ril::V1_1::PhysicalChannelConfig phyChnlCfg; 52911fccf17Sopenharmony_ci phyChnlCfg.cellConnStatus = static_cast<HDI::Ril::V1_1::RilCellConnectionStatus>( 53011fccf17Sopenharmony_ci hrilChannelConfigList->channelConfigs[i].cellConnStatus); 53111fccf17Sopenharmony_ci phyChnlCfg.cellBandwidthDownlinkKhz = hrilChannelConfigList->channelConfigs[i].cellBandwidthDownlinkKhz; 53211fccf17Sopenharmony_ci phyChnlCfg.cellBandwidthUplinkKhz = hrilChannelConfigList->channelConfigs[i].cellBandwidthUplinkKhz; 53311fccf17Sopenharmony_ci phyChnlCfg.ratType = 53411fccf17Sopenharmony_ci static_cast<HDI::Ril::V1_1::RilRadioTech>(hrilChannelConfigList->channelConfigs[i].ratType); 53511fccf17Sopenharmony_ci phyChnlCfg.freqRange = hrilChannelConfigList->channelConfigs[i].freqRange; 53611fccf17Sopenharmony_ci phyChnlCfg.downlinkChannelNum = hrilChannelConfigList->channelConfigs[i].downlinkChannelNum; 53711fccf17Sopenharmony_ci phyChnlCfg.uplinkChannelNum = hrilChannelConfigList->channelConfigs[i].uplinkChannelNum; 53811fccf17Sopenharmony_ci phyChnlCfg.physicalCellId = hrilChannelConfigList->channelConfigs[i].physicalCellId; 53911fccf17Sopenharmony_ci phyChnlCfg.contextIdNum = hrilChannelConfigList->channelConfigs[i].contextIdNum; 54011fccf17Sopenharmony_ci TELEPHONY_LOGI( 54111fccf17Sopenharmony_ci "GetPhysicalChannelConfigResponse cellConnStatus:%{private}d, " 54211fccf17Sopenharmony_ci "cellBandwidthDownlinkKhz:%{private}d, cellBandwidthUplinkKhz:%{private}d, physicalCellId:%{private}d, " 54311fccf17Sopenharmony_ci "ratType:%{private}d, freqRange:%{private}d, downlinkChannelNum:%{private}d, " 54411fccf17Sopenharmony_ci "uplinkChannelNum:%{private}d, contextIdNum:%{private}d", 54511fccf17Sopenharmony_ci phyChnlCfg.cellConnStatus, phyChnlCfg.cellBandwidthDownlinkKhz, phyChnlCfg.cellBandwidthUplinkKhz, 54611fccf17Sopenharmony_ci phyChnlCfg.ratType, phyChnlCfg.freqRange, phyChnlCfg.downlinkChannelNum, phyChnlCfg.uplinkChannelNum, 54711fccf17Sopenharmony_ci phyChnlCfg.physicalCellId, phyChnlCfg.contextIdNum); 54811fccf17Sopenharmony_ci for (int32_t j = 0; j < phyChnlCfg.contextIdNum; j++) { 54911fccf17Sopenharmony_ci phyChnlCfg.contextIds.push_back(hrilChannelConfigList->channelConfigs[i].contextIds[j]); 55011fccf17Sopenharmony_ci TELEPHONY_LOGI("contextIds:%{public}d---contextId:%{private}d", j, phyChnlCfg.contextIds[j]); 55111fccf17Sopenharmony_ci } 55211fccf17Sopenharmony_ci phyChnlCfgList.channelConfigInfos.push_back(phyChnlCfg); 55311fccf17Sopenharmony_ci } 55411fccf17Sopenharmony_ci TELEPHONY_LOGI("GetPhysicalChannelConfigResponse itemNum:%{public}d", phyChnlCfgList.itemNum); 55511fccf17Sopenharmony_ci } 55611fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetPhysicalChannelConfigResponse, phyChnlCfgList); 55711fccf17Sopenharmony_ci} 55811fccf17Sopenharmony_ci 55911fccf17Sopenharmony_ciint32_t HRilNetwork::SetLocateUpdatesResponse( 56011fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 56111fccf17Sopenharmony_ci{ 56211fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetLocateUpdatesResponse); 56311fccf17Sopenharmony_ci} 56411fccf17Sopenharmony_ci 56511fccf17Sopenharmony_ciint32_t HRilNetwork::SetNotificationFilterResponse( 56611fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 56711fccf17Sopenharmony_ci{ 56811fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetNotificationFilterResponse); 56911fccf17Sopenharmony_ci} 57011fccf17Sopenharmony_ci 57111fccf17Sopenharmony_ciint32_t HRilNetwork::SetDeviceStateResponse( 57211fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 57311fccf17Sopenharmony_ci{ 57411fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetDeviceStateResponse); 57511fccf17Sopenharmony_ci} 57611fccf17Sopenharmony_ci 57711fccf17Sopenharmony_ciint32_t HRilNetwork::SetNrOptionModeResponse( 57811fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 57911fccf17Sopenharmony_ci{ 58011fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetNrOptionModeResponse); 58111fccf17Sopenharmony_ci} 58211fccf17Sopenharmony_ci 58311fccf17Sopenharmony_ciint32_t HRilNetwork::GetNrOptionModeResponse( 58411fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 58511fccf17Sopenharmony_ci{ 58611fccf17Sopenharmony_ci int32_t nrOptionMode = 0; 58711fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(int32_t)) { 58811fccf17Sopenharmony_ci TELEPHONY_LOGE("GetNrOptionModeResponse response is invalid"); 58911fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 59011fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 59111fccf17Sopenharmony_ci } 59211fccf17Sopenharmony_ci } else { 59311fccf17Sopenharmony_ci nrOptionMode = *(static_cast<const int32_t *>(response)); 59411fccf17Sopenharmony_ci TELEPHONY_LOGI("GetNrOptionModeResponse nrOptionMode: %{public}d", nrOptionMode); 59511fccf17Sopenharmony_ci } 59611fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetNrOptionModeResponse, nrOptionMode); 59711fccf17Sopenharmony_ci} 59811fccf17Sopenharmony_ci 59911fccf17Sopenharmony_ciint32_t HRilNetwork::GetRrcConnectionStateResponse( 60011fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 60111fccf17Sopenharmony_ci{ 60211fccf17Sopenharmony_ci int32_t rrcConnectionState = 0; 60311fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(int32_t)) { 60411fccf17Sopenharmony_ci TELEPHONY_LOGE("GetRrcConnectionStateResponse response is invalid"); 60511fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 60611fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 60711fccf17Sopenharmony_ci } 60811fccf17Sopenharmony_ci } else { 60911fccf17Sopenharmony_ci rrcConnectionState = *(static_cast<const int32_t *>(response)); 61011fccf17Sopenharmony_ci TELEPHONY_LOGD("GetRrcConnectionStateResponse rrcConnectionState: %{public}d", rrcConnectionState); 61111fccf17Sopenharmony_ci } 61211fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetRrcConnectionStateResponse, rrcConnectionState); 61311fccf17Sopenharmony_ci} 61411fccf17Sopenharmony_ci 61511fccf17Sopenharmony_ciint32_t HRilNetwork::GetNrSsbIdResponse( 61611fccf17Sopenharmony_ci int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen) 61711fccf17Sopenharmony_ci{ 61811fccf17Sopenharmony_ci HDI::Ril::V1_2::NrCellSsbIds nrCellSsbIds; 61911fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(NrCellSsbIdsVendor)) { 62011fccf17Sopenharmony_ci TELEPHONY_LOGE("Response is invalid"); 62111fccf17Sopenharmony_ci if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) { 62211fccf17Sopenharmony_ci responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE; 62311fccf17Sopenharmony_ci } 62411fccf17Sopenharmony_ci } else { 62511fccf17Sopenharmony_ci nrCellSsbIds.arfcn = 0; 62611fccf17Sopenharmony_ci nrCellSsbIds.cid = 0; 62711fccf17Sopenharmony_ci nrCellSsbIds.pic = 0; 62811fccf17Sopenharmony_ci nrCellSsbIds.rsrp = 0; 62911fccf17Sopenharmony_ci nrCellSsbIds.sinr = 0; 63011fccf17Sopenharmony_ci nrCellSsbIds.timeAdvance = 0; 63111fccf17Sopenharmony_ci nrCellSsbIds.sCellSsbList.clear(); 63211fccf17Sopenharmony_ci nrCellSsbIds.nbCellCount = 0; 63311fccf17Sopenharmony_ci nrCellSsbIds.nbCellSsbList.clear(); 63411fccf17Sopenharmony_ci if (BuildNrCellSsbIdsInfo(nrCellSsbIds, response, responseLen) != 0) { 63511fccf17Sopenharmony_ci TELEPHONY_LOGE("BuildNrCellSsbIdsInfo failed"); 63611fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 63711fccf17Sopenharmony_ci } 63811fccf17Sopenharmony_ci } 63911fccf17Sopenharmony_ci return Response(responseInfo, &HDI::Ril::V1_2::IRilCallback::GetNrSsbIdResponse, nrCellSsbIds); 64011fccf17Sopenharmony_ci} 64111fccf17Sopenharmony_ci 64211fccf17Sopenharmony_ciint32_t HRilNetwork::NetworkCsRegStatusUpdated( 64311fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 64411fccf17Sopenharmony_ci{ 64511fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilRegStatusInfo)) { 64611fccf17Sopenharmony_ci TELEPHONY_LOGE("response is invalid"); 64711fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 64811fccf17Sopenharmony_ci } 64911fccf17Sopenharmony_ci HDI::Ril::V1_1::CsRegStatusInfo regStatusInfoNotify = {}; 65011fccf17Sopenharmony_ci const HRilRegStatusInfo *hrilRegStatusInfo = static_cast<const HRilRegStatusInfo *>(response); 65111fccf17Sopenharmony_ci regStatusInfoNotify.notifyType = hrilRegStatusInfo->notifyMode; 65211fccf17Sopenharmony_ci regStatusInfoNotify.regStatus = static_cast<HDI::Ril::V1_1::RilRegStatus>(hrilRegStatusInfo->regStatus); 65311fccf17Sopenharmony_ci regStatusInfoNotify.lacCode = hrilRegStatusInfo->lacCode; 65411fccf17Sopenharmony_ci regStatusInfoNotify.cellId = hrilRegStatusInfo->cellId; 65511fccf17Sopenharmony_ci regStatusInfoNotify.radioTechnology = static_cast<HDI::Ril::V1_1::RilRadioTech>(hrilRegStatusInfo->actType); 65611fccf17Sopenharmony_ci TELEPHONY_LOGD("notifyType:%{public}d, regStatus:%{public}d, " 65711fccf17Sopenharmony_ci "lacCode:%{private}d, cellId:%{private}d, radioTechnology:%{public}d", 65811fccf17Sopenharmony_ci regStatusInfoNotify.notifyType, regStatusInfoNotify.regStatus, regStatusInfoNotify.lacCode, 65911fccf17Sopenharmony_ci regStatusInfoNotify.cellId, regStatusInfoNotify.radioTechnology); 66011fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::NetworkCsRegStatusUpdated, regStatusInfoNotify); 66111fccf17Sopenharmony_ci} 66211fccf17Sopenharmony_ci 66311fccf17Sopenharmony_ciint32_t HRilNetwork::NetworkPsRegStatusUpdated( 66411fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 66511fccf17Sopenharmony_ci{ 66611fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilRegStatusInfo)) { 66711fccf17Sopenharmony_ci TELEPHONY_LOGE("response is invalid"); 66811fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 66911fccf17Sopenharmony_ci } 67011fccf17Sopenharmony_ci HDI::Ril::V1_1::PsRegStatusInfo regStatusInfoNotify = {}; 67111fccf17Sopenharmony_ci const HRilRegStatusInfo *hrilRegStatusInfo = static_cast<const HRilRegStatusInfo *>(response); 67211fccf17Sopenharmony_ci regStatusInfoNotify.notifyType = hrilRegStatusInfo->notifyMode; 67311fccf17Sopenharmony_ci regStatusInfoNotify.regStatus = static_cast<HDI::Ril::V1_1::RilRegStatus>(hrilRegStatusInfo->regStatus); 67411fccf17Sopenharmony_ci regStatusInfoNotify.lacCode = hrilRegStatusInfo->lacCode; 67511fccf17Sopenharmony_ci regStatusInfoNotify.cellId = hrilRegStatusInfo->cellId; 67611fccf17Sopenharmony_ci regStatusInfoNotify.radioTechnology = static_cast<HDI::Ril::V1_1::RilRadioTech>(hrilRegStatusInfo->actType); 67711fccf17Sopenharmony_ci regStatusInfoNotify.isDcNrRestricted = hrilRegStatusInfo->isDcNrRestricted; 67811fccf17Sopenharmony_ci regStatusInfoNotify.isNrAvailable = hrilRegStatusInfo->isNrAvailable; 67911fccf17Sopenharmony_ci regStatusInfoNotify.isEnDcAvailable = hrilRegStatusInfo->isEnDcAvailable; 68011fccf17Sopenharmony_ci TELEPHONY_LOGD( 68111fccf17Sopenharmony_ci "notifyType:%{public}d, regStatus:%{public}d, lacCode:%{private}d, cellId:%{private}d, " 68211fccf17Sopenharmony_ci "radioTechnology:%{public}d, isDcNrRestricted:%{private}d, isNrAvailable:%{private}d, " 68311fccf17Sopenharmony_ci "isEnDcAvailable:%{private}d", 68411fccf17Sopenharmony_ci regStatusInfoNotify.notifyType, regStatusInfoNotify.regStatus, regStatusInfoNotify.lacCode, 68511fccf17Sopenharmony_ci regStatusInfoNotify.cellId, regStatusInfoNotify.radioTechnology, regStatusInfoNotify.isDcNrRestricted, 68611fccf17Sopenharmony_ci regStatusInfoNotify.isNrAvailable, regStatusInfoNotify.isEnDcAvailable); 68711fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::NetworkPsRegStatusUpdated, regStatusInfoNotify); 68811fccf17Sopenharmony_ci} 68911fccf17Sopenharmony_ci 69011fccf17Sopenharmony_ciint32_t HRilNetwork::SignalStrengthUpdated( 69111fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 69211fccf17Sopenharmony_ci{ 69311fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilRssi)) { 69411fccf17Sopenharmony_ci TELEPHONY_LOGE("SignalStrengthUpdated response is invalid"); 69511fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 69611fccf17Sopenharmony_ci } 69711fccf17Sopenharmony_ci HDI::Ril::V1_1::Rssi rssi = {}; 69811fccf17Sopenharmony_ci ExchangeRilRssiToHdf(response, rssi); 69911fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::SignalStrengthUpdated, rssi); 70011fccf17Sopenharmony_ci} 70111fccf17Sopenharmony_ci 70211fccf17Sopenharmony_ciint32_t HRilNetwork::NetworkTimeUpdated( 70311fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 70411fccf17Sopenharmony_ci{ 70511fccf17Sopenharmony_ci if (response == nullptr) { 70611fccf17Sopenharmony_ci TELEPHONY_LOGE("NetworkTimeUpdated response is invalid"); 70711fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 70811fccf17Sopenharmony_ci } 70911fccf17Sopenharmony_ci int64_t nitzRecvTime = 0; 71011fccf17Sopenharmony_ci struct timespec tv {}; 71111fccf17Sopenharmony_ci if (clock_gettime(CLOCK_BOOTTIME, &tv) < 0) { 71211fccf17Sopenharmony_ci nitzRecvTime = 0; 71311fccf17Sopenharmony_ci } else { 71411fccf17Sopenharmony_ci nitzRecvTime = tv.tv_sec * NANO_TO_SECOND + tv.tv_nsec; 71511fccf17Sopenharmony_ci } 71611fccf17Sopenharmony_ci std::string str = ";" + std::to_string(nitzRecvTime); 71711fccf17Sopenharmony_ci std::string nitzStr = (char *)response; 71811fccf17Sopenharmony_ci nitzStr += str; 71911fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::NetworkTimeUpdated, (const char *)(nitzStr.data())); 72011fccf17Sopenharmony_ci} 72111fccf17Sopenharmony_ci 72211fccf17Sopenharmony_ciint32_t HRilNetwork::NetworkTimeZoneUpdated( 72311fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 72411fccf17Sopenharmony_ci{ 72511fccf17Sopenharmony_ci if (response == nullptr) { 72611fccf17Sopenharmony_ci TELEPHONY_LOGE("NetworkTimeZoneUpdated response is invalid"); 72711fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 72811fccf17Sopenharmony_ci } 72911fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::NetworkTimeZoneUpdated, (const char *)response); 73011fccf17Sopenharmony_ci} 73111fccf17Sopenharmony_ci 73211fccf17Sopenharmony_ciint32_t HRilNetwork::NetworkPhyChnlCfgUpdated( 73311fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 73411fccf17Sopenharmony_ci{ 73511fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilChannelConfigList)) { 73611fccf17Sopenharmony_ci TELEPHONY_LOGE("NetworkPhyChnlCfgUpdated response is invalid"); 73711fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 73811fccf17Sopenharmony_ci } 73911fccf17Sopenharmony_ci HDI::Ril::V1_1::ChannelConfigInfoList phyChnlCfgList = {}; 74011fccf17Sopenharmony_ci phyChnlCfgList.itemNum = 0; 74111fccf17Sopenharmony_ci phyChnlCfgList.channelConfigInfos.clear(); 74211fccf17Sopenharmony_ci const HRilChannelConfigList *hrilChannelConfigList = static_cast<const HRilChannelConfigList *>(response); 74311fccf17Sopenharmony_ci phyChnlCfgList.itemNum = hrilChannelConfigList->itemNum; 74411fccf17Sopenharmony_ci for (int32_t i = 0; i < phyChnlCfgList.itemNum; i++) { 74511fccf17Sopenharmony_ci HDI::Ril::V1_1::PhysicalChannelConfig phyChnlCfg; 74611fccf17Sopenharmony_ci phyChnlCfg.cellConnStatus = static_cast<HDI::Ril::V1_1::RilCellConnectionStatus>( 74711fccf17Sopenharmony_ci hrilChannelConfigList->channelConfigs[i].cellConnStatus); 74811fccf17Sopenharmony_ci phyChnlCfg.cellBandwidthDownlinkKhz = hrilChannelConfigList->channelConfigs[i].cellBandwidthDownlinkKhz; 74911fccf17Sopenharmony_ci phyChnlCfg.cellBandwidthUplinkKhz = hrilChannelConfigList->channelConfigs[i].cellBandwidthUplinkKhz; 75011fccf17Sopenharmony_ci phyChnlCfg.ratType = 75111fccf17Sopenharmony_ci static_cast<HDI::Ril::V1_1::RilRadioTech>(hrilChannelConfigList->channelConfigs[i].ratType); 75211fccf17Sopenharmony_ci phyChnlCfg.freqRange = hrilChannelConfigList->channelConfigs[i].freqRange; 75311fccf17Sopenharmony_ci phyChnlCfg.downlinkChannelNum = hrilChannelConfigList->channelConfigs[i].downlinkChannelNum; 75411fccf17Sopenharmony_ci phyChnlCfg.uplinkChannelNum = hrilChannelConfigList->channelConfigs[i].uplinkChannelNum; 75511fccf17Sopenharmony_ci phyChnlCfg.physicalCellId = hrilChannelConfigList->channelConfigs[i].physicalCellId; 75611fccf17Sopenharmony_ci phyChnlCfg.contextIdNum = hrilChannelConfigList->channelConfigs[i].contextIdNum; 75711fccf17Sopenharmony_ci for (int32_t j = 0; j < phyChnlCfg.contextIdNum; j++) { 75811fccf17Sopenharmony_ci phyChnlCfg.contextIds.push_back(hrilChannelConfigList->channelConfigs[i].contextIds[j]); 75911fccf17Sopenharmony_ci } 76011fccf17Sopenharmony_ci phyChnlCfgList.channelConfigInfos.push_back(phyChnlCfg); 76111fccf17Sopenharmony_ci } 76211fccf17Sopenharmony_ci TELEPHONY_LOGI("NetworkPhyChnlCfgUpdated itemNum:%{public}d", phyChnlCfgList.itemNum); 76311fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::NetworkPhyChnlCfgUpdated, phyChnlCfgList); 76411fccf17Sopenharmony_ci} 76511fccf17Sopenharmony_ci 76611fccf17Sopenharmony_ciint32_t HRilNetwork::NetworkCurrentCellUpdated( 76711fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 76811fccf17Sopenharmony_ci{ 76911fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(HRilRegStatusInfo)) { 77011fccf17Sopenharmony_ci TELEPHONY_LOGE("NetworkCurrentCellUpdated response is invalid"); 77111fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 77211fccf17Sopenharmony_ci } 77311fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListCurrentInfo cellList; 77411fccf17Sopenharmony_ci cellList.itemNum = 0; 77511fccf17Sopenharmony_ci cellList.cellCurrentInfo.clear(); 77611fccf17Sopenharmony_ci if (BuildCurrentCellList(cellList, response, responseLen) != 0) { 77711fccf17Sopenharmony_ci TELEPHONY_LOGE("NetworkCurrentCellUpdated BuildCurrentCellList failed"); 77811fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 77911fccf17Sopenharmony_ci } 78011fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::NetworkCurrentCellUpdated, cellList); 78111fccf17Sopenharmony_ci} 78211fccf17Sopenharmony_ci 78311fccf17Sopenharmony_ciint32_t HRilNetwork::NetworkCurrentCellUpdated_1_2( 78411fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 78511fccf17Sopenharmony_ci{ 78611fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(CurrentCellInfoList)) { 78711fccf17Sopenharmony_ci TELEPHONY_LOGE("response is invalid"); 78811fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 78911fccf17Sopenharmony_ci } 79011fccf17Sopenharmony_ci HDI::Ril::V1_2::CellListCurrentInfo_1_2 cellList; 79111fccf17Sopenharmony_ci cellList.itemNum = 0; 79211fccf17Sopenharmony_ci cellList.cellCurrentInfo.clear(); 79311fccf17Sopenharmony_ci if (BuildCurrentCellList(cellList, response, responseLen) != 0) { 79411fccf17Sopenharmony_ci TELEPHONY_LOGE("BuildCurrentCellInfoList failed"); 79511fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 79611fccf17Sopenharmony_ci } 79711fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_2::IRilCallback::NetworkCurrentCellUpdated_1_2, cellList); 79811fccf17Sopenharmony_ci} 79911fccf17Sopenharmony_ci 80011fccf17Sopenharmony_ciint32_t HRilNetwork::GetRrcConnectionStateUpdated( 80111fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 80211fccf17Sopenharmony_ci{ 80311fccf17Sopenharmony_ci if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(int32_t)) != 0) { 80411fccf17Sopenharmony_ci TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen); 80511fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 80611fccf17Sopenharmony_ci } 80711fccf17Sopenharmony_ci if (response == nullptr) { 80811fccf17Sopenharmony_ci TELEPHONY_LOGE("response is null"); 80911fccf17Sopenharmony_ci return HRIL_ERR_NULL_POINT; 81011fccf17Sopenharmony_ci } 81111fccf17Sopenharmony_ci return Notify( 81211fccf17Sopenharmony_ci indType, error, &HDI::Ril::V1_1::IRilCallback::GetRrcConnectionStateUpdated, *(const int32_t *)response); 81311fccf17Sopenharmony_ci} 81411fccf17Sopenharmony_ci 81511fccf17Sopenharmony_ciint32_t HRilNetwork::NetworkCurrentCellUpdated_1_1( 81611fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen) 81711fccf17Sopenharmony_ci{ 81811fccf17Sopenharmony_ci if (response == nullptr || responseLen != sizeof(CurrentCellInfoList)) { 81911fccf17Sopenharmony_ci TELEPHONY_LOGE("response is invalid"); 82011fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 82111fccf17Sopenharmony_ci } 82211fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListCurrentInfo_1_1 cellList; 82311fccf17Sopenharmony_ci cellList.itemNum = 0; 82411fccf17Sopenharmony_ci cellList.cellCurrentInfo.clear(); 82511fccf17Sopenharmony_ci if (BuildCurrentCellList(cellList, response, responseLen) != 0) { 82611fccf17Sopenharmony_ci TELEPHONY_LOGE("BuildCurrentCellList failed"); 82711fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 82811fccf17Sopenharmony_ci } 82911fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_1::IRilCallback::NetworkCurrentCellUpdated_1_1, cellList); 83011fccf17Sopenharmony_ci} 83111fccf17Sopenharmony_ci 83211fccf17Sopenharmony_ciint32_t HRilNetwork::ResidentNetworkUpdated(int32_t indType, const HRilErrNumber error, const void *response, 83311fccf17Sopenharmony_ci size_t responseLen) 83411fccf17Sopenharmony_ci{ 83511fccf17Sopenharmony_ci if (response == nullptr) { 83611fccf17Sopenharmony_ci TELEPHONY_LOGE("ResidentNetworkUpdated response is invalid"); 83711fccf17Sopenharmony_ci return HRIL_ERR_INVALID_PARAMETER; 83811fccf17Sopenharmony_ci } 83911fccf17Sopenharmony_ci return Notify(indType, error, &HDI::Ril::V1_2::IRilCallback::ResidentNetworkUpdated, (const char *)response); 84011fccf17Sopenharmony_ci} 84111fccf17Sopenharmony_ci 84211fccf17Sopenharmony_civoid HRilNetwork::ExchangeRilRssiToHdf(const void *response, HDI::Ril::V1_1::Rssi &rssi) 84311fccf17Sopenharmony_ci{ 84411fccf17Sopenharmony_ci HRilRssi *rilRssi = (HRilRssi *)response; 84511fccf17Sopenharmony_ci rssi.gw.rxlev = rilRssi->gsmRssi.rxlev; 84611fccf17Sopenharmony_ci rssi.gw.ber = rilRssi->gsmRssi.ber; 84711fccf17Sopenharmony_ci rssi.cdma.absoluteRssi = rilRssi->cdmaRssi.absoluteRssi; 84811fccf17Sopenharmony_ci rssi.cdma.ecno = rilRssi->cdmaRssi.ecno; 84911fccf17Sopenharmony_ci rssi.wcdma.rxlev = rilRssi->wcdmaRssi.rxlev; 85011fccf17Sopenharmony_ci rssi.wcdma.ber = rilRssi->wcdmaRssi.ber; 85111fccf17Sopenharmony_ci rssi.wcdma.ecio = rilRssi->wcdmaRssi.ecio; 85211fccf17Sopenharmony_ci rssi.wcdma.rscp = rilRssi->wcdmaRssi.rscp; 85311fccf17Sopenharmony_ci rssi.lte.rxlev = rilRssi->lteRssi.rxlev; 85411fccf17Sopenharmony_ci rssi.lte.rsrp = rilRssi->lteRssi.rsrp; 85511fccf17Sopenharmony_ci rssi.lte.rsrq = rilRssi->lteRssi.rsrq; 85611fccf17Sopenharmony_ci rssi.lte.snr = rilRssi->lteRssi.snr; 85711fccf17Sopenharmony_ci rssi.tdScdma.rscp = rilRssi->tdScdmaRssi.rscp; 85811fccf17Sopenharmony_ci rssi.nr.rsrp = rilRssi->nrRssi.rsrp; 85911fccf17Sopenharmony_ci rssi.nr.rsrq = rilRssi->nrRssi.rsrq; 86011fccf17Sopenharmony_ci rssi.nr.sinr = rilRssi->nrRssi.sinr; 86111fccf17Sopenharmony_ci TELEPHONY_LOGD("ExchangeRilRssiToHdf rxlev:%{public}d, rsrp:%{public}d", rssi.lte.rxlev, rssi.lte.rsrp); 86211fccf17Sopenharmony_ci} 86311fccf17Sopenharmony_ci 86411fccf17Sopenharmony_civoid HRilNetwork::BuildOperatorList( 86511fccf17Sopenharmony_ci HDI::Ril::V1_1::AvailableNetworkList &availableNetworkList, const void *response, size_t responseLen) 86611fccf17Sopenharmony_ci{ 86711fccf17Sopenharmony_ci size_t numStrings = responseLen / sizeof(AvailableOperInfo *); 86811fccf17Sopenharmony_ci HDI::Ril::V1_1::AvailableNetworkInfo operInfo = {}; 86911fccf17Sopenharmony_ci availableNetworkList.itemNum = numStrings; 87011fccf17Sopenharmony_ci TELEPHONY_LOGI( 87111fccf17Sopenharmony_ci "BuildOperatorList availableNetworkList.itemNum: %{public}lu", static_cast<unsigned long>(numStrings)); 87211fccf17Sopenharmony_ci for (size_t i = 0; i < numStrings; i++) { 87311fccf17Sopenharmony_ci AvailableOperInfo *curPtr = ((AvailableOperInfo **)response)[i]; 87411fccf17Sopenharmony_ci if (curPtr != nullptr) { 87511fccf17Sopenharmony_ci operInfo.status = curPtr->status; 87611fccf17Sopenharmony_ci TELEPHONY_LOGI("operInfo.status:%{public}d", curPtr->status); 87711fccf17Sopenharmony_ci operInfo.longName = (curPtr->longName == nullptr) ? "" : curPtr->longName; 87811fccf17Sopenharmony_ci TELEPHONY_LOGI("operInfo.longName:%{public}s", curPtr->longName); 87911fccf17Sopenharmony_ci operInfo.numeric = (curPtr->numeric == nullptr) ? "" : curPtr->numeric; 88011fccf17Sopenharmony_ci TELEPHONY_LOGI("operInfo.numeric:%{public}s", curPtr->numeric); 88111fccf17Sopenharmony_ci operInfo.shortName = (curPtr->shortName == nullptr) ? "" : curPtr->shortName; 88211fccf17Sopenharmony_ci TELEPHONY_LOGI("operInfo.shortName:%{public}s", curPtr->shortName); 88311fccf17Sopenharmony_ci operInfo.rat = curPtr->rat; 88411fccf17Sopenharmony_ci TELEPHONY_LOGI("operInfo.rat:%{public}d", curPtr->rat); 88511fccf17Sopenharmony_ci availableNetworkList.availableNetworkInfo.push_back(operInfo); 88611fccf17Sopenharmony_ci } 88711fccf17Sopenharmony_ci } 88811fccf17Sopenharmony_ci} 88911fccf17Sopenharmony_ci 89011fccf17Sopenharmony_civoid HRilNetwork::FillCellNearbyInfo(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *cellPtr) 89111fccf17Sopenharmony_ci{ 89211fccf17Sopenharmony_ci cellInfo.ratType = cellPtr->ratType; 89311fccf17Sopenharmony_ci switch (cellPtr->ratType) { 89411fccf17Sopenharmony_ci case NETWORK_TYPE_GSM: 89511fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.band = cellPtr->ServiceCellParas.gsm.band; 89611fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.arfcn = cellPtr->ServiceCellParas.gsm.arfcn; 89711fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.bsic = cellPtr->ServiceCellParas.gsm.bsic; 89811fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.cellId = cellPtr->ServiceCellParas.gsm.cellId; 89911fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.lac = cellPtr->ServiceCellParas.gsm.lac; 90011fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxlev = cellPtr->ServiceCellParas.gsm.rxlev; 90111fccf17Sopenharmony_ci break; 90211fccf17Sopenharmony_ci case NETWORK_TYPE_LTE: 90311fccf17Sopenharmony_ci cellInfo.serviceCells.lte.arfcn = cellPtr->ServiceCellParas.lte.arfcn; 90411fccf17Sopenharmony_ci cellInfo.serviceCells.lte.pci = cellPtr->ServiceCellParas.lte.pci; 90511fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrp = cellPtr->ServiceCellParas.lte.rsrp; 90611fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrq = cellPtr->ServiceCellParas.lte.rsrq; 90711fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rxlev = cellPtr->ServiceCellParas.lte.rxlev; 90811fccf17Sopenharmony_ci break; 90911fccf17Sopenharmony_ci case NETWORK_TYPE_WCDMA: 91011fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.arfcn = cellPtr->ServiceCellParas.wcdma.arfcn; 91111fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.psc = cellPtr->ServiceCellParas.wcdma.psc; 91211fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rscp = cellPtr->ServiceCellParas.wcdma.rscp; 91311fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ecno = cellPtr->ServiceCellParas.wcdma.ecno; 91411fccf17Sopenharmony_ci break; 91511fccf17Sopenharmony_ci case NETWORK_TYPE_CDMA: 91611fccf17Sopenharmony_ci FillCellNearbyInfoCdma(cellInfo, cellPtr); 91711fccf17Sopenharmony_ci break; 91811fccf17Sopenharmony_ci case NETWORK_TYPE_TDSCDMA: 91911fccf17Sopenharmony_ci FillCellNearbyInfoTdscdma(cellInfo, cellPtr); 92011fccf17Sopenharmony_ci break; 92111fccf17Sopenharmony_ci case NETWORK_TYPE_NR: 92211fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nrArfcn = cellPtr->ServiceCellParas.nr.nrArfcn; 92311fccf17Sopenharmony_ci cellInfo.serviceCells.nr.pci = cellPtr->ServiceCellParas.nr.pci; 92411fccf17Sopenharmony_ci cellInfo.serviceCells.nr.tac = cellPtr->ServiceCellParas.nr.tac; 92511fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nci = cellPtr->ServiceCellParas.nr.nci; 92611fccf17Sopenharmony_ci break; 92711fccf17Sopenharmony_ci default: 92811fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.band = 0; 92911fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.arfcn = 0; 93011fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.bsic = 0; 93111fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.cellId = 0; 93211fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.lac = 0; 93311fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxlev = 0; 93411fccf17Sopenharmony_ci break; 93511fccf17Sopenharmony_ci } 93611fccf17Sopenharmony_ci} 93711fccf17Sopenharmony_ci 93811fccf17Sopenharmony_civoid HRilNetwork::FillCellNearbyInfoTdscdma(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *hrilCellPtr) 93911fccf17Sopenharmony_ci{ 94011fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.arfcn = hrilCellPtr->ServiceCellParas.tdscdma.arfcn; 94111fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.syncId = hrilCellPtr->ServiceCellParas.tdscdma.syncId; 94211fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.sc = hrilCellPtr->ServiceCellParas.tdscdma.sc; 94311fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cellId = hrilCellPtr->ServiceCellParas.tdscdma.cellId; 94411fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.lac = hrilCellPtr->ServiceCellParas.tdscdma.lac; 94511fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rscp = hrilCellPtr->ServiceCellParas.tdscdma.rscp; 94611fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.drx = hrilCellPtr->ServiceCellParas.tdscdma.drx; 94711fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rac = hrilCellPtr->ServiceCellParas.tdscdma.rac; 94811fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cpid = hrilCellPtr->ServiceCellParas.tdscdma.cpid; 94911fccf17Sopenharmony_ci} 95011fccf17Sopenharmony_ci 95111fccf17Sopenharmony_civoid HRilNetwork::FillCellNearbyInfoCdma(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *hrilCellPtr) 95211fccf17Sopenharmony_ci{ 95311fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.systemId = hrilCellPtr->ServiceCellParas.cdma.systemId; 95411fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.networkId = hrilCellPtr->ServiceCellParas.cdma.networkId; 95511fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.baseId = hrilCellPtr->ServiceCellParas.cdma.baseId; 95611fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.zoneId = hrilCellPtr->ServiceCellParas.cdma.zoneId; 95711fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotPn = hrilCellPtr->ServiceCellParas.cdma.pilotPn; 95811fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotStrength = hrilCellPtr->ServiceCellParas.cdma.pilotStrength; 95911fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.channel = hrilCellPtr->ServiceCellParas.cdma.channel; 96011fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.longitude = hrilCellPtr->ServiceCellParas.cdma.longitude; 96111fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.latitude = hrilCellPtr->ServiceCellParas.cdma.latitude; 96211fccf17Sopenharmony_ci} 96311fccf17Sopenharmony_ci 96411fccf17Sopenharmony_civoid HRilNetwork::FillCellNearbyInfo(HDI::Ril::V1_2::CellNearbyInfo_1_2 &cellInfo, const CellInfo *cellPtr) 96511fccf17Sopenharmony_ci{ 96611fccf17Sopenharmony_ci cellInfo.ratType = cellPtr->ratType; 96711fccf17Sopenharmony_ci switch (cellPtr->ratType) { 96811fccf17Sopenharmony_ci case NETWORK_TYPE_GSM: 96911fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.band = cellPtr->ServiceCellParas.gsm.band; 97011fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.arfcn = cellPtr->ServiceCellParas.gsm.arfcn; 97111fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.bsic = cellPtr->ServiceCellParas.gsm.bsic; 97211fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.cellId = cellPtr->ServiceCellParas.gsm.cellId; 97311fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.lac = cellPtr->ServiceCellParas.gsm.lac; 97411fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxlev = cellPtr->ServiceCellParas.gsm.rxlev; 97511fccf17Sopenharmony_ci break; 97611fccf17Sopenharmony_ci case NETWORK_TYPE_LTE: 97711fccf17Sopenharmony_ci cellInfo.serviceCells.lte.arfcn = cellPtr->ServiceCellParas.lte.arfcn; 97811fccf17Sopenharmony_ci cellInfo.serviceCells.lte.pci = cellPtr->ServiceCellParas.lte.pci; 97911fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrp = cellPtr->ServiceCellParas.lte.rsrp; 98011fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrq = cellPtr->ServiceCellParas.lte.rsrq; 98111fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rxlev = cellPtr->ServiceCellParas.lte.rxlev; 98211fccf17Sopenharmony_ci break; 98311fccf17Sopenharmony_ci case NETWORK_TYPE_WCDMA: 98411fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.arfcn = cellPtr->ServiceCellParas.wcdma.arfcn; 98511fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.psc = cellPtr->ServiceCellParas.wcdma.psc; 98611fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rscp = cellPtr->ServiceCellParas.wcdma.rscp; 98711fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ecno = cellPtr->ServiceCellParas.wcdma.ecno; 98811fccf17Sopenharmony_ci break; 98911fccf17Sopenharmony_ci case NETWORK_TYPE_CDMA: 99011fccf17Sopenharmony_ci FillCellNearbyInfoCdma(cellInfo, cellPtr); 99111fccf17Sopenharmony_ci break; 99211fccf17Sopenharmony_ci case NETWORK_TYPE_TDSCDMA: 99311fccf17Sopenharmony_ci FillCellNearbyInfoTdscdma(cellInfo, cellPtr); 99411fccf17Sopenharmony_ci break; 99511fccf17Sopenharmony_ci case NETWORK_TYPE_NR: 99611fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nrArfcn = cellPtr->ServiceCellParas.nr.nrArfcn; 99711fccf17Sopenharmony_ci cellInfo.serviceCells.nr.pci = cellPtr->ServiceCellParas.nr.pci; 99811fccf17Sopenharmony_ci cellInfo.serviceCells.nr.tac = cellPtr->ServiceCellParas.nr.tac; 99911fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nci = cellPtr->ServiceCellParas.nr.nci; 100011fccf17Sopenharmony_ci cellInfo.serviceCells.nr.rsrp = cellPtr->ServiceCellParas.nr.rsrp; 100111fccf17Sopenharmony_ci cellInfo.serviceCells.nr.rsrq = cellPtr->ServiceCellParas.nr.rsrq; 100211fccf17Sopenharmony_ci break; 100311fccf17Sopenharmony_ci default: 100411fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.band = 0; 100511fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.arfcn = 0; 100611fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.bsic = 0; 100711fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.cellId = 0; 100811fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.lac = 0; 100911fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxlev = 0; 101011fccf17Sopenharmony_ci break; 101111fccf17Sopenharmony_ci } 101211fccf17Sopenharmony_ci} 101311fccf17Sopenharmony_ci 101411fccf17Sopenharmony_civoid HRilNetwork::FillCellNearbyInfoTdscdma(HDI::Ril::V1_2::CellNearbyInfo_1_2 &cellInfo, const CellInfo *hrilCellPtr) 101511fccf17Sopenharmony_ci{ 101611fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.arfcn = hrilCellPtr->ServiceCellParas.tdscdma.arfcn; 101711fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.syncId = hrilCellPtr->ServiceCellParas.tdscdma.syncId; 101811fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.sc = hrilCellPtr->ServiceCellParas.tdscdma.sc; 101911fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cellId = hrilCellPtr->ServiceCellParas.tdscdma.cellId; 102011fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.lac = hrilCellPtr->ServiceCellParas.tdscdma.lac; 102111fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rscp = hrilCellPtr->ServiceCellParas.tdscdma.rscp; 102211fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.drx = hrilCellPtr->ServiceCellParas.tdscdma.drx; 102311fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rac = hrilCellPtr->ServiceCellParas.tdscdma.rac; 102411fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cpid = hrilCellPtr->ServiceCellParas.tdscdma.cpid; 102511fccf17Sopenharmony_ci} 102611fccf17Sopenharmony_ci 102711fccf17Sopenharmony_civoid HRilNetwork::FillCellNearbyInfoCdma(HDI::Ril::V1_2::CellNearbyInfo_1_2 &cellInfo, const CellInfo *hrilCellPtr) 102811fccf17Sopenharmony_ci{ 102911fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.systemId = hrilCellPtr->ServiceCellParas.cdma.systemId; 103011fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.networkId = hrilCellPtr->ServiceCellParas.cdma.networkId; 103111fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.baseId = hrilCellPtr->ServiceCellParas.cdma.baseId; 103211fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.zoneId = hrilCellPtr->ServiceCellParas.cdma.zoneId; 103311fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotPn = hrilCellPtr->ServiceCellParas.cdma.pilotPn; 103411fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotStrength = hrilCellPtr->ServiceCellParas.cdma.pilotStrength; 103511fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.channel = hrilCellPtr->ServiceCellParas.cdma.channel; 103611fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.longitude = hrilCellPtr->ServiceCellParas.cdma.longitude; 103711fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.latitude = hrilCellPtr->ServiceCellParas.cdma.latitude; 103811fccf17Sopenharmony_ci} 103911fccf17Sopenharmony_ci 104011fccf17Sopenharmony_ciint32_t HRilNetwork::BuildNeighboringCellList( 104111fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListNearbyInfo &cellInfoList, const void *response, size_t responseLen) 104211fccf17Sopenharmony_ci{ 104311fccf17Sopenharmony_ci const CellInfoList *temp = reinterpret_cast<const CellInfoList *>(response); 104411fccf17Sopenharmony_ci cellInfoList.itemNum = temp->itemNum; 104511fccf17Sopenharmony_ci TELEPHONY_LOGI("cellInfoList.itemNum = %{public}d", cellInfoList.itemNum); 104611fccf17Sopenharmony_ci for (int32_t i = 0; i < temp->itemNum; i++) { 104711fccf17Sopenharmony_ci HDI::Ril::V1_1::CellNearbyInfo cellInfo; 104811fccf17Sopenharmony_ci CellInfo *cell = temp->cellNearbyInfo + i; 104911fccf17Sopenharmony_ci if (cell == nullptr) { 105011fccf17Sopenharmony_ci TELEPHONY_LOGE("cell is nullptr"); 105111fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 105211fccf17Sopenharmony_ci } 105311fccf17Sopenharmony_ci FillCellNearbyInfo(cellInfo, cell); 105411fccf17Sopenharmony_ci cellInfoList.cellNearbyInfo.push_back(cellInfo); 105511fccf17Sopenharmony_ci } 105611fccf17Sopenharmony_ci return HRIL_ERR_SUCCESS; 105711fccf17Sopenharmony_ci} 105811fccf17Sopenharmony_ci 105911fccf17Sopenharmony_ciint32_t HRilNetwork::BuildNeighboringCellList( 106011fccf17Sopenharmony_ci HDI::Ril::V1_2::CellListNearbyInfo_1_2 &cellInfoList, const void *response, size_t responseLen) 106111fccf17Sopenharmony_ci{ 106211fccf17Sopenharmony_ci const CellInfoList *temp = reinterpret_cast<const CellInfoList *>(response); 106311fccf17Sopenharmony_ci cellInfoList.itemNum = temp->itemNum; 106411fccf17Sopenharmony_ci TELEPHONY_LOGI("cellInfoList.itemNum = %{public}d", cellInfoList.itemNum); 106511fccf17Sopenharmony_ci for (int32_t i = 0; i < temp->itemNum; i++) { 106611fccf17Sopenharmony_ci HDI::Ril::V1_2::CellNearbyInfo_1_2 cellInfo; 106711fccf17Sopenharmony_ci CellInfo *cell = temp->cellNearbyInfo + i; 106811fccf17Sopenharmony_ci if (cell == nullptr) { 106911fccf17Sopenharmony_ci TELEPHONY_LOGE("cell is nullptr"); 107011fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 107111fccf17Sopenharmony_ci } 107211fccf17Sopenharmony_ci FillCellNearbyInfo(cellInfo, cell); 107311fccf17Sopenharmony_ci cellInfoList.cellNearbyInfo.push_back(cellInfo); 107411fccf17Sopenharmony_ci } 107511fccf17Sopenharmony_ci return HRIL_ERR_SUCCESS; 107611fccf17Sopenharmony_ci} 107711fccf17Sopenharmony_ci 107811fccf17Sopenharmony_civoid HRilNetwork::FillCellInfoType( 107911fccf17Sopenharmony_ci HDI::Ril::V1_1::CurrentCellInfo &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor) 108011fccf17Sopenharmony_ci{ 108111fccf17Sopenharmony_ci if (hrilCellInfoVendor->ratType == NETWORK_TYPE_WCDMA) { 108211fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.arfcn = hrilCellInfoVendor->ServiceCellParas.wcdma.arfcn; 108311fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.cellId = hrilCellInfoVendor->ServiceCellParas.wcdma.cellId; 108411fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.psc = hrilCellInfoVendor->ServiceCellParas.wcdma.psc; 108511fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.lac = hrilCellInfoVendor->ServiceCellParas.wcdma.lac; 108611fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rxlev = hrilCellInfoVendor->ServiceCellParas.wcdma.rxlev; 108711fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rscp = hrilCellInfoVendor->ServiceCellParas.wcdma.rscp; 108811fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ecno = hrilCellInfoVendor->ServiceCellParas.wcdma.ecno; 108911fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ura = hrilCellInfoVendor->ServiceCellParas.wcdma.ura; 109011fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.drx = hrilCellInfoVendor->ServiceCellParas.wcdma.drx; 109111fccf17Sopenharmony_ci } else if (hrilCellInfoVendor->ratType == NETWORK_TYPE_CDMA) { 109211fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.systemId = hrilCellInfoVendor->ServiceCellParas.cdma.systemId; 109311fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.networkId = hrilCellInfoVendor->ServiceCellParas.cdma.networkId; 109411fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.baseId = hrilCellInfoVendor->ServiceCellParas.cdma.baseId; 109511fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.zoneId = hrilCellInfoVendor->ServiceCellParas.cdma.zoneId; 109611fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotPn = hrilCellInfoVendor->ServiceCellParas.cdma.pilotPn; 109711fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotStrength = hrilCellInfoVendor->ServiceCellParas.cdma.pilotStrength; 109811fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.channel = hrilCellInfoVendor->ServiceCellParas.cdma.channel; 109911fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.longitude = hrilCellInfoVendor->ServiceCellParas.cdma.longitude; 110011fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.latitude = hrilCellInfoVendor->ServiceCellParas.cdma.latitude; 110111fccf17Sopenharmony_ci } else if (hrilCellInfoVendor->ratType == NETWORK_TYPE_TDSCDMA) { 110211fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.arfcn = hrilCellInfoVendor->ServiceCellParas.tdscdma.arfcn; 110311fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.syncId = hrilCellInfoVendor->ServiceCellParas.tdscdma.syncId; 110411fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.sc = hrilCellInfoVendor->ServiceCellParas.tdscdma.sc; 110511fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cellId = hrilCellInfoVendor->ServiceCellParas.tdscdma.cellId; 110611fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.lac = hrilCellInfoVendor->ServiceCellParas.tdscdma.lac; 110711fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rscp = hrilCellInfoVendor->ServiceCellParas.tdscdma.rscp; 110811fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.drx = hrilCellInfoVendor->ServiceCellParas.tdscdma.drx; 110911fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rac = hrilCellInfoVendor->ServiceCellParas.tdscdma.rac; 111011fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cpid = hrilCellInfoVendor->ServiceCellParas.tdscdma.cpid; 111111fccf17Sopenharmony_ci } 111211fccf17Sopenharmony_ci} 111311fccf17Sopenharmony_ci 111411fccf17Sopenharmony_civoid HRilNetwork::FillCellInfoType( 111511fccf17Sopenharmony_ci HDI::Ril::V1_1::CurrentCellInfo_1_1 &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor) 111611fccf17Sopenharmony_ci{ 111711fccf17Sopenharmony_ci switch (hrilCellInfoVendor->ratType) { 111811fccf17Sopenharmony_ci case NETWORK_TYPE_WCDMA: 111911fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.arfcn = hrilCellInfoVendor->ServiceCellParas.wcdma.arfcn; 112011fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.cellId = hrilCellInfoVendor->ServiceCellParas.wcdma.cellId; 112111fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.psc = hrilCellInfoVendor->ServiceCellParas.wcdma.psc; 112211fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.lac = hrilCellInfoVendor->ServiceCellParas.wcdma.lac; 112311fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rxlev = hrilCellInfoVendor->ServiceCellParas.wcdma.rxlev; 112411fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rscp = hrilCellInfoVendor->ServiceCellParas.wcdma.rscp; 112511fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ecno = hrilCellInfoVendor->ServiceCellParas.wcdma.ecno; 112611fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ura = hrilCellInfoVendor->ServiceCellParas.wcdma.ura; 112711fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.drx = hrilCellInfoVendor->ServiceCellParas.wcdma.drx; 112811fccf17Sopenharmony_ci break; 112911fccf17Sopenharmony_ci case NETWORK_TYPE_CDMA: 113011fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.systemId = hrilCellInfoVendor->ServiceCellParas.cdma.systemId; 113111fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.networkId = hrilCellInfoVendor->ServiceCellParas.cdma.networkId; 113211fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.baseId = hrilCellInfoVendor->ServiceCellParas.cdma.baseId; 113311fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.zoneId = hrilCellInfoVendor->ServiceCellParas.cdma.zoneId; 113411fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotPn = hrilCellInfoVendor->ServiceCellParas.cdma.pilotPn; 113511fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotStrength = hrilCellInfoVendor->ServiceCellParas.cdma.pilotStrength; 113611fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.channel = hrilCellInfoVendor->ServiceCellParas.cdma.channel; 113711fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.longitude = hrilCellInfoVendor->ServiceCellParas.cdma.longitude; 113811fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.latitude = hrilCellInfoVendor->ServiceCellParas.cdma.latitude; 113911fccf17Sopenharmony_ci break; 114011fccf17Sopenharmony_ci case NETWORK_TYPE_TDSCDMA: 114111fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.arfcn = hrilCellInfoVendor->ServiceCellParas.tdscdma.arfcn; 114211fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.syncId = hrilCellInfoVendor->ServiceCellParas.tdscdma.syncId; 114311fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.sc = hrilCellInfoVendor->ServiceCellParas.tdscdma.sc; 114411fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cellId = hrilCellInfoVendor->ServiceCellParas.tdscdma.cellId; 114511fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.lac = hrilCellInfoVendor->ServiceCellParas.tdscdma.lac; 114611fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rscp = hrilCellInfoVendor->ServiceCellParas.tdscdma.rscp; 114711fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.drx = hrilCellInfoVendor->ServiceCellParas.tdscdma.drx; 114811fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rac = hrilCellInfoVendor->ServiceCellParas.tdscdma.rac; 114911fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cpid = hrilCellInfoVendor->ServiceCellParas.tdscdma.cpid; 115011fccf17Sopenharmony_ci break; 115111fccf17Sopenharmony_ci case NETWORK_TYPE_NR: 115211fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nrArfcn = hrilCellInfoVendor->ServiceCellParas.nr.nrArfcn; 115311fccf17Sopenharmony_ci cellInfo.serviceCells.nr.pci = hrilCellInfoVendor->ServiceCellParas.nr.pci; 115411fccf17Sopenharmony_ci cellInfo.serviceCells.nr.tac = hrilCellInfoVendor->ServiceCellParas.nr.tac; 115511fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nci = hrilCellInfoVendor->ServiceCellParas.nr.nci; 115611fccf17Sopenharmony_ci cellInfo.serviceCells.nr.rsrp = hrilCellInfoVendor->ServiceCellParas.nr.rsrp; 115711fccf17Sopenharmony_ci cellInfo.serviceCells.nr.rsrq = hrilCellInfoVendor->ServiceCellParas.nr.rsrq; 115811fccf17Sopenharmony_ci break; 115911fccf17Sopenharmony_ci default: 116011fccf17Sopenharmony_ci break; 116111fccf17Sopenharmony_ci } 116211fccf17Sopenharmony_ci} 116311fccf17Sopenharmony_ci 116411fccf17Sopenharmony_civoid HRilNetwork::FillCellInfoType( 116511fccf17Sopenharmony_ci HDI::Ril::V1_2::CurrentCellInfo_1_2 &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor) 116611fccf17Sopenharmony_ci{ 116711fccf17Sopenharmony_ci switch (hrilCellInfoVendor->ratType) { 116811fccf17Sopenharmony_ci case NETWORK_TYPE_WCDMA: 116911fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.arfcn = hrilCellInfoVendor->ServiceCellParas.wcdma.arfcn; 117011fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.cellId = hrilCellInfoVendor->ServiceCellParas.wcdma.cellId; 117111fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.psc = hrilCellInfoVendor->ServiceCellParas.wcdma.psc; 117211fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.lac = hrilCellInfoVendor->ServiceCellParas.wcdma.lac; 117311fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rxlev = hrilCellInfoVendor->ServiceCellParas.wcdma.rxlev; 117411fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rscp = hrilCellInfoVendor->ServiceCellParas.wcdma.rscp; 117511fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ecno = hrilCellInfoVendor->ServiceCellParas.wcdma.ecno; 117611fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ura = hrilCellInfoVendor->ServiceCellParas.wcdma.ura; 117711fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.drx = hrilCellInfoVendor->ServiceCellParas.wcdma.drx; 117811fccf17Sopenharmony_ci break; 117911fccf17Sopenharmony_ci case NETWORK_TYPE_CDMA: 118011fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.systemId = hrilCellInfoVendor->ServiceCellParas.cdma.systemId; 118111fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.networkId = hrilCellInfoVendor->ServiceCellParas.cdma.networkId; 118211fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.baseId = hrilCellInfoVendor->ServiceCellParas.cdma.baseId; 118311fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.zoneId = hrilCellInfoVendor->ServiceCellParas.cdma.zoneId; 118411fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotPn = hrilCellInfoVendor->ServiceCellParas.cdma.pilotPn; 118511fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.pilotStrength = hrilCellInfoVendor->ServiceCellParas.cdma.pilotStrength; 118611fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.channel = hrilCellInfoVendor->ServiceCellParas.cdma.channel; 118711fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.longitude = hrilCellInfoVendor->ServiceCellParas.cdma.longitude; 118811fccf17Sopenharmony_ci cellInfo.serviceCells.cdma.latitude = hrilCellInfoVendor->ServiceCellParas.cdma.latitude; 118911fccf17Sopenharmony_ci break; 119011fccf17Sopenharmony_ci case NETWORK_TYPE_TDSCDMA: 119111fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.arfcn = hrilCellInfoVendor->ServiceCellParas.tdscdma.arfcn; 119211fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.syncId = hrilCellInfoVendor->ServiceCellParas.tdscdma.syncId; 119311fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.sc = hrilCellInfoVendor->ServiceCellParas.tdscdma.sc; 119411fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cellId = hrilCellInfoVendor->ServiceCellParas.tdscdma.cellId; 119511fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.lac = hrilCellInfoVendor->ServiceCellParas.tdscdma.lac; 119611fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rscp = hrilCellInfoVendor->ServiceCellParas.tdscdma.rscp; 119711fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.drx = hrilCellInfoVendor->ServiceCellParas.tdscdma.drx; 119811fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.rac = hrilCellInfoVendor->ServiceCellParas.tdscdma.rac; 119911fccf17Sopenharmony_ci cellInfo.serviceCells.tdscdma.cpid = hrilCellInfoVendor->ServiceCellParas.tdscdma.cpid; 120011fccf17Sopenharmony_ci break; 120111fccf17Sopenharmony_ci case NETWORK_TYPE_NR: 120211fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nrArfcn = hrilCellInfoVendor->ServiceCellParas.nr.nrArfcn; 120311fccf17Sopenharmony_ci cellInfo.serviceCells.nr.pci = hrilCellInfoVendor->ServiceCellParas.nr.pci; 120411fccf17Sopenharmony_ci cellInfo.serviceCells.nr.tac = hrilCellInfoVendor->ServiceCellParas.nr.tac; 120511fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nci = hrilCellInfoVendor->ServiceCellParas.nr.nci; 120611fccf17Sopenharmony_ci cellInfo.serviceCells.nr.rsrp = hrilCellInfoVendor->ServiceCellParas.nr.rsrp; 120711fccf17Sopenharmony_ci cellInfo.serviceCells.nr.rsrq = hrilCellInfoVendor->ServiceCellParas.nr.rsrq; 120811fccf17Sopenharmony_ci break; 120911fccf17Sopenharmony_ci default: 121011fccf17Sopenharmony_ci break; 121111fccf17Sopenharmony_ci } 121211fccf17Sopenharmony_ci} 121311fccf17Sopenharmony_ci 121411fccf17Sopenharmony_civoid HRilNetwork::FillCurrentCellInfo( 121511fccf17Sopenharmony_ci HDI::Ril::V1_1::CurrentCellInfo &cellInfo, const CurrentCellInfoVendor *cellInfoVendor) 121611fccf17Sopenharmony_ci{ 121711fccf17Sopenharmony_ci cellInfo.ratType = cellInfoVendor->ratType; 121811fccf17Sopenharmony_ci cellInfo.mcc = cellInfoVendor->mcc; 121911fccf17Sopenharmony_ci cellInfo.mnc = cellInfoVendor->mnc; 122011fccf17Sopenharmony_ci switch (cellInfoVendor->ratType) { 122111fccf17Sopenharmony_ci case NETWORK_TYPE_GSM: 122211fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.band = cellInfoVendor->ServiceCellParas.gsm.band; 122311fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.arfcn = cellInfoVendor->ServiceCellParas.gsm.arfcn; 122411fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.bsic = cellInfoVendor->ServiceCellParas.gsm.bsic; 122511fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.cellId = cellInfoVendor->ServiceCellParas.gsm.cellId; 122611fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.lac = cellInfoVendor->ServiceCellParas.gsm.lac; 122711fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxlev = cellInfoVendor->ServiceCellParas.gsm.rxlev; 122811fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxQuality = cellInfoVendor->ServiceCellParas.gsm.rxQuality; 122911fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.ta = cellInfoVendor->ServiceCellParas.gsm.ta; 123011fccf17Sopenharmony_ci break; 123111fccf17Sopenharmony_ci case NETWORK_TYPE_LTE: 123211fccf17Sopenharmony_ci cellInfo.serviceCells.lte.arfcn = cellInfoVendor->ServiceCellParas.lte.arfcn; 123311fccf17Sopenharmony_ci cellInfo.serviceCells.lte.cellId = cellInfoVendor->ServiceCellParas.lte.cellId; 123411fccf17Sopenharmony_ci cellInfo.serviceCells.lte.pci = cellInfoVendor->ServiceCellParas.lte.pci; 123511fccf17Sopenharmony_ci cellInfo.serviceCells.lte.tac = cellInfoVendor->ServiceCellParas.lte.tac; 123611fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrp = cellInfoVendor->ServiceCellParas.lte.rsrp; 123711fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrq = cellInfoVendor->ServiceCellParas.lte.rsrq; 123811fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rssi = cellInfoVendor->ServiceCellParas.lte.rssi; 123911fccf17Sopenharmony_ci break; 124011fccf17Sopenharmony_ci case NETWORK_TYPE_WCDMA: 124111fccf17Sopenharmony_ci case NETWORK_TYPE_CDMA: 124211fccf17Sopenharmony_ci case NETWORK_TYPE_TDSCDMA: 124311fccf17Sopenharmony_ci FillCellInfoType(cellInfo, cellInfoVendor); 124411fccf17Sopenharmony_ci break; 124511fccf17Sopenharmony_ci case NETWORK_TYPE_NR: 124611fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nrArfcn = cellInfoVendor->ServiceCellParas.nr.nrArfcn; 124711fccf17Sopenharmony_ci cellInfo.serviceCells.nr.pci = cellInfoVendor->ServiceCellParas.nr.pci; 124811fccf17Sopenharmony_ci cellInfo.serviceCells.nr.tac = cellInfoVendor->ServiceCellParas.nr.tac; 124911fccf17Sopenharmony_ci cellInfo.serviceCells.nr.nci = cellInfoVendor->ServiceCellParas.nr.nci; 125011fccf17Sopenharmony_ci break; 125111fccf17Sopenharmony_ci default: 125211fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.arfcn = 0; 125311fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.cellId = 0; 125411fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.psc = 0; 125511fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.lac = 0; 125611fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rxlev = 0; 125711fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rscp = 0; 125811fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ecno = 0; 125911fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.drx = 0; 126011fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ura = 0; 126111fccf17Sopenharmony_ci break; 126211fccf17Sopenharmony_ci } 126311fccf17Sopenharmony_ci} 126411fccf17Sopenharmony_ci 126511fccf17Sopenharmony_civoid HRilNetwork::FillCurrentCellInfo( 126611fccf17Sopenharmony_ci HDI::Ril::V1_1::CurrentCellInfo_1_1 &cellInfo, const CurrentCellInfoVendor *cellInfoVendor) 126711fccf17Sopenharmony_ci{ 126811fccf17Sopenharmony_ci cellInfo.ratType = cellInfoVendor->ratType; 126911fccf17Sopenharmony_ci cellInfo.mcc = cellInfoVendor->mcc; 127011fccf17Sopenharmony_ci cellInfo.mnc = cellInfoVendor->mnc; 127111fccf17Sopenharmony_ci switch (cellInfoVendor->ratType) { 127211fccf17Sopenharmony_ci case NETWORK_TYPE_GSM: 127311fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.band = cellInfoVendor->ServiceCellParas.gsm.band; 127411fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.arfcn = cellInfoVendor->ServiceCellParas.gsm.arfcn; 127511fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.bsic = cellInfoVendor->ServiceCellParas.gsm.bsic; 127611fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.cellId = cellInfoVendor->ServiceCellParas.gsm.cellId; 127711fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.lac = cellInfoVendor->ServiceCellParas.gsm.lac; 127811fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxlev = cellInfoVendor->ServiceCellParas.gsm.rxlev; 127911fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxQuality = cellInfoVendor->ServiceCellParas.gsm.rxQuality; 128011fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.ta = cellInfoVendor->ServiceCellParas.gsm.ta; 128111fccf17Sopenharmony_ci break; 128211fccf17Sopenharmony_ci case NETWORK_TYPE_LTE: 128311fccf17Sopenharmony_ci cellInfo.serviceCells.lte.arfcn = cellInfoVendor->ServiceCellParas.lte.arfcn; 128411fccf17Sopenharmony_ci cellInfo.serviceCells.lte.cellId = cellInfoVendor->ServiceCellParas.lte.cellId; 128511fccf17Sopenharmony_ci cellInfo.serviceCells.lte.pci = cellInfoVendor->ServiceCellParas.lte.pci; 128611fccf17Sopenharmony_ci cellInfo.serviceCells.lte.tac = cellInfoVendor->ServiceCellParas.lte.tac; 128711fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrp = cellInfoVendor->ServiceCellParas.lte.rsrp; 128811fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrq = cellInfoVendor->ServiceCellParas.lte.rsrq; 128911fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rssi = cellInfoVendor->ServiceCellParas.lte.rssi; 129011fccf17Sopenharmony_ci break; 129111fccf17Sopenharmony_ci case NETWORK_TYPE_WCDMA: 129211fccf17Sopenharmony_ci case NETWORK_TYPE_CDMA: 129311fccf17Sopenharmony_ci case NETWORK_TYPE_TDSCDMA: 129411fccf17Sopenharmony_ci case NETWORK_TYPE_NR: 129511fccf17Sopenharmony_ci FillCellInfoType(cellInfo, cellInfoVendor); 129611fccf17Sopenharmony_ci break; 129711fccf17Sopenharmony_ci default: 129811fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.arfcn = 0; 129911fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.cellId = 0; 130011fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.psc = 0; 130111fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.lac = 0; 130211fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rxlev = 0; 130311fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rscp = 0; 130411fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ecno = 0; 130511fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.drx = 0; 130611fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ura = 0; 130711fccf17Sopenharmony_ci break; 130811fccf17Sopenharmony_ci } 130911fccf17Sopenharmony_ci} 131011fccf17Sopenharmony_ci 131111fccf17Sopenharmony_civoid HRilNetwork::FillCurrentCellInfo( 131211fccf17Sopenharmony_ci HDI::Ril::V1_2::CurrentCellInfo_1_2 &cellInfo, const CurrentCellInfoVendor *cellInfoVendor) 131311fccf17Sopenharmony_ci{ 131411fccf17Sopenharmony_ci cellInfo.ratType = cellInfoVendor->ratType; 131511fccf17Sopenharmony_ci cellInfo.mcc = cellInfoVendor->mcc; 131611fccf17Sopenharmony_ci cellInfo.mnc = cellInfoVendor->mnc; 131711fccf17Sopenharmony_ci switch (cellInfoVendor->ratType) { 131811fccf17Sopenharmony_ci case NETWORK_TYPE_GSM: 131911fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.band = cellInfoVendor->ServiceCellParas.gsm.band; 132011fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.arfcn = cellInfoVendor->ServiceCellParas.gsm.arfcn; 132111fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.bsic = cellInfoVendor->ServiceCellParas.gsm.bsic; 132211fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.cellId = cellInfoVendor->ServiceCellParas.gsm.cellId; 132311fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.lac = cellInfoVendor->ServiceCellParas.gsm.lac; 132411fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxlev = cellInfoVendor->ServiceCellParas.gsm.rxlev; 132511fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.rxQuality = cellInfoVendor->ServiceCellParas.gsm.rxQuality; 132611fccf17Sopenharmony_ci cellInfo.serviceCells.gsm.ta = cellInfoVendor->ServiceCellParas.gsm.ta; 132711fccf17Sopenharmony_ci break; 132811fccf17Sopenharmony_ci case NETWORK_TYPE_LTE: 132911fccf17Sopenharmony_ci cellInfo.serviceCells.lte.arfcn = cellInfoVendor->ServiceCellParas.lte.arfcn; 133011fccf17Sopenharmony_ci cellInfo.serviceCells.lte.cellId = cellInfoVendor->ServiceCellParas.lte.cellId; 133111fccf17Sopenharmony_ci cellInfo.serviceCells.lte.pci = cellInfoVendor->ServiceCellParas.lte.pci; 133211fccf17Sopenharmony_ci cellInfo.serviceCells.lte.tac = cellInfoVendor->ServiceCellParas.lte.tac; 133311fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrp = cellInfoVendor->ServiceCellParas.lte.rsrp; 133411fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rsrq = cellInfoVendor->ServiceCellParas.lte.rsrq; 133511fccf17Sopenharmony_ci cellInfo.serviceCells.lte.rssi = cellInfoVendor->ServiceCellParas.lte.rssi; 133611fccf17Sopenharmony_ci break; 133711fccf17Sopenharmony_ci case NETWORK_TYPE_WCDMA: 133811fccf17Sopenharmony_ci case NETWORK_TYPE_CDMA: 133911fccf17Sopenharmony_ci case NETWORK_TYPE_TDSCDMA: 134011fccf17Sopenharmony_ci case NETWORK_TYPE_NR: 134111fccf17Sopenharmony_ci FillCellInfoType(cellInfo, cellInfoVendor); 134211fccf17Sopenharmony_ci break; 134311fccf17Sopenharmony_ci default: 134411fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.arfcn = 0; 134511fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.cellId = 0; 134611fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.psc = 0; 134711fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.lac = 0; 134811fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rxlev = 0; 134911fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.rscp = 0; 135011fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ecno = 0; 135111fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.drx = 0; 135211fccf17Sopenharmony_ci cellInfo.serviceCells.wcdma.ura = 0; 135311fccf17Sopenharmony_ci break; 135411fccf17Sopenharmony_ci } 135511fccf17Sopenharmony_ci} 135611fccf17Sopenharmony_ci 135711fccf17Sopenharmony_ciint32_t HRilNetwork::BuildCurrentCellList(HDI::Ril::V1_1::CellListCurrentInfo &cellInfoList, 135811fccf17Sopenharmony_ci const void *response, size_t responseLen) 135911fccf17Sopenharmony_ci{ 136011fccf17Sopenharmony_ci const CurrentCellInfoList *temp = reinterpret_cast<const CurrentCellInfoList *>(response); 136111fccf17Sopenharmony_ci cellInfoList.itemNum = temp->itemNum; 136211fccf17Sopenharmony_ci TELEPHONY_LOGI("BuildCurrentCellList cellInfoList.itemNum = %{public}d", cellInfoList.itemNum); 136311fccf17Sopenharmony_ci for (int32_t i = 0; i < temp->itemNum; i++) { 136411fccf17Sopenharmony_ci HDI::Ril::V1_1::CurrentCellInfo cellInfo; 136511fccf17Sopenharmony_ci CurrentCellInfoVendor *cell = temp->currentCellInfo + i; 136611fccf17Sopenharmony_ci if (cell == nullptr) { 136711fccf17Sopenharmony_ci TELEPHONY_LOGE("BuildCurrentCellList cell is nullptr"); 136811fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 136911fccf17Sopenharmony_ci } 137011fccf17Sopenharmony_ci FillCurrentCellInfo(cellInfo, cell); 137111fccf17Sopenharmony_ci cellInfoList.cellCurrentInfo.push_back(cellInfo); 137211fccf17Sopenharmony_ci } 137311fccf17Sopenharmony_ci return HRIL_ERR_SUCCESS; 137411fccf17Sopenharmony_ci} 137511fccf17Sopenharmony_ci 137611fccf17Sopenharmony_ciint32_t HRilNetwork::BuildCurrentCellList( 137711fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListCurrentInfo_1_1 &cellInfoList, const void *response, size_t responseLen) 137811fccf17Sopenharmony_ci{ 137911fccf17Sopenharmony_ci const CurrentCellInfoList *temp = reinterpret_cast<const CurrentCellInfoList *>(response); 138011fccf17Sopenharmony_ci cellInfoList.itemNum = temp->itemNum; 138111fccf17Sopenharmony_ci TELEPHONY_LOGI("cellInfoList.itemNum = %{public}d", cellInfoList.itemNum); 138211fccf17Sopenharmony_ci for (int32_t i = 0; i < temp->itemNum; i++) { 138311fccf17Sopenharmony_ci HDI::Ril::V1_1::CurrentCellInfo_1_1 cellInfo; 138411fccf17Sopenharmony_ci CurrentCellInfoVendor *cell = temp->currentCellInfo + i; 138511fccf17Sopenharmony_ci if (cell == nullptr) { 138611fccf17Sopenharmony_ci TELEPHONY_LOGE("cell is nullptr"); 138711fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 138811fccf17Sopenharmony_ci } 138911fccf17Sopenharmony_ci FillCurrentCellInfo(cellInfo, cell); 139011fccf17Sopenharmony_ci cellInfoList.cellCurrentInfo.push_back(cellInfo); 139111fccf17Sopenharmony_ci } 139211fccf17Sopenharmony_ci return HRIL_ERR_SUCCESS; 139311fccf17Sopenharmony_ci} 139411fccf17Sopenharmony_ci 139511fccf17Sopenharmony_ciint32_t HRilNetwork::BuildCurrentCellList( 139611fccf17Sopenharmony_ci HDI::Ril::V1_2::CellListCurrentInfo_1_2 &cellInfoList, const void *response, size_t responseLen) 139711fccf17Sopenharmony_ci{ 139811fccf17Sopenharmony_ci const CurrentCellInfoList *temp = reinterpret_cast<const CurrentCellInfoList *>(response); 139911fccf17Sopenharmony_ci cellInfoList.itemNum = temp->itemNum; 140011fccf17Sopenharmony_ci TELEPHONY_LOGD("cellInfoList.itemNum = %{public}d", cellInfoList.itemNum); 140111fccf17Sopenharmony_ci for (int32_t i = 0; i < temp->itemNum; i++) { 140211fccf17Sopenharmony_ci HDI::Ril::V1_2::CurrentCellInfo_1_2 cellInfo; 140311fccf17Sopenharmony_ci CurrentCellInfoVendor *cell = temp->currentCellInfo + i; 140411fccf17Sopenharmony_ci if (cell == nullptr) { 140511fccf17Sopenharmony_ci TELEPHONY_LOGE("cell is nullptr"); 140611fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 140711fccf17Sopenharmony_ci } 140811fccf17Sopenharmony_ci FillCurrentCellInfo(cellInfo, cell); 140911fccf17Sopenharmony_ci cellInfoList.cellCurrentInfo.push_back(cellInfo); 141011fccf17Sopenharmony_ci } 141111fccf17Sopenharmony_ci return HRIL_ERR_SUCCESS; 141211fccf17Sopenharmony_ci} 141311fccf17Sopenharmony_ci 141411fccf17Sopenharmony_ciint32_t HRilNetwork::BuildNrCellSsbIdsInfo(HDI::Ril::V1_2::NrCellSsbIds &nrCellSsbIds, 141511fccf17Sopenharmony_ci const void *response, size_t responseLen) 141611fccf17Sopenharmony_ci{ 141711fccf17Sopenharmony_ci const NrCellSsbIdsVendor *temp = reinterpret_cast<const NrCellSsbIdsVendor *>(response); 141811fccf17Sopenharmony_ci if (temp->nbCellCount > MAX_NBCELL_COUNT) { 141911fccf17Sopenharmony_ci TELEPHONY_LOGE("NbCellCount > max size 4"); 142011fccf17Sopenharmony_ci return HRIL_ERR_GENERIC_FAILURE; 142111fccf17Sopenharmony_ci } 142211fccf17Sopenharmony_ci nrCellSsbIds.arfcn = temp->arfcn; 142311fccf17Sopenharmony_ci nrCellSsbIds.cid = temp->cid; 142411fccf17Sopenharmony_ci nrCellSsbIds.pic = temp->pic; 142511fccf17Sopenharmony_ci nrCellSsbIds.rsrp = temp->rsrp; 142611fccf17Sopenharmony_ci nrCellSsbIds.sinr = temp->sinr; 142711fccf17Sopenharmony_ci nrCellSsbIds.timeAdvance = temp->timeAdvance; 142811fccf17Sopenharmony_ci nrCellSsbIds.nbCellCount = temp->nbCellCount; 142911fccf17Sopenharmony_ci for (int32_t i = 0; i < SCELL_SSB_LIST; i++) { 143011fccf17Sopenharmony_ci HDI::Ril::V1_2::SsbIdInfo ssbIdInfo = {0}; 143111fccf17Sopenharmony_ci SsbIdInfoVendor *sCellSsbList = temp->sCellSsbList + i; 143211fccf17Sopenharmony_ci ssbIdInfo.ssbId = sCellSsbList->ssbId; 143311fccf17Sopenharmony_ci ssbIdInfo.rsrp = sCellSsbList->rsrp; 143411fccf17Sopenharmony_ci nrCellSsbIds.sCellSsbList.push_back(ssbIdInfo); 143511fccf17Sopenharmony_ci } 143611fccf17Sopenharmony_ci for (int32_t i = 0; i < temp->nbCellCount; i++) { 143711fccf17Sopenharmony_ci HDI::Ril::V1_2::NeighboringCellSsbInfo neighboringCellSsbInfo; 143811fccf17Sopenharmony_ci neighboringCellSsbInfo.pci = temp->nbCellSsbList[i].pci; 143911fccf17Sopenharmony_ci neighboringCellSsbInfo.arfcn = temp->nbCellSsbList[i].arfcn; 144011fccf17Sopenharmony_ci neighboringCellSsbInfo.rsrp = temp->nbCellSsbList[i].rsrp; 144111fccf17Sopenharmony_ci neighboringCellSsbInfo.sinr = temp->nbCellSsbList[i].sinr; 144211fccf17Sopenharmony_ci for (int32_t j = 0; j < NBCELL_SSB_LIST; j++) { 144311fccf17Sopenharmony_ci HDI::Ril::V1_2::SsbIdInfo ssbIdInfo = {0}; 144411fccf17Sopenharmony_ci SsbIdInfoVendor *sCellSsbList = temp->nbCellSsbList[i].ssbIdList + j; 144511fccf17Sopenharmony_ci ssbIdInfo.ssbId = sCellSsbList->ssbId; 144611fccf17Sopenharmony_ci ssbIdInfo.rsrp = sCellSsbList->rsrp; 144711fccf17Sopenharmony_ci neighboringCellSsbInfo.ssbIdList.push_back(ssbIdInfo); 144811fccf17Sopenharmony_ci } 144911fccf17Sopenharmony_ci nrCellSsbIds.nbCellSsbList.push_back(neighboringCellSsbInfo); 145011fccf17Sopenharmony_ci } 145111fccf17Sopenharmony_ci return HRIL_ERR_SUCCESS; 145211fccf17Sopenharmony_ci} 145311fccf17Sopenharmony_ci 145411fccf17Sopenharmony_cibool HRilNetwork::IsNetworkResponse(uint32_t code) 145511fccf17Sopenharmony_ci{ 145611fccf17Sopenharmony_ci return ((code >= HREQ_NETWORK_BASE) && (code < HREQ_COMMON_BASE)); 145711fccf17Sopenharmony_ci} 145811fccf17Sopenharmony_ci 145911fccf17Sopenharmony_cibool HRilNetwork::IsNetworkNotification(uint32_t code) 146011fccf17Sopenharmony_ci{ 146111fccf17Sopenharmony_ci return ((code >= HNOTI_NETWORK_BASE) && (code < HNOTI_COMMON_BASE)); 146211fccf17Sopenharmony_ci} 146311fccf17Sopenharmony_ci 146411fccf17Sopenharmony_cibool HRilNetwork::IsNetworkRespOrNotify(uint32_t code) 146511fccf17Sopenharmony_ci{ 146611fccf17Sopenharmony_ci return IsNetworkResponse(code) || IsNetworkNotification(code); 146711fccf17Sopenharmony_ci} 146811fccf17Sopenharmony_ci 146911fccf17Sopenharmony_civoid HRilNetwork::RegisterNetworkFuncs(const HRilNetworkReq *networkFuncs) 147011fccf17Sopenharmony_ci{ 147111fccf17Sopenharmony_ci networkFuncs_ = networkFuncs; 147211fccf17Sopenharmony_ci} 147311fccf17Sopenharmony_ci} // namespace Telephony 147411fccf17Sopenharmony_ci} // namespace OHOS 1475