• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_H
17 #define OHOS_WIFI_HOTSPOT_H
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 #include "wifi_errcode.h"
23 #include "wifi_ap_msg.h"
24 #include "i_wifi_hotspot_callback.h"
25 
26 namespace OHOS {
27 namespace Wifi {
28 class WifiHotspot {
29 public:
30     static std::unique_ptr<WifiHotspot> CreateWifiHotspot(int system_ability_id, int id = 0);
31 
32     static std::unique_ptr<WifiHotspot> GetInstance(int system_ability_id, int id = 0);
33 
34     virtual ~WifiHotspot();
35 
36     /**
37      * @Description Check whether the hotspot is active.
38      *
39      * @param isActive - active / inactive
40      * @return ErrCode - operation result
41      */
42     virtual ErrCode IsHotspotActive(bool &isActive) = 0;
43 
44     /**
45      * @Description Check whether the hotspot supports dual band.
46      *
47      * @param isSupported - Supported / NOT Supported
48      * @return ErrCode - operation result
49      */
50     virtual ErrCode IsHotspotDualBandSupported(bool &isSupported) = 0;
51 
52     /**
53      * @Description Get the Hotspot Config object
54      *
55      * @param state - Result of obtaining the hotspot status
56      * @return ErrCode - operation result
57      */
58     virtual ErrCode GetHotspotState(int &state) = 0;
59 
60     /**
61      * @Description Get the Hotspot State object
62      *
63      * @param config - Current hotspot configuration
64      * @return ErrCode - operation result
65      */
66     virtual ErrCode GetHotspotConfig(HotspotConfig &config) = 0;
67 
68     /**
69      * @Description Set the configuration of Hotspot
70      *
71      * @param config - HotspotConfig object,
72      * @return ErrCode - operation result
73      */
74     virtual ErrCode SetHotspotConfig(const HotspotConfig &config) = 0;
75 
76     /**
77      * @Description Get the Station List object
78      *
79      * @param result - Get result vector of connect Station Info
80      * @return ErrCode - operation result
81      */
82     virtual ErrCode GetStationList(std::vector<StationInfo> &result) = 0;
83 
84     /**
85      * @Description Disconnects a specified sta connection when ap is opened
86      *
87      * @param info - StationInfo object
88      * @return ErrCode - operation result
89      */
90     virtual ErrCode DisassociateSta(const StationInfo &info) = 0;
91 
92     /**
93      * @Description Enable Hotspot
94      *
95      * @param type - service type
96      * @return ErrCode - operation result
97      */
98     virtual ErrCode EnableHotspot(const ServiceType type = ServiceType::DEFAULT) = 0;
99 
100     /**
101      * @Description Disable Hotspot
102      *
103      * @param type - service type
104      * @return ErrCode - operation result
105      */
106     virtual ErrCode DisableHotspot(const ServiceType type = ServiceType::DEFAULT) = 0;
107 
108     /**
109      * @Description Get the Block Lists object
110      *
111      * @param infos - Get Blocklist result vector of StationInfo
112      * @return ErrCode - operation result
113      */
114     virtual ErrCode GetBlockLists(std::vector<StationInfo> &infos) = 0;
115 
116     /**
117      * @Description Add a StationInfo object to Blocklist when ap is opened
118      *
119      * @param info - StationInfo object
120      * @return ErrCode - operation result
121      */
122     virtual ErrCode AddBlockList(const StationInfo &info) = 0;
123 
124     /**
125      * @Description Del a StationInfo object from Blocklist
126      *
127      * @param info - StationInfo object
128      * @return ErrCode - operation result
129      */
130     virtual ErrCode DelBlockList(const StationInfo &info) = 0;
131 
132     /**
133      * @Description Get the Valid Bands object
134      *
135      * @param bands - Get result vector of BandType when ap is opened
136      * @return ErrCode - operation result
137      */
138     virtual ErrCode GetValidBands(std::vector<BandType> &bands) = 0;
139 
140     /**
141      * @Description Get the Valid Channels object when ap is opened
142      *
143      * @param band - Specified Valid Band.
144      * @param validchannels - Obtains the channels corresponding to the specified band
145      * @return ErrCode - operation result
146      */
147     virtual ErrCode GetValidChannels(BandType band, std::vector<int32_t> &validchannels) = 0;
148 
149     /**
150      * @Description Register callback client
151      *
152      * @param callback - callback struct
153      * @return ErrCode - operation result
154      */
155     virtual ErrCode RegisterCallBack(const sptr<IWifiHotspotCallback> &callback) = 0;
156 
157     /**
158      * @Description Get supported features
159      *
160      * @param features - return supported features
161      * @return ErrCode - operation result
162      */
163     virtual ErrCode GetSupportedFeatures(long &features) = 0;
164 
165     /**
166      * @Description Check if supported input feature
167      *
168      * @param feature - input feature
169      * @return bool - true if supported, false if unsupported
170      */
171     virtual bool IsFeatureSupported(long feature) = 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 }  // namespace Wifi
198 }  // namespace OHOS
199 #endif