Skip to content

Commit

Permalink
Changed wifi provisioning scan method
Browse files Browse the repository at this point in the history
Signed-off-by: sanket.wadekar <[email protected]>
  • Loading branch information
sanketwadekar committed Dec 31, 2022
1 parent 490216a commit 9067214
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
12 changes: 12 additions & 0 deletions components/wifi_provisioning/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,16 @@ menu "Wi-Fi Provisioning Manager"
depends on WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
default y

choice WIFI_PROV_STA_SCAN_METHOD
bool "Wifi Provisioning Scan Method"
default WIFI_PROV_STA_ALL_CHANNEL_SCAN
config WIFI_PROV_STA_ALL_CHANNEL_SCAN
bool "All Channel Scan"
help
Scan will end after scanning the entire channel. This option is useful in Mesh WiFi Systems.
config WIFI_PROV_STA_FAST_SCAN
bool "Fast Scan"
help
Scan will end after an AP matching with the SSID has been detected.
endchoice
endmenu
25 changes: 12 additions & 13 deletions components/wifi_provisioning/src/handlers.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -118,6 +110,13 @@ static esp_err_t set_config_handler(const wifi_prov_config_set_data_t *req_data,
/* Using strlcpy allows both max passphrase length (63 bytes) and ensures null termination
* because size of wifi_cfg->sta.password is 64 bytes (1 extra byte for null character) */
strlcpy((char *) wifi_cfg->sta.password, req_data->password, sizeof(wifi_cfg->sta.password));

#ifdef CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN
wifi_cfg->sta.scan_method = WIFI_ALL_CHANNEL_SCAN;
#else /* CONFIG_WIFI_PROV_STA_FAST_SCAN */
wifi_cfg->sta.scan_method = WIFI_FAST_SCAN;
#endif

return ESP_OK;
}

Expand Down
1 change: 0 additions & 1 deletion tools/ci/check_copyright_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,6 @@ components/wifi_provisioning/proto-c/wifi_scan.pb-c.h
components/wifi_provisioning/python/wifi_config_pb2.py
components/wifi_provisioning/python/wifi_constants_pb2.py
components/wifi_provisioning/python/wifi_scan_pb2.py
components/wifi_provisioning/src/handlers.c
components/wifi_provisioning/src/scheme_console.c
components/wifi_provisioning/src/wifi_config.c
components/wifi_provisioning/src/wifi_provisioning_priv.h
Expand Down

0 comments on commit 9067214

Please sign in to comment.