• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 I_CELLULAR_DATA_MANAGER_H
17 #define I_CELLULAR_DATA_MANAGER_H
18 
19 #include "iremote_broker.h"
20 #include "sim_account_callback.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 class ICellularDataManager : public IRemoteBroker {
25 public:
26     /**
27      * Whether the cellular data user switch is enabled
28      *
29      * @return return errorCode of is cellulardata enabled
30      */
31     virtual int32_t IsCellularDataEnabled(bool &dataEnabled) = 0;
32 
33     /**
34      * Whether to enable cellular data user switch
35      *
36      * @param enable allow or not
37      * @return return 84082688 invalid parameter, 1 data enable success, 0 enable fail
38      */
39     virtual int32_t EnableCellularData(bool enable) = 0;
40 
41     /**
42      * Cellular data connection status
43      *
44      * @return 84082688 Indicates that a cellular data link is unknown
45      *         11 Indicates that a cellular data link is disconnected
46      *         12 Indicates that a cellular data link is being connected
47      *         13 Indicates that a cellular data link is connected
48      *         14 Indicates that a cellular data link is suspended
49      */
50     virtual int32_t GetCellularDataState() = 0;
51 
52     /**
53      * Whether roaming is allowed
54      *
55      * @param slotId card slot identification
56      * @param dataRoamingEnabled result of data is enabled
57      * @return return errorCode of is cellulardata enabled
58      */
59     virtual int32_t IsCellularDataRoamingEnabled(int32_t slotId, bool &dataRoamingEnabled) = 0;
60 
61     /**
62      * Whether roaming switches are allowed
63      *
64      * @param slotId card slot identification
65      * @param enable Whether roaming switches are allowed
66      * @return Returns 0 on failure, 1 on failure. 84082688 invalid parameter
67      */
68     virtual int32_t EnableCellularDataRoaming(int32_t slotId, bool enable) = 0;
69 
70     /**
71      * Processing of APN content changes
72      *
73      * @param slotId card slot identification
74      * @param apns changed apns
75      * @return the number of apns created else 84082688 invalid parameter
76      */
77     virtual int32_t HandleApnChanged(int32_t slotId) = 0;
78 
79     /**
80      * Get the slotId that uses the data traffic by default
81      *
82      * @return default settings data card, -1 error code
83      */
84     virtual int32_t GetDefaultCellularDataSlotId() = 0;
85 
86     /**
87      * Get the simId that uses the data traffic by default
88      *
89      * @param simId Returns default settings data sim id
90      * @return Returns 0 on success, others on failure.
91      */
92     virtual int32_t GetDefaultCellularDataSimId(int32_t &simId) = 0;
93 
94     /**
95      * set the slotId that uses the data traffic by default
96      *
97      * @return 1 set success, 0 set fail, 84082688 invalid parameter
98      */
99     virtual int32_t SetDefaultCellularDataSlotId(int32_t slotId) = 0;
100 
101     /**
102      * get data packet type
103      *
104      * @return 0 Indicates that there is no uplink or down link data,
105      *         1 Indicates that there is only down link data,
106      *         2 Indicates that there is only uplink data,
107      *         3 Indicates that there is uplink and down link data
108      *         4 Indicates that there is no uplink or down link data,
109      *           and the bottom-layer link is in the dormant state
110      *         84082688 Indicates invalid parameter
111      */
112     virtual int32_t GetCellularDataFlowType() = 0;
113 
114     virtual int32_t HasInternetCapability(int32_t slotId, int32_t cid) = 0;
115 
116     virtual int32_t ClearCellularDataConnections(int32_t slotId) = 0;
117 
118     virtual int32_t RegisterSimAccountCallback(const sptr<SimAccountCallback> &callback) = 0;
119 
120     virtual int32_t UnregisterSimAccountCallback() = 0;
121 
122 public:
123     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.telephony.ICellularDataManager");
124 };
125 } // namespace Telephony
126 } // namespace OHOS
127 #endif // I_CELLULAR_DATA_MANAGER_H
128