• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OHOS_I_SIM_MANAGER_H
17 #define OHOS_I_SIM_MANAGER_H
18 
19 #include "sim_state_type.h"
20 #include "dialling_numbers_info.h"
21 #include "i_network_search.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 class ISimManager {
26 public:
27     using HANDLE = const std::shared_ptr<AppExecFwk::EventHandler>;
28     // Init
29     virtual bool OnInit(int32_t slotCount) = 0;
30     virtual void SetNetworkSearchManager(int32_t slotCount, std::shared_ptr<INetworkSearch> networkSearchManager) = 0;
31     // SimState
32     virtual bool HasSimCard(int32_t slotId) = 0;
33     virtual int32_t GetSimState(int32_t slotId) = 0;
34     virtual int32_t GetCardType(int32_t slotId) = 0;
35     virtual bool UnlockPin(int32_t slotId, std::string pin, LockStatusResponse &response) = 0;
36     virtual bool UnlockPuk(int32_t slotId, std::string newPin, std::string puk, LockStatusResponse &response) = 0;
37     virtual bool AlterPin(int32_t slotId, std::string newPin, std::string oldPin, LockStatusResponse &response) = 0;
38     virtual bool SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response) = 0;
39     virtual int32_t GetLockState(int32_t slotId, LockType lockType) = 0;
40     virtual int32_t RefreshSimState(int32_t slotId) = 0;
41     virtual bool UnlockPin2(int32_t slotId, std::string pin2, LockStatusResponse &response) = 0;
42     virtual bool UnlockPuk2(
43         int32_t slotId, std::string newPin2, std::string puk2, LockStatusResponse &response) = 0;
44     virtual bool AlterPin2(
45         int32_t slotId, std::string newPin2, std::string oldPin2, LockStatusResponse &response) = 0;
46     virtual bool UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response) = 0;
47     // SimAccount
48     virtual bool IsSimActive(int32_t slotId) = 0;
49     virtual bool SetActiveSim(int32_t slotId, int32_t enable) = 0;
50     virtual bool GetSimAccountInfo(int32_t slotId, IccAccountInfo &info) = 0;
51     virtual bool SetDefaultVoiceSlotId(int32_t slotId) = 0;
52     virtual bool SetDefaultSmsSlotId(int32_t slotId) = 0;
53     virtual bool SetDefaultCellularDataSlotId(int32_t slotId) = 0;
54     virtual bool SetPrimarySlotId(int32_t slotId) = 0;
55     virtual bool SetShowNumber(int32_t slotId, const std::u16string number) = 0;
56     virtual bool SetShowName(int32_t slotId, const std::u16string name) = 0;
57     virtual int32_t GetDefaultVoiceSlotId() = 0;
58     virtual int32_t GetDefaultSmsSlotId() = 0;
59     virtual int32_t GetDefaultCellularDataSlotId() = 0;
60     virtual int32_t GetPrimarySlotId() = 0;
61     virtual std::u16string GetShowNumber(int32_t slotId) = 0;
62     virtual std::u16string GetShowName(int32_t slotId) = 0;
63     virtual bool GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList) = 0;
64     virtual bool GetOperatorConfigs(int slotId, OperatorConfig &poc) = 0;
65     virtual bool HasOperatorPrivileges(const int32_t slotId) = 0;
66     // STK
67     virtual bool SendEnvelopeCmd(int32_t slotId, const std::string &cmd) = 0;
68     virtual bool SendTerminalResponseCmd(int32_t slotId, const std::string &cmd) = 0;
69     // SimFile
70     virtual std::u16string GetSimOperatorNumeric(int32_t slotId) = 0;
71     virtual std::u16string GetISOCountryCodeForSim(int32_t slotId) = 0;
72     virtual std::u16string GetSimSpn(int32_t slotId) = 0;
73     virtual std::u16string GetSimIccId(int32_t slotId) = 0;
74     virtual std::u16string GetIMSI(int32_t slotId) = 0;
75     virtual std::u16string GetLocaleFromDefaultSim(int32_t slotId) = 0;
76     virtual std::u16string GetSimGid1(int32_t slotId) = 0;
77     virtual std::u16string GetSimTelephoneNumber(int32_t slotId) = 0;
78     virtual std::u16string GetSimTeleNumberIdentifier(const int32_t slotId) = 0;
79     virtual std::u16string GetVoiceMailIdentifier(int32_t slotId) = 0;
80     virtual std::u16string GetVoiceMailNumber(int32_t slotId) = 0;
81     virtual int ObtainSpnCondition(int32_t slotId, bool roaming, std::string operatorNum) = 0;
82     virtual bool SetVoiceMailInfo(
83         int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber) = 0;
84     // SimSms
85     virtual bool AddSmsToIcc(int32_t slotId, int status, std::string &pdu, std::string &smsc) = 0;
86     virtual bool UpdateSmsIcc(int32_t slotId, int index, int status, std::string &pduData, std::string &smsc) = 0;
87     virtual bool DelSmsIcc(int32_t slotId, int index) = 0;
88     virtual std::vector<std::string> ObtainAllSmsOfIcc(int32_t slotId) = 0;
89     // IccDiallingNumbers
90     virtual std::vector<std::shared_ptr<DiallingNumbersInfo>> QueryIccDiallingNumbers(int slotId, int type) = 0;
91     virtual bool AddIccDiallingNumbers(
92         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0;
93     virtual bool DelIccDiallingNumbers(
94         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0;
95     virtual bool UpdateIccDiallingNumbers(
96         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) = 0;
97     // Event register
98     virtual void RegisterCoreNotify(int32_t slotId, const HANDLE &handler, int what) = 0;
99     virtual void UnRegisterCoreNotify(int32_t slotId, const HANDLE &observerCallBack, int what) = 0;
100 };
101 } // namespace Telephony
102 } // namespace OHOS
103 #endif // OHOS_I_SIM_MANAGER_H
104