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#ifndef OHOS_HRIL_NETWORK_H 1711fccf17Sopenharmony_ci#define OHOS_HRIL_NETWORK_H 1811fccf17Sopenharmony_ci 1911fccf17Sopenharmony_ci#include "hril_base.h" 2011fccf17Sopenharmony_ci 2111fccf17Sopenharmony_cinamespace OHOS { 2211fccf17Sopenharmony_cinamespace Telephony { 2311fccf17Sopenharmony_ciclass HRilNetwork : public HRilBase { 2411fccf17Sopenharmony_cipublic: 2511fccf17Sopenharmony_ci HRilNetwork(int32_t slotId); 2611fccf17Sopenharmony_ci virtual ~HRilNetwork() = default; 2711fccf17Sopenharmony_ci 2811fccf17Sopenharmony_ci int32_t GetSignalStrength(int32_t serialId); 2911fccf17Sopenharmony_ci int32_t GetCsRegStatus(int32_t serialId); 3011fccf17Sopenharmony_ci int32_t GetPsRegStatus(int32_t serialId); 3111fccf17Sopenharmony_ci int32_t GetOperatorInfo(int32_t serialId); 3211fccf17Sopenharmony_ci int32_t GetNeighboringCellInfoList(int32_t serialId); 3311fccf17Sopenharmony_ci int32_t GetCurrentCellInfo(int32_t serialId); 3411fccf17Sopenharmony_ci int32_t GetNetworkSearchInformation(int32_t serialId); 3511fccf17Sopenharmony_ci int32_t GetNetworkSelectionMode(int32_t serialId); 3611fccf17Sopenharmony_ci int32_t SetNetworkSelectionMode(int32_t serialId, const HDI::Ril::V1_1::SetNetworkModeInfo &networkModeInfo); 3711fccf17Sopenharmony_ci int32_t SetPreferredNetwork(int32_t serialId, int32_t preferredNetworkType); 3811fccf17Sopenharmony_ci int32_t GetPreferredNetwork(int32_t serialId); 3911fccf17Sopenharmony_ci int32_t GetPhysicalChannelConfig(int32_t serialId); 4011fccf17Sopenharmony_ci int32_t SetLocateUpdates(int32_t serialId, const HDI::Ril::V1_1::RilRegNotifyMode mode); 4111fccf17Sopenharmony_ci int32_t SetNotificationFilter(int32_t serialId, int32_t newFilter); 4211fccf17Sopenharmony_ci int32_t SetDeviceState(int32_t serialId, int32_t deviceStateType, int32_t deviceStateOn); 4311fccf17Sopenharmony_ci int32_t SetNrOptionMode(int32_t serialId, int32_t mode); 4411fccf17Sopenharmony_ci int32_t GetNrOptionMode(int32_t serialId); 4511fccf17Sopenharmony_ci int32_t GetRrcConnectionState(int32_t serialId); 4611fccf17Sopenharmony_ci int32_t GetNrSsbId(int32_t serialId); 4711fccf17Sopenharmony_ci 4811fccf17Sopenharmony_ci int32_t GetSignalStrengthResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 4911fccf17Sopenharmony_ci const void *response, size_t responseLen); 5011fccf17Sopenharmony_ci int32_t GetCsRegStatusResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 5111fccf17Sopenharmony_ci const void *response, size_t responseLen); 5211fccf17Sopenharmony_ci int32_t GetPsRegStatusResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 5311fccf17Sopenharmony_ci const void *response, size_t responseLen); 5411fccf17Sopenharmony_ci int32_t GetOperatorInfoResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 5511fccf17Sopenharmony_ci const void *response, size_t responseLen); 5611fccf17Sopenharmony_ci int32_t GetNetworkSearchInformationResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 5711fccf17Sopenharmony_ci const void *response, size_t responseLen); 5811fccf17Sopenharmony_ci int32_t GetNetworkSelectionModeResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 5911fccf17Sopenharmony_ci const void *response, size_t responseLen); 6011fccf17Sopenharmony_ci int32_t SetNetworkSelectionModeResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 6111fccf17Sopenharmony_ci const void *response, size_t responseLen); 6211fccf17Sopenharmony_ci int32_t SetPreferredNetworkResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 6311fccf17Sopenharmony_ci const void *response, size_t responseLen); 6411fccf17Sopenharmony_ci int32_t GetPreferredNetworkResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 6511fccf17Sopenharmony_ci const void *response, size_t responseLen); 6611fccf17Sopenharmony_ci int32_t GetNeighboringCellInfoListResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 6711fccf17Sopenharmony_ci const void *response, size_t responseLen); 6811fccf17Sopenharmony_ci int32_t GetNeighboringCellInfoListResponse_1_2(int32_t requestNum, 6911fccf17Sopenharmony_ci HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 7011fccf17Sopenharmony_ci int32_t GetCurrentCellInfoResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 7111fccf17Sopenharmony_ci const void *response, size_t responseLen); 7211fccf17Sopenharmony_ci int32_t GetCurrentCellInfoResponse_1_1(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 7311fccf17Sopenharmony_ci const void *response, size_t responseLen); 7411fccf17Sopenharmony_ci int32_t GetCurrentCellInfoResponse_1_2(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 7511fccf17Sopenharmony_ci const void *response, size_t responseLen); 7611fccf17Sopenharmony_ci int32_t GetPhysicalChannelConfigResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 7711fccf17Sopenharmony_ci const void *response, size_t responseLen); 7811fccf17Sopenharmony_ci int32_t SetLocateUpdatesResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 7911fccf17Sopenharmony_ci const void *response, size_t responseLen); 8011fccf17Sopenharmony_ci int32_t SetNotificationFilterResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 8111fccf17Sopenharmony_ci const void *response, size_t responseLen); 8211fccf17Sopenharmony_ci int32_t SetDeviceStateResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 8311fccf17Sopenharmony_ci const void *response, size_t responseLen); 8411fccf17Sopenharmony_ci int32_t SetNrOptionModeResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 8511fccf17Sopenharmony_ci const void *response, size_t responseLen); 8611fccf17Sopenharmony_ci int32_t GetNrOptionModeResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 8711fccf17Sopenharmony_ci const void *response, size_t responseLen); 8811fccf17Sopenharmony_ci int32_t GetRrcConnectionStateResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 8911fccf17Sopenharmony_ci const void *response, size_t responseLen); 9011fccf17Sopenharmony_ci int32_t GetNrSsbIdResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 9111fccf17Sopenharmony_ci const void *response, size_t responseLen); 9211fccf17Sopenharmony_ci 9311fccf17Sopenharmony_ci int32_t NetworkCsRegStatusUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 9411fccf17Sopenharmony_ci int32_t NetworkPsRegStatusUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 9511fccf17Sopenharmony_ci int32_t SignalStrengthUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 9611fccf17Sopenharmony_ci int32_t NetworkTimeUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 9711fccf17Sopenharmony_ci int32_t NetworkTimeZoneUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 9811fccf17Sopenharmony_ci int32_t NetworkPhyChnlCfgUpdated( 9911fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen); 10011fccf17Sopenharmony_ci int32_t NetworkCurrentCellUpdated( 10111fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen); 10211fccf17Sopenharmony_ci int32_t GetRrcConnectionStateUpdated( 10311fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen); 10411fccf17Sopenharmony_ci int32_t NetworkCurrentCellUpdated_1_1( 10511fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen); 10611fccf17Sopenharmony_ci int32_t NetworkCurrentCellUpdated_1_2( 10711fccf17Sopenharmony_ci int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen); 10811fccf17Sopenharmony_ci void RegisterNetworkFuncs(const HRilNetworkReq *networkFuncs); 10911fccf17Sopenharmony_ci bool IsNetworkRespOrNotify(uint32_t code); 11011fccf17Sopenharmony_ci int32_t ResidentNetworkUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 11111fccf17Sopenharmony_ci 11211fccf17Sopenharmony_ciprivate: 11311fccf17Sopenharmony_ci void AddNotificationToMap(); 11411fccf17Sopenharmony_ci void AddBasicHandlerToMap(); 11511fccf17Sopenharmony_ci void AddNetworkSearchHandlerToMap(); 11611fccf17Sopenharmony_ci void ExchangeRilRssiToHdf(const void *response, HDI::Ril::V1_1::Rssi &rssi); 11711fccf17Sopenharmony_ci void BuildOperatorList( 11811fccf17Sopenharmony_ci HDI::Ril::V1_1::AvailableNetworkList &availableNetworkList, const void *response, size_t responseLen); 11911fccf17Sopenharmony_ci // V1_0 12011fccf17Sopenharmony_ci void FillCellNearbyInfo(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *cellPtr); 12111fccf17Sopenharmony_ci void FillCellNearbyInfoTdscdma(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *hrilCellPtr); 12211fccf17Sopenharmony_ci void FillCellNearbyInfoCdma(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *hrilCellPtr); 12311fccf17Sopenharmony_ci int32_t BuildNeighboringCellList(HDI::Ril::V1_1::CellListNearbyInfo &cellInfoList, 12411fccf17Sopenharmony_ci const void *response, size_t responseLen); 12511fccf17Sopenharmony_ci // V1_2 12611fccf17Sopenharmony_ci void FillCellNearbyInfo(HDI::Ril::V1_2::CellNearbyInfo_1_2 &cellInfo, const CellInfo *cellPtr); 12711fccf17Sopenharmony_ci void FillCellNearbyInfoTdscdma(HDI::Ril::V1_2::CellNearbyInfo_1_2 &cellInfo, const CellInfo *hrilCellPtr); 12811fccf17Sopenharmony_ci void FillCellNearbyInfoCdma(HDI::Ril::V1_2::CellNearbyInfo_1_2 &cellInfo, const CellInfo *hrilCellPtr); 12911fccf17Sopenharmony_ci int32_t BuildNeighboringCellList( 13011fccf17Sopenharmony_ci HDI::Ril::V1_2::CellListNearbyInfo_1_2 &cellInfoList, const void *response, size_t responseLen); 13111fccf17Sopenharmony_ci // V1_0 13211fccf17Sopenharmony_ci void FillCellInfoType(HDI::Ril::V1_1::CurrentCellInfo &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor); 13311fccf17Sopenharmony_ci void FillCurrentCellInfo(HDI::Ril::V1_1::CurrentCellInfo &cellInfo, const CurrentCellInfoVendor *cellInfoVendor); 13411fccf17Sopenharmony_ci int32_t BuildCurrentCellList( 13511fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListCurrentInfo &cellInfoList, const void *response, size_t responseLen); 13611fccf17Sopenharmony_ci // V1_1 13711fccf17Sopenharmony_ci void FillCellInfoType( 13811fccf17Sopenharmony_ci HDI::Ril::V1_1::CurrentCellInfo_1_1 &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor); 13911fccf17Sopenharmony_ci void FillCurrentCellInfo( 14011fccf17Sopenharmony_ci HDI::Ril::V1_1::CurrentCellInfo_1_1 &cellInfo, const CurrentCellInfoVendor *cellInfoVendor); 14111fccf17Sopenharmony_ci int32_t BuildCurrentCellList( 14211fccf17Sopenharmony_ci HDI::Ril::V1_1::CellListCurrentInfo_1_1 &cellInfoList, const void *response, size_t responseLen); 14311fccf17Sopenharmony_ci // V1_2 14411fccf17Sopenharmony_ci void FillCellInfoType( 14511fccf17Sopenharmony_ci HDI::Ril::V1_2::CurrentCellInfo_1_2 &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor); 14611fccf17Sopenharmony_ci void FillCurrentCellInfo( 14711fccf17Sopenharmony_ci HDI::Ril::V1_2::CurrentCellInfo_1_2 &cellInfo, const CurrentCellInfoVendor *cellInfoVendor); 14811fccf17Sopenharmony_ci int32_t BuildCurrentCellList( 14911fccf17Sopenharmony_ci HDI::Ril::V1_2::CellListCurrentInfo_1_2 &cellInfoList, const void *response, size_t responseLen); 15011fccf17Sopenharmony_ci int32_t BuildNrCellSsbIdsInfo(HDI::Ril::V1_2::NrCellSsbIds &nrCellSsbIds, const void *response, size_t responseLen); 15111fccf17Sopenharmony_ci bool IsNetworkResponse(uint32_t code); 15211fccf17Sopenharmony_ci bool IsNetworkNotification(uint32_t code); 15311fccf17Sopenharmony_ci 15411fccf17Sopenharmony_ciprivate: 15511fccf17Sopenharmony_ci const HRilNetworkReq *networkFuncs_ = nullptr; 15611fccf17Sopenharmony_ci const int32_t SCELL_SSB_LIST = 8; 15711fccf17Sopenharmony_ci const int32_t NBCELL_SSB_LIST = 4; 15811fccf17Sopenharmony_ci const int32_t MAX_NBCELL_COUNT = 4; 15911fccf17Sopenharmony_ci}; 16011fccf17Sopenharmony_ci} // namespace Telephony 16111fccf17Sopenharmony_ci} // namespace OHOS 16211fccf17Sopenharmony_ci#endif // OHOS_HRIL_NETWORK_H 163