mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
ble_mesh: Miscellaneous modifications
1. Add an API to get provisioned node count 2. Update several ble mesh documents 3. Fix some bugs which have been merged
This commit is contained in:
parent
3d49e49210
commit
36918e179c
@ -1749,7 +1749,7 @@ if BLE_MESH
|
||||
|
||||
config BLE_MESH_PROVISIONER_APP_KEY_COUNT
|
||||
int "Maximum number of application keys that can be owned by Provisioner"
|
||||
default 9
|
||||
default 3
|
||||
range 1 4096
|
||||
help
|
||||
This option specifies how many application keys the Provisioner can have.
|
||||
@ -2058,7 +2058,7 @@ if BLE_MESH
|
||||
|
||||
config BLE_MESH_TX_SEG_MAX
|
||||
int "Maximum number of segments in outgoing messages"
|
||||
default 20
|
||||
default 32
|
||||
range 2 32
|
||||
help
|
||||
Maximum number of segments supported for outgoing messages.
|
||||
|
@ -495,6 +495,11 @@ const uint8_t *esp_ble_mesh_provisioner_get_local_net_key(uint16_t net_idx)
|
||||
return bt_mesh_provisioner_local_net_key_get(net_idx);
|
||||
}
|
||||
|
||||
uint16_t esp_ble_mesh_provisioner_get_prov_node_count(void)
|
||||
{
|
||||
return btc_ble_mesh_provisioner_get_prov_node_count();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BLE_MESH_PROVISIONER */
|
||||
|
||||
#if (CONFIG_BLE_MESH_FAST_PROV)
|
||||
|
@ -362,6 +362,14 @@ esp_err_t esp_ble_mesh_provisioner_update_local_net_key(const uint8_t net_key[16
|
||||
*/
|
||||
const uint8_t *esp_ble_mesh_provisioner_get_local_net_key(uint16_t net_idx);
|
||||
|
||||
/**
|
||||
* @brief This function is called by Provisioner to get provisioned node count.
|
||||
*
|
||||
* @return Number of the provisioned nodes.
|
||||
*
|
||||
*/
|
||||
uint16_t esp_ble_mesh_provisioner_get_prov_node_count(void);
|
||||
|
||||
/**
|
||||
* @brief This function is called to get fast provisioning application key.
|
||||
*
|
||||
|
@ -323,7 +323,7 @@ typedef uint8_t esp_ble_mesh_bd_addr_t[BD_ADDR_LEN];
|
||||
/// BLE device address type
|
||||
typedef uint8_t esp_ble_mesh_addr_type_t;
|
||||
|
||||
/*!< BLE Mesh deinit parameters */
|
||||
/** BLE Mesh deinit parameters */
|
||||
typedef struct {
|
||||
bool erase_flash; /*!< Indicate if erasing flash when deinit mesh stack */
|
||||
} esp_ble_mesh_deinit_param_t;
|
||||
@ -354,17 +354,17 @@ typedef struct {
|
||||
/** Pointer to the model to which the context belongs. Initialized by the stack. */
|
||||
esp_ble_mesh_model_t *model;
|
||||
|
||||
uint16_t publish_addr; /*!< Publish Address. */
|
||||
uint16_t app_idx; /*!< Publish AppKey Index. */
|
||||
uint16_t publish_addr; /*!< Publish Address. */
|
||||
uint16_t app_idx:12, /*!< Publish AppKey Index. */
|
||||
cred:1; /*!< Friendship Credentials Flag. */
|
||||
|
||||
uint8_t ttl; /*!< Publish Time to Live. */
|
||||
uint8_t retransmit; /*!< Retransmit Count & Interval Steps. */
|
||||
uint8_t ttl; /*!< Publish Time to Live. */
|
||||
uint8_t retransmit; /*!< Retransmit Count & Interval Steps. */
|
||||
|
||||
uint8_t period; /*!< Publish Period. */
|
||||
uint16_t period_div: 4, /*!< Divisor for the Period. */
|
||||
cred: 1, /*!< Friendship Credentials Flag. */
|
||||
fast_period: 1, /*!< Use FastPeriodDivisor */
|
||||
count: 3; /*!< Retransmissions left. */
|
||||
uint8_t period_div:4, /*!< Divisor for the Period. */
|
||||
fast_period:1, /*!< Use FastPeriodDivisor */
|
||||
count:3; /*!< Retransmissions left. */
|
||||
|
||||
uint32_t period_start; /*!< Start of the current period. */
|
||||
|
||||
@ -993,7 +993,7 @@ typedef union {
|
||||
*/
|
||||
struct ble_mesh_provisioner_prov_dev_with_addr_comp_param {
|
||||
int err_code; /*!< Indicate the result of Provisioner starting to provision a device */
|
||||
} provisioner_prov_dev_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT */
|
||||
} provisioner_prov_dev_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT */
|
||||
/**
|
||||
* @brief ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT
|
||||
*/
|
||||
|
@ -996,6 +996,11 @@ const esp_ble_mesh_comp_t *btc_ble_mesh_comp_get(void)
|
||||
return (const esp_ble_mesh_comp_t *)bt_mesh_comp_get();
|
||||
}
|
||||
|
||||
u16_t btc_ble_mesh_provisioner_get_prov_node_count(void)
|
||||
{
|
||||
return bt_mesh_provisioner_get_prov_node_count();
|
||||
}
|
||||
|
||||
/* Configuration Models */
|
||||
extern const struct bt_mesh_model_op bt_mesh_cfg_srv_op[];
|
||||
extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[];
|
||||
|
@ -290,6 +290,8 @@ esp_ble_mesh_model_t *btc_ble_mesh_model_find(const esp_ble_mesh_elem_t *elem,
|
||||
|
||||
const esp_ble_mesh_comp_t *btc_ble_mesh_comp_get(void);
|
||||
|
||||
u16_t btc_ble_mesh_provisioner_get_prov_node_count(void);
|
||||
|
||||
void btc_ble_mesh_model_call_handler(btc_msg_t *msg);
|
||||
void btc_ble_mesh_model_cb_handler(btc_msg_t *msg);
|
||||
|
||||
|
@ -318,7 +318,7 @@ static s32_t next_period(struct bt_mesh_model *mod)
|
||||
|
||||
BT_INFO("Publishing took %ums", elapsed);
|
||||
|
||||
if (elapsed > period) {
|
||||
if (elapsed >= period) {
|
||||
BT_WARN("Publication sending took longer than the period");
|
||||
/* Return smallest positive number since 0 means disabled */
|
||||
return K_MSEC(1);
|
||||
|
@ -27,11 +27,7 @@
|
||||
#if defined(CONFIG_BLE_MESH_FAST_PROV)
|
||||
#define UNPROVISIONED_INTERVAL K_SECONDS(3)
|
||||
#else
|
||||
#if !CONFIG_BLE_MESH_PROV_TEST
|
||||
#define UNPROVISIONED_INTERVAL K_SECONDS(5)
|
||||
#else
|
||||
#define UNPROVISIONED_INTERVAL K_SECONDS(1)
|
||||
#endif
|
||||
#endif /* CONFIG_BLE_MESH_FAST_PROV */
|
||||
#define PROVISIONED_INTERVAL K_SECONDS(10)
|
||||
|
||||
|
@ -334,15 +334,15 @@ struct bt_mesh_model_pub {
|
||||
struct bt_mesh_model *mod;
|
||||
|
||||
u16_t addr; /**< Publish Address. */
|
||||
u16_t key; /**< Publish AppKey Index. */
|
||||
u16_t key:12, /**< Publish AppKey Index. */
|
||||
cred:1; /**< Friendship Credentials Flag. */
|
||||
|
||||
u8_t ttl; /**< Publish Time to Live. */
|
||||
u8_t retransmit; /**< Retransmit Count & Interval Steps. */
|
||||
u8_t period; /**< Publish Period. */
|
||||
u16_t period_div: 4, /**< Divisor for the Period. */
|
||||
cred: 1, /**< Friendship Credentials Flag. */
|
||||
fast_period: 1, /**< Use FastPeriodDivisor */
|
||||
count: 3; /**< Retransmissions left. */
|
||||
u8_t period_div:4, /**< Divisor for the Period. */
|
||||
fast_period:1,/**< Use FastPeriodDivisor */
|
||||
count:3; /**< Retransmissions left. */
|
||||
|
||||
u32_t period_start; /**< Start of the current period. */
|
||||
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "btc/btc_task.h"
|
||||
#include "osi/alarm.h"
|
||||
|
||||
#include "mbedtls/aes.h"
|
||||
#include "mbedtls/ecp.h"
|
||||
|
||||
@ -19,16 +22,9 @@
|
||||
#include "services/gatt/ble_svc_gatt.h"
|
||||
|
||||
#include "mesh_hci.h"
|
||||
#include "mesh_aes_encrypt.h"
|
||||
#include "mesh_bearer_adapt.h"
|
||||
#include "mesh_trace.h"
|
||||
#include "mesh_buf.h"
|
||||
#include "mesh_atomic.h"
|
||||
|
||||
#include "esp_ble_mesh_defs.h"
|
||||
|
||||
#include "provisioner_prov.h"
|
||||
#include "mesh_common.h"
|
||||
#include "mesh_aes_encrypt.h"
|
||||
#include "provisioner_prov.h"
|
||||
|
||||
/** @def BT_UUID_MESH_PROV
|
||||
* @brief Mesh Provisioning Service
|
||||
@ -67,7 +63,7 @@ struct bt_mesh_dev bt_mesh_dev;
|
||||
|
||||
/* P-256 Variables */
|
||||
static u8_t bt_mesh_public_key[64];
|
||||
static BT_OCTET32 bt_mesh_private_key = {
|
||||
static u8_t bt_mesh_private_key[32] = {
|
||||
0x3f, 0x49, 0xf6, 0xd4, 0xa3, 0xc5, 0x5f, 0x38,
|
||||
0x74, 0xc9, 0xb3, 0xe3, 0xd2, 0x10, 0x3f, 0x50,
|
||||
0x4a, 0xff, 0x60, 0x7b, 0xeb, 0x40, 0xb7, 0x99,
|
||||
@ -85,7 +81,7 @@ static sys_slist_t bt_mesh_gatts_db;
|
||||
static struct bt_mesh_conn bt_mesh_gatts_conn[BLE_MESH_MAX_CONN];
|
||||
static struct bt_mesh_conn_cb *bt_mesh_gatts_conn_cb;
|
||||
|
||||
static BD_ADDR bt_mesh_gatts_addr;
|
||||
static u8_t bt_mesh_gatts_addr[6];
|
||||
|
||||
#endif /* defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE */
|
||||
|
||||
@ -1705,7 +1701,7 @@ int bt_mesh_dh_key_gen(const u8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const u
|
||||
{
|
||||
uint8_t dhkey[32];
|
||||
|
||||
BT_DBG("private key = %s", bt_hex(bt_mesh_private_key, BT_OCTET32_LEN));
|
||||
BT_DBG("private key = %s", bt_hex(bt_mesh_private_key, 32));
|
||||
|
||||
ble_sm_alg_gen_dhkey((uint8_t *)&remote_pk[0], (uint8_t *)&remote_pk[32], bt_mesh_private_key, dhkey);
|
||||
|
||||
|
@ -24,11 +24,7 @@
|
||||
#if CONFIG_BLE_MESH_NODE
|
||||
|
||||
/* 3 transmissions, 20ms interval */
|
||||
#if !CONFIG_BLE_MESH_PROV_TEST
|
||||
#define PROV_XMIT BLE_MESH_TRANSMIT(2, 20)
|
||||
#else
|
||||
#define PROV_XMIT BLE_MESH_TRANSMIT(3, 10)
|
||||
#endif
|
||||
|
||||
#define AUTH_METHOD_NO_OOB 0x00
|
||||
#define AUTH_METHOD_STATIC 0x01
|
||||
@ -178,11 +174,7 @@ struct prov_rx {
|
||||
#define TRANSACTION_TIMEOUT K_SECONDS(3)
|
||||
#define PROTOCOL_TIMEOUT K_SECONDS(6)
|
||||
#else
|
||||
#if !CONFIG_BLE_MESH_PROV_TEST
|
||||
#define RETRANSMIT_TIMEOUT K_MSEC(500)
|
||||
#else
|
||||
#define RETRANSMIT_TIMEOUT K_MSEC(80)
|
||||
#endif
|
||||
#define TRANSACTION_TIMEOUT K_SECONDS(30)
|
||||
#define PROTOCOL_TIMEOUT K_SECONDS(60)
|
||||
#endif /* CONFIG_BLE_MESH_FAST_PROV */
|
||||
|
@ -31,11 +31,7 @@ _Static_assert(BLE_MESH_MAX_CONN >= CONFIG_BLE_MESH_PBG_SAME_TIME,
|
||||
"Too large BLE Mesh PB-GATT count");
|
||||
|
||||
/* 3 transmissions, 20ms interval */
|
||||
#if !CONFIG_BLE_MESH_PROV_TEST
|
||||
#define PROV_XMIT BLE_MESH_TRANSMIT(2, 20)
|
||||
#else
|
||||
#define PROV_XMIT BLE_MESH_TRANSMIT(4, 10)
|
||||
#endif
|
||||
|
||||
#define AUTH_METHOD_NO_OOB 0x00
|
||||
#define AUTH_METHOD_STATIC 0x01
|
||||
@ -315,11 +311,7 @@ static unprov_adv_pkt_cb_t notify_unprov_adv_pkt_cb;
|
||||
#define TRANSACTION_TIMEOUT K_SECONDS(3)
|
||||
#define PROVISION_TIMEOUT K_SECONDS(6)
|
||||
#else
|
||||
#if !CONFIG_BLE_MESH_PROV_TEST
|
||||
#define RETRANSMIT_TIMEOUT K_MSEC(500)
|
||||
#else
|
||||
#define RETRANSMIT_TIMEOUT K_MSEC(100)
|
||||
#endif
|
||||
#define TRANSACTION_TIMEOUT K_SECONDS(30)
|
||||
#define PROVISION_TIMEOUT K_SECONDS(60)
|
||||
#endif /* CONFIG_BLE_MESH_FAST_PROV */
|
||||
@ -1339,16 +1331,7 @@ static void buf_sent(int err, void *user_data)
|
||||
return;
|
||||
}
|
||||
|
||||
#if !CONFIG_BLE_MESH_PROV_TEST
|
||||
k_delayed_work_submit(&link[idx].tx.retransmit, RETRANSMIT_TIMEOUT);
|
||||
#else
|
||||
if (link[idx].tx_pdu_type == 0x2) {
|
||||
BT_DBG("expect_ack_for: %x %x",link[idx].tx_pdu_type,link[idx].expect_ack_for);
|
||||
k_delayed_work_submit(&link[idx].tx.retransmit, 100 * 3);
|
||||
} else {
|
||||
k_delayed_work_submit(&link[idx].tx.retransmit, 100);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct bt_mesh_send_cb buf_sent_cb = {
|
||||
@ -1461,12 +1444,6 @@ static void gen_prov_ack_send(const u8_t idx, u8_t xact_id)
|
||||
return;
|
||||
}
|
||||
|
||||
#if CONFIG_BLE_MESH_PROV_TEST
|
||||
if (link[idx].pending_ack < xact_id) {
|
||||
link[idx].pending_ack = xact_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
buf = adv_buf_create();
|
||||
if (!buf) {
|
||||
return;
|
||||
|
@ -226,10 +226,10 @@ static void seg_tx_reset(struct seg_tx *tx)
|
||||
tx->seg[i] = NULL;
|
||||
}
|
||||
|
||||
bt_mesh_tx_seg_unlock();
|
||||
|
||||
tx->nack_count = 0U;
|
||||
|
||||
bt_mesh_tx_seg_unlock();
|
||||
|
||||
if (bt_mesh_atomic_test_and_clear_bit(bt_mesh.flags, BLE_MESH_IVU_PENDING)) {
|
||||
BT_DBG("Proceding with pending IV Update");
|
||||
/* bt_mesh_net_iv_update() will re-enable the flag if this
|
||||
@ -322,8 +322,8 @@ static void seg_tx_send_unacked(struct seg_tx *tx)
|
||||
&seg_sent_cb, tx);
|
||||
if (err) {
|
||||
BT_ERR("%s, Sending segment failed", __func__);
|
||||
seg_tx_complete(tx, -EIO);
|
||||
bt_mesh_tx_seg_unlock();
|
||||
seg_tx_complete(tx, -EIO);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -210,16 +210,7 @@ int bt_mesh_client_send_msg(struct bt_mesh_model *model,
|
||||
sys_slist_append(&internal->queue, &node->client_node);
|
||||
bt_mesh_list_unlock();
|
||||
k_delayed_work_init(&node->timer, timer_handler);
|
||||
|
||||
#if !CONFIG_BLE_MESH_PROV_TEST
|
||||
k_delayed_work_submit(&node->timer, timeout ? timeout : CONFIG_BLE_MESH_CLIENT_MSG_TIMEOUT);
|
||||
#else
|
||||
if (node->opcode == 0x8008 || node->opcode == 0x0) {
|
||||
k_delayed_work_submit(&node->timer, timeout ? timeout : 600 * 4);
|
||||
} else {
|
||||
k_delayed_work_submit(&node->timer, timeout ? timeout : 400);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,72 +1,76 @@
|
||||
# ESP BLE Mesh Examples
|
||||
# ESP-BLE-MESH Examples
|
||||
|
||||
[ESP BLE Mesh]($IDF_PATH/components/bt/esp_ble_mesh/) is the official BLE Mesh stack of Espressif Systems. We will provide long-term support for new features, performance optimization, etc.
|
||||
[ESP-BLE-MESH]($IDF_PATH/components/bt/esp_ble_mesh/) is the official Bluetooth® Mesh stack of Espressif Systems. We will provide long-term support for new features, performance optimization, etc.
|
||||
|
||||
Please help note that breaking changes may be introduced into ESP BLE Mesh on [minor IDF versions](https://docs.espressif.com/projects/esp-idf/en/latest/versions.html).
|
||||
Please help note that breaking changes may be introduced into ESP-BLE-MESH on [minor IDF versions](https://docs.espressif.com/projects/esp-idf/en/latest/versions.html).
|
||||
|
||||
Note: To use examples in this directory, you need to have Bluetooth enabled in configuration and Bluedroid selected as the host stack. ESP BLE Mesh will support NimBLE host soon, and currently the integration of NimBLE host with ESP BLE Mesh stack is under development.
|
||||
Note: To use examples in this directory, you need to have Bluetooth enabled in configuration, and either Bluedroid or NimBLE can be selected as the host stack.
|
||||
|
||||
# Example Layout
|
||||
|
||||
This directory includes examples to demonstrate BLE Mesh functionality based on Zephyr (https://github.com/zephyrproject-rtos/zephyr) Mesh stack.
|
||||
|
||||
## ble_mesh_client_model
|
||||
|
||||
This example shows how ESP32 acts as a BLE Mesh Node with Generic OnOff Client & Server Models in the Primary Element.
|
||||
|
||||
See the [README.md](./ble_mesh_client_model/README.md) file in the example [ble_mesh_client_model](./ble_mesh_client_model/).
|
||||
This directory includes examples to demonstrate ESP-BLE-MESH functionality based on [Zephyr Bluetooth Mesh stack](https://github.com/zephyrproject-rtos/zephyr/tree/master/subsys/bluetooth/mesh).
|
||||
|
||||
## ble_mesh_console
|
||||
|
||||
This example demonstrates how ESP BLE Mesh uses Console for message transmitting/receiving tests.
|
||||
This example demonstrates how ESP-BLE-MESH uses Console for message transmitting/receiving tests.
|
||||
|
||||
### ble_mesh_node
|
||||
#### ble_mesh_node
|
||||
|
||||
This example shows how ESP32 acts as a BLE Mesh Node and sends vendor messages for testing.
|
||||
|
||||
See the [README.md](./ble_mesh_console/ble_mesh_node/README.md) file in the example [ble_mesh_node](./ble_mesh_console/ble_mesh_node/).
|
||||
See [ble_mesh_node](ble_mesh_console/ble_mesh_node) folder for more details.
|
||||
|
||||
### ble_mesh_provisioner
|
||||
#### ble_mesh_provisioner
|
||||
|
||||
This example shows how ESP32 acts as a BLE Mesh Provisioner and sends vendor messages for testing.
|
||||
|
||||
See the [README.md](./ble_mesh_console/ble_mesh_provisioner/README.md) file in the example [ble_mesh_provisioner](./ble_mesh_console/ble_mesh_provisioner/).
|
||||
See [ble_mesh_provisioner](ble_mesh_console/ble_mesh_provisioner) folder for more details.
|
||||
|
||||
## ble_mesh_fast_provision
|
||||
|
||||
This example illustrates the solution of ESP BLE Mesh Fast Provisioning.
|
||||
This example illustrates the solution of ESP-BLE-MESH Fast Provisioning.
|
||||
|
||||
### ble_mesh_fast_prov_client
|
||||
#### ble_mesh_fast_prov_client
|
||||
|
||||
This example shows how ESP32, acting as a BLE Mesh Fast Provisioning Client, provisions other unprovisioned devices and then control the nodes.
|
||||
This example shows how ESP32, acting as a BLE Mesh Fast Provisioning Client, provisions other unprovisioned devices and then controls the nodes.
|
||||
|
||||
See the [README.md](./ble_mesh_fast_provision/ble_mesh_fast_prov_client/README.md) file in the example [ble_mesh_fast_prov_client](./ble_mesh_fast_provision/ble_mesh_fast_prov_client/).
|
||||
See [ble_mesh_fast_prov_client](ble_mesh_fast_provision/ble_mesh_fast_prov_client) folder for more details.
|
||||
|
||||
### ble_mesh_fast_prov_server
|
||||
#### ble_mesh_fast_prov_server
|
||||
|
||||
This example illustrates the process that:
|
||||
1. Firstly as a BLE Mesh Fast Provisioning Server, ESP32 is provisioned into a Node;
|
||||
2. and then provisions other unprovisioned devices as a Temporary Provisioner.
|
||||
1. ESP32 as a BLE Mesh Fast Provisioning Server is provisioned into a node;
|
||||
2. ESP32 as a Temporary Provisioner provisions other unprovisioned devices.
|
||||
|
||||
See the [README.md](./ble_mesh_fast_provision/ble_mesh_fast_prov_server/README.md) file in the example [ble_mesh_fast_prov_server](./ble_mesh_fast_provision/ble_mesh_fast_prov_server/).
|
||||
See [ble_mesh_fast_prov_server](ble_mesh_fast_provision/ble_mesh_fast_prov_server) folder for more details.
|
||||
|
||||
## ble_mesh_node
|
||||
|
||||
This example shows how ESP32 acts as a BLE Mesh Node with only Generic OnOff Server Model in the Primary Element.
|
||||
This example demonstrates how ESP32 acts as a BLE Mesh node with Generic OnOff Server model or Generic OnOff Client model on board.
|
||||
|
||||
See the [README.md](./ble_mesh_node/README.md) file in the example [ble_mesh_node](./ble_mesh_node/).
|
||||
#### onoff_client
|
||||
|
||||
This example shows how ESP32 acts as a BLE Mesh Node with Generic OnOff Client model in the Primary Element.
|
||||
|
||||
See [onoff_client](ble_mesh_node/onoff_client) folder for more details.
|
||||
|
||||
#### onoff_server
|
||||
|
||||
This example shows how ESP32 acts as a BLE Mesh Node with only Generic OnOff Server model in the Primary Element.
|
||||
|
||||
See [onoff_server](ble_mesh_node/onoff_server) folder for more details.
|
||||
|
||||
## ble_mesh_provisioner
|
||||
|
||||
This example shows how ESP32 acts as a BLE Mesh Provisioner and provisions other unprovisioned devices.
|
||||
|
||||
See the [README.md](./ble_mesh_provisioner/README.md) file in the example [ble_mesh_provisioner](./ble_mesh_provisioner/).
|
||||
See [ble_mesh_provisioner](ble_mesh_provisioner) folder for more details.
|
||||
|
||||
## ble_mesh_wifi_coexist
|
||||
|
||||
This example shows how ESP32 acts as a BLE Mesh Fast Provisioning Server and coexists with Wi-Fi iperf functionality.
|
||||
|
||||
See the [README.md](./ble_mesh_wifi_coexist/README.md) file in the example [ble_mesh_wifi_coexist](./ble_mesh_wifi_coexist/).
|
||||
See [ble_mesh_wifi_coexist](ble_mesh_wifi_coexist) folder for more details.
|
||||
|
||||
# More
|
||||
|
||||
|
@ -5,41 +5,19 @@ CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y
|
||||
CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY=
|
||||
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=y
|
||||
CONFIG_GATTS_ENABLE=y
|
||||
CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
|
||||
CONFIG_BLE_MESH=y
|
||||
CONFIG_BLE_MESH_HCI_5_0=y
|
||||
CONFIG_BLE_MESH_USE_DUPLICATE_SCAN=y
|
||||
CONFIG_BLE_MESH_NODE=y
|
||||
CONFIG_BLE_MESH_PROV=y
|
||||
CONFIG_BLE_MESH_NET_BUF_POOL_USAGE=y
|
||||
CONFIG_BLE_MESH_PROXY=y
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_GATT_PROXY_SERVER=y
|
||||
CONFIG_BLE_MESH_NODE_ID_TIMEOUT=60
|
||||
CONFIG_BLE_MESH_PROXY_FILTER_SIZE=1
|
||||
CONFIG_BLE_MESH_SUBNET_COUNT=1
|
||||
CONFIG_BLE_MESH_APP_KEY_COUNT=1
|
||||
CONFIG_BLE_MESH_MODEL_KEY_COUNT=1
|
||||
CONFIG_BLE_MESH_MODEL_GROUP_COUNT=1
|
||||
CONFIG_BLE_MESH_LABEL_COUNT=1
|
||||
CONFIG_BLE_MESH_CRPL=10
|
||||
CONFIG_BLE_MESH_MSG_CACHE_SIZE=10
|
||||
CONFIG_BLE_MESH_ADV_BUF_COUNT=60
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=6
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=1
|
||||
CONFIG_BLE_MESH_RX_SDU_MAX=384
|
||||
CONFIG_BLE_MESH_TX_SEG_MAX=32
|
||||
CONFIG_BLE_MESH_RELAY=y
|
||||
CONFIG_BLE_MESH_LOW_POWER=
|
||||
CONFIG_BLE_MESH_FRIEND=
|
||||
CONFIG_BLE_MESH_CFG_CLI=y
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
|
||||
# Override some defaults of ESP BLE Mesh
|
||||
CONFIG_BLE_MESH=y
|
||||
CONFIG_BLE_MESH_NODE=y
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_CFG_CLI=y
|
||||
|
||||
CONFIG_CONSOLE_UART_BAUDRATE=921600
|
||||
CONFIG_ESPTOOLPY_BAUD_921600B=y
|
||||
CONFIG_MONITOR_BAUD_921600B=y
|
@ -5,38 +5,17 @@ CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y
|
||||
CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY=
|
||||
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=y
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
|
||||
# Override some defaults of ESP BLE Mesh
|
||||
CONFIG_BLE_MESH=y
|
||||
CONFIG_BLE_MESH_HCI_5_0=y
|
||||
CONFIG_BLE_MESH_USE_DUPLICATE_SCAN=y
|
||||
CONFIG_BLE_MESH_PROV=y
|
||||
CONFIG_BLE_MESH_PROVISIONER=y
|
||||
CONFIG_BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM=20
|
||||
CONFIG_BLE_MESH_MAX_PROV_NODES=20
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_PBA_SAME_TIME=10
|
||||
CONFIG_BLE_MESH_PBG_SAME_TIME=3
|
||||
CONFIG_BLE_MESH_PROVISIONER_SUBNET_COUNT=3
|
||||
CONFIG_BLE_MESH_PROVISIONER_APP_KEY_COUNT=9
|
||||
CONFIG_BLE_MESH_PB_ADV=y
|
||||
CONFIG_BLE_MESH_NET_BUF_POOL_USAGE=y
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_GATT_PROXY_SERVER=y
|
||||
CONFIG_BLE_MESH_RELAY=y
|
||||
CONFIG_BLE_MESH_LOW_POWER=
|
||||
CONFIG_BLE_MESH_FRIEND=
|
||||
CONFIG_BLE_MESH_MSG_CACHE_SIZE=10
|
||||
CONFIG_BLE_MESH_ADV_BUF_COUNT=60
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=6
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=1
|
||||
CONFIG_BLE_MESH_RX_SDU_MAX=384
|
||||
CONFIG_BLE_MESH_TX_SEG_MAX=32
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_CFG_CLI=y
|
||||
CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
|
||||
CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
|
@ -7,22 +7,15 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM=
|
||||
CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n
|
||||
CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y
|
||||
CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y
|
||||
CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y
|
||||
CONFIG_BLUEDROID_ENABLED=y
|
||||
CONFIG_BLE_SMP_ENABLE=n
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
|
||||
# Override some defaults of ESP BLE Mesh
|
||||
CONFIG_BLE_MESH=y
|
||||
CONFIG_BLE_MESH_PROVISIONER=y
|
||||
CONFIG_BLE_MESH_PROV=y
|
||||
CONFIG_BLE_MESH_PBA_SAME_TIME=1
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_CRPL=10
|
||||
CONFIG_BLE_MESH_ADV_BUF_COUNT=100
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_TX_SEG_MAX=32
|
||||
CONFIG_BLE_MESH_TRACE_LEVEL_WARNING=y
|
||||
CONFIG_BLE_MESH_CFG_CLI=y
|
||||
CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
|
@ -7,10 +7,7 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM=
|
||||
CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n
|
||||
CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y
|
||||
CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y
|
||||
CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y
|
||||
CONFIG_BLUEDROID_ENABLED=y
|
||||
CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
|
||||
CONFIG_BLE_SMP_ENABLE=n
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
|
||||
# Override some defaults of ESP BLE Mesh
|
||||
@ -18,13 +15,11 @@ CONFIG_BLE_MESH=y
|
||||
CONFIG_BLE_MESH_FAST_PROV=y
|
||||
CONFIG_BLE_MESH_MAX_PROV_NODES=6
|
||||
CONFIG_BLE_MESH_PBA_SAME_TIME=3
|
||||
CONFIG_BLE_MESH_PBG_SAME_TIME=3
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_CRPL=60
|
||||
CONFIG_BLE_MESH_MSG_CACHE_SIZE=60
|
||||
CONFIG_BLE_MESH_ADV_BUF_COUNT=200
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_TX_SEG_MAX=32
|
||||
CONFIG_BLE_MESH_TRACE_LEVEL_ERROR=y
|
||||
CONFIG_BLE_MESH_CFG_CLI=y
|
@ -7,10 +7,7 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM=
|
||||
CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n
|
||||
CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y
|
||||
CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y
|
||||
CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y
|
||||
CONFIG_BLUEDROID_ENABLED=y
|
||||
CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
|
||||
CONFIG_BLE_SMP_ENABLE=n
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
|
||||
# Override some defaults of ESP BLE Mesh
|
||||
@ -19,6 +16,4 @@ CONFIG_BLE_MESH_NODE=y
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_TX_SEG_MAX=32
|
||||
CONFIG_BLE_MESH_TRACE_LEVEL_WARNING=y
|
||||
CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
|
||||
|
@ -208,6 +208,7 @@ static void example_ble_mesh_provisioning_cb(esp_ble_mesh_prov_cb_event_t event,
|
||||
static void example_ble_mesh_generic_server_cb(esp_ble_mesh_generic_server_cb_event_t event,
|
||||
esp_ble_mesh_generic_server_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_gen_onoff_srv_t *srv;
|
||||
ESP_LOGI(TAG, "event 0x%02x, opcode 0x%04x, src 0x%04x, dst 0x%04x",
|
||||
event, param->ctx.recv_op, param->ctx.addr, param->ctx.recv_dst);
|
||||
|
||||
@ -223,6 +224,8 @@ static void example_ble_mesh_generic_server_cb(esp_ble_mesh_generic_server_cb_ev
|
||||
case ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT:
|
||||
ESP_LOGI(TAG, "ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT");
|
||||
if (param->ctx.recv_op == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET) {
|
||||
srv = param->model->user_data;
|
||||
ESP_LOGI(TAG, "onoff 0x%02x", srv->state.onoff);
|
||||
example_handle_gen_onoff_msg(param->model, ¶m->ctx, NULL);
|
||||
}
|
||||
break;
|
||||
|
@ -7,10 +7,7 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM=
|
||||
CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n
|
||||
CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y
|
||||
CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y
|
||||
CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y
|
||||
CONFIG_BLUEDROID_ENABLED=y
|
||||
CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
|
||||
CONFIG_BLE_SMP_ENABLE=n
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
|
||||
# Override some defaults of ESP BLE Mesh
|
||||
@ -18,6 +15,4 @@ CONFIG_BLE_MESH=y
|
||||
CONFIG_BLE_MESH_NODE=y
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_TX_SEG_MAX=32
|
||||
CONFIG_BLE_MESH_TRACE_LEVEL_WARNING=y
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
@ -303,9 +303,6 @@ static void example_ble_mesh_provisioning_cb(esp_ble_mesh_prov_cb_event_t event,
|
||||
break;
|
||||
case ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT:
|
||||
ESP_LOGI(TAG, "ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT, err_code %d", param->provisioner_set_dev_uuid_match_comp.err_code);
|
||||
if( param->provisioner_set_dev_uuid_match_comp.err_code != 0){
|
||||
|
||||
}
|
||||
break;
|
||||
case ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT: {
|
||||
ESP_LOGI(TAG, "ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT, err_code %d", param->provisioner_set_node_name_comp.err_code);
|
||||
|
@ -7,10 +7,6 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM=
|
||||
CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n
|
||||
CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y
|
||||
CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y
|
||||
CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y
|
||||
CONFIG_BLUEDROID_ENABLED=y
|
||||
CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
|
||||
CONFIG_BLE_SMP_ENABLE=n
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
|
||||
# Override some defaults of ESP BLE Mesh
|
||||
@ -19,6 +15,5 @@ CONFIG_BLE_MESH_PROVISIONER=y
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_TX_SEG_MAX=32
|
||||
CONFIG_BLE_MESH_CFG_CLI=y
|
||||
CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
|
||||
|
@ -7,10 +7,7 @@ CONFIG_BTDM_CONTROLLER_MODE_BTDM=
|
||||
CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=n
|
||||
CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR=y
|
||||
CONFIG_BLE_MESH_SCAN_DUPLICATE_EN=y
|
||||
CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y
|
||||
CONFIG_BLUEDROID_ENABLED=y
|
||||
CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
|
||||
CONFIG_BLE_SMP_ENABLE=n
|
||||
CONFIG_BTU_TASK_STACK_SIZE=4512
|
||||
|
||||
# Override some defaults of ESP BLE Mesh
|
||||
@ -18,14 +15,12 @@ CONFIG_BLE_MESH=y
|
||||
CONFIG_BLE_MESH_FAST_PROV=y
|
||||
CONFIG_BLE_MESH_MAX_PROV_NODES=6
|
||||
CONFIG_BLE_MESH_PBA_SAME_TIME=3
|
||||
CONFIG_BLE_MESH_PBG_SAME_TIME=3
|
||||
CONFIG_BLE_MESH_PB_GATT=y
|
||||
CONFIG_BLE_MESH_CRPL=60
|
||||
CONFIG_BLE_MESH_MSG_CACHE_SIZE=60
|
||||
CONFIG_BLE_MESH_ADV_BUF_COUNT=200
|
||||
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=10
|
||||
CONFIG_BLE_MESH_TX_SEG_MAX=32
|
||||
CONFIG_BLE_MESH_TRACE_LEVEL_ERROR=y
|
||||
CONFIG_BLE_MESH_CFG_CLI=y
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user