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 BITNUMS_OF_ONE_BYTE 8 30 #define SCHED_SCAN_PLANS_ATTR_INDEX1 1 31 #define SCHED_SCAN_PLANS_ATTR_INDEX2 2 32 #define MS_PER_SECOND 1000 33 #define SIGNAL_LEVEL_CONFFICIENT 100 34 35 36 typedef struct { 37 uint8_t maxNumScanSsids; 38 uint8_t maxNumSchedScanSsids; 39 uint8_t maxMatchSets; 40 uint32_t maxNumScanPlans; 41 uint32_t maxScanPlanInterval; 42 uint32_t maxScanPlanIterations; 43 } ScanCapabilities; 44 45 typedef struct { 46 bool supportsRandomMacSchedScan; 47 bool supportsLowPowerOneshotScan; 48 bool supportsExtSchedScanRelativeRssi; 49 } WiphyFeatures; 50 51 typedef struct { 52 ScanCapabilities scanCapabilities; 53 WiphyFeatures wiphyFeatures; 54 } WiphyInfo; 55 56 WifiError WifiStartScan(wifiInterfaceHandle handle, 57 const OHOS::HDI::Wlan::Chip::V1_0::ScanParams& scanParam); 58 WifiError WifiGetScanInfo(wifiInterfaceHandle handle, 59 std::vector<OHOS::HDI::Wlan::Chip::V1_0::ScanResultsInfo>& mscanResults); 60 WifiError WifiStartPnoScan(wifiInterfaceHandle handle, 61 const OHOS::HDI::Wlan::Chip::V1_0::PnoScanParams& scanParam); 62 WifiError WifiStopPnoScan(wifiInterfaceHandle handle); 63 64 #endif 65