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_OBSERVER_BROKER_H 17 #define TELEPHONY_OBSERVER_BROKER_H 18 19 #include "iremote_broker.h" 20 #include "cell_information.h" 21 #include "network_state.h" 22 #include "signal_information.h" 23 #include "sim_state_type.h" 24 25 namespace OHOS { 26 namespace Telephony { 27 class TelephonyObserverBroker : public IRemoteBroker { 28 public: 29 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.TelephonyObserverBroker"); 30 31 enum class ObserverBrokerCode { 32 ON_CALL_STATE_UPDATED = 0, 33 ON_SIGNAL_INFO_UPDATED, 34 ON_NETWORK_STATE_UPDATED, 35 ON_CELL_INFO_UPDATED, 36 ON_SIM_STATE_UPDATED, 37 ON_CELLULAR_DATA_CONNECT_STATE_UPDATED, 38 ON_CELLULAR_DATA_FLOW_UPDATED 39 }; 40 41 virtual void OnCellularDataConnectStateUpdated( 42 int32_t slotId, int32_t dataState, int32_t networkType) = 0; 43 virtual void OnCallStateUpdated( 44 int32_t slotId, int32_t callState, const std::u16string &phoneNumber) = 0; 45 virtual void OnSignalInfoUpdated( 46 int32_t slotId, const std::vector<sptr<SignalInformation>> &vec) = 0; 47 virtual void OnNetworkStateUpdated( 48 int32_t slotId, const sptr<NetworkState> &networkState) = 0; 49 virtual void OnCellInfoUpdated( 50 int32_t slotId, const std::vector<sptr<CellInformation>> &vec) = 0; 51 virtual void OnSimStateUpdated( 52 int32_t slotId, CardType type, SimState state, LockReason reason) = 0; 53 virtual void OnCellularDataFlowUpdated( 54 int32_t slotId, int32_t dataFlowType) = 0; 55 56 public: 57 static const uint32_t OBSERVER_MASK_NETWORK_STATE = 0x00000001; 58 static const uint32_t OBSERVER_MASK_CALL_STATE = 0x00000004; 59 static const uint32_t OBSERVER_MASK_CELL_INFO = 0x00000008; 60 static const uint32_t OBSERVER_MASK_SIGNAL_STRENGTHS = 0x00000010; 61 static const uint32_t OBSERVER_MASK_SIM_STATE = 0x00000020; 62 static const uint32_t OBSERVER_MASK_DATA_CONNECTION_STATE = 0x00000040; 63 static const uint32_t OBSERVER_MASK_DATA_FLOW = 0x00000080; 64 }; 65 } // namespace Telephony 66 } // namespace OHOS 67 #endif // TELEPHONY_OBSERVER_BROKER_H