1 /* 2 * Copyright (C) 2021-2022 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 OHOS_I_WIFI_HOTSPOT_H 17 #define OHOS_I_WIFI_HOTSPOT_H 18 19 #include "iremote_broker.h" 20 #include "message_parcel.h" 21 #include "message_option.h" 22 #include "wifi_errcode.h" 23 #include "wifi_ap_msg.h" 24 #include "define.h" 25 #include "wifi_errcode.h" 26 #include "i_wifi_hotspot_callback.h" 27 28 namespace OHOS { 29 namespace Wifi { 30 class IWifiHotspot : public IRemoteBroker { 31 public: ~IWifiHotspot()32 virtual ~IWifiHotspot() 33 {} 34 35 /** 36 * @Description Check whether the hotspot is active. 37 * 38 * @param bActive - active / inactive 39 * @return ErrCode - operation result 40 */ 41 virtual ErrCode IsHotspotActive(bool &bActive) = 0; 42 43 /** 44 * @Description Check whether the hotspot supports dual band. 45 * 46 * @param isSupported - Supported / NOT supported 47 * @return ErrCode - operation result 48 */ 49 virtual ErrCode IsHotspotDualBandSupported(bool &isSupported) = 0; 50 51 /** 52 * @Description Get the Hotspot Config object 53 * 54 * @param config - HotapotConfig object 55 * @return ErrCode - operation result 56 */ 57 virtual ErrCode GetHotspotConfig(HotspotConfig &config) = 0; 58 59 /** 60 * @Description Get the Hotspot State object 61 * 62 * @param state - current Hotspot state 63 * @return ErrCode - operation result 64 */ 65 virtual ErrCode GetHotspotState(int &state) = 0; 66 67 /** 68 * @Description Set the configuration of Hotspot 69 * 70 * @param config - HotspotConfig object 71 * @return ErrCode - operation result 72 */ 73 virtual ErrCode SetHotspotConfig(const HotspotConfig &config) = 0; 74 75 /** 76 * @Description Set the idel timeout of Hotspot 77 * 78 * @param time -input time, 79 * @return ErrCode - operation result 80 */ 81 virtual ErrCode SetHotspotIdleTimeout(int time) = 0; 82 83 /** 84 * @Description Get the Station List object. 85 * 86 * @param result - Get result vector of connect Station Info 87 * @return ErrCode - operation result 88 */ 89 virtual ErrCode GetStationList(std::vector<StationInfo> &result) = 0; 90 91 /** 92 * @Description Disconnects a specified sta connection 93 * 94 * @param info - Station object 95 * @return ErrCode - operation result 96 */ 97 virtual ErrCode DisassociateSta(const StationInfo &info) = 0; 98 99 /** 100 * @Description Enable Hotspot 101 * 102 * @param type - service type 103 * @return ErrCode - operation result 104 */ 105 virtual ErrCode EnableHotspot(const ServiceType type = ServiceType::DEFAULT) = 0; 106 107 /** 108 * @Description Disable Hotspot 109 * 110 * @param type - service type 111 * @return ErrCode - operation result 112 */ 113 virtual ErrCode DisableHotspot(const ServiceType type = ServiceType::DEFAULT) = 0; 114 115 /** 116 * @Description Get the Block Lists object 117 * 118 * @param infos - Get Blocklist result vector of StationInfo 119 * @return ErrCode - operation result 120 */ 121 virtual ErrCode GetBlockLists(std::vector<StationInfo> &infos) = 0; 122 123 /** 124 * @Description Add a StationInfo object to Blocklist 125 * 126 * @param info - Station object 127 * @return ErrCode - operation result 128 */ 129 virtual ErrCode AddBlockList(const StationInfo &info) = 0; 130 131 /** 132 * @Description Del a StationInfo object from Blocklist 133 * 134 * @param info - StationInfo object 135 * @return ErrCode - operation result 136 */ 137 virtual ErrCode DelBlockList(const StationInfo &info) = 0; 138 139 /** 140 * @Description Get the Valid Bands object 141 * 142 * @param bands - Get result vector of BandType 143 * @return ErrCode - operation result 144 */ 145 virtual ErrCode GetValidBands(std::vector<BandType> &bands) = 0; 146 147 /** 148 * @Description Get the Valid Channels object 149 * 150 * @param band - Specified band 151 * @param validchannels - Obtains the channels corresponding to the specified band 152 * @return ErrCode - operation result 153 */ 154 virtual ErrCode GetValidChannels(BandType band, std::vector<int32_t> &validchannels) = 0; 155 156 /** 157 * @Description Register callback client 158 * 159 * @param callback - callback struct 160 * @return ErrCode - operation result 161 */ 162 virtual ErrCode RegisterCallBack(const sptr<IWifiHotspotCallback> &callback, 163 const std::vector<std::string> &event) = 0; 164 165 /** 166 * @Description Get supported features 167 * 168 * @param features - return supported features 169 * @return ErrCode - operation result 170 */ 171 virtual ErrCode GetSupportedFeatures(long &features) = 0; 172 173 /** 174 * @Description Get supported power model list 175 * 176 * @param setPowerModelList - supported power model list 177 * @return ErrCode - operation result 178 */ 179 virtual ErrCode GetSupportedPowerModel(std::set<PowerModel>& setPowerModelList) = 0; 180 181 /** 182 * @Description Get power model 183 * 184 * @param model - current power model 185 * @return ErrCode - operation result 186 */ 187 virtual ErrCode GetPowerModel(PowerModel& model) = 0; 188 189 /** 190 * @Description Get supported power model list 191 * 192 * @param model - the model to be set 193 * @return ErrCode - operation result 194 */ 195 virtual ErrCode SetPowerModel(const PowerModel& model) = 0; 196 197 /** 198 * @Description Check whether service is died. 199 * 200 * @return bool - true: service is died, false: service is not died. 201 */ 202 virtual bool IsRemoteDied(void) = 0; 203 204 public: 205 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.wifi.IWifiHotspotService"); 206 }; 207 } // namespace Wifi 208 } // namespace OHOS 209 #endif