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