• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     virtual bool SetForcePreferredNetwork(int32_t slotId, int32_t networkMode) = 0;
79     /**
80      * @brief Obtains the registration status of the packet switched (PS) domain.
81      *
82      * @param slotId[in], sim slot id
83      * @return Returns the registration status.
84      */
85     virtual int32_t GetPsRegState(int32_t slotId) = 0;
86     /**
87      * @brief Obtains the registration status of the circuit switched (CS) domain.
88      *
89      * @param slotId[in], sim slot id
90      * @return Returns the registration status.
91      */
92     virtual int32_t GetCsRegState(int32_t slotId) = 0;
93     /**
94      * @brief Obtains the roaming status of the packet switched (PS) domain.
95      *
96      * @param slotId[in], sim slot id
97      * @return Returns the roaming status.
98      */
99     virtual int32_t GetPsRoamingState(int32_t slotId) = 0;
100     virtual int32_t GetImei(int32_t slotId, std::u16string &imei) = 0;
101     virtual int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv) = 0;
102     virtual int32_t GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info) = 0;
103     virtual int32_t GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo) = 0;
104     virtual int32_t GetNeighboringCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo) = 0;
105     virtual int32_t SendUpdateCellLocationRequest(int32_t slotId) = 0;
106     /**
107      * @brief Obtains the location of the device.
108      *
109      * @param slotId[in], sim slot id
110      * @return Returns the current location of the device.
111      */
112     virtual sptr<CellLocation> GetCellLocation(int32_t slotId) = 0;
113     virtual int32_t GetMeid(int32_t slotId, std::u16string &meid) = 0;
114     virtual int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId) = 0;
115     /**
116      * @brief Obtains the network status of the phone.
117      *
118      * @param slotId[in], sim slot id
119      * @return Returns the network status of the phone.
120      */
121     virtual PhoneType GetPhoneType(int32_t slotId) = 0;
122     virtual int32_t SetNrOptionMode(int32_t slotId, int32_t mode) = 0;
123     virtual int32_t SetNrOptionMode(int32_t slotId, int32_t mode, NSCALLBACK &callback) = 0;
124     virtual int32_t GetNrOptionMode(int32_t slotId, NrMode &mode) = 0;
125     virtual int32_t GetNrOptionMode(int32_t slotId, NSCALLBACK &callback) = 0;
126 
127     /**
128      * @brief Obtains the frequency type.
129      *
130      * @param slotId[in], sim slot id
131      * @return Returns the frequency type.
132      */
133     virtual FrequencyType GetFrequencyType(int32_t slotId) = 0;
134     /**
135      * @brief Obtains the 5G New Radio (NR) status.
136      *
137      * @param slotId[in], sim slot id
138      * @return Returns the 5G New Radio (NR) status.
139      */
140     virtual NrState GetNrState(int32_t slotId) = 0;
141     virtual int32_t RegisterImsRegInfoCallback(int32_t slotId, ImsServiceType imsSrvType, const int32_t tokenId,
142         const sptr<ImsRegInfoCallback> &callback) = 0;
143     virtual int32_t UnregisterImsRegInfoCallback(
144         int32_t slotId, ImsServiceType imsSrvType, const int32_t tokenId) = 0;
145     virtual int32_t GetBasebandVersion(int32_t slotId, std::string &version) = 0;
146     /**
147      * @brief Init airplane mode.
148      *
149      * @param slotId[in], sim slot id
150      */
151     virtual void InitAirplaneMode(int32_t slotId) = 0;
152     /**
153      * @brief Get the airplane mode.
154      *
155      * @param airplaneMode[out], true if airplane is on, false if airplane is off
156      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
157      */
158     virtual int32_t GetAirplaneMode(bool &airplaneMode) = 0;
159     /**
160      * @brief Get the network capability.
161      *
162      * @param slotId[in], sim slot id
163      * @param networkCapabilityType[in], the device capability type
164      * @param networkCapabilityState[in], the device capability state
165      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
166      */
167     virtual int32_t GetNetworkCapability(
168         int32_t slotId, int32_t networkCapabilityType, int32_t &networkCapabilityState) = 0;
169     /**
170      * @brief Set the network capability.
171      *
172      * @param slotId[in], sim slot id
173      * @param networkCapabilityType[in], the device capability type
174      * @param networkCapabilityState[in], the device capability state
175      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
176      */
177     virtual int32_t SetNetworkCapability(
178         int32_t slotId, int32_t networkCapabilityType, int32_t networkCapabilityState) = 0;
179     /**
180      * @brief Update radio on, set airplane mode Off and radio state on
181      *
182      * @param slotId[in], sim slot id
183      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
184      */
185     virtual int32_t UpdateRadioOn(int32_t slotId) = 0;
186     virtual int32_t GetRrcConnectionState(int32_t slotId, int32_t &status) = 0;
187     virtual int32_t FactoryReset(int32_t slotId) = 0;
188     virtual int32_t GetNrSsbId(int32_t slotId, const std::shared_ptr<NrSsbInformation> &nrSsbInformation) = 0;
189 
190     /**
191      * @brief support Nr network or not
192      *
193      * @return true support
194      * @return false not support
195      */
196     virtual bool IsNrSupported(int32_t slotId) = 0;
197 
198     /**
199      * @brief support Satellite network or not
200      *
201      * @return true support
202      * @return false not support
203      */
204     virtual bool IsSatelliteEnabled() = 0;
205 
206     /**
207      * @brief Update physical link active status
208      *
209      * @param slotId[in], sim slot id
210      * @param isActive[in], physical link active or not
211      */
212     virtual void DcPhysicalLinkActiveUpdate(int32_t slotId, bool isActive) = 0;
213     virtual int32_t NotifyCallStatusToNetworkSearch(int32_t slotId, int32_t callStatus) = 0;
214     virtual int32_t HandleNotifyStateChangeWithDelay(int32_t slotId, bool isNeedDelay) = 0;
215     virtual int32_t IsGsm(int32_t slotId, bool &isGsm) = 0;
216     virtual int32_t IsCdma(int32_t slotId, bool &isCdma) = 0;
217     virtual int32_t StartRadioOnState(int32_t slotId) = 0;
218     virtual int32_t StartGetRilSignalIntensity(int32_t slotId) = 0;
219     virtual int32_t ProcessSignalIntensity(int32_t slotId, const struct Rssi &signalIntensity) = 0;
220     virtual int32_t UpdateOperatorName(int32_t slotId) = 0;
221 };
222 } // namespace Telephony
223 } // namespace OHOS
224 #endif // I_NETWORK_SEARCH_H
225