• 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 TELEPHONY_SIMSTATETRACKER_H
17 #define TELEPHONY_SIMSTATETRACKER_H
18 
19 #include <string>
20 
21 #include "iservice_registry.h"
22 #include "operator_config_cache.h"
23 #include "operator_config_loader.h"
24 #include "telephony_log_wrapper.h"
25 
26 namespace OHOS {
27 namespace Telephony {
28 using namespace OHOS::EventFwk;
29 class SimStateTracker : public TelEventHandler {
30 public:
31     SimStateTracker(std::weak_ptr<SimFileManager> simFileManager,
32         std::shared_ptr<OperatorConfigCache> operatorConfigCache, int32_t slotId);
33     ~SimStateTracker();
34     void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);
35     bool RegisterForIccLoaded();
36     bool RegisterOpkeyLoaded();
37     bool RegisterOperatorCacheDel();
38     bool RegisterOperatorConfigUpdate();
39     bool UnRegisterForIccLoaded();
40     bool UnRegisterOpkeyLoaded();
41     bool UnregisterOperatorCacheDel();
42     bool UnRegisterOperatorConfigUpdate();
43 
44     std::shared_ptr<OperatorConfigLoader> operatorConfigLoader_ = nullptr;
45 
46 private:
47     std::weak_ptr<SimFileManager> simFileManager_;
48     sptr<ISystemAbilityStatusChange> statusChangeListener_ = nullptr;
49     std::shared_ptr<OperatorConfigCache> operatorConfigCache_ = nullptr;
50     int32_t slotId_;
51     void ProcessSimRecordLoad(const AppExecFwk::InnerEvent::Pointer &event);
52     void ProcessSimOpkeyLoad(const AppExecFwk::InnerEvent::Pointer &event);
53     void ProcessOperatorCacheDel(const AppExecFwk::InnerEvent::Pointer &event);
54     void ProcessOperatorConfigUpdate(const AppExecFwk::InnerEvent::Pointer &event);
55     bool IsNeedUpdateCarrierConfig();
56     void ResetNeedUpdateCarrierConfig();
57     void ReloadOperatorConfigCache();
58     void ReloadOperatorConfig();
59 };
60 } // namespace Telephony
61 } // namespace OHOS
62 #endif // TELEPHONY_SIMSTATETRACKER_H