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; OnCallStateUpdated(int32_t slotId,int32_t callState,const std::u16string & phoneNumber)29 void OnCallStateUpdated(int32_t slotId, int32_t callState, const std::u16string &phoneNumber) 30 { 31 TELEPHONY_LOGI( 32 "StateRegistryObserver%{public}d::OnCallStateUpdated callState is %{public}d", slotId, callState); 33 } OnSignalInfoUpdated(int32_t slotId,const std::vector<sptr<SignalInformation>> & vec)34 void OnSignalInfoUpdated(int32_t slotId, const std::vector<sptr<SignalInformation>> &vec) 35 { 36 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnSignalInfoUpdated", slotId); 37 } OnNetworkStateUpdated(int32_t slotId,const sptr<NetworkState> & networkState)38 void OnNetworkStateUpdated(int32_t slotId, const sptr<NetworkState> &networkState) 39 { 40 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnNetworkStateUpdated", slotId); 41 } OnCellInfoUpdated(int32_t slotId,const std::vector<sptr<CellInformation>> & vec)42 void OnCellInfoUpdated(int32_t slotId, const std::vector<sptr<CellInformation>> &vec) 43 { 44 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnCellInfoUpdated", slotId); 45 } OnSimStateUpdated(int32_t slotId,CardType type,SimState state,LockReason reason)46 void OnSimStateUpdated(int32_t slotId, CardType type, SimState state, LockReason reason) 47 { 48 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnSimStateUpdated state is %{public}d", slotId, state); 49 } OnCellularDataConnectStateUpdated(int32_t slotId,int32_t dataState,int32_t networkType)50 void OnCellularDataConnectStateUpdated(int32_t slotId, int32_t dataState, int32_t networkType) 51 { 52 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnCellularDataConnectStateUpdated dataState is %{public}d", 53 slotId, dataState); 54 } OnCellularDataFlowUpdated(int32_t slotId,int32_t dataFlowType)55 void OnCellularDataFlowUpdated(int32_t slotId, int32_t dataFlowType) 56 { 57 TELEPHONY_LOGI("StateRegistryObserver%{public}d::OnCellularDataFlowUpdated dataFlowType is %{public}d", slotId, 58 dataFlowType); 59 } 60 }; 61 } // namespace Telephony 62 } // namespace OHOS 63 #endif // STATE_REGISTRY_OBSERVER_H