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