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