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