1 /* 2 * Copyright (c) 2022 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 STATE_REGISTRY_OBSERVER_H 17 #define STATE_REGISTRY_OBSERVER_H 18 19 #include "string_ex.h" 20 #include "telephony_log_wrapper.h" 21 #include "telephony_observer.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 class StateRegistryObserver : public Telephony::TelephonyObserver { 26 public: 27 StateRegistryObserver() = default; 28 ~StateRegistryObserver() = default; 29 OnCallStateUpdated(int32_t slotId,int32_t callState,const std::u16string & phoneNumber)30 void OnCallStateUpdated(int32_t slotId, int32_t callState, const std::u16string &phoneNumber) 31 { 32 TELEPHONY_LOGI( 33 "StateRegistryObserver%{public}d::OnCallStateUpdated callState is %{public}d", slotId, callState); 34 } 35 OnSignalInfoUpdated(int32_t slotId,const std::vector<sptr<SignalInformation>> & vec)36 void OnSignalInfoUpdated(int32_t slotId, const std::vector<sptr<SignalInformation>> &vec) 37 { 38 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnSignalInfoUpdated", slotId); 39 } 40 OnSignalInfoUpdatedExt(int32_t slotId,const std::vector<sptr<SignalInformation>> & vec)41 void OnSignalInfoUpdatedExt(int32_t slotId, const std::vector<sptr<SignalInformation>> &vec) 42 { 43 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnSignalInfoUpdatedExt", slotId); 44 } 45 OnNetworkStateUpdated(int32_t slotId,const sptr<NetworkState> & networkState)46 void OnNetworkStateUpdated(int32_t slotId, const sptr<NetworkState> &networkState) 47 { 48 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnNetworkStateUpdated", slotId); 49 } 50 OnNetworkStateUpdatedExt(int32_t slotId,const sptr<NetworkState> & networkState)51 void OnNetworkStateUpdatedExt(int32_t slotId, const sptr<NetworkState> &networkState) 52 { 53 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnNetworkStateUpdatedExt", slotId); 54 } 55 OnCellInfoUpdated(int32_t slotId,const std::vector<sptr<CellInformation>> & vec)56 void OnCellInfoUpdated(int32_t slotId, const std::vector<sptr<CellInformation>> &vec) 57 { 58 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnCellInfoUpdated", slotId); 59 } 60 OnCellInfoUpdatedExt(int32_t slotId,const std::vector<sptr<CellInformation>> & vec)61 void OnCellInfoUpdatedExt(int32_t slotId, const std::vector<sptr<CellInformation>> &vec) 62 { 63 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnCellInfoUpdatedExt", slotId); 64 } 65 OnSimStateUpdated(int32_t slotId,CardType type,SimState state,LockReason reason)66 void OnSimStateUpdated(int32_t slotId, CardType type, SimState state, LockReason reason) 67 { 68 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnSimStateUpdated state is %{public}d", slotId, state); 69 } 70 OnCellularDataConnectStateUpdated(int32_t slotId,int32_t dataState,int32_t networkType)71 void OnCellularDataConnectStateUpdated(int32_t slotId, int32_t dataState, int32_t networkType) 72 { 73 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnCellularDataConnectStateUpdated dataState is %{public}d", 74 slotId, dataState); 75 } 76 OnCellularDataFlowUpdated(int32_t slotId,int32_t dataFlowType)77 void OnCellularDataFlowUpdated(int32_t slotId, int32_t dataFlowType) 78 { 79 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnCellularDataFlowUpdated dataFlowType is %{public}d", slotId, 80 dataFlowType); 81 } 82 OnCfuIndicatorUpdated(int32_t slotId,bool cfuResult)83 void OnCfuIndicatorUpdated(int32_t slotId, bool cfuResult) 84 { 85 TELEPHONY_LOGI( 86 "StateRegistryObserver%{public}d::OnCfuIndicatorUpdated cfuResult is %{public}d", slotId, cfuResult); 87 } 88 OnVoiceMailMsgIndicatorUpdated(int32_t slotId,bool voiceMailMsgResult)89 void OnVoiceMailMsgIndicatorUpdated(int32_t slotId, bool voiceMailMsgResult) 90 { 91 TELEPHONY_LOGI( 92 "StateRegistryObserver%{public}d::OnVoiceMailMsgIndicatorUpdated voiceMailMsgResult is %{public}d", slotId, 93 voiceMailMsgResult); 94 } 95 OnIccAccountUpdated()96 void OnIccAccountUpdated() 97 { 98 TELEPHONY_LOGI("StateRegistryObserver::OnIccAccountUpdated"); 99 } 100 }; 101 } // namespace Telephony 102 } // namespace OHOS 103 #endif // STATE_REGISTRY_OBSERVER_H