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_WIFI_HOTSPOT_PROXY_H 17 #define OHOS_WIFI_HOTSPOT_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "i_wifi_hotspot.h" 21 #include "wifi_errcode.h" 22 #include "wifi_ap_msg.h" 23 24 namespace OHOS { 25 namespace Wifi { 26 class WifiHotspotProxy : public IRemoteProxy<IWifiHotspot>, public IRemoteObject::DeathRecipient { 27 public: 28 explicit WifiHotspotProxy(const sptr<IRemoteObject> &impl); 29 30 ~WifiHotspotProxy(); 31 32 /** 33 * @Description Check whether the hotspot is active. 34 * 35 * @param bActive - active / inactive 36 * @return ErrCode - operation result 37 */ 38 ErrCode IsHotspotActive(bool &bActive) override; 39 40 /** 41 * @Description Get the Hotspot Config object 42 * 43 * @param config - HotapotConfig object 44 * @return ErrCode - operation result 45 */ 46 ErrCode GetHotspotConfig(HotspotConfig &config) override; 47 48 /** 49 * @Description Get the Hotspot State object 50 * 51 * @param state - current Hotspot state 52 * @return ErrCode - operation result 53 */ 54 ErrCode GetHotspotState(int &state) override; 55 56 /** 57 * @Description Set the configuration of Hotspot 58 * 59 * @param config - HotspotConfig object 60 * @return ErrCode - operation result 61 */ 62 ErrCode SetHotspotConfig(const HotspotConfig &config) override; 63 64 /** 65 * @Description Get the Station List object 66 * 67 * @param result - Get result vector of connect Station Info 68 * @return ErrCode - operation result 69 */ 70 ErrCode GetStationList(std::vector<StationInfo> &result) override; 71 72 /** 73 * @Description Disconnects a specified sta connection 74 * 75 * @param info - Station object 76 * @return ErrCode - operation result 77 */ 78 ErrCode DisassociateSta(const StationInfo &info) override; 79 80 /** 81 * @Description Enable Hotspot 82 * 83 * @return ErrCode - operation result 84 */ 85 ErrCode EnableHotspot(void) override; 86 87 /** 88 * @Description Disable Hotspot 89 * 90 * @return ErrCode - operation result 91 */ 92 ErrCode DisableHotspot(void) override; 93 94 /** 95 * @Description Get the Block Lists object 96 * 97 * @param infos - Get Blocklist result vector of StationInfo 98 * @return ErrCode - operation result 99 */ 100 ErrCode GetBlockLists(std::vector<StationInfo> &infos) override; 101 102 /** 103 * @Description Add a StationInfo object to Blocklist 104 * 105 * @param info - Station object 106 * @return ErrCode - operation result 107 */ 108 ErrCode AddBlockList(const StationInfo &info) override; 109 110 /** 111 * @Description Del a StationInfo object from Blocklist 112 * 113 * @param info - StationInfo object 114 * @return ErrCode - operation result 115 */ 116 ErrCode DelBlockList(const StationInfo &info) override; 117 118 /** 119 * @Description Get the Valid Bands object 120 * 121 * @param bands - Get result vector of BandType 122 * @return ErrCode - operation result 123 */ 124 ErrCode GetValidBands(std::vector<BandType> &bands) override; 125 126 /** 127 * @Description Get the Valid Channels object 128 * 129 * @param band - Specified band 130 * @param validchannels - Obtains the channels corresponding to the specified band 131 * @return ErrCode - operation result 132 */ 133 ErrCode GetValidChannels(BandType band, std::vector<int32_t> &validchannels) override; 134 135 /** 136 * @Description Register callback client 137 * 138 * @param callback - callback struct 139 * @return ErrCode - operation result 140 */ 141 ErrCode RegisterCallBack(const sptr<IWifiHotspotCallback> &callback) override; 142 143 /** 144 * @Description Get supported features 145 * 146 * @param features - return supported features 147 * @return ErrCode - operation result 148 */ 149 ErrCode GetSupportedFeatures(long &features) override; 150 151 /** 152 * @Description Handle remote object died event. 153 * @param remoteObject remote object. 154 */ 155 void OnRemoteDied(const wptr<IRemoteObject>& remoteObject) override; 156 157 private: 158 static BrokerDelegator<WifiHotspotProxy> g_delegator; 159 160 bool mRemoteDied; 161 }; 162 } // namespace Wifi 163 } // namespace OHOS 164 #endif