From 1a8f37b383de736f34bec19565d2151591584990 Mon Sep 17 00:00:00 2001 From: lly Date: Tue, 3 Sep 2019 19:32:05 +0800 Subject: [PATCH] ble_mesh: update ble mesh examples sdkconfig.defaults --- .../mesh_core/mesh_bearer_adapt.c | 16 ++--- components/bt/esp_ble_mesh/mesh_core/net.c | 10 +-- components/bt/esp_ble_mesh/mesh_core/prov.c | 2 +- .../bt/esp_ble_mesh/mesh_core/transport.c | 62 +++++++++---------- .../ble_mesh_client_model/sdkconfig.defaults | 2 + .../ble_mesh_node/sdkconfig.defaults | 2 + .../ble_mesh_provisioner/sdkconfig.defaults | 2 + .../sdkconfig.defaults | 2 + .../sdkconfig.defaults | 2 + .../ble_mesh_node/sdkconfig.defaults | 2 + .../ble_mesh_provisioner/sdkconfig.defaults | 2 + .../ble_mesh_wifi_coexist/sdkconfig.defaults | 2 + 12 files changed, 62 insertions(+), 44 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/mesh_bearer_adapt.c b/components/bt/esp_ble_mesh/mesh_core/mesh_bearer_adapt.c index 8724bf8573..d6eed43b8e 100644 --- a/components/bt/esp_ble_mesh/mesh_core/mesh_bearer_adapt.c +++ b/components/bt/esp_ble_mesh/mesh_core/mesh_bearer_adapt.c @@ -1656,21 +1656,23 @@ const u8_t *bt_mesh_pub_key_get(void) BT_OCTET32 private_key = {0}; Point public_key = {0}; -#if 1 if (bt_mesh_atomic_test_bit(bt_mesh_dev.flags, BLE_MESH_DEV_HAS_PUB_KEY)) { return bt_mesh_public_key; } -#else + /* BLE Mesh BQB test case MESH/NODE/PROV/UPD/BV-12-C requires * different public key for each provisioning procedure. * Note: if enabled, when Provisioner provision multiple devices * at the same time, this may cause invalid confirmation value. + * + * Use the following code for generating different private key + * for each provisioning procedure. + * + * if (bt_mesh_rand(bt_mesh_private_key, BT_OCTET32_LEN)) { + * BT_ERR("%s, Unable to generate bt_mesh_private_key", __func__); + * return NULL; + * } */ - if (bt_mesh_rand(bt_mesh_private_key, BT_OCTET32_LEN)) { - BT_ERR("%s, Unable to generate bt_mesh_private_key", __func__); - return NULL; - } -#endif memcpy(private_key, bt_mesh_private_key, BT_OCTET32_LEN); ECC_PointMult(&public_key, &(curve_p256.G), (DWORD *)private_key, KEY_LENGTH_DWORDS_P256); diff --git a/components/bt/esp_ble_mesh/mesh_core/net.c b/components/bt/esp_ble_mesh/mesh_core/net.c index a9bbb2e6b8..ad778269a9 100644 --- a/components/bt/esp_ble_mesh/mesh_core/net.c +++ b/components/bt/esp_ble_mesh/mesh_core/net.c @@ -785,11 +785,11 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf, } if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) { - if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY) && - bt_mesh_proxy_relay(&buf->b, dst)) { - send_cb_finalize(cb, cb_data); - return 0; - } + if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY) && + bt_mesh_proxy_relay(&buf->b, dst)) { + send_cb_finalize(cb, cb_data); + return 0; + } } bt_mesh_adv_send(buf, cb, cb_data); diff --git a/components/bt/esp_ble_mesh/mesh_core/prov.c b/components/bt/esp_ble_mesh/mesh_core/prov.c index b270519365..63848eaa51 100644 --- a/components/bt/esp_ble_mesh/mesh_core/prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/prov.c @@ -1527,7 +1527,7 @@ static void gen_prov_start(struct prov_rx *rx, struct net_buf_simple *buf) if (link.rx.buf->len > link.rx.buf->size) { BT_ERR("%s, Too large provisioning PDU (%u bytes)", __func__, link.rx.buf->len); - // prov_send_fail_msg(PROV_ERR_NVAL_FMT); + /* Zephyr uses prov_send_fail_msg() here */ return; } diff --git a/components/bt/esp_ble_mesh/mesh_core/transport.c b/components/bt/esp_ble_mesh/mesh_core/transport.c index 19a3b0c668..9b3606a981 100644 --- a/components/bt/esp_ble_mesh/mesh_core/transport.c +++ b/components/bt/esp_ble_mesh/mesh_core/transport.c @@ -418,28 +418,28 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu, net_buf_simple_pull(sdu, len); if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) { - if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND)) { - enum bt_mesh_friend_pdu_type type; + if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND)) { + enum bt_mesh_friend_pdu_type type; - if (seg_o == tx->seg_n) { - type = BLE_MESH_FRIEND_PDU_COMPLETE; - } else { - type = BLE_MESH_FRIEND_PDU_PARTIAL; - } + if (seg_o == tx->seg_n) { + type = BLE_MESH_FRIEND_PDU_COMPLETE; + } else { + type = BLE_MESH_FRIEND_PDU_PARTIAL; + } - if (bt_mesh_friend_enqueue_tx(net_tx, type, - &tx->seq_auth, - tx->seg_n + 1, - &seg->b) && - BLE_MESH_ADDR_IS_UNICAST(net_tx->ctx->addr)) { - /* PDUs for a specific Friend should only go - * out through the Friend Queue. - */ - net_buf_unref(seg); - continue; + if (bt_mesh_friend_enqueue_tx(net_tx, type, + &tx->seq_auth, + tx->seg_n + 1, + &seg->b) && + BLE_MESH_ADDR_IS_UNICAST(net_tx->ctx->addr)) { + /* PDUs for a specific Friend should only go + * out through the Friend Queue. + */ + net_buf_unref(seg); + continue; + } } } - } tx->seg[seg_o] = net_buf_ref(seg); @@ -1543,26 +1543,26 @@ int bt_mesh_trans_recv(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx) * */ if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) { - if (IS_ENABLED(CONFIG_BLE_MESH_LOW_POWER) && - (bt_mesh_lpn_timer() || - (bt_mesh_lpn_established() && bt_mesh_lpn_waiting_update()))) { - bt_mesh_lpn_msg_received(rx); - } + if (IS_ENABLED(CONFIG_BLE_MESH_LOW_POWER) && + (bt_mesh_lpn_timer() || + (bt_mesh_lpn_established() && bt_mesh_lpn_waiting_update()))) { + bt_mesh_lpn_msg_received(rx); + } } net_buf_simple_restore(buf, &state); if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) { - if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND) && rx->friend_match && !err) { - if (seq_auth == TRANS_SEQ_AUTH_NVAL) { - bt_mesh_friend_enqueue_rx(rx, pdu_type, NULL, - seg_count, buf); - } else { - bt_mesh_friend_enqueue_rx(rx, pdu_type, &seq_auth, - seg_count, buf); + if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND) && rx->friend_match && !err) { + if (seq_auth == TRANS_SEQ_AUTH_NVAL) { + bt_mesh_friend_enqueue_rx(rx, pdu_type, NULL, + seg_count, buf); + } else { + bt_mesh_friend_enqueue_rx(rx, pdu_type, &seq_auth, + seg_count, buf); + } } } - } return err; } diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/sdkconfig.defaults b/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/sdkconfig.defaults index e1aee38f72..0be67101dd 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/sdkconfig.defaults @@ -7,10 +7,12 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM= CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n CONFIG_BLE_SCAN_DUPLICATE=y CONFIG_SCAN_DUPLICATE_TYPE=2 +CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y CONFIG_MESH_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=n CONFIG_GATTS_ENABLE=y CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y CONFIG_BLE_MESH=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/sdkconfig.defaults b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/sdkconfig.defaults index 732947bb16..1a9c02e1bf 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/sdkconfig.defaults @@ -10,10 +10,12 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM= CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n CONFIG_BLE_SCAN_DUPLICATE=y CONFIG_SCAN_DUPLICATE_TYPE=2 +CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y CONFIG_MESH_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=n CONFIG_GATTS_ENABLE=y CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y CONFIG_BLE_MESH=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/sdkconfig.defaults b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/sdkconfig.defaults index 9c0ad1b87c..cf11fdcc8c 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/sdkconfig.defaults @@ -7,10 +7,12 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM= CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n CONFIG_BLE_SCAN_DUPLICATE=y CONFIG_SCAN_DUPLICATE_TYPE=2 +CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y CONFIG_MESH_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=n CONFIG_BLE_MESH=y CONFIG_BLE_MESH_HCI_5_0=y CONFIG_BLE_MESH_USE_DUPLICATE_SCAN=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_client/sdkconfig.defaults b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_client/sdkconfig.defaults index a5c4750931..22854582c3 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_client/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_client/sdkconfig.defaults @@ -7,10 +7,12 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM= CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n CONFIG_BLE_SCAN_DUPLICATE=y CONFIG_SCAN_DUPLICATE_TYPE=2 +CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y CONFIG_MESH_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=n CONFIG_BLE_MESH=y CONFIG_BLE_MESH_HCI_5_0=y CONFIG_BLE_MESH_USE_DUPLICATE_SCAN=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server/sdkconfig.defaults b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server/sdkconfig.defaults index 4f6ca5787a..5118ab757f 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server/sdkconfig.defaults @@ -7,10 +7,12 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM= CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n CONFIG_BLE_SCAN_DUPLICATE=y CONFIG_SCAN_DUPLICATE_TYPE=2 +CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y CONFIG_MESH_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=n CONFIG_GATTS_ENABLE=y CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y CONFIG_BLE_MESH=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/sdkconfig.defaults b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/sdkconfig.defaults index 565e251ebd..292c41a327 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/sdkconfig.defaults @@ -7,10 +7,12 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM= CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n CONFIG_BLE_SCAN_DUPLICATE=y CONFIG_SCAN_DUPLICATE_TYPE=2 +CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y CONFIG_MESH_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=n CONFIG_GATTS_ENABLE=y CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y CONFIG_BLE_MESH=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.defaults b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.defaults index 12c5be5d12..ae512edd8c 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.defaults @@ -7,10 +7,12 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM= CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n CONFIG_BLE_SCAN_DUPLICATE=y CONFIG_SCAN_DUPLICATE_TYPE=2 +CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y CONFIG_MESH_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=n CONFIG_BLE_MESH=y CONFIG_BLE_MESH_HCI_5_0=y CONFIG_BLE_MESH_USE_DUPLICATE_SCAN=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.defaults b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.defaults index 5ef063bfee..214f15eb6c 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.defaults @@ -11,10 +11,12 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM= CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n CONFIG_BLE_SCAN_DUPLICATE=y CONFIG_SCAN_DUPLICATE_TYPE=2 +CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y CONFIG_MESH_DUPLICATE_SCAN_CACHE_SIZE=200 CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=n CONFIG_GATTS_ENABLE=y CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y CONFIG_BLE_MESH=y