• 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_RUIM_FILE_H
17 #define OHOS_RUIM_FILE_H
18 
19 #include "icc_file.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 class RuimFile : public IccFile {
24 public:
25     RuimFile(const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
26     void StartLoad();
27     std::string ObtainSimOperator();
28     std::string ObtainIsoCountryCode();
29     void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);
30     ~RuimFile();
31     bool ProcessIccReady(const AppExecFwk::InnerEvent::Pointer &event);
32     std::string ObtainMdnNumber();
33     std::string ObtainCdmaMin();
34     std::string ObtainPrlVersion();
35     std::string ObtainNAI();
36     std::string ObtainMdn();
37     std::string ObtainMin();
38     std::string ObtainSid();
39     std::string ObtainNid();
40     bool ObtainCsimSpnDisplayCondition();
41     int ObtainSpnCondition(bool roaming, const std::string &operatorNum);
42     bool UpdateVoiceMail(const std::string &mailName, const std::string &mailNumber);
43 
44 protected:
45     void ProcessIccRefresh(int msgId);
46     void ProcessFileLoaded(bool response);
47     void OnAllFilesFetched();
48     void LoadRuimFiles();
49     bool ProcessIccLocked(const AppExecFwk::InnerEvent::Pointer &event);
50 
51 private:
52     using RecordProcessFunc = bool (RuimFile::*)(const AppExecFwk::InnerEvent::Pointer &event);
53     std::map<int, RecordProcessFunc> memberFuncMap_;
54     void InitMemberFunc();
55     void ProcessLockedAllFilesFetched();
56     bool ProcessGetImsiDone(const AppExecFwk::InnerEvent::Pointer &event);
57     bool ProcessGetIccidDone(const AppExecFwk::InnerEvent::Pointer &event);
58     bool ProcessGetSubscriptionDone(const AppExecFwk::InnerEvent::Pointer &event);
59     bool ProcessGetSpnDone(const AppExecFwk::InnerEvent::Pointer &event);
60     void ParseSpnName(int encodeType, const unsigned char* spnData, int dataLen);
61     const size_t MCC_LEN = 3;
62     const int LOAD_STEP = 1;
63     const int SPN_FLAG = 0x01;
64     const int ENCODING_POS = 1;
65     const int LANG_POS = 2;
66     static const int BUFFER_SIZE = 50;
67     const int FLAG_NUM = 3;
68     const int MAX_DATA_BYTE = 32;
69     const uint8_t BYTE_NUM = 0xFF;
70     std::string phoneNumber_ = "";
71     // C.S0005 section 2.3.1
72     std::string min2And1_ = "";
73     // C.S0065 section 5.2.2
74     std::string prlVersion_ = "";
75     bool displayConditionOfCsimSpn_ = false;
76     std::string mdn_ = "";
77     std::string min_ = "";
78     std::string systemId_ = "";
79     std::string networkId_ = "";
80     std::string nai_ = "";
81 };
82 } // namespace Telephony
83 } // namespace OHOS
84 #endif // OHOS_RUIM_FILE_H