mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
Merge branch 'wifi_prov_mgr_fix_v4.3' into 'release/v4.3'
Wifi_prov_mgr: Fix for ios device needs to do forget device (v4.3) See merge request espressif/esp-idf!15484
This commit is contained in:
commit
98d34e5f6d
@ -1,16 +1,8 @@
|
||||
// Copyright 2018 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: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -86,6 +78,12 @@ typedef struct protocomm_ble_config {
|
||||
* Pointer to the Name-UUID lookup table
|
||||
*/
|
||||
protocomm_ble_name_uuid_t *nu_lookup;
|
||||
|
||||
/**
|
||||
* BLE bonding
|
||||
*/
|
||||
unsigned ble_bonding:1;
|
||||
|
||||
} protocomm_ble_config_t;
|
||||
|
||||
/**
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2015-2018 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: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <esp_system.h>
|
||||
@ -272,6 +264,25 @@ esp_err_t simple_ble_start(simple_ble_cfg_t *cfg)
|
||||
ESP_LOGE(TAG, "set local MTU failed, error code = 0x%x", local_mtu_ret);
|
||||
}
|
||||
ESP_LOGD(TAG, "Free mem at end of simple_ble_init %d", esp_get_free_heap_size());
|
||||
|
||||
/* set the security iocap & auth_req & key size & init key response key parameters to the stack*/
|
||||
esp_ble_auth_req_t auth_req;
|
||||
if (cfg->ble_bonding) {
|
||||
auth_req = ESP_LE_AUTH_REQ_SC_MITM_BOND; //bonding with peer device after authentication
|
||||
} else {
|
||||
auth_req = ESP_LE_AUTH_REQ_SC_MITM;
|
||||
}
|
||||
esp_ble_io_cap_t iocap = ESP_IO_CAP_NONE; //set the IO capability to No output No input
|
||||
uint8_t key_size = 16; //the key size should be 7~16 bytes
|
||||
uint8_t init_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
|
||||
uint8_t rsp_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
|
||||
|
||||
esp_ble_gap_set_security_param(ESP_BLE_SM_AUTHEN_REQ_MODE, &auth_req, sizeof(uint8_t));
|
||||
esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(uint8_t));
|
||||
esp_ble_gap_set_security_param(ESP_BLE_SM_MAX_KEY_SIZE, &key_size, sizeof(uint8_t));
|
||||
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_INIT_KEY, &init_key, sizeof(uint8_t));
|
||||
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_RSP_KEY, &rsp_key, sizeof(uint8_t));
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2015-2018 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: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef _SIMPLE_BLE_
|
||||
#define _SIMPLE_BLE_
|
||||
|
||||
@ -57,6 +49,8 @@ typedef struct {
|
||||
simple_ble_cb_t *connect_fn;
|
||||
/** MTU set callback */
|
||||
simple_ble_cb_t *set_mtu_fn;
|
||||
/** BLE bonding **/
|
||||
unsigned ble_bonding:1;
|
||||
} simple_ble_cfg_t;
|
||||
|
||||
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2018 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: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <esp_log.h>
|
||||
@ -653,6 +645,8 @@ esp_err_t protocomm_ble_start(protocomm_t *pc, const protocomm_ble_config_t *con
|
||||
ble_config->device_name = protocomm_ble_device_name;
|
||||
ble_config->gatt_db_count = populate_gatt_db(&ble_config->gatt_db);
|
||||
|
||||
ble_config->ble_bonding = config->ble_bonding;
|
||||
|
||||
if (ble_config->gatt_db_count == -1) {
|
||||
ESP_LOGE(TAG, "Invalid GATT database count");
|
||||
simple_ble_deinit();
|
||||
|
@ -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-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <esp_log.h>
|
||||
@ -129,6 +121,8 @@ typedef struct {
|
||||
simple_ble_cb_t *connect_fn;
|
||||
/** MTU set callback */
|
||||
simple_ble_cb_t *set_mtu_fn;
|
||||
/** BLE bonding **/
|
||||
unsigned ble_bonding:1;
|
||||
} simple_ble_cfg_t;
|
||||
|
||||
static simple_ble_cfg_t *ble_cfg_p;
|
||||
@ -492,6 +486,17 @@ static int simple_ble_start(const simple_ble_cfg_t *cfg)
|
||||
ble_hs_cfg.reset_cb = simple_ble_on_reset;
|
||||
ble_hs_cfg.sync_cb = simple_ble_on_sync;
|
||||
ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb;
|
||||
ble_hs_cfg.store_status_cb = ble_store_util_status_rr;
|
||||
|
||||
/* Initialize security manager configuration in NimBLE host */
|
||||
ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_NO_IO; /* Just Works */
|
||||
ble_hs_cfg.sm_bonding = cfg->ble_bonding;
|
||||
ble_hs_cfg.sm_mitm = 1;
|
||||
ble_hs_cfg.sm_sc = 1; /* Enable secure connection by default */
|
||||
|
||||
/* Distribute LTK and IRK */
|
||||
ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID;
|
||||
ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID;
|
||||
|
||||
rc = gatt_svr_init(cfg);
|
||||
if (rc != 0) {
|
||||
@ -900,6 +905,7 @@ esp_err_t protocomm_ble_start(protocomm_t *pc, const protocomm_ble_config_t *con
|
||||
ble_config->adv_params = adv_params;
|
||||
|
||||
ble_config->device_name = protocomm_ble_device_name;
|
||||
ble_config->ble_bonding = config->ble_bonding;
|
||||
|
||||
if (populate_gatt_db(&ble_config->gatt_db, config) != 0) {
|
||||
ESP_LOGE(TAG, "Error populating GATT Database");
|
||||
|
@ -15,4 +15,11 @@ menu "Wi-Fi Provisioning Manager"
|
||||
Time (in seconds) after which the Wi-Fi provisioning manager will auto-stop after connecting to
|
||||
a Wi-Fi network successfully.
|
||||
|
||||
config WIFI_PROV_BLE_BONDING
|
||||
bool
|
||||
default n
|
||||
prompt "Enable BLE bonding"
|
||||
depends on BT_ENABLED
|
||||
help
|
||||
This option is applicable only when provisioning transport is BLE.
|
||||
endmenu
|
||||
|
@ -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-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <esp_log.h>
|
||||
@ -46,6 +38,10 @@ static esp_err_t prov_start(protocomm_t *pc, void *config)
|
||||
|
||||
protocomm_ble_config_t *ble_config = (protocomm_ble_config_t *) config;
|
||||
|
||||
#ifdef CONFIG_WIFI_PROV_BLE_BONDING
|
||||
ble_config->ble_bonding = 1;
|
||||
#endif
|
||||
|
||||
/* Start protocomm as BLE service */
|
||||
if (protocomm_ble_start(pc, ble_config) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to start protocomm BLE service");
|
||||
|
4273
tools/ci/check_copyright_ignore.txt
Normal file
4273
tools/ci/check_copyright_ignore.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user