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 OHOS_I_SIM_MANAGER_H 17 #define OHOS_I_SIM_MANAGER_H 18 19 #include "dialling_numbers_info.h" 20 #include "i_network_search.h" 21 #include "operator_config_types.h" 22 #include "sim_account_callback.h" 23 #include "sim_state_type.h" 24 25 namespace OHOS { 26 namespace Telephony { 27 class ISimManager { 28 public: 29 using HANDLE = const std::shared_ptr<AppExecFwk::EventHandler>; 30 // Init 31 virtual bool OnInit(int32_t slotCount) = 0; 32 virtual void SetNetworkSearchManager(std::shared_ptr<INetworkSearch> networkSearchManager) = 0; 33 // SimState 34 virtual int32_t HasSimCard(int32_t slotId, bool &hasSimCard) = 0; 35 virtual int32_t GetSimState(int32_t slotId, SimState &simState) = 0; 36 virtual int32_t GetCardType(int32_t slotId, CardType &cardType) = 0; 37 virtual int32_t UnlockPin(int32_t slotId, const std::string &pin, LockStatusResponse &response) = 0; 38 virtual int32_t UnlockPuk( 39 int32_t slotId, const std::string &newPin, const std::string &puk, LockStatusResponse &response) = 0; 40 virtual int32_t AlterPin( 41 int32_t slotId, const std::string &newPin, const std::string &oldPin, LockStatusResponse &response) = 0; 42 virtual int32_t SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response) = 0; 43 virtual int32_t GetLockState(int32_t slotId, LockType lockType, LockState &lockState) = 0; 44 virtual int32_t RefreshSimState(int32_t slotId) = 0; 45 virtual int32_t UnlockPin2(int32_t slotId, const std::string &pin2, LockStatusResponse &response) = 0; 46 virtual int32_t UnlockPuk2( 47 int32_t slotId, const std::string &newPin2, const std::string &puk2, LockStatusResponse &response) = 0; 48 virtual int32_t AlterPin2( 49 int32_t slotId, const std::string &newPin2, const std::string &oldPin2, LockStatusResponse &response) = 0; 50 virtual int32_t UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response) = 0; 51 // SimAccount 52 virtual bool IsSimActive(int32_t slotId) = 0; 53 virtual int32_t SetActiveSim(int32_t slotId, int32_t enable) = 0; 54 virtual int32_t GetSimAccountInfo(int32_t slotId, IccAccountInfo &info) = 0; 55 virtual int32_t SetDefaultVoiceSlotId(int32_t slotId) = 0; 56 virtual int32_t SetDefaultSmsSlotId(int32_t slotId) = 0; 57 virtual int32_t SetDefaultCellularDataSlotId(int32_t slotId) = 0; 58 virtual int32_t SetPrimarySlotId(int32_t slotId) = 0; 59 virtual int32_t SetShowNumber(int32_t slotId, const std::u16string &number) = 0; 60 virtual int32_t SetShowName(int32_t slotId, const std::u16string &name) = 0; 61 virtual int32_t GetDefaultVoiceSlotId() = 0; 62 virtual int32_t GetDefaultSmsSlotId() = 0; 63 virtual int32_t GetDefaultCellularDataSlotId() = 0; 64 virtual int32_t RegisterSimAccountCallback( 65 const std::string &bundleName, const sptr<SimAccountCallback> &callback) = 0; 66 virtual int32_t UnregisterSimAccountCallback(const std::string &bundleName) = 0; 67 virtual int32_t GetPrimarySlotId(int32_t &slotId) = 0; 68 virtual int32_t GetShowNumber(int32_t slotId, std::u16string &showNumber) = 0; 69 virtual int32_t GetShowName(int32_t slotId, std::u16string &showName) = 0; 70 virtual int32_t GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList) = 0; 71 virtual int32_t GetOperatorConfigs(int slotId, OperatorConfig &poc) = 0; 72 virtual int32_t HasOperatorPrivileges(const int32_t slotId, bool &hasOperatorPrivileges) = 0; 73 virtual int32_t SimAuthentication( 74 int32_t slotId, const std::string &aid, const std::string &authData, SimAuthenticationResponse &response) = 0; 75 virtual int32_t GetRadioProtocolTech(int32_t slotId) = 0; 76 virtual void GetRadioProtocol(int32_t slotId) = 0; 77 // STK 78 virtual int32_t SendEnvelopeCmd(int32_t slotId, const std::string &cmd) = 0; 79 virtual int32_t SendTerminalResponseCmd(int32_t slotId, const std::string &cmd) = 0; 80 virtual int32_t SendCallSetupRequestResult(int32_t slotId, bool accept) = 0; 81 // SimFile 82 virtual int32_t GetSimOperatorNumeric(int32_t slotId, std::u16string &operatorNumeric) = 0; 83 virtual int32_t GetISOCountryCodeForSim(int32_t slotId, std::u16string &countryCode) = 0; 84 virtual int32_t GetSimSpn(int32_t slotId, std::u16string &spn) = 0; 85 virtual int32_t GetSimIccId(int32_t slotId, std::u16string &iccId) = 0; 86 virtual int32_t GetIMSI(int32_t slotId, std::u16string &imsi) = 0; 87 virtual std::u16string GetLocaleFromDefaultSim(int32_t slotId) = 0; 88 virtual int32_t GetSlotId(int32_t simId) = 0; 89 virtual int32_t GetSimId(int32_t slotId) = 0; 90 virtual int32_t GetSimGid1(int32_t slotId, std::u16string &gid1) = 0; 91 virtual std::u16string GetSimGid2(int32_t slotId) = 0; 92 virtual int32_t GetOpName(int32_t slotId, std::u16string &opname) = 0; 93 virtual int32_t GetOpKey(int32_t slotId, std::u16string &opkey) = 0; 94 virtual int32_t GetOpKeyExt(int32_t slotId, std::u16string &opkeyExt) = 0; 95 virtual int32_t GetSimTelephoneNumber(int32_t slotId, std::u16string &telephoneNumber) = 0; 96 virtual std::u16string GetSimTeleNumberIdentifier(const int32_t slotId) = 0; 97 virtual int32_t GetVoiceMailIdentifier(int32_t slotId, std::u16string &voiceMailIdentifier) = 0; 98 virtual int32_t GetVoiceMailNumber(int32_t slotId, std::u16string &voiceMailNumber) = 0; 99 virtual std::u16string GetSimIst(int32_t slotId) = 0; 100 virtual int ObtainSpnCondition(int32_t slotId, bool roaming, std::string operatorNum) = 0; 101 virtual int32_t SetVoiceMailInfo( 102 int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber) = 0; 103 virtual std::u16string GetSimEons(int32_t slotId, const std::string &plmn, int32_t lac, bool longNameRequired) = 0; 104 // SimSms 105 virtual int32_t AddSmsToIcc(int32_t slotId, int status, std::string &pdu, std::string &smsc) = 0; 106 virtual int32_t UpdateSmsIcc(int32_t slotId, int index, int status, std::string &pduData, std::string &smsc) = 0; 107 virtual int32_t DelSmsIcc(int32_t slotId, int index) = 0; 108 virtual std::vector<std::string> ObtainAllSmsOfIcc(int32_t slotId) = 0; 109 // IccDiallingNumbers 110 virtual int32_t QueryIccDiallingNumbers( 111 int slotId, int type, std::vector<std::shared_ptr<DiallingNumbersInfo>> &result) = 0; 112 virtual int32_t AddIccDiallingNumbers( 113 int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0; 114 virtual int32_t DelIccDiallingNumbers( 115 int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0; 116 virtual int32_t UpdateIccDiallingNumbers( 117 int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0; 118 // Event register 119 virtual void RegisterCoreNotify(int32_t slotId, const HANDLE &handler, int what) = 0; 120 virtual void UnRegisterCoreNotify(int32_t slotId, const HANDLE &observerCallBack, int what) = 0; 121 // Ims Switch 122 virtual int32_t SaveImsSwitch(int32_t slotId, int32_t imsSwitchValue) = 0; 123 virtual int32_t QueryImsSwitch(int32_t slotId, int32_t &imsSwitchValue) = 0; 124 }; 125 } // namespace Telephony 126 } // namespace OHOS 127 #endif // OHOS_I_SIM_MANAGER_H 128