1 /* 2 * Copyright (C) 2021 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 "dialling_numbers_info.h" 20 #include "i_network_search_callback.h" 21 #include "sim_state_type.h" 22 #include "network_search_result.h" 23 #include "network_state.h" 24 #include "signal_information.h" 25 #include "cell_information.h" 26 27 namespace OHOS { 28 namespace Telephony { 29 class ICoreService : public IRemoteBroker { 30 public: 31 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.telephony.ICoreService"); 32 33 public: 34 virtual ~ICoreService() = default; 35 virtual int32_t GetPsRadioTech(int32_t slotId) = 0; 36 virtual int32_t GetCsRadioTech(int32_t slotId) = 0; 37 virtual std::u16string GetOperatorNumeric(int32_t slotId) = 0; 38 virtual std::u16string GetOperatorName(int32_t slotId) = 0; 39 virtual std::vector<sptr<SignalInformation>> GetSignalInfoList(int32_t slotId) = 0; 40 virtual const sptr<NetworkState> GetNetworkState(int32_t slotId) = 0; 41 virtual bool SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback) = 0; 42 virtual bool GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0; 43 virtual std::u16string GetImei(int32_t slotId) = 0; 44 virtual std::u16string GetMeid(int32_t slotId) = 0; 45 virtual std::u16string GetUniqueDeviceId(int32_t slotId) = 0; 46 virtual bool IsNrSupported(int32_t slotId) = 0; 47 virtual NrMode GetNrOptionMode(int32_t slotId) = 0; 48 virtual bool HasSimCard(int32_t slotId) = 0; 49 virtual int32_t GetSimState(int32_t slotId) = 0; 50 virtual int32_t GetCardType(int32_t slotId) = 0; 51 virtual bool UnlockPin(int32_t slotId, std::u16string pin, LockStatusResponse &response) = 0; 52 virtual bool UnlockPuk( 53 int32_t slotId, std::u16string newPin, std::u16string puk, LockStatusResponse &response) = 0; 54 virtual bool AlterPin( 55 int32_t slotId, std::u16string newPin, std::u16string oldPin, LockStatusResponse &response) = 0; 56 virtual bool UnlockPin2(int32_t slotId, std::u16string pin2, LockStatusResponse &response) = 0; 57 virtual bool UnlockPuk2( 58 int32_t slotId, std::u16string newPin2, std::u16string puk2, LockStatusResponse &response) = 0; 59 virtual bool AlterPin2( 60 int32_t slotId, std::u16string newPin2, std::u16string oldPin2, LockStatusResponse &response) = 0; 61 virtual bool SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response) = 0; 62 virtual int32_t GetLockState(int32_t slotId, LockType lockType) = 0; 63 virtual std::u16string GetSimOperatorNumeric(int32_t slotId) = 0; 64 virtual std::u16string GetISOCountryCodeForSim(int32_t slotId) = 0; 65 virtual std::u16string GetSimSpn(int32_t slotId) = 0; 66 virtual std::u16string GetSimIccId(int32_t slotId) = 0; 67 virtual std::u16string GetIMSI(int32_t slotId) = 0; 68 virtual bool IsSimActive(int32_t slotId) = 0; 69 virtual bool GetNetworkSearchInformation(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0; 70 virtual bool GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0; 71 virtual std::u16string GetLocaleFromDefaultSim() = 0; 72 virtual std::u16string GetSimGid1(int32_t slotId) = 0; 73 virtual bool SetNetworkSelectionMode(int32_t slotId, int32_t selectMode, 74 const sptr<NetworkInformation> &networkInformation, bool resumeSelection, 75 const sptr<INetworkSearchCallback> &callback) = 0; 76 virtual std::u16string GetIsoCountryCodeForNetwork(int32_t slotId) = 0; 77 virtual bool GetSimAccountInfo(int32_t slotId, IccAccountInfo &info) = 0; 78 virtual bool SetDefaultVoiceSlotId(int32_t slotId) = 0; 79 virtual int32_t GetDefaultVoiceSlotId() = 0; 80 virtual bool SetPrimarySlotId(int32_t slotId) = 0; 81 virtual int32_t GetPrimarySlotId() = 0; 82 virtual bool SetShowNumber(int32_t slotId, const std::u16string number) = 0; 83 virtual std::u16string GetShowNumber(int32_t slotId) = 0; 84 virtual bool SetShowName(int32_t slotId, const std::u16string name) = 0; 85 virtual std::u16string GetShowName(int32_t slotId) = 0; 86 virtual bool GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList) = 0; 87 virtual bool GetOperatorConfigs(int32_t slotId, OperatorConfig &poc) = 0; 88 virtual int32_t RefreshSimState(int32_t slotId) = 0; 89 virtual bool SetActiveSim(int32_t slotId, int32_t enable) = 0; 90 virtual bool GetPreferredNetwork(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0; 91 virtual bool SetPreferredNetwork( 92 int32_t slotId, int32_t networkMode, const sptr<INetworkSearchCallback> &callback) = 0; 93 virtual std::u16string GetSimTelephoneNumber(int32_t slotId) = 0; 94 virtual std::u16string GetSimTeleNumberIdentifier(const int32_t slotId) = 0; 95 virtual std::u16string GetVoiceMailIdentifier(int32_t slotId) = 0; 96 virtual std::u16string GetVoiceMailNumber(int32_t slotId) = 0; 97 virtual std::vector<std::shared_ptr<DiallingNumbersInfo>> QueryIccDiallingNumbers(int slotId, int type) = 0; 98 virtual bool AddIccDiallingNumbers( 99 int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0; 100 virtual bool DelIccDiallingNumbers( 101 int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0; 102 virtual bool UpdateIccDiallingNumbers( 103 int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0; 104 virtual bool SetVoiceMailInfo( 105 const int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber) = 0; 106 virtual bool GetImsRegStatus(int32_t slotId) = 0; 107 virtual int32_t GetMaxSimCount() = 0; 108 virtual bool SendEnvelopeCmd(int32_t slotId, const std::string &cmd) = 0; 109 virtual bool SendTerminalResponseCmd(int32_t slotId, const std::string &cmd) = 0; 110 virtual bool UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response) = 0; 111 virtual std::vector<sptr<CellInformation>> GetCellInfoList(int32_t slotId) = 0; 112 virtual bool SendUpdateCellLocationRequest(int32_t slotId) = 0; 113 virtual bool HasOperatorPrivileges(const int32_t slotId) = 0; 114 enum class InterfaceID { 115 GET_PS_RADIO_TECH = 0, 116 GET_CS_RADIO_TECH, 117 GET_OPERATOR_NUMERIC, 118 GET_OPERATOR_NAME, 119 GET_SIGNAL_INFO_LIST, 120 GET_NETWORK_STATE, 121 GET_CELL_INFO_LIST, 122 SET_RADIO_STATE, 123 GET_RADIO_STATE, 124 GET_IMEI, 125 GET_MEID, 126 GET_UNIQUE_DEVICE_ID, 127 HAS_SIM_CARD, 128 GET_SIM_STATE, 129 GET_ISO_COUNTRY_CODE, 130 GET_ISO_COUNTRY_CODE_FOR_NETWORK, 131 SET_PS_ATTACH_STATUS, 132 GET_SPN, 133 GET_ICCID, 134 GET_IMSI, 135 IS_SIM_ACTIVE, 136 UNLOCK_PIN, 137 UNLOCK_PUK, 138 ALTER_PIN, 139 CHECK_LOCK, 140 SWITCH_LOCK, 141 UNLOCK_PIN2, 142 UNLOCK_PUK2, 143 ALTER_PIN2, 144 GET_SIM_OPERATOR_NUMERIC, 145 GET_NETWORK_SEARCH_RESULT, 146 GET_NETWORK_SELECTION_MODE, 147 GET_SIM_LANGUAGE, 148 GET_SIM_GID1, 149 SET_NETWORK_SELECTION_MODE, 150 GET_CELL_LOCATION, 151 GET_SIM_SUB_INFO, 152 SET_DEFAULT_VOICE_SLOTID, 153 GET_DEFAULT_VOICE_SLOTID, 154 SET_PRIMARY_SLOTID, 155 GET_PRIMARY_SLOTID, 156 SET_DEFAULT_DATA_SLOTID, 157 GET_DEFAULT_DATA_SLOTID, 158 SET_SHOW_NUMBER, 159 GET_SHOW_NUMBER, 160 SET_SHOW_NAME, 161 GET_SHOW_NAME, 162 GET_ACTIVE_ACCOUNT_INFO_LIST, 163 GET_OPERATOR_CONFIG, 164 REFRESH_SIM_STATE, 165 SET_SIM_ACTIVE, 166 GET_PREFERRED_NETWORK_MODE, 167 SET_PREFERRED_NETWORK_MODE, 168 GET_SIM_PHONE_NUMBER, 169 GET_SIM_TELENUMBER_IDENTIFIER, 170 GET_VOICE_MAIL_TAG, 171 GET_VOICE_MAIL_NUMBER, 172 ICC_DIALLING_NUMBERS_GET, 173 ICC_DIALLING_NUMBERS_DELETE, 174 ICC_DIALLING_NUMBERS_INSERT, 175 ICC_DIALLING_NUMBERS_UPDATE, 176 SET_VOICE_MAIL, 177 GET_MAX_SIM_COUNT, 178 GET_IMS_REG_STATUS, 179 STK_CMD_FROM_APP_ENVELOPE, 180 STK_CMD_FROM_APP_TERMINAL_RESPONSE, 181 GET_CARD_TYPE, 182 UNLOCK_SIMLOCK, 183 HAS_OPERATOR_PRIVILEGES, 184 IS_NR_SUPPORTED, 185 GET_NR_OPTION_MODE, 186 }; 187 188 protected: 189 const int32_t ERROR = -1; 190 const int32_t MIN_STRING_LE = 1; 191 const int32_t MAX_STRING_LE = 32; 192 const int32_t MAX_VECTOR = 100; 193 }; 194 } // namespace Telephony 195 } // namespace OHOS 196 #endif // I_BASE_PHONE_SERVICE_H 197