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