1 /* 2 * Copyright (C) 2021 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 #ifndef NETWORK_SEARCH_INCLUDE_NETWORK_REGISTER_H 16 #define NETWORK_SEARCH_INCLUDE_NETWORK_REGISTER_H 17 #include <memory> 18 #include <string> 19 #include <vector> 20 #include <map> 21 #include "event_handler.h" 22 23 #include "hril_network_parcel.h" 24 #include "network_search_state.h" 25 26 namespace OHOS { 27 namespace Telephony { 28 class NetworkRegister { 29 public: 30 NetworkRegister(std::shared_ptr<NetworkSearchState> networkSearchState, 31 std::weak_ptr<NetworkSearchManager> networkSearchManager, int32_t slotId); 32 virtual ~NetworkRegister() = default; 33 void InitNrConversionConfig(); 34 void ProcessPsRegister(const AppExecFwk::InnerEvent::Pointer &event); 35 void ProcessCsRegister(const AppExecFwk::InnerEvent::Pointer &event) const; 36 void ProcessRestrictedState(const AppExecFwk::InnerEvent::Pointer &event) const; 37 void ProcessPsAttachStatus(const AppExecFwk::InnerEvent::Pointer &event) const; 38 void ProcessChannelConfigInfo(const AppExecFwk::InnerEvent::Pointer &event); 39 void DcPhysicalLinkActiveUpdate(bool isActive); 40 enum class RilRegister { 41 REG_STATE_NOT_REG = 0, 42 REG_STATE_HOME_ONLY = 1, 43 REG_STATE_SEARCH = 2, 44 REG_STATE_NO_SERVICE = 3, 45 REG_STATE_INVALID = 4, 46 REG_STATE_ROAMING = 5, 47 REG_STATE_EMERGENCY_ONLY = 6 48 }; 49 enum class ConnectServiceCell { 50 /** Connection status is unknown. */ 51 CONNECTION_UNKNOWN = 0, 52 /** UE has connection to primary cell cell(3GPP 36.331).*/ 53 CONNECTION_PRIMARY_CELL = 1, 54 /** UE has connectionto secondary cell cell(3GPP 36.331).*/ 55 CONNECTION_SECONDARY_CELL = 2 56 }; 57 58 private: 59 RegServiceState ConvertRegFromRil(RilRegister code) const; 60 RadioTech ConvertTechFromRil(HRilRadioTech code) const; 61 NrState ConvertStringToNrState(std::string &strState) const; 62 void UpdateNrState(); 63 void UpdateCfgTech(); 64 void NotifyNrFrequencyChanged(); 65 void NrConfigParse(std::string &cfgStr); 66 67 private: 68 std::shared_ptr<NetworkSearchState> networkSearchState_ = nullptr; 69 std::weak_ptr<NetworkSearchManager> networkSearchManager_; 70 /** 71 * Indicates that if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving 72 * cell. 73 * 74 * Reference: 3GPP TS 36.331 V16.6.0 6.3.1 System information blocks. 75 */ 76 bool endcSupport_ = false; 77 /** 78 * Indicates if the use of dual connectivity with NR is restricted. 79 * Reference: 3GPP TS 24.301 V17.4.0 section 9.9.3.12A. 80 */ 81 bool dcNrRestricted_ = false; 82 /** 83 * Indicates if NR is supported by the selected PLMN. 84 * Reference: 3GPP TS 36.331 V16.6.0 section 6.3.1 PLMN-InfoList-r15. 85 * 3GPP TS 36.331 V16.6.0 section 6.2.2 SystemInformationBlockType1 message. 86 */ 87 bool nrSupport_ = false; 88 FrequencyType freqType_ = FrequencyType::FREQ_TYPE_UNKNOWN; 89 bool isNrSecondaryCell_ = false; 90 bool isPhysicalLinkActive_ = false; 91 NrState nrState_ = NrState::NR_STATE_NOT_SUPPORT; 92 std::vector<PhysicalChannelConfig> channelConfigInfos_; 93 std::map<NrState, RadioTech> nrConfigMap_; 94 95 int32_t slotId_ = 0; 96 bool isCsCapable_ = true; 97 }; 98 } // namespace Telephony 99 } // namespace OHOS 100 #endif // NETWORK_SEARCH_INCLUDE_NETWORK_REGISTER_H 101