1 /*
2  * Copyright (C) 2021-2023 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     /**
26      * UpdateCellularDataConnectState
27      *
28      * @param slotId sim slot id
29      * @param dataState cellular data link state
30      * @param networkState network state
31      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
32      */
33     virtual int32_t UpdateCellularDataConnectState(int32_t slotId, int32_t dataState, int32_t networkState) = 0;
34 
35     /**
36      * UpdateCellularDataFlow
37      *
38      * @param slotId sim slot id
39      * @param dataFlowType cellular data flow state
40      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
41      */
42     virtual int32_t UpdateCellularDataFlow(int32_t slotId, int32_t dataFlowType) = 0;
43 
44     /**
45      * UpdateSimState
46      *
47      * @param slotId sim slot id
48      * @param CardType sim card type
49      * @param state sim state
50      * @param reason
51      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
52      */
53     virtual int32_t UpdateSimState(int32_t slotId, CardType type, SimState state, LockReason reason) = 0;
54 
55     /**
56      * UpdateCallState
57      *
58      * @param callStatus call status
59      * @param number call number
60      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
61      */
62     virtual int32_t UpdateCallState(int32_t callStatus, const std::u16string &number) = 0;
63 
64     /**
65      * UpdateCallStateForSlotId
66      *
67      * @param slotId sim slot id
68      * @param callStatus call status
69      * @param number incoming number
70      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
71      */
72     virtual int32_t UpdateCallStateForSlotId(
73         int32_t slotId, int32_t callStatus, const std::u16string &number) = 0;
74 
75     /**
76      * UpdateSignalInfo
77      *
78      * @param slotId sim slot id
79      * @param vec networkType search signal information
80      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
81      */
82     virtual int32_t UpdateSignalInfo(int32_t slotId, const std::vector<sptr<SignalInformation>> &vec) = 0;
83 
84     /**
85      * UpdateCellInfo
86      *
87      * @param slotId sim slot id
88      * @param vec cell info
89      * @return int32_t TELEPHONY_NO_ERROR on success, others on failure.
90      */
91     virtual int32_t UpdateCellInfo(int32_t slotId, const std::vector<sptr<CellInformation>> &vec) = 0;
92 
93     /**
94      * UpdateNetworkState
95      *
96      * @param slotId sim slot id
97      * @param networkStatus network status
98      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
99      */
100     virtual int32_t UpdateNetworkState(int32_t slotId, const sptr<NetworkState> &networkState) = 0;
101 
102     /**
103      * Update call forward unconditionally indicator
104      *
105      * @param slotId sim slot id
106      * @param cfuResult set the result of call forwarding
107      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
108      */
109     virtual int32_t UpdateCfuIndicator(int32_t slotId, bool cfuResult) = 0;
110 
111     virtual int32_t UpdateIccAccount() = 0;
112 
113     /**
114      * Update voice mail message indicator
115      *
116      * @param slotId sim slot id
117      * @param voiceMailMsgResult voice mail message indicator
118      * @return int32_t TELEPHONY_SUCCESS on success, others on failure.
119      */
120     virtual int32_t UpdateVoiceMailMsgIndicator(int32_t slotId, bool voiceMailMsgResult) = 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(
132         const sptr<TelephonyObserverBroker> &telephonyObserver, 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