• 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_ISIM_FILE_H
17 #define OHOS_ISIM_FILE_H
18 
19 #include "icc_file.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 class IsimFile : public IccFile {
24 public:
25     explicit IsimFile(std::shared_ptr<SimStateManager> simStateManager);
26     void StartLoad();
27     void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);
28     ~IsimFile();
29     bool ProcessIccReady(const AppExecFwk::InnerEvent::Pointer &event);
30     std::string ObtainIsimImpi();
31     std::string ObtainIsimDomain();
32     std::string *ObtainIsimImpu();
33     std::string ObtainIsimIst();
34     std::string *ObtainIsimPcscf();
35     bool UpdateVoiceMail(const std::string &mailName, const std::string &mailNumber);
36     bool SetVoiceMailCount(int32_t voiceMailCount);
37     bool SetVoiceCallForwarding(bool enable, const std::string &number);
38     void ProcessIccRefresh(int msgId);
39     int ObtainSpnCondition(bool roaming, const std::string &operatorNum);
40     std::string ObtainIsoCountryCode();
41     std::string GetVoiceMailNumber();
42     void SetVoiceMailNumber(const std::string mailNumber);
43 
44 protected:
45     void ProcessFileLoaded(bool response);
46     void OnAllFilesFetched();
47     void LoadIsimFiles();
48     bool ProcessIsimRefresh(const AppExecFwk::InnerEvent::Pointer &event);
49 
50 private:
51     using RecordProcessFunc = bool (IsimFile::*)(const AppExecFwk::InnerEvent::Pointer &event);
52     std::map<int, RecordProcessFunc> memberFuncMap_;
53     void InitMemberFunc();
54     void ProcessLockedAllFilesFetched();
55     bool ProcessGetImsiDone(const AppExecFwk::InnerEvent::Pointer &event);
56     bool ProcessGetIccidDone(const AppExecFwk::InnerEvent::Pointer &event);
57     bool ProcessGetImpiDone(const AppExecFwk::InnerEvent::Pointer &event);
58     bool ProcessGetIstDone(const AppExecFwk::InnerEvent::Pointer &event);
59     const int LOAD_STEP = 1;
60     // see 3GPP TS 31.103
61     std::string impi_ = "";
62     std::string domain_ = "";
63     std::string *impu_ = nullptr;
64     std::string ist_ = "";
65     std::string* pcscf_ = nullptr;
66     std::string authRsp_ = "";
67 };
68 } // namespace Telephony
69 } // namespace OHOS
70 #endif // OHOS_ISIM_FILE_H