• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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         ON_CFU_INDICATOR_UPDATED,
40         ON_VOICE_MAIL_MSG_INDICATOR_UPDATED,
41         ON_ICC_ACCOUNT_UPDATED,
42     };
43 
44     virtual void OnCellularDataConnectStateUpdated(
45         int32_t slotId, int32_t dataState, int32_t networkType) = 0;
46     virtual void OnCallStateUpdated(
47         int32_t slotId, int32_t callState, const std::u16string &phoneNumber) = 0;
48     virtual void OnSignalInfoUpdated(
49         int32_t slotId, const std::vector<sptr<SignalInformation>> &vec) = 0;
50     virtual void OnNetworkStateUpdated(
51         int32_t slotId, const sptr<NetworkState> &networkState) = 0;
52     virtual void OnCellInfoUpdated(
53         int32_t slotId, const std::vector<sptr<CellInformation>> &vec) = 0;
54     virtual void OnSimStateUpdated(
55         int32_t slotId, CardType type, SimState state, LockReason reason) = 0;
56     virtual void OnCellularDataFlowUpdated(
57         int32_t slotId, int32_t dataFlowType) = 0;
58     virtual void OnCfuIndicatorUpdated(int32_t slotId, bool cfuResult) = 0;
59     virtual void OnVoiceMailMsgIndicatorUpdated(int32_t slotId, bool voiceMailMsgResult) = 0;
60     virtual void OnIccAccountUpdated() = 0;
61 
62 public:
63     static const uint32_t OBSERVER_MASK_NETWORK_STATE = 0x00000001;
64     static const uint32_t OBSERVER_MASK_CALL_STATE = 0x00000004;
65     static const uint32_t OBSERVER_MASK_CELL_INFO = 0x00000008;
66     static const uint32_t OBSERVER_MASK_SIGNAL_STRENGTHS = 0x00000010;
67     static const uint32_t OBSERVER_MASK_SIM_STATE = 0x00000020;
68     static const uint32_t OBSERVER_MASK_DATA_CONNECTION_STATE = 0x00000040;
69     static const uint32_t OBSERVER_MASK_DATA_FLOW = 0x00000080;
70     static const uint32_t OBSERVER_MASK_CFU_INDICATOR = 0x00000100;
71     static const uint32_t OBSERVER_MASK_VOICE_MAIL_MSG_INDICATOR = 0x00000200;
72     static const uint32_t OBSERVER_MASK_ICC_ACCOUNT = 0x00000400;
73 };
74 } // namespace Telephony
75 } // namespace OHOS
76 #endif // TELEPHONY_OBSERVER_BROKER_H