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