/* * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SMS_NETWORK_POLICY_MANAGER_H #define SMS_NETWORK_POLICY_MANAGER_H #include #include #include #include "ims_reg_state_callback_stub.h" #include "network_state.h" #include "sms_common.h" #include "tel_event_handler.h" namespace OHOS { namespace Telephony { enum NotificationType { NOTIFICATION_TYPE_IMS = 600, }; class SmsNetworkPolicyManager : public TelEventHandler { public: explicit SmsNetworkPolicyManager(int32_t slotId); virtual ~SmsNetworkPolicyManager() = default; virtual void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; void Init(); void UnRegisterHandler(); NetWorkType GetNetWorkType(); bool IsImsNetDomain() const; void GetRadioState(); int32_t GetVoiceServiceState() const; std::optional NetworkRegister( const std::function &callback); std::optional NetworkRegister( const std::function &&callback); void NetworkUnregister(int32_t id); protected: void HandlerRadioState(const AppExecFwk::InnerEvent::Pointer &event); void RegisterHandler(); private: int32_t GetId(); void GetImsRegState(); void HandleFactoryReset(); private: int32_t slotId_; enum NetWorkType netWorkType_ = NetWorkType::NET_TYPE_UNKNOWN; bool isImsNetDomain_ = false; int32_t voiceServiceState_ = static_cast(RegServiceState::REG_STATE_UNKNOWN); std::map> callbackMap_; int32_t id_ = 0; std::mutex callbackMapMutex_; }; } // namespace Telephony } // namespace OHOS #endif // SMS_NETWORK_POLICY_MANAGER_H