• 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     IsimFile(
26         const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
27     void Init();
28     void StartLoad();
29     void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);
30     ~IsimFile();
31     bool ProcessIccReady(const AppExecFwk::InnerEvent::Pointer &event);
32     std::string ObtainIsimImpi();
33     std::string ObtainIsimDomain();
34     std::string *ObtainIsimImpu();
35     std::string ObtainIsimIst();
36     std::string *ObtainIsimPcscf();
37     bool UpdateVoiceMail(const std::string &mailName, const std::string &mailNumber);
38     int ObtainSpnCondition(bool roaming, const std::string &operatorNum);
39     std::string ObtainIsoCountryCode();
40 
41 protected:
42     void ProcessIccRefresh(int msgId);
43     void ProcessFileLoaded(bool response);
44     void OnAllFilesFetched();
45     void LoadIsimFiles();
46     bool ProcessIsimRefresh(const AppExecFwk::InnerEvent::Pointer &event);
47 
48 private:
49     using RecordProcessFunc = bool (IsimFile::*)(const AppExecFwk::InnerEvent::Pointer &event);
50     std::map<int, RecordProcessFunc> memberFuncMap_;
51     void InitMemberFunc();
52     void ProcessLockedAllFilesFetched();
53     bool ProcessGetImsiDone(const AppExecFwk::InnerEvent::Pointer &event);
54     bool ProcessGetIccidDone(const AppExecFwk::InnerEvent::Pointer &event);
55     bool ProcessGetImpiDone(const AppExecFwk::InnerEvent::Pointer &event);
56     const int LOAD_STEP = 1;
57     // see 3GPP TS 31.103
58     std::string impi_ = "";
59     std::string domain_ = "";
60     std::string* impu_ = nullptr;
61     std::string ist_ = "";
62     std::string* pcscf_ = nullptr;
63     std::string authRsp_ = "";
64 };
65 } // namespace Telephony
66 } // namespace OHOS
67 #endif // OHOS_ISIM_FILE_H