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