• 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_SCAN_H
17 #define OHOS_WIFI_SCAN_H
18 
19 #include "wifi_errcode.h"
20 #include "wifi_scan_msg.h"
21 #include "i_wifi_scan_callback.h"
22 
23 namespace OHOS {
24 namespace Wifi {
25 class WifiScan {
26 public:
27     static std::unique_ptr<WifiScan> CreateWifiScan(int system_ability_id);
28     static std::unique_ptr<WifiScan> GetInstance(int system_ability_id);
29 
~WifiScan()30     virtual ~WifiScan()
31     {}
32 
33     /**
34      * @Description Set the Scan Control Info object
35      *
36      * @param info - ScanControlInfo object
37      * @return ErrCode - operation result
38      */
39     virtual ErrCode SetScanControlInfo(const ScanControlInfo &info) = 0;
40 
41     /**
42      * @Description Start scan Wifi
43      *
44      * @return ErrCode - operation result
45      */
46     virtual ErrCode Scan() = 0;
47 
48     /**
49      * @Description Obtain the scanning result
50      *
51      * @param result - Get result vector of WifiScanInfo
52      * @return ErrCode - operation result
53      */
54     virtual ErrCode GetScanInfoList(std::vector<WifiScanInfo> &result) = 0;
55 
56 #ifdef OHOS_ARCH_LITE
57     virtual ErrCode RegisterCallBack(const std::shared_ptr<IWifiScanCallback> &callback) = 0;
58 #else
59     virtual ErrCode RegisterCallBack(const sptr<IWifiScanCallback> &callback) = 0;
60 #endif
61 
62     /**
63      * @Description Get supported features
64      *
65      * @param features - return supported features
66      * @return ErrCode - operation result
67      */
68     virtual ErrCode GetSupportedFeatures(long &features) = 0;
69 
70     /**
71      * @Description Check if supported input feature
72      *
73      * @param feature - input feature
74      * @return bool - true if supported, false if unsupported
75      */
76     virtual bool IsFeatureSupported(long feature) = 0;
77 };
78 }  // namespace Wifi
79 }  // namespace OHOS
80 #endif