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(const std::shared_ptr<AppExecFwk::EventRunner> &runner, 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 int ObtainSpnCondition(bool roaming, const std::string &operatorNum); 37 std::string ObtainIsoCountryCode(); 38 39 protected: 40 void ProcessIccRefresh(int msgId); 41 void ProcessFileLoaded(bool response); 42 void OnAllFilesFetched(); 43 void LoadIsimFiles(); 44 bool ProcessIsimRefresh(const AppExecFwk::InnerEvent::Pointer &event); 45 46 private: 47 using RecordProcessFunc = bool (IsimFile::*)(const AppExecFwk::InnerEvent::Pointer &event); 48 std::map<int, RecordProcessFunc> memberFuncMap_; 49 void InitMemberFunc(); 50 void ProcessLockedAllFilesFetched(); 51 bool ProcessGetImsiDone(const AppExecFwk::InnerEvent::Pointer &event); 52 bool ProcessGetIccidDone(const AppExecFwk::InnerEvent::Pointer &event); 53 bool ProcessGetImpiDone(const AppExecFwk::InnerEvent::Pointer &event); 54 bool ProcessGetIstDone(const AppExecFwk::InnerEvent::Pointer &event); 55 const int LOAD_STEP = 1; 56 // see 3GPP TS 31.103 57 std::string impi_ = ""; 58 std::string domain_ = ""; 59 std::string *impu_ = nullptr; 60 std::string ist_ = ""; 61 std::string* pcscf_ = nullptr; 62 std::string authRsp_ = ""; 63 }; 64 } // namespace Telephony 65 } // namespace OHOS 66 #endif // OHOS_ISIM_FILE_H