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 OHOS_I_TELEPHONY_STATE_NOTIFY_H 17 #define OHOS_I_TELEPHONY_STATE_NOTIFY_H 18 19 #include "telephony_observer_broker.h" 20 21 namespace OHOS { 22 namespace Telephony { 23 class ITelephonyStateNotify : public IRemoteBroker { 24 public: 25 enum class StateNotifyCode { 26 CELL_INFO = 0, 27 CELLULAR_DATA_STATE, 28 CELLULAR_DATA_FLOW, 29 SIGNAL_INFO, 30 NET_WORK_STATE, 31 CALL_STATE, 32 CALL_STATE_FOR_ID, 33 SIM_STATE, 34 ADD_OBSERVER, 35 REMOVE_OBSERVER 36 }; 37 38 /** 39 * UpdateCellularDataConnectState 40 * 41 * @param slotId sim slot id 42 * @param dataState cellular data link state 43 * @param networkState network state 44 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 45 */ 46 virtual int32_t UpdateCellularDataConnectState( 47 int32_t slotId, int32_t dataState, int32_t networkState) = 0; 48 /** 49 * UpdateCellularDataFlow 50 * 51 * @param slotId sim slot id 52 * @param dataFlowType cellular data flow state 53 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 54 */ 55 virtual int32_t UpdateCellularDataFlow( 56 int32_t slotId, int32_t dataFlowType) = 0; 57 58 /** 59 * UpdateSimState 60 * 61 * @param slotId sim slot id 62 * @param CardType sim card type 63 * @param state sim state 64 * @param reason 65 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 66 */ 67 virtual int32_t UpdateSimState( 68 int32_t slotId, CardType type, SimState state, LockReason reason) = 0; 69 /** 70 * UpdateCallState 71 * 72 * @param slotId sim slot id 73 * @param callStatus call status 74 * @param number call number 75 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 76 */ 77 virtual int32_t UpdateCallState( 78 int32_t slotId, int32_t callStatus, const std::u16string &number) = 0; 79 80 /** 81 * UpdateCallStateForSlotId 82 * 83 * @param slotId sim slot id 84 * @param callId call id 85 * @param callStatus call status 86 * @param number incoming number 87 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 88 */ 89 virtual int32_t UpdateCallStateForSlotId( 90 int32_t slotId, int32_t callId, int32_t callStatus, const std::u16string &incomingNumber) = 0; 91 92 /** 93 * UpdateSignalInfo 94 * 95 * @param slotId sim slot id 96 * @param vec networkType search signal information 97 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 98 */ 99 virtual int32_t UpdateSignalInfo( 100 int32_t slotId, const std::vector<sptr<SignalInformation>> &vec) = 0; 101 102 /** 103 * UpdateCellInfo 104 * 105 * @param slotId sim slot id 106 * @param vec cell info 107 * @return int32_t TELEPHONY_NO_ERROR on success, others on failure. 108 */ 109 virtual int32_t UpdateCellInfo( 110 int32_t slotId, const std::vector<sptr<CellInformation>> &vec) = 0; 111 112 /** 113 * UpdateNetworkState 114 * 115 * @param slotId sim slot id 116 * @param networkStatus network status 117 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 118 */ 119 virtual int32_t UpdateNetworkState( 120 int32_t slotId, const sptr<NetworkState> &networkState) = 0; 121 122 /** 123 * RegisterStateChange 124 * 125 * @param telephonyObserver api callback 126 * @param slotId sim slot id 127 * @param mask listening type bitmask 128 * @param isUpdate Whether to update immediately 129 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 130 */ 131 virtual int32_t RegisterStateChange(const sptr<TelephonyObserverBroker> &telephonyObserver, 132 int32_t slotId, uint32_t mask, bool isUpdate) = 0; 133 134 /** 135 * UnregisterStateChange 136 * 137 * @param slotId sim slot id 138 * @param mask listening type bitmask 139 * @return int32_t TELEPHONY_SUCCESS on success, others on failure. 140 */ 141 virtual int32_t UnregisterStateChange(int32_t slotId, uint32_t mask) = 0; 142 143 public: 144 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.ITelephonyStateNotify"); 145 }; 146 } // namespace Telephony 147 } // namespace OHOS 148 #endif // OHOS_I_TELEPHONY_STATE_NOTIFY_H 149