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 I_NETWORK_SEARCH_H 17 #define I_NETWORK_SEARCH_H 18 19 #include <vector> 20 21 #include "cell_information.h" 22 #include "cell_location.h" 23 #include "event_handler.h" 24 #include "i_network_search_callback.h" 25 #include "ims_reg_info_callback.h" 26 #include "network_search_callback_base.h" 27 #include "network_search_result.h" 28 #include "network_state.h" 29 #include "nr_ssb_information.h" 30 #include "signal_information.h" 31 #include "tel_ril_types.h" 32 33 namespace OHOS { 34 namespace Telephony { 35 class INetworkSearch { 36 public: 37 using HANDLE = const std::shared_ptr<AppExecFwk::EventHandler>; 38 using NSCALLBACK = const sptr<INetworkSearchCallback>; 39 virtual bool OnInit() = 0; 40 virtual int32_t InitTelExtraModule(int32_t slotId) = 0; 41 virtual int32_t GetPsRadioTech(int32_t slotId, int32_t &psRadioTech) = 0; 42 virtual int32_t GetCsRadioTech(int32_t slotId, int32_t &csRadioTech) = 0; 43 virtual std::u16string GetOperatorNumeric(int32_t slotId) = 0; 44 virtual std::string GetResidentNetworkNumeric(int32_t slotId) = 0; 45 virtual int32_t GetOperatorName(int32_t slotId, std::u16string &operatorName) = 0; 46 /** 47 * @brief Get network state 48 * 49 * @param slotId[in], sim slot id 50 * @param networkState[out], the network state of the SIM card 51 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 52 */ 53 virtual int32_t GetNetworkStatus(int32_t slotId, sptr<NetworkState> &networkState) = 0; 54 virtual int32_t GetRadioState(int32_t slotId) = 0; 55 virtual int32_t GetRadioState(int32_t slotId, NSCALLBACK &callback) = 0; 56 /** 57 * Set radio state 58 * 27007-410_2001 8.2 Set phone functionality +CFUN 59 * 3GPP TS 27.007 V4.1.0 (2001-03) 60 */ 61 virtual void SetRadioState(int32_t slotId, bool isOn, int32_t rst) = 0; 62 virtual int32_t SetRadioState(int32_t slotId, bool isOn, int32_t rst, NSCALLBACK &callback) = 0; 63 virtual int32_t GetSignalInfoList(int32_t slotId, std::vector<sptr<SignalInformation>> &signals) = 0; 64 virtual void RegisterCoreNotify(int32_t slotId, HANDLE &handler, int32_t what) = 0; 65 virtual void UnRegisterCoreNotify(int32_t slotId, HANDLE &handler, int32_t what) = 0; 66 virtual void RegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> &callback) = 0; 67 virtual void UnRegisterCellularDataObject(const sptr<NetworkSearchCallBackBase> &callback) = 0; 68 virtual void RegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> &callback) = 0; 69 virtual void UnRegisterCellularCallObject(const sptr<NetworkSearchCallBackBase> &callback) = 0; 70 virtual int32_t GetNetworkSearchInformation(int32_t slotId, NSCALLBACK &callback) = 0; 71 virtual int32_t GetNetworkSelectionMode(int32_t slotId, NSCALLBACK &callback) = 0; 72 virtual int32_t SetNetworkSelectionMode(int32_t slotId, int32_t selectMode, 73 const sptr<NetworkInformation> &networkInformation, bool resumeSelection, NSCALLBACK &callback) = 0; 74 virtual int32_t GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode) = 0; 75 virtual int32_t GetPreferredNetwork(int32_t slotId, NSCALLBACK &callback) = 0; 76 virtual int32_t SetPreferredNetwork(int32_t slotId, int32_t networkMode, NSCALLBACK &callback) = 0; 77 virtual bool SetPreferredNetwork(int32_t slotId, int32_t networkMode) = 0; 78 /** 79 * @brief Obtains the registration status of the packet switched (PS) domain. 80 * 81 * @param slotId[in], sim slot id 82 * @return Returns the registration status. 83 */ 84 virtual int32_t GetPsRegState(int32_t slotId) = 0; 85 /** 86 * @brief Obtains the registration status of the circuit switched (CS) domain. 87 * 88 * @param slotId[in], sim slot id 89 * @return Returns the registration status. 90 */ 91 virtual int32_t GetCsRegState(int32_t slotId) = 0; 92 /** 93 * @brief Obtains the roaming status of the packet switched (PS) domain. 94 * 95 * @param slotId[in], sim slot id 96 * @return Returns the roaming status. 97 */ 98 virtual int32_t GetPsRoamingState(int32_t slotId) = 0; 99 virtual int32_t GetImei(int32_t slotId, std::u16string &imei) = 0; 100 virtual int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv) = 0; 101 virtual int32_t GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info) = 0; 102 virtual int32_t GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo) = 0; 103 virtual int32_t GetNeighboringCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo) = 0; 104 virtual int32_t SendUpdateCellLocationRequest(int32_t slotId) = 0; 105 /** 106 * @brief Obtains the location of the device. 107 * 108 * @param slotId[in], sim slot id 109 * @return Returns the current location of the device. 110 */ 111 virtual sptr<CellLocation> GetCellLocation(int32_t slotId) = 0; 112 virtual int32_t GetMeid(int32_t slotId, std::u16string &meid) = 0; 113 virtual int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId) = 0; 114 /** 115 * @brief Obtains the network status of the phone. 116 * 117 * @param slotId[in], sim slot id 118 * @return Returns the network status of the phone. 119 */ 120 virtual PhoneType GetPhoneType(int32_t slotId) = 0; 121 virtual int32_t SetNrOptionMode(int32_t slotId, int32_t mode) = 0; 122 virtual int32_t SetNrOptionMode(int32_t slotId, int32_t mode, NSCALLBACK &callback) = 0; 123 virtual int32_t GetNrOptionMode(int32_t slotId, NrMode &mode) = 0; 124 virtual int32_t GetNrOptionMode(int32_t slotId, NSCALLBACK &callback) = 0; 125 126 /** 127 * @brief Obtains the frequency type. 128 * 129 * @param slotId[in], sim slot id 130 * @return Returns the frequency type. 131 */ 132 virtual FrequencyType GetFrequencyType(int32_t slotId) = 0; 133 /** 134 * @brief Obtains the 5G New Radio (NR) status. 135 * 136 * @param slotId[in], sim slot id 137 * @return Returns the 5G New Radio (NR) status. 138 */ 139 virtual NrState GetNrState(int32_t slotId) = 0; 140 virtual int32_t RegisterImsRegInfoCallback(int32_t slotId, ImsServiceType imsSrvType, const int32_t tokenId, 141 const sptr<ImsRegInfoCallback> &callback) = 0; 142 virtual int32_t UnregisterImsRegInfoCallback( 143 int32_t slotId, ImsServiceType imsSrvType, const int32_t tokenId) = 0; 144 virtual int32_t GetBasebandVersion(int32_t slotId, std::string &version) = 0; 145 /** 146 * @brief Init airplane mode. 147 * 148 * @param slotId[in], sim slot id 149 */ 150 virtual void InitAirplaneMode(int32_t slotId) = 0; 151 /** 152 * @brief Get the airplane mode. 153 * 154 * @param airplaneMode[out], true if airplane is on, false if airplane is off 155 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 156 */ 157 virtual int32_t GetAirplaneMode(bool &airplaneMode) = 0; 158 /** 159 * @brief Get the network capability. 160 * 161 * @param slotId[in], sim slot id 162 * @param networkCapabilityType[in], the device capability type 163 * @param networkCapabilityState[in], the device capability state 164 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 165 */ 166 virtual int32_t GetNetworkCapability( 167 int32_t slotId, int32_t networkCapabilityType, int32_t &networkCapabilityState) = 0; 168 /** 169 * @brief Set the network capability. 170 * 171 * @param slotId[in], sim slot id 172 * @param networkCapabilityType[in], the device capability type 173 * @param networkCapabilityState[in], the device capability state 174 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 175 */ 176 virtual int32_t SetNetworkCapability( 177 int32_t slotId, int32_t networkCapabilityType, int32_t networkCapabilityState) = 0; 178 /** 179 * @brief Update radio on, set airplane mode Off and radio state on 180 * 181 * @param slotId[in], sim slot id 182 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 183 */ 184 virtual int32_t UpdateRadioOn(int32_t slotId) = 0; 185 virtual int32_t GetRrcConnectionState(int32_t slotId, int32_t &status) = 0; 186 virtual int32_t FactoryReset(int32_t slotId) = 0; 187 virtual int32_t GetNrSsbId(int32_t slotId, const std::shared_ptr<NrSsbInformation> &nrSsbInformation) = 0; 188 189 /** 190 * @brief support Nr network or not 191 * 192 * @return true support 193 * @return false not support 194 */ 195 virtual bool IsNrSupported(int32_t slotId) = 0; 196 197 /** 198 * @brief support Satellite network or not 199 * 200 * @return true support 201 * @return false not support 202 */ 203 virtual bool IsSatelliteEnabled() = 0; 204 205 /** 206 * @brief Update physical link active status 207 * 208 * @param slotId[in], sim slot id 209 * @param isActive[in], physical link active or not 210 */ 211 virtual void DcPhysicalLinkActiveUpdate(int32_t slotId, bool isActive) = 0; 212 virtual int32_t NotifyCallStatusToNetworkSearch(int32_t slotId, int32_t callStatus) = 0; 213 virtual int32_t HandleNotifyStateChangeWithDelay(int32_t slotId, bool isNeedDelay) = 0; 214 virtual int32_t IsGsm(int32_t slotId, bool &isGsm) = 0; 215 virtual int32_t IsCdma(int32_t slotId, bool &isCdma) = 0; 216 virtual int32_t StartRadioOnState(int32_t slotId) = 0; 217 virtual int32_t StartGetRilSignalIntensity(int32_t slotId) = 0; 218 virtual int32_t ProcessSignalIntensity(int32_t slotId, const struct Rssi &signalIntensity) = 0; 219 virtual int32_t UpdateOperatorName(int32_t slotId) = 0; 220 }; 221 } // namespace Telephony 222 } // namespace OHOS 223 #endif // I_NETWORK_SEARCH_H 224