• 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_BASE_PHONE_SERVICE_H
17 #define I_BASE_PHONE_SERVICE_H
18 
19 #include "cell_information.h"
20 #include "dialling_numbers_info.h"
21 #include "i_network_search_callback.h"
22 #include "ims_reg_info_callback.h"
23 #include "network_search_result.h"
24 #include "network_state.h"
25 #include "operator_config_types.h"
26 #include "signal_information.h"
27 #include "sim_state_type.h"
28 
29 namespace OHOS {
30 namespace Telephony {
31 class ICoreService : public IRemoteBroker {
32 public:
33     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.telephony.ICoreService");
34 
35 public:
36     virtual ~ICoreService() = default;
37     virtual int32_t GetPsRadioTech(int32_t slotId, int32_t &psRadioTech) = 0;
38     virtual int32_t GetCsRadioTech(int32_t slotId, int32_t &csRadioTech) = 0;
39     virtual std::u16string GetOperatorNumeric(int32_t slotId) = 0;
40     virtual int32_t GetOperatorName(int32_t slotId, std::u16string &operatorName) = 0;
41     virtual int32_t GetSignalInfoList(int32_t slotId, std::vector<sptr<SignalInformation>> &signals) = 0;
42     virtual int32_t GetNetworkState(int32_t slotId, sptr<NetworkState> &networkState) = 0;
43     virtual int32_t SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback) = 0;
44     virtual int32_t GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
45     virtual int32_t GetImei(int32_t slotId, std::u16string &imei) = 0;
46     virtual int32_t GetMeid(int32_t slotId, std::u16string &meid) = 0;
47     virtual int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId) = 0;
48     virtual bool IsNrSupported(int32_t slotId) = 0;
49     virtual int32_t GetNrOptionMode(int32_t slotId, NrMode &mode) = 0;
50     virtual int32_t HasSimCard(int32_t slotId, bool &hasSimCard) = 0;
51     virtual int32_t GetSimState(int32_t slotId, SimState &simState) = 0;
52     virtual int32_t GetCardType(int32_t slotId, CardType &cardType) = 0;
53     virtual int32_t UnlockPin(int32_t slotId, const std::u16string &pin, LockStatusResponse &response) = 0;
54     virtual int32_t UnlockPuk(
55         int32_t slotId, const std::u16string &newPin, const std::u16string &puk, LockStatusResponse &response) = 0;
56     virtual int32_t AlterPin(
57         int32_t slotId, const std::u16string &newPin, const std::u16string &oldPin, LockStatusResponse &response) = 0;
58     virtual int32_t UnlockPin2(int32_t slotId, const std::u16string &pin2, LockStatusResponse &response) = 0;
59     virtual int32_t UnlockPuk2(
60         int32_t slotId, const std::u16string &newPin2, const std::u16string &puk2, LockStatusResponse &response) = 0;
61     virtual int32_t AlterPin2(
62         int32_t slotId, const std::u16string &newPin2, const std::u16string &oldPin2, LockStatusResponse &response) = 0;
63     virtual int32_t SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response) = 0;
64     virtual int32_t GetLockState(int32_t slotId, LockType lockType, LockState &lockState) = 0;
65     virtual int32_t GetSimOperatorNumeric(int32_t slotId, std::u16string &operatorNumeric) = 0;
66     virtual int32_t GetISOCountryCodeForSim(int32_t slotId, std::u16string &countryCode) = 0;
67     virtual int32_t GetSimSpn(int32_t slotId, std::u16string &spn) = 0;
68     virtual int32_t GetSimIccId(int32_t slotId, std::u16string &iccId) = 0;
69     virtual int32_t GetIMSI(int32_t slotId, std::u16string &imsi) = 0;
70     virtual bool IsSimActive(int32_t slotId) = 0;
71     virtual int32_t GetSlotId(int32_t simId) = 0;
72     virtual int32_t GetSimId(int32_t slotId) = 0;
73     virtual int32_t GetNetworkSearchInformation(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
74     virtual int32_t GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
75     virtual std::u16string GetLocaleFromDefaultSim() = 0;
76     virtual int32_t GetSimGid1(int32_t slotId, std::u16string &gid1) = 0;
77     virtual std::u16string GetSimGid2(int32_t slotId) = 0;
78     virtual std::u16string GetSimEons(int32_t slotId, const std::string &plmn, int32_t lac, bool longNameRequired) = 0;
79     virtual int32_t SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
80         const sptr<NetworkInformation> &networkInformation, bool resumeSelection,
81         const sptr<INetworkSearchCallback> &callback) = 0;
82     virtual int32_t GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode) = 0;
83     virtual int32_t GetSimAccountInfo(int32_t slotId, IccAccountInfo &info) = 0;
84     virtual int32_t SetDefaultVoiceSlotId(int32_t slotId) = 0;
85     virtual int32_t GetDefaultVoiceSlotId() = 0;
86     virtual int32_t SetPrimarySlotId(int32_t slotId) = 0;
87     virtual int32_t GetPrimarySlotId(int32_t &slotId) = 0;
88     virtual int32_t SetShowNumber(int32_t slotId, const std::u16string &number) = 0;
89     virtual int32_t GetShowNumber(int32_t slotId, std::u16string &showNumber) = 0;
90     virtual int32_t SetShowName(int32_t slotId, const std::u16string &name) = 0;
91     virtual int32_t GetShowName(int32_t slotId, std::u16string &showName) = 0;
92     virtual int32_t GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList) = 0;
93     virtual int32_t GetOperatorConfigs(int32_t slotId, OperatorConfig &poc) = 0;
94     virtual int32_t RefreshSimState(int32_t slotId) = 0;
95     virtual int32_t SetActiveSim(int32_t slotId, int32_t enable) = 0;
96     virtual int32_t GetPreferredNetwork(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
97     virtual int32_t SetPreferredNetwork(
98         int32_t slotId, int32_t networkMode, const sptr<INetworkSearchCallback> &callback) = 0;
99     virtual int32_t GetSimTelephoneNumber(int32_t slotId, std::u16string &telephoneNumber) = 0;
100     virtual std::u16string GetSimTeleNumberIdentifier(const int32_t slotId) = 0;
101     virtual int32_t GetVoiceMailIdentifier(int32_t slotId, std::u16string &voiceMailIdentifier) = 0;
102     virtual int32_t GetVoiceMailNumber(int32_t slotId, std::u16string &voiceMailNumber) = 0;
103     virtual int32_t QueryIccDiallingNumbers(
104         int slotId, int type, std::vector<std::shared_ptr<DiallingNumbersInfo>> &result) = 0;
105     virtual int32_t AddIccDiallingNumbers(
106         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0;
107     virtual int32_t DelIccDiallingNumbers(
108         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0;
109     virtual int32_t UpdateIccDiallingNumbers(
110         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0;
111     virtual int32_t SetVoiceMailInfo(
112         const int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber) = 0;
113     virtual int32_t GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info) = 0;
114     virtual int32_t GetMaxSimCount() = 0;
115     virtual int32_t GetOpKey(int32_t slotId, std::u16string &opkey) = 0;
116     virtual int32_t GetOpKeyExt(int32_t slotId, std::u16string &opkeyExt) = 0;
117     virtual int32_t GetOpName(int32_t slotId, std::u16string &opname) = 0;
118     virtual int32_t SendEnvelopeCmd(int32_t slotId, const std::string &cmd) = 0;
119     virtual int32_t SendTerminalResponseCmd(int32_t slotId, const std::string &cmd) = 0;
120     virtual int32_t SendCallSetupRequestResult(int32_t slotId, bool accept) = 0;
121     virtual int32_t UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response) = 0;
122     virtual int32_t GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo) = 0;
123     virtual int32_t SendUpdateCellLocationRequest(int32_t slotId) = 0;
124     virtual int32_t HasOperatorPrivileges(const int32_t slotId, bool &hasOperatorPrivileges) = 0;
125     virtual int32_t SimAuthentication(
126         int32_t slotId, const std::string &aid, const std::string &authData, SimAuthenticationResponse &response) = 0;
127     virtual int32_t RegisterImsRegInfoCallback(
128         int32_t slotId, ImsServiceType imsSrvType, const sptr<ImsRegInfoCallback> &callback) = 0;
129     virtual int32_t UnregisterImsRegInfoCallback(int32_t slotId, ImsServiceType imsSrvType) = 0;
130     enum class InterfaceID {
131         GET_PS_RADIO_TECH = 0,
132         GET_CS_RADIO_TECH,
133         GET_OPERATOR_NUMERIC,
134         GET_OPERATOR_NAME,
135         GET_SIGNAL_INFO_LIST,
136         GET_NETWORK_STATE,
137         GET_CELL_INFO_LIST,
138         SET_RADIO_STATE,
139         GET_RADIO_STATE,
140         GET_IMEI,
141         GET_MEID,
142         GET_UNIQUE_DEVICE_ID,
143         HAS_SIM_CARD,
144         GET_SIM_STATE,
145         GET_ISO_COUNTRY_CODE,
146         GET_ISO_COUNTRY_CODE_FOR_NETWORK,
147         SET_PS_ATTACH_STATUS,
148         GET_SPN,
149         GET_ICCID,
150         GET_IMSI,
151         IS_SIM_ACTIVE,
152         UNLOCK_PIN,
153         UNLOCK_PUK,
154         ALTER_PIN,
155         CHECK_LOCK,
156         SWITCH_LOCK,
157         UNLOCK_PIN2,
158         UNLOCK_PUK2,
159         ALTER_PIN2,
160         GET_SIM_OPERATOR_NUMERIC,
161         GET_NETWORK_SEARCH_RESULT,
162         GET_NETWORK_SELECTION_MODE,
163         GET_SIM_LANGUAGE,
164         GET_SIM_GID1,
165         GET_SIM_GID2,
166         SET_NETWORK_SELECTION_MODE,
167         GET_CELL_LOCATION,
168         GET_SIM_SUB_INFO,
169         SET_DEFAULT_VOICE_SLOTID,
170         GET_DEFAULT_VOICE_SLOTID,
171         SET_PRIMARY_SLOTID,
172         GET_PRIMARY_SLOTID,
173         SET_DEFAULT_DATA_SLOTID,
174         GET_DEFAULT_DATA_SLOTID,
175         SET_SHOW_NUMBER,
176         GET_SHOW_NUMBER,
177         SET_SHOW_NAME,
178         GET_SHOW_NAME,
179         GET_ACTIVE_ACCOUNT_INFO_LIST,
180         GET_OPERATOR_CONFIG,
181         REFRESH_SIM_STATE,
182         SET_SIM_ACTIVE,
183         GET_PREFERRED_NETWORK_MODE,
184         SET_PREFERRED_NETWORK_MODE,
185         GET_SIM_PHONE_NUMBER,
186         GET_SIM_TELENUMBER_IDENTIFIER,
187         GET_VOICE_MAIL_TAG,
188         GET_VOICE_MAIL_NUMBER,
189         ICC_DIALLING_NUMBERS_GET,
190         ICC_DIALLING_NUMBERS_DELETE,
191         ICC_DIALLING_NUMBERS_INSERT,
192         ICC_DIALLING_NUMBERS_UPDATE,
193         SET_VOICE_MAIL,
194         GET_MAX_SIM_COUNT,
195         GET_OPKEY,
196         GET_OPKEY_EXT,
197         GET_OPNAME,
198         GET_IMS_REG_STATUS,
199         STK_CMD_FROM_APP_ENVELOPE,
200         STK_CMD_FROM_APP_TERMINAL_RESPONSE,
201         STK_RESULT_FROM_APP_CALL_SETUP_REQUEST,
202         GET_CARD_TYPE,
203         UNLOCK_SIMLOCK,
204         HAS_OPERATOR_PRIVILEGES,
205         SIM_AUTHENTICATION,
206         IS_NR_SUPPORTED,
207         GET_NR_OPTION_MODE,
208         REG_IMS_CALLBACK,
209         UN_REG_IMS_CALLBACK,
210         GET_SIM_EONS,
211         GET_SIM_SLOTID,
212         GET_SIM_SIMID,
213     };
214 
215 protected:
216     const int32_t ERROR = -1;
217     const int32_t MIN_STRING_LE = 1;
218     const int32_t MAX_STRING_LE = 32;
219     const int32_t MAX_VECTOR = 100;
220 };
221 } // namespace Telephony
222 } // namespace OHOS
223 #endif // I_BASE_PHONE_SERVICE_H
224