1 /* 2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_HRIL_NETWORK_H 17 #define OHOS_HRIL_NETWORK_H 18 19 #include "hril_base.h" 20 #include "hril_network_parcel.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 class HRilNetwork : public HRilBase { 25 public: 26 HRilNetwork(int32_t slotId, IHRilReporter &hrilReporter); 27 virtual ~HRilNetwork() = default; 28 29 int32_t GetSignalStrength(int32_t serialId); 30 int32_t GetCsRegStatus(int32_t serialId); 31 int32_t GetPsRegStatus(int32_t serialId); 32 int32_t GetOperatorInfo(int32_t serialId); 33 int32_t GetNeighboringCellInfoList(int32_t serialId); 34 int32_t GetCurrentCellInfo(int32_t serialId); 35 int32_t GetNetworkSearchInformation(int32_t serialId); 36 int32_t GetNetworkSelectionMode(int32_t serialId); 37 int32_t SetNetworkSelectionMode(int32_t serialId, const HDI::Ril::V1_0::SetNetworkModeInfo &networkModeInfo); 38 int32_t SetPreferredNetwork(int32_t serialId, int32_t preferredNetworkType); 39 int32_t GetPreferredNetwork(int32_t serialId); 40 int32_t GetPhysicalChannelConfig(int32_t serialId); 41 int32_t SetLocateUpdates(int32_t serialId, const HDI::Ril::V1_0::RilRegNotifyMode mode); 42 int32_t SetNotificationFilter(int32_t serialId, int32_t newFilter); 43 int32_t SetDeviceState(int32_t serialId, int32_t deviceStateType, int32_t deviceStateOn); 44 45 int32_t GetSignalStrengthResponse( 46 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 47 int32_t GetCsRegStatusResponse( 48 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 49 int32_t GetPsRegStatusResponse( 50 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 51 int32_t GetOperatorInfoResponse( 52 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 53 int32_t GetNetworkSearchInformationResponse( 54 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 55 int32_t GetNetworkSelectionModeResponse( 56 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 57 int32_t SetNetworkSelectionModeResponse( 58 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 59 int32_t SetPreferredNetworkResponse( 60 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 61 int32_t GetPreferredNetworkResponse( 62 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 63 int32_t GetNeighboringCellInfoListResponse( 64 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 65 int32_t GetCurrentCellInfoResponse( 66 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 67 int32_t GetPhysicalChannelConfigResponse( 68 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 69 int32_t SetLocateUpdatesResponse( 70 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 71 int32_t SetNotificationFilterResponse( 72 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 73 int32_t SetDeviceStateResponse( 74 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 75 76 int32_t NetworkCsRegStatusUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 77 int32_t NetworkPsRegStatusUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 78 int32_t SignalStrengthUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 79 int32_t NetworkTimeUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 80 int32_t NetworkTimeZoneUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 81 int32_t NetworkPhyChnlCfgUpdated( 82 int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen); 83 int32_t NetworkCurrentCellUpdated( 84 int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen); 85 86 void RegisterNetworkFuncs(const HRilNetworkReq *networkFuncs); 87 bool IsNetworkRespOrNotify(uint32_t code); 88 89 private: 90 void AddHandlerToMap(); 91 void ExchangeRilRssiToHdf(const void *response, HDI::Ril::V1_0::Rssi &rssi); 92 void BuildOperatorList( 93 HDI::Ril::V1_0::AvailableNetworkList &availableNetworkList, const void *response, size_t responseLen); 94 void FillCellNearbyInfo(HDI::Ril::V1_0::CellNearbyInfo &cellInfo, const CellInfo *cellPtr); 95 void FillCellNearbyInfoTdscdma(HDI::Ril::V1_0::CellNearbyInfo &cellInfo, const CellInfo *hrilCellPtr); 96 void FillCellNearbyInfoCdma(HDI::Ril::V1_0::CellNearbyInfo &cellInfo, const CellInfo *hrilCellPtr); 97 int32_t BuildNeighboringCellList(HDI::Ril::V1_0::CellListNearbyInfo &cellInfoList, 98 const void *response, size_t responseLen); 99 void FillCellInfoType(HDI::Ril::V1_0::CurrentCellInfo &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor); 100 void FillCurrentCellInfo(HDI::Ril::V1_0::CurrentCellInfo &cellInfo, const CurrentCellInfoVendor *cellInfoVendor); 101 int32_t BuildCurrentCellList(HDI::Ril::V1_0::CellListCurrentInfo &cellInfoList, 102 const void *response, size_t responseLen); 103 bool IsNetworkResponse(uint32_t code); 104 bool IsNetworkNotification(uint32_t code); 105 106 private: 107 const HRilNetworkReq *networkFuncs_ = nullptr; 108 }; 109 } // namespace Telephony 110 } // namespace OHOS 111 #endif // OHOS_HRIL_NETWORK_H 112