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_SCAN_IMPL 17 #define OHOS_WIFI_SCAN_IMPL 18 19 #include "wifi_scan.h" 20 #include "wifi_scan_proxy.h" 21 22 namespace OHOS { 23 namespace Wifi { 24 class WifiScanImpl : public Wifi::WifiScan { 25 public: 26 explicit WifiScanImpl(int systemAbilityId); 27 ~WifiScanImpl(); 28 bool Init(); 29 30 /** 31 * @Description Set the Scan Control Info object 32 * 33 * @param info - ScanControlInfo object 34 * @return ErrCode - operation result 35 */ 36 virtual ErrCode SetScanControlInfo(const ScanControlInfo &info) override; 37 38 /** 39 * @Description Start scan Wifi 40 * 41 * @return ErrCode - operation result 42 */ 43 virtual ErrCode Scan() override; 44 45 /** 46 * @Description Obtain the scanning result 47 * 48 * @param result - Get result venctor of WifiScanInfo 49 * @return ErrCode - operation result 50 */ 51 virtual ErrCode GetScanInfoList(std::vector<WifiScanInfo> &result) override; 52 53 virtual ErrCode RegisterCallBack(const sptr<IWifiScanCallback> &callback) override; 54 55 /** 56 * @Description Get supported features 57 * 58 * @param features - return supported features 59 * @return ErrCode - operation result 60 */ 61 ErrCode GetSupportedFeatures(long &features) override; 62 63 /** 64 * @Description Check if supported input feature 65 * 66 * @param feature - input feature 67 * @return true - supported 68 * @return false - unsupported 69 */ 70 bool IsFeatureSupported(long feature) override; 71 72 /** 73 * @Description Check whether the ScanAlways mode is enabled 74 * 75 * @param bOpen - true / false 76 * @return ErrCode - operation result 77 */ 78 ErrCode IsWifiClosedScan(bool &bOpen); 79 80 /** 81 * @Description Start scan with specified params 82 * 83 * @param params - WifiScanParams object 84 * @return ErrCode - operation result 85 */ 86 ErrCode AdvanceScan(const WifiScanParams ¶ms); 87 88 private: 89 int systemAbilityId_; 90 sptr<OHOS::Wifi::IWifiScan> client_; 91 }; 92 } // namespace Wifi 93 } // namespace OHOS 94 #endif