• 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     bool SetVoiceMailCount(int32_t voiceMailCount);
44     bool SetVoiceCallForwarding(bool enable, const std::string &number);
45 
46 protected:
47     void ProcessIccRefresh(int msgId);
48     void ProcessFileLoaded(bool response);
49     void OnAllFilesFetched();
50     void LoadRuimFiles();
51     bool ProcessIccLocked(const AppExecFwk::InnerEvent::Pointer &event);
52 
53 private:
54     using RecordProcessFunc = bool (RuimFile::*)(const AppExecFwk::InnerEvent::Pointer &event);
55     std::map<int, RecordProcessFunc> memberFuncMap_;
56     void InitMemberFunc();
57     void ProcessLockedAllFilesFetched();
58     bool ProcessGetImsiDone(const AppExecFwk::InnerEvent::Pointer &event);
59     bool ProcessGetIccidDone(const AppExecFwk::InnerEvent::Pointer &event);
60     bool ProcessGetSubscriptionDone(const AppExecFwk::InnerEvent::Pointer &event);
61     bool ProcessGetSpnDone(const AppExecFwk::InnerEvent::Pointer &event);
62     void ParseSpnName(int encodeType, const unsigned char* spnData, int dataLen);
63     const size_t MCC_LEN = 3;
64     const int LOAD_STEP = 1;
65     const int SPN_FLAG = 0x01;
66     const int ENCODING_POS = 1;
67     const int LANG_POS = 2;
68     static const int BUFFER_SIZE = 50;
69     const int FLAG_NUM = 3;
70     const int MAX_DATA_BYTE = 32;
71     const uint8_t BYTE_NUM = 0xFF;
72     std::string phoneNumber_ = "";
73     // C.S0005 section 2.3.1
74     std::string min2And1_ = "";
75     // C.S0065 section 5.2.2
76     std::string prlVersion_ = "";
77     bool displayConditionOfCsimSpn_ = false;
78     std::string mdn_ = "";
79     std::string min_ = "";
80     std::string systemId_ = "";
81     std::string networkId_ = "";
82     std::string nai_ = "";
83 };
84 } // namespace Telephony
85 } // namespace OHOS
86 #endif // OHOS_RUIM_FILE_H