1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. 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 WIFI_SCAN 17 #define WIFI_SCAN 18 #include "wifi_hal.h" 19 20 #define SCAN_QUAL_INVALID 1U << 0 21 #define SCAN_NOISE_INVALID 1U << 1 22 #define SCAN_LEVEL_INVALID 1U << 2 23 #define SCAN_LEVEL_DBM 1U << 3 24 #define SCAN_ASSOCIATED 1U << 5 25 26 #define BITNUMS_OF_ONE_BYTE 8 27 #define SLOW_SCAN_INTERVAL_MULTIPLIER 3 28 #define FAST_SCAN_ITERATIONS 3 29 #define SCHED_SCAN_PLANS_ATTR_INDEX1 1 30 #define SCHED_SCAN_PLANS_ATTR_INDEX2 2 31 #define MS_PER_SECOND 1000 32 #define SIGNAL_LEVEL_CONFFICIENT 100 33 34 typedef struct { 35 uint8_t maxNumScanSsids; 36 uint8_t maxNumSchedScanSsids; 37 uint8_t maxMatchSets; 38 uint32_t maxNumScanPlans; 39 uint32_t maxScanPlanInterval; 40 uint32_t maxScanPlanIterations; 41 } ScanCapabilities; 42 43 typedef struct { 44 bool supportsRandomMacSchedScan; 45 bool supportsLowPowerOneshotScan; 46 bool supportsExtSchedScanRelativeRssi; 47 } WiphyFeatures; 48 49 typedef struct { 50 ScanCapabilities scanCapabilities; 51 WiphyFeatures wiphyFeatures; 52 } WiphyInfo; 53 54 WifiError WifiStartScan(wifiInterfaceHandle handle, 55 const OHOS::HDI::Wlan::Chip::V2_0::ScanParams& scanParam); 56 WifiError WifiGetScanInfo(wifiInterfaceHandle handle, 57 std::vector<OHOS::HDI::Wlan::Chip::V2_0::ScanResultsInfo>& mscanResults); 58 WifiError WifiStartPnoScan(wifiInterfaceHandle handle, 59 const OHOS::HDI::Wlan::Chip::V2_0::PnoScanParams& scanParam); 60 WifiError WifiStopPnoScan(wifiInterfaceHandle handle); 61 62 #endif 63