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