• 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 UPDATE_CONTEXTS_H
17 #define UPDATE_CONTEXTS_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "event_listener.h"
23 #include "network_state.h"
24 #include "refbase.h"
25 #include "signal_information.h"
26 #include "update_infos.h"
27 
28 namespace OHOS {
29 namespace Telephony {
30 struct CallStateContext : EventListener {
31     int32_t callState;
32     std::u16string phoneNumber;
33     CallStateContext &operator=(const CallStateUpdateInfo &info)
34     {
35         callState = info.callState_;
36         phoneNumber = info.phoneNumber_;
37         return *this;
38     }
39 };
40 
41 struct SignalListContext : EventListener {
42     std::vector<sptr<SignalInformation>> signalInfoList;
43     SignalListContext &operator=(SignalUpdateInfo &info)
44     {
45         signalInfoList = info.signalInfoList_;
46         return *this;
47     }
48 };
49 
50 struct NetworkStateContext : EventListener {
51     sptr<NetworkState> networkState;
52     NetworkStateContext &operator=(const NetworkStateUpdateInfo &info)
53     {
54         networkState = info.networkState_;
55         return *this;
56     }
57 };
58 
59 struct SimStateContext : EventListener {
60     CardType cardType;
61     SimState simState;
62     LockReason reason;
63     SimStateContext &operator=(const SimStateUpdateInfo &info)
64     {
65         cardType = info.type_;
66         simState = info.state_;
67         reason = info.reason_;
68         return *this;
69     }
70 };
71 
72 struct CellInfomationContext : EventListener {
73     std::vector<sptr<CellInformation>> cellInfoVec;
74     CellInfomationContext &operator=(CellInfomationUpdate &info)
75     {
76         cellInfoVec = info.cellInfoVec_;
77         return *this;
78     }
79 };
80 
81 struct CellularDataConnectStateContext : EventListener {
82     int32_t dataState;
83     int32_t networkType;
84     CellularDataConnectStateContext &operator=(const CellularDataConnectState &info)
85     {
86         dataState = info.dataState_;
87         networkType = info.networkType_;
88         return *this;
89     }
90 };
91 
92 struct CellularDataFlowContext : EventListener {
93     int32_t flowType_;
94     CellularDataFlowContext &operator=(const CellularDataFlowUpdate &info)
95     {
96         flowType_ = info.flowType_;
97         return *this;
98     }
99 };
100 } // namespace Telephony
101 } // namespace OHOS
102 #endif // UPDATE_CONTEXTS_H