Преглед изворни кода

feat(ble_mesh): Remove ble_mesh_console example

Liu Linyan пре 2 година
родитељ
комит
0e63bfcddc
33 измењених фајлова са 0 додато и 4111 уклоњено
  1. 0 2
      docs/en/api-guides/esp-ble-mesh/ble-mesh-feature-list.rst
  2. 0 2
      docs/en/api-guides/esp-ble-mesh/ble-mesh-index.rst
  3. 0 2
      docs/zh_CN/api-guides/esp-ble-mesh/ble-mesh-index.rst
  4. 0 4
      examples/bluetooth/esp_ble_mesh/README.md
  5. 0 8
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/CMakeLists.txt
  6. 0 12
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/README.md
  7. 0 166
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_commands_README.md
  8. 0 15
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/CMakeLists.txt
  9. 0 366
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.c
  10. 0 128
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.h
  11. 0 40
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_decl.h
  12. 0 124
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_lib.c
  13. 0 28
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_lib.h
  14. 0 89
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_main.c
  15. 0 73
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_system.c
  16. 0 117
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_model.c
  17. 0 86
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_model.h
  18. 0 405
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_reg_cfg_client_cmd.c
  19. 0 243
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_reg_gen_onoff_client_cmd.c
  20. 0 325
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_reg_test_perf_client_cmd.c
  21. 0 1098
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_register_cmd.c
  22. 0 124
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_register_server_cmd.c
  23. 0 78
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/register_bluetooth.c
  24. 0 267
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/transaction.c
  25. 0 94
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/transaction.h
  26. 0 4
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/partitions.csv
  27. 0 32
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.ci.bluedroid
  28. 0 32
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.ci.nimble
  29. 0 33
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults
  30. 0 27
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults.esp32c3
  31. 0 30
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults.esp32c6
  32. 0 30
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults.esp32h2
  33. 0 27
      examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults.esp32s3

+ 0 - 2
docs/en/api-guides/esp-ble-mesh/ble-mesh-feature-list.rst

@@ -128,8 +128,6 @@ Mesh Applications
     * :example_file:`Tutorial <bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/tutorial/BLE_Mesh_WiFi_Coexist_Example_Walkthrough.md>`
     * :example:`Example <bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist>`
     * `Demo Video <https://dl.espressif.com/BLE/public/ESP_BLE_MESH_WIFI_Coexistence.mp4>`__
-* ESP-BLE-MESH Console Commands
-    * :example:`Example <bluetooth/esp_ble_mesh/ble_mesh_console>`
 
 
 Future Release Features

+ 0 - 2
docs/en/api-guides/esp-ble-mesh/ble-mesh-index.rst

@@ -223,8 +223,6 @@ ESP-BLE-MESH Examples
 
 * :example_file:`ESP-BLE-MESH and Wi-Fi Coexistence <bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/tutorial/BLE_Mesh_WiFi_Coexist_Example_Walkthrough.md>` - an example that demonstrates the Wi-Fi and Bluetooth (BLE/BR/EDR) coexistence feature of {IDF_TARGET_NAME}. Simply put, users can use the Wi-Fi while operating Bluetooth, see :example:`example code <bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist>`.
 
-* ESP-BLE-MESH Console - an example that implements BLE Mesh basic features. Within this example a node can be scanned and provisioned by Provisioner and reply to get/set message from Provisioner, see :example:`example node code <bluetooth/esp_ble_mesh/ble_mesh_console>`.
-
 
 .. _esp-ble-mesh-demo-videos:
 

+ 0 - 2
docs/zh_CN/api-guides/esp-ble-mesh/ble-mesh-index.rst

@@ -223,8 +223,6 @@ ESP-BLE-MESH 示例
 
 * :example_file:`Wi-Fi 和 ESP-BLE-MESH 共存 <bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/tutorial/BLE_Mesh_WiFi_Coexist_Example_Walkthrough.md>` - 该示例用于演示 Wi-Fi 和 ESP-BLE-MESH 共存的功能。简而言之,用户可在运行 ESP-BLE-MESH 时使用 Wi-Fi,示例请见 :example:`example code <bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist>`。
 
-* ESP-BLE-MESH 节点控制台 - 该演示实现 ESP-BLE-MESH 节点的基本功能。在演示中,Provisioner and Node 可以扫描、验证节点,节点可以回复 Provisioner 的获取/设置消息,示例请见::example:`example code <bluetooth/esp_ble_mesh/ble_mesh_console>`。
-
 
 .. _esp-ble-mesh-demo-videos:
 

+ 0 - 4
examples/bluetooth/esp_ble_mesh/README.md

@@ -10,10 +10,6 @@ Note: To use examples in this directory, you need to have Bluetooth enabled in c
 
 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.
-
 ## ble_mesh_fast_provision
 
 This example illustrates the solution of ESP-BLE-MESH Fast Provisioning.

+ 0 - 8
examples/bluetooth/esp_ble_mesh/ble_mesh_console/CMakeLists.txt

@@ -1,8 +0,0 @@
-# The following lines of boilerplate have to be in your project's CMakeLists
-# in this exact order for cmake to work correctly
-cmake_minimum_required(VERSION 3.16)
-
-set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/bluetooth/esp_ble_mesh/common_components/example_init)
-
-include($ENV{IDF_PATH}/tools/cmake/project.cmake)
-project(ble_mesh_console)

+ 0 - 12
examples/bluetooth/esp_ble_mesh/ble_mesh_console/README.md

@@ -1,12 +0,0 @@
-| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-S3 |
-| ----------------- | ----- | -------- | -------- | -------- |
-
-# ble mesh node console demo
-## Introduction  
-This demo implements ble mesh node basic features.Based on this demo, node can be scaned and proved by provisioner, reply get/set message to provisioner.  
-
-Demo steps:  
-1. Build the ble mesh node console demo with sdkconfig.default  
-2. register node and set oob info, load model to init ble mesh node  
-3. enable bearer, so that it can be scaned and provisioned by provisioner  
-

+ 0 - 166
examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_commands_README.md

@@ -1,166 +0,0 @@
-# The Document of ESP32 BLE_MESH Commands
-
-## Overall Command
-
-
-* `bmreg`: Provisioner/node register callback
-    * Example: `bmreg`
-    * Result: `Bm:Reg,OK`
-
-* `bminit`: Provisioner/node initialize
-    * `-m`: `mesh modle`
-    * Example: `bminit -m 0x0001`
-    * Result: `Bm:Init,OK`
-
-* `bmpbind`: Provisioner binds Appkey with local model
-    * `-a`: `<appkey index>:appkey index`
-    * `-e`: `<element address>:element address`
-    * `-n`: `<network index>:network index`
-    * `-m`: `<model id>:model id`
-    * `-c`: `<model id>:company id`
-    * Example: `bmpbind -a 0 -e 0x01 -m 0x1001 -n 0x00`
-    * Result: `provisioning:AppKeyBind,OK`
-
-* `bmpdev`: Provisioner add/delete unprovisioned device
-    * `-z`: `action type <add/delete>`
-    * `-d`: `device address`
-    * `-u`: `device uuid`
-    * `-a`: `address type`
-    * `-f`: `address flag`
-    * `-b`: `used bearer`
-    * `-o`: `oob information`
-    * Example: `bmpdev -z add -d bt_mac -b -1 -a 0`
-    * Result: `provisioner:DevAdd/Del,OK`
-
-* `bmoob`: Provisioner/node config OOB parameters
-    * `-s`: `Static OOB value`
-    * `-l`: `Static OOB value length`
-    * `-x`: `Maximum size of Output OOB`
-    * `-o`: `Supported Output OOB Actions`
-    * `-y`: `Maximum size of Input OOB`
-    * `-i`: `Supported Input OOB Actions`
-    * `-p`: `start address assigned by provisioner`
-    * Example: `bmoob -o -0 -x 0`
-    * Result: `OOB:Load,OK`
-
-* `bmpbearer`: Enable/disable provisioner different bearer
-    * `-b`: `bearer supported`
-    * `-e`: `enable or disable bearer`
-    * Example: `bmpbearer -b 1 -e 1`
-    * Result: `provisioner:EnBearer,OK`
-
-* `bmnbearer`: Enable/disable node different bearer
-    * `-b`: `bearer supported`
-    * `-e`: `enable or disable bearer`
-    * Example: `bmnbearer -b 1 -e 1`
-    * Result: `Node:EnBearer,OK`
-
-* `bmpkey`: Add/Delete NetKey and AppKey of Provisioner
-    * `-z`: `<action type>:add app key or network key`
-    * `-n`: `<net key index>:network key index`
-    * `-k`: `<key>:appkey or network`
-    * `-a`: `<app key index>:appkey index`
-    * Example: `bmpkey -z netkey -n 1 -k <network_key>`
-    * Result: `provisioner:NetKeyAdd,OK`
-
-* `bmccm`: BLE Mesh configuration client model operations
-    * `-z`: `<action>:action type`:add or del client model
-    * `-x`: `<state>:set state`
-    * `-o`: `<opcode>:message opcode`
-    * `-u`: `<address>:unicast address`
-    * `-n`: `<network>:net work index`
-    * `-i`: `<index>:appkey index`
-    * `-r`: `<relay>:relay statue`
-    * `-t`: `<transmit>:relay transmit`
-    * `-c`: `<cid>:company id`
-    * `-v`: `<value>:value`
-    * `-a`: `<address>:address`
-    * `-m`: `<mod id>:model id`
-    * Example: `bmccm -z reg`
-    * Result: `ConfigClient:OK`
-
-* `bmgocm`: BLE Mesh onoff client model operations
-    * `-z`: `<action>:action type`: on or off client model
-    * `-o`: `<opcode>:message opcode`
-    * `-u`: `<address>:unicast address`
-    * `-n`: `<netkey index>:network key index`
-    * `-a`: `<index>:appkey index`
-    * `-r`: `<role>:role`
-    * `-t`: `<time>:time to complete state transition`
-    * `-e`: `<optional>:whether optional parameters included`
-    * `-s` : `<state>:present onoff state`
-    * `-a`: `<address>:address`
-    * `-i`: `<identifier>:transaction identifier`
-    * `-d`: `<delay>:indicate message execution delay`
-    * Example: `bmgocm -z reg`
-    * Result: `GenONOFFClient:Reg,OK`
-
-* `bmnreset`: Reset node to become an unprovisioned device
-    * Example: `bmnreset`
-    * Result: `Node:Reset`
-
-* `bmpublish`: BLE Mesh model publication 
-    * `-d`: `<data>:message data`
-    * `-o`: `<opcode>:operation opcode`
-    * `-m`: `<module>:module published to`
-    * `-r`: `<role>:device role`
-    * `-a`: `<address>:unicast address`
-    * `-i`: `<app key>:app key index`
-    * `-p`: `<period>:period`
-    * Example: `bmpublish -d 1 -o 0x8204 -m 0x1000 -r 0 -a 1 -p 0 -i 0`
-    * Result: `PublishSend,OK`
-
-* `bmnnwk`: An unprovisioned device enters the mesh network and becomes a node without the provisioning procedure
-    * `-k`: `<net key>:network key`
-    * `-n`: `<net index>:network key index`
-    * `-u`: `<unicast address>:unicast address`
-    * `-d`: `<device key>:device key`
-    * `-a`: `<appkey>:app key`
-    * `-i`: `<app key>:app key index`
-    * `-g`: `<group address>:group address`
-    * Example: `bnnnwk -k 0x1000 -n 1 -u 0x0010 -a 0x%s -d0x%s -i 0 -g 0xC000`
-    * Result: `Provisioning:Success,%d`
-
-* `bmpaddn`: Provisioner add device's information into the mesh database while unprovisioned device enter mesh network automatically
-    * `-o`: `<oob info>:oob information`
-    * `-a`: `<unicast address>:unicast address`
-    * `-e`: `<element num>:element num`
-    * `-n`: `<net index>:net index`
-    * `-d`: `<device key>:device key`
-    * `-u`: `<device uuid>:device uuid`
-    * Example: `bmpaddn -o -0x0 -a %s -e 1 -n 1 -d 0x%s -u 0x%s`
-    * Result: `Provisioner:AddNodeInfo,OK`
-
-* `bmcperf`: BLE Mesh client test performance
-    * `-z`: `<action>:action type`:init/get/destroy/percent 
-    * `-s`: `<test size>:test size`
-    * `-n`: `<node number>:node number`
-    * `-l`: `<test number>:ttl`
-    * Example: `bmcperf -z init -n 1 -s %d -l 7`
-    * Result: `VendorPerfTest:InitStatistics,OK`
-
-* `bmperf`: BLE Mesh vendor server model performance test
-    * `-z`: `<action>:action type`:init/get/destroy/percent
-    * `-p`: `<package>:package number`
-    * Example: `bmsperf -z init -p %d`
-    * Result: `Node:InitStatistics,OK`
-
-* `bmtpcvm`: BLE Mesh vendor client model performance test
-    * `-z`: `<action>:action type`:init or start
-    * `-p`: `<byte>:playload byte`
-    * `-n`: `<number>:test number`
-    * `-o`: `<opcode>:opcode`
-    * `-u`: `<address>:unicast address`
-    * `-t`: `<ttl>:ttl`
-    * `-a`: `<appkey>:appkey index`
-    * `-i`: `<network key>:network key index`
-    * `-d`: `<role>:device role`
-    * Example: `bmtpcvm -z start -p %d -n %d -o 0xC302C4 -u %s -t 7 -a 0 -i 1 -d 1`
-    * Result: `VendorModel:SendPackage,Finish`
-
-* `bmtxpower`: Provisioner/node set tx power or rx sensitivity"
-    * `-z`: `<action>:action type`:set tx power or rx sensitivity
-    * `-t`: `<power>:tx power or sense`
-    * Example: `bmtxpower -z tx -t %d`
-    * Result: `Node:SetPower,OK`
-

+ 0 - 15
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/CMakeLists.txt

@@ -1,15 +0,0 @@
-set(srcs "ble_mesh_adapter.c"
-        "ble_mesh_model.c"
-        "ble_mesh_console_lib.c"
-        "ble_mesh_console_main.c"
-        "ble_mesh_console_system.c"
-        "ble_mesh_register_cmd.c"
-        "ble_mesh_reg_cfg_client_cmd.c"
-        "ble_mesh_register_server_cmd.c"
-        "ble_mesh_reg_gen_onoff_client_cmd.c"
-        "ble_mesh_reg_test_perf_client_cmd.c"
-        "transaction.c"
-        "register_bluetooth.c")
-
-idf_component_register(SRCS "${srcs}"
-                    INCLUDE_DIRS  ".")

+ 0 - 366
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.c

@@ -1,366 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <inttypes.h>
-
-#include "esp_ble_mesh_networking_api.h"
-#include "ble_mesh_adapter.h"
-
-ble_mesh_performance_statistics_t test_perf_statistics;
-ble_mesh_node_statistics_t ble_mesh_node_statistics;
-
-ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_pub_0, 2 + 3, ROLE_NODE);
-ESP_BLE_MESH_MODEL_PUB_DEFINE(model_pub_config, 2 + 1, ROLE_NODE);
-
-static esp_ble_mesh_model_t srv_models[] = {
-    ESP_BLE_MESH_MODEL_CFG_SRV(&cfg_srv),
-    ESP_BLE_MESH_MODEL_GEN_ONOFF_SRV(&onoff_pub_0, &onoff_server),
-};
-
-esp_ble_mesh_model_t vendor_srv_models[] = {
-    ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_SRV,
-    test_perf_srv_op, NULL, NULL),
-};
-
-static esp_ble_mesh_elem_t srv_elements[] = {
-    ESP_BLE_MESH_ELEMENT(0, srv_models, vendor_srv_models),
-};
-
-static esp_ble_mesh_comp_t srv_composition = {
-    .cid = CID_ESP,
-    .elements = srv_elements,
-    .element_count = ARRAY_SIZE(srv_elements),
-};
-
-//client models
-esp_ble_mesh_model_t cli_models[] = {
-    ESP_BLE_MESH_MODEL_CFG_SRV(&cfg_srv),
-    ESP_BLE_MESH_MODEL_CFG_CLI(&cfg_cli),
-    ESP_BLE_MESH_MODEL_GEN_ONOFF_CLI(&model_pub_config, &gen_onoff_cli),
-    ESP_BLE_MESH_MODEL_GEN_ONOFF_SRV(&onoff_pub_0, &onoff_server),
-};
-
-esp_ble_mesh_model_t vendor_cli_models[] = {
-    ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_CLI,
-    test_perf_cli_op, &vendor_model_pub_config, &test_perf_cli),
-};
-
-static esp_ble_mesh_elem_t cli_elements[] = {
-    ESP_BLE_MESH_ELEMENT(0, cli_models, vendor_cli_models),
-};
-
-static esp_ble_mesh_comp_t cli_composition = {
-    .cid = CID_ESP,
-    .elements = cli_elements,
-    .element_count = ARRAY_SIZE(cli_elements),
-};
-
-esp_ble_mesh_comp_t *ble_mesh_get_component(uint16_t model_id)
-{
-    esp_ble_mesh_comp_t *comp = NULL;
-    switch (model_id) {
-    case ESP_BLE_MESH_MODEL_ID_CONFIG_SRV:
-    case ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV:
-    case ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_SRV:
-        comp = &srv_composition;
-        break;
-    case ESP_BLE_MESH_MODEL_ID_CONFIG_CLI:
-#if (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
-    case ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_CLI:
-#endif
-    case ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_CLI:
-        comp = &cli_composition;
-        break;
-    default:
-        break;
-    }
-    return comp;
-}
-
-int ble_mesh_init_node_prestore_params(void)
-{
-    uint16_t i;
-
-    for (i = 0; i < NODE_MAX_GROUP_CONFIG; i++) {
-        ble_mesh_node_prestore_params[i].net_idx = ESP_BLE_MESH_KEY_UNUSED;
-        ble_mesh_node_prestore_params[i].unicast_addr = ESP_BLE_MESH_ADDR_UNASSIGNED;
-    }
-    if(ble_mesh_node_sema == NULL) {
-        ble_mesh_node_sema = xSemaphoreCreateMutex();
-        if (!ble_mesh_node_sema) {
-            ESP_LOGE(TAG, "%s init fail, mesh node semaphore create fail", __func__);
-            return ESP_ERR_NO_MEM;
-        }
-    }
-    return 0;
-}
-
-void ble_mesh_set_node_prestore_params(uint16_t netkey_index, uint16_t unicast_addr)
-{
-    uint16_t i;
-    xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY);
-    for (i = 0; i < NODE_MAX_GROUP_CONFIG; i++) {
-        if (ble_mesh_node_prestore_params[i].net_idx != ESP_BLE_MESH_KEY_UNUSED && ble_mesh_node_prestore_params[i].unicast_addr != ESP_BLE_MESH_ADDR_UNASSIGNED) {
-            ble_mesh_node_prestore_params[i].net_idx = netkey_index;
-            ble_mesh_node_prestore_params[i].unicast_addr = unicast_addr;
-        }
-    }
-    xSemaphoreGive(ble_mesh_node_sema);
-}
-
-void ble_mesh_deinit_node_prestore_params(void)
-{
-    if (ble_mesh_node_sema != NULL) {
-        vSemaphoreDelete(ble_mesh_node_sema);
-        ble_mesh_node_sema = NULL;
-    }
-}
-
-void ble_mesh_node_statistics_get(void)
-{
-    xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY);
-    ESP_LOGI(TAG, "Statistics:%" PRIu32, ble_mesh_node_statistics.package_num);
-    xSemaphoreGive(ble_mesh_node_sema);
-}
-
-int ble_mesh_node_statistics_accumulate(uint8_t *data, uint32_t value, uint16_t type)
-{
-    uint16_t i;
-    uint16_t sequence_num = (data[0] << 8) | data[1];
-
-    xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY);
-
-    for (i = 0; i < ble_mesh_node_statistics.total_package_num; i++) {
-        /* Filter out repeated packages during retransmission */
-        if (ble_mesh_node_statistics.package_index[i] == sequence_num) {
-            xSemaphoreGive(ble_mesh_node_sema);
-            return 0;
-        }
-    }
-
-    // package type wrong
-    if (data[2] != type) {
-        xSemaphoreGive(ble_mesh_node_sema);
-        return 1;
-    }
-
-    for (i = 0; i < ble_mesh_node_statistics.total_package_num; i++) {
-        /* Judge whether the package is received for the first time */
-        if (ble_mesh_node_statistics.package_index[i] == 0) {
-            ble_mesh_node_statistics.package_index[i] = sequence_num;
-            ble_mesh_node_statistics.package_num += 1;
-            ble_mesh_node_statistics.statistics += value;
-            break;
-        }
-    }
-    xSemaphoreGive(ble_mesh_node_sema);
-
-    return 0;
-}
-
-int ble_mesh_node_statistics_init(uint16_t package_num)
-{
-    uint16_t i;
-
-    ble_mesh_node_statistics.package_index = malloc(sizeof(uint16_t) * package_num);
-    ble_mesh_node_statistics.total_package_num = package_num;
-    if (ble_mesh_node_statistics.package_index == NULL) {
-        ESP_LOGE(TAG, " %s, %d malloc fail", __func__, __LINE__);
-        return ESP_ERR_NO_MEM;
-    }
-
-    ble_mesh_node_statistics.package_num = 0;
-    for (i = 0; i < package_num; i++) {
-        ble_mesh_node_statistics.package_index[i] = 0;
-    }
-    return 0;
-}
-
-void ble_mesh_node_statistics_destroy(void)
-{
-    if (ble_mesh_node_statistics.package_index != NULL) {
-        free(ble_mesh_node_statistics.package_index);
-    }
-}
-
-void ble_mesh_create_send_data(char *data, uint16_t byte_num, uint16_t sequence_num, uint32_t opcode)
-{
-    uint16_t i;
-
-    // first two bytes are sequence num, third is type
-    data[0] = sequence_num >> 8;
-    data[1] = sequence_num & 0xFF;
-    switch (opcode) {
-    case ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_GET:
-        data[2] = VENDOR_MODEL_PERF_OPERATION_TYPE_GET;
-        break;
-    case ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET:
-        data[2] = VENDOR_MODEL_PERF_OPERATION_TYPE_SET;
-        break;
-    case ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET_UNACK:
-        data[2] = VENDOR_MODEL_PERF_OPERATION_TYPE_SET_UNACK;
-        break;
-    }
-
-    for (i = 3; i < byte_num; i++) {
-        data[i] = i;
-    }
-}
-
-void ble_mesh_test_performance_client_model_get(void)
-{
-    uint32_t i;
-    uint32_t succeed_packet_count;
-    uint32_t sum_time = 0;
-    uint32_t failed_packet_num = 0;
-    uint32_t rtt = 0;
-
-    for (i = 0, succeed_packet_count = 0; i < test_perf_statistics.test_num; i++) {
-        if (test_perf_statistics.time[i] != 0) {
-            sum_time += test_perf_statistics.time[i];
-            succeed_packet_count += 1;
-        } else {
-            failed_packet_num += 1;
-        }
-    }
-
-    if(succeed_packet_count != 0){
-        rtt = (int)(sum_time / succeed_packet_count);
-    }
-
-    ESP_LOGI(TAG, "VendorModel:Statistics,%" PRIu32 ",%" PRIu32, failed_packet_num, rtt);
-}
-
-void ble_mesh_test_performance_client_model_get_received_percent(void)
-{
-    uint32_t i, j;
-    uint32_t max_time = 1400;
-    uint32_t min_time = 0;
-    uint32_t time_level_num = 0;
-    typedef struct {
-        uint16_t time_level;
-        uint16_t time_num;
-    } statistics_time_performance;
-    statistics_time_performance *statistics_time_percent;
-
-    time_level_num = ((max_time - min_time) / 50 + 1);
-    statistics_time_percent = malloc(sizeof(statistics_time_performance) * time_level_num);
-    if (statistics_time_percent == NULL) {
-        ESP_LOGI(TAG, "malloc error");
-        return;
-    }
-
-    for (j = 0; j < time_level_num; j++) {
-        statistics_time_percent[j].time_level = min_time + 50 * j;
-        statistics_time_percent[j].time_num = 0;
-    }
-
-    for (i = 0; i < test_perf_statistics.test_num; i++) {
-        for (j = 0; j < time_level_num; j++) {
-            if (test_perf_statistics.time[i] > max_time) {
-                j -= 1;
-                break;
-            }
-            if (test_perf_statistics.time[i] >= min_time + 50 * j
-                    && test_perf_statistics.time[i] < min_time + 50 * (j + 1)) {
-                statistics_time_percent[j].time_num += 1;
-                break;
-            }
-        }
-    }
-
-    // for script match
-    ESP_LOGI(TAG, "VendorModel:Statistics");
-    for (j = 0; j < time_level_num; j++) {
-        ESP_LOGI("", "%d:%d", statistics_time_percent[j].time_level, statistics_time_percent[j].time_num);
-    }
-    free(statistics_time_percent);
-}
-
-void ble_mesh_test_performance_client_model_accumulate_statistics(uint32_t value)
-{
-    test_perf_statistics.statistics += value;
-}
-
-int ble_mesh_test_performance_client_model_accumulate_time(uint16_t time, uint8_t *data, uint8_t ack_ttl, uint16_t length)
-{
-    uint16_t i;
-    uint16_t sequence_num = 0;
-    uint16_t node_received_ttl = 0;
-
-    if (data != NULL) {
-        sequence_num = (data[0] << 8) | data[1];
-        if (data[2] == VENDOR_MODEL_PERF_OPERATION_TYPE_SET) {
-            node_received_ttl = data[3];
-        }
-    }
-    for (i = 0; i < test_perf_statistics.test_num; i++) {
-        if (test_perf_statistics.package_index[i] == sequence_num) {
-            return 1;
-        }
-    }
-
-    for (i = 0; i < test_perf_statistics.test_num; i++) {
-        if (test_perf_statistics.package_index[i] == 0) {
-            test_perf_statistics.package_index[i] = sequence_num;
-            if (data[2] == VENDOR_MODEL_PERF_OPERATION_TYPE_SET) {
-                if (node_received_ttl == test_perf_statistics.ttl) {
-                    test_perf_statistics.time[i] = time;
-                } else {
-                    test_perf_statistics.time[i] = 0;
-                }
-            } else if (data[2] == VENDOR_MODEL_PERF_OPERATION_TYPE_SET_UNACK) {
-                test_perf_statistics.time[i] = time;
-            }
-            break;
-        }
-    }
-
-    return 0;
-}
-
-int ble_mesh_test_performance_client_model_init(uint16_t node_num, uint32_t test_num, uint8_t ttl)
-{
-    uint16_t i;
-
-    test_perf_statistics.time = malloc(test_num * sizeof(uint16_t));
-    if (test_perf_statistics.time == NULL) {
-        ESP_LOGE(TAG, " %s %d, malloc fail", __func__, __LINE__);
-        return ESP_ERR_NO_MEM;
-    }
-
-    test_perf_statistics.package_index = malloc(test_num * sizeof(uint16_t));
-    if (test_perf_statistics.package_index == NULL) {
-        ESP_LOGE(TAG, " %s %d, malloc fail", __func__, __LINE__);
-        return ESP_ERR_NO_MEM;
-    }
-    for (i = 0; i < test_num; i++) {
-        test_perf_statistics.time[i] = 0;
-        test_perf_statistics.package_index[i] = 0;
-    }
-
-    test_perf_statistics.test_num = test_num;
-    test_perf_statistics.node_num = node_num;
-    test_perf_statistics.ttl = ttl;
-    test_perf_statistics.statistics = 0;
-    return 0;
-}
-
-void ble_mesh_test_performance_client_model_destroy(void)
-{
-    if (test_perf_statistics.time != NULL) {
-        free(test_perf_statistics.time);
-    }
-
-    if (test_perf_statistics.package_index != NULL) {
-        free(test_perf_statistics.package_index);
-    }
-
-    test_perf_statistics.test_num = 0;
-    test_perf_statistics.ttl = 0;
-    test_perf_statistics.node_num = 0;
-    test_perf_statistics.statistics = 0;
-}

+ 0 - 128
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.h

@@ -1,128 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#ifndef _BLE_MESH_ADAPTER_H_
-#define _BLE_MESH_ADAPTER_H_
-
-#include "freertos/FreeRTOS.h"
-#include "freertos/semphr.h"
-
-#include "ble_mesh_console_lib.h"
-#include "ble_mesh_model.h"
-#include "esp_ble_mesh_local_data_operation_api.h"
-
-#define TAG "ble_mesh_console"
-
-#define TRANS_TYPE_MESH_PERF 0x01
-#define TRANS_MESH_SEND_MESSAGE 0x01
-#define TRANS_MESH_SEND_MESSAGE_EVT 0x01
-
-typedef enum {
-    VENDOR_MODEL_PERF_OPERATION_TYPE_GET = 1,
-    VENDOR_MODEL_PERF_OPERATION_TYPE_SET,
-    VENDOR_MODEL_PERF_OPERATION_TYPE_SET_UNACK
-} ble_mesh_perf_operation_type;
-
-typedef struct {
-    uint8_t current;
-    uint8_t previous;
-    char *name;
-} ble_mesh_node_status;
-
-typedef struct {
-    bool need_ack;
-    uint8_t ttl;
-    uint16_t length;
-    uint16_t test_num;
-    uint16_t address;
-    uint16_t app_idx;
-    uint16_t net_idx;
-    uint32_t opcode;
-    esp_ble_mesh_model_t *model;
-    esp_ble_mesh_dev_role_t device_role;
-} ble_mesh_test_perf_throughput_data;
-
-typedef struct {
-    uint32_t statistics;
-    uint32_t test_num;
-    uint16_t test_length;
-    uint16_t node_num;
-    uint16_t *time;
-    uint16_t *package_index;
-    uint8_t  ttl;
-} ble_mesh_performance_statistics_t;
-extern ble_mesh_performance_statistics_t test_perf_statistics;
-
-typedef struct {
-    uint32_t statistics;
-    uint32_t package_num;
-    uint16_t *package_index;
-    uint32_t total_package_num;
-} ble_mesh_node_statistics_t;
-extern ble_mesh_node_statistics_t ble_mesh_node_statistics;
-
-extern SemaphoreHandle_t ble_mesh_node_sema;
-extern ble_mesh_node_status node_status;
-
-#define SEND_MESSAGE_TIMEOUT (30000/portTICK_PERIOD_MS)
-
-#define arg_int_to_value(src_msg, dst_msg, message) do { \
-    if (src_msg->count != 0) {\
-        ESP_LOGD(TAG, "\n%s, %s", __func__, message);\
-        dst_msg = src_msg->ival[0];\
-    } \
-} while(0) \
-
-#define ble_mesh_node_get_value(index, key, value) do { \
-    uint16_t _index = 0; \
-    xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY); \
-    for (_index = 0; _index < NODE_MAX_GROUP_CONFIG; _index) { \
-        if (node_set_prestore_params[_index].key == value) { \
-            break; \
-        } \
-    } \
-    index = _index; \
-    xSemaphoreGive(ble_mesh_node_sema); \
-} while(0) \
-
-#define ble_mesh_node_set_state(status) do { \
-    xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY); \
-    node_status.previous = node_status.current; \
-    node_status.current = status; \
-    xSemaphoreGive(ble_mesh_node_sema); \
-}while(0) \
-
-#define ble_mesh_node_get_state(status) do { \
-    xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY); \
-    status = node_status.current; \
-    xSemaphoreGive(ble_mesh_node_sema); \
-}while(0) \
-
-#define ble_mesh_callback_check_err_code(err_code, message) do { \
-    if (err_code == ESP_OK) { \
-        ESP_LOGI(TAG, "%s,OK", message); \
-    } else { \
-        ESP_LOGE(TAG, "%s,Fail,%d", message, err_code); \
-    } \
-}while(0) \
-
-int ble_mesh_init_node_prestore_params(void);
-void ble_mesh_deinit_node_prestore_params(void);
-void ble_mesh_set_node_prestore_params(uint16_t netkey_index, uint16_t unicast_addr);
-esp_ble_mesh_comp_t *ble_mesh_get_component(uint16_t model_id);
-void ble_mesh_node_statistics_get(void);
-int ble_mesh_node_statistics_accumulate(uint8_t *data, uint32_t value, uint16_t type);
-int ble_mesh_node_statistics_init(uint16_t package_num);
-void ble_mesh_node_statistics_destroy(void);
-void ble_mesh_create_send_data(char *data, uint16_t byte_num, uint16_t sequence_num, uint32_t opcode);
-void ble_mesh_test_performance_client_model_get(void);
-void ble_mesh_test_performance_client_model_get_received_percent(void);
-void ble_mesh_test_performance_client_model_accumulate_statistics(uint32_t value);
-int ble_mesh_test_performance_client_model_accumulate_time(uint16_t time, uint8_t *data, uint8_t ack_ttl, uint16_t length);
-int ble_mesh_test_performance_client_model_init(uint16_t node_num, uint32_t test_num, uint8_t ttl);
-void ble_mesh_test_performance_client_model_destroy(void);
-
-#endif //_BLE_MESH_ADAOTER_H_

+ 0 - 40
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_decl.h

@@ -1,40 +0,0 @@
-/*
- * Console example - declarations of command registration functions.
- *
- * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-#pragma once
-
-#include "esp_ble_mesh_defs.h"
-
-// Register system functions
-void register_system(void);
-
-// Register blutooth
-void register_bluetooth(void);
-
-// Register mesh node cmd
-void ble_mesh_register_mesh_node(void);
-
-// Register Test Perf client cmd
-void ble_mesh_register_mesh_test_performance_client(void);
-
-#if (CONFIG_BLE_MESH_CFG_CLI)
-// Register mesh config client operation cmd
-void ble_mesh_register_configuration_client_model(void);
-#endif
-
-// Register mesh config server and generic server operation cmd
-void ble_mesh_register_server(void);
-
-#if (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
-// Register mesh client operation cmd
-void ble_mesh_register_gen_onoff_client(void);
-#endif
-
-#if (CONFIG_BLE_MESH_CFG_CLI)
-// Register mesh config client operation cmd
-void ble_mesh_register_configuration_client_model(void);
-#endif

+ 0 - 124
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_lib.c

@@ -1,124 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "ble_mesh_console_lib.h"
-
-static int hex2num(char c);
-static int hex2byte(const char *hex);
-
-static int hex2num(char c)
-{
-    if (c >= '0' && c <= '9') {
-        return c - '0';
-    }
-    if (c >= 'a' && c <= 'f') {
-        return c - 'a' + 10;
-    }
-    if (c >= 'A' && c <= 'F') {
-        return c - 'A' + 10;
-    }
-    return -1;
-}
-
-static int hex2byte(const char *hex)
-{
-    int a, b;
-    a = hex2num(*hex++);
-    if (a < 0) {
-        return -1;
-    }
-    b = hex2num(*hex++);
-    if (b < 0) {
-        return -1;
-    }
-    return (a << 4) | b;
-}
-
-int hexstr_2_bin(const char *hex, uint8_t *buf, uint32_t len)
-{
-    uint32_t i;
-    int a;
-    const char *ipos = hex;
-    uint8_t *opos = buf;
-
-    for (i = 0; i < len; i++) {
-        a = hex2byte(ipos);
-        if (a < 0) {
-            return -1;
-        }
-        *opos ++ = a;
-        ipos += 2;
-    }
-    return 0;
-}
-
-int get_value_string(char *value_in, char *buf)
-{
-    int result = -1;
-    uint8_t loop = 0;
-    uint16_t length = strlen(value_in);
-
-    // address string, need sepcial test
-    for (loop = 0; loop < 17 ; loop++) {
-        if (loop % 3 == 2) {
-            if (value_in[loop] == ':') {
-                return result;
-            }
-        }
-    }
-
-    if (length > 2) {
-        if (value_in[0] == '0' && value_in[1] == 'x') {
-            buf[(length - 2) / 2] = 0;
-            result = hexstr_2_bin(&value_in[2], (uint8_t *)buf, (length - 2) / 2);
-            length = (length - 2) / 2;
-        } else {
-            strcpy(buf, value_in);
-            result = 0;
-        }
-    } else {
-        strcpy(buf, value_in);
-        result = 0;
-    }
-    return result;
-}
-
-bool str_2_mac(uint8_t *str, uint8_t *dest)
-{
-    uint8_t loop = 0;
-    uint8_t tmp = 0;
-    uint8_t *src_p = str;
-
-    if (strlen((char *)src_p) != 17) { // must be like 12:34:56:78:90:AB
-        return false;
-    }
-
-    for (loop = 0; loop < 17 ; loop++) {
-        if (loop % 3 == 2) {
-            if (src_p[loop] != ':') {
-                return false;
-            }
-            continue;
-        }
-
-        if ((src_p[loop] >= '0') && (src_p[loop] <= '9')) {
-            tmp = tmp * 16 + src_p[loop] - '0';
-        } else if ((src_p[loop] >= 'A') && (src_p[loop] <= 'F')) {
-            tmp = tmp * 16 + src_p[loop] - 'A' + 10;
-        } else if ((src_p[loop] >= 'a') && (src_p[loop] <= 'f')) {
-            tmp = tmp * 16 + src_p[loop] - 'a' + 10;
-        } else {
-            return false;
-        }
-
-        if (loop % 3 == 1) {
-            *dest++ = tmp;
-            tmp = 0;
-        }
-    }
-
-    return true;
-}

+ 0 - 28
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_lib.h

@@ -1,28 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#ifndef _BLE_MESH_CONSOLE_LIB_H_
-#define _BLE_MESH_CONSOLE_LIB_H_
-
-#include <stdio.h>
-#include <string.h>
-
-#include "esp_system.h"
-#include "esp_log.h"
-#include "nvs_flash.h"
-#include "esp_console.h"
-#include "argtable3/argtable3.h"
-
-#ifndef MAC2STR
-#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
-#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
-#endif
-
-bool str_2_mac(uint8_t *str, uint8_t *dest);
-int hexstr_2_bin(const char *hex, uint8_t *buf, uint32_t len);
-int get_value_string(char *value_in, char *buf);
-
-#endif //_BLE_MESH_CONSOLE_LIB_H_

+ 0 - 89
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_main.c

@@ -1,89 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "esp_log.h"
-#include "esp_vfs_dev.h"
-#include "nvs.h"
-#include "nvs_flash.h"
-#include "esp_vfs_fat.h"
-#include "esp_console.h"
-#include "ble_mesh_console_decl.h"
-#include "ble_mesh_example_init.h"
-
-#if CONFIG_STORE_HISTORY
-
-#define MOUNT_PATH "/data"
-#define HISTORY_PATH MOUNT_PATH "/history.txt"
-
-static void initialize_filesystem(void)
-{
-    static wl_handle_t wl_handle;
-    const esp_vfs_fat_mount_config_t mount_config = {
-        .max_files = 4,
-        .format_if_mount_failed = true
-    };
-    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(MOUNT_PATH, "storage", &mount_config, &wl_handle);
-    if (err != ESP_OK) {
-        return;
-    }
-}
-#endif // CONFIG_STORE_HISTORY
-
-void app_main(void)
-{
-    esp_err_t res;
-
-    nvs_flash_init();
-
-    // init and enable bluetooth
-    res = bluetooth_init();
-    if (res) {
-        printf("esp32_bluetooth_init failed (ret %d)", res);
-    }
-
-    esp_log_level_set("*", ESP_LOG_INFO);
-    esp_log_level_set("ble_mesh_console", ESP_LOG_INFO);
-
-    esp_console_repl_t *repl = NULL;
-    esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
-    esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
-#if CONFIG_STORE_HISTORY
-    initialize_filesystem();
-    repl_config.history_save_path = HISTORY_PATH;
-#endif
-
-#if CONFIG_IDF_TARGET_ESP32C3
-    repl_config.prompt = "esp32c3>";
-#elif CONFIG_IDF_TARGET_ESP32S3
-    repl_config.prompt = "esp32s3>";
-#else
-    repl_config.prompt = "esp32>";
-#endif
-
-    // init console REPL environment
-    repl_config.max_history_len = 1;
-    ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &repl));
-
-    /* Register commands */
-    register_system();
-    register_bluetooth();
-    ble_mesh_register_mesh_node();
-    ble_mesh_register_mesh_test_performance_client();
-    ble_mesh_register_server();
-#if (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
-    ble_mesh_register_gen_onoff_client();
-#endif
-#if (CONFIG_BLE_MESH_CFG_CLI)
-    ble_mesh_register_configuration_client_model();
-#endif
-    printf("!!!ready!!!\n");
-    // start console REPL
-    ESP_ERROR_CHECK(esp_console_start_repl(repl));
-}

+ 0 - 73
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_system.c

@@ -1,73 +0,0 @@
-/*
- * Console example - various system commands
- *
- * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <inttypes.h>
-
-#include "esp_log.h"
-#include "esp_console.h"
-#include "esp_system.h"
-#include "esp_sleep.h"
-#include "driver/rtc_io.h"
-#include "argtable3/argtable3.h"
-
-#include "freertos/FreeRTOS.h"
-#include "freertos/task.h"
-
-#include "ble_mesh_console_decl.h"
-
-#define CONFIG_ESPTOOLPY_PORT "Which is choosen by Users for CMake"
-
-static void register_free(void);
-static void register_restart(void);
-
-void register_system(void)
-{
-    register_free();
-    register_restart();
-}
-
-/** 'restart' command restarts the program */
-
-static int restart(int argc, char **argv)
-{
-    printf("%s, %s", __func__, "Restarting");
-    esp_restart();
-}
-
-static void register_restart(void)
-{
-    const esp_console_cmd_t cmd = {
-        .command = "restart",
-        .help = "Restart the program",
-        .hint = NULL,
-        .func = &restart,
-    };
-    ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
-}
-
-/** 'free' command prints available heap memory */
-
-static int free_mem(int argc, char **argv)
-{
-    printf("freeheap:%" PRIu32 "\n", esp_get_free_heap_size());
-    return 0;
-}
-
-static void register_free(void)
-{
-    const esp_console_cmd_t cmd = {
-        .command = "free",
-        .help = "Get the total size of heap memory available",
-        .hint = NULL,
-        .func = &free_mem,
-    };
-    ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
-}

+ 0 - 117
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_model.c

@@ -1,117 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "ble_mesh_model.h"
-uint8_t dev_uuid[16] = {0xdd, 0xdd};
-
-ble_mesh_node_config_params ble_mesh_node_prestore_params[NODE_MAX_GROUP_CONFIG];
-
-esp_ble_mesh_prov_t prov = {
-#if CONFIG_BLE_MESH_NODE
-    .uuid = dev_uuid,
-#endif //CONFIG_BLE_MESH_NODE
-#if CONFIG_BLE_MESH_PROVISIONER
-    .prov_uuid           = dev_uuid,
-    .prov_unicast_addr   = 0x0001,
-    .prov_start_address  = 0x0005,
-    .prov_attention      = 0x00,
-    .prov_algorithm      = 0x00,
-    .prov_pub_key_oob    = 0x00,
-    .prov_static_oob_val = NULL,
-    .prov_static_oob_len = 0x00,
-    .flags               = 0x00,
-    .iv_index            = 0x00,
-#endif //CONFIG_BLE_MESH_PROVISIONER
-};
-
-esp_ble_mesh_model_pub_t vendor_model_pub_config;
-
-// Configuration server model
-esp_ble_mesh_cfg_srv_t cfg_srv = {
-    .relay = ESP_BLE_MESH_RELAY_ENABLED,
-    .beacon = ESP_BLE_MESH_BEACON_ENABLED,
-#if defined(CONFIG_BLE_MESH_FRIEND)
-    .friend_state = ESP_BLE_MESH_FRIEND_ENABLED,
-#else
-    .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED,
-#endif
-#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
-    .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED,
-#else
-    .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED,
-#endif
-    .default_ttl = 7,
-
-    /* 3 transmissions with 20ms interval */
-    .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20),
-    .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20),
-};
-
-// Configuration Client model
-esp_ble_mesh_client_t cfg_cli;
-
-esp_ble_mesh_model_t config_client_models[] = {
-    ESP_BLE_MESH_MODEL_CFG_SRV(&cfg_srv),
-    ESP_BLE_MESH_MODEL_CFG_CLI(&cfg_cli),
-};
-
-esp_ble_mesh_elem_t config_client_elements[] = {
-    ESP_BLE_MESH_ELEMENT(0, config_client_models, ESP_BLE_MESH_MODEL_NONE),
-};
-
-esp_ble_mesh_comp_t config_client_comp = {
-    .cid = CID_ESP,
-    .elements = config_client_elements,
-    .element_count = ARRAY_SIZE(config_client_elements),
-};
-
-// Generic OnOff Server model
-esp_ble_mesh_gen_onoff_srv_t onoff_server = {
-    .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP,
-    .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP,
-};
-
-// Generic OnOff Client model
-#if (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
-esp_ble_mesh_client_t gen_onoff_cli;
-#endif //CONFIG_BLE_MESH_GENERIC_ONOFF_CLI
-
-//CONFIG VENDOR MODEL TEST PERFORMANCE
-#define ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_SRV 0x2000
-#define ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_CLI 0x2001
-
-#define ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_GET                 ESP_BLE_MESH_MODEL_OP_3(0x01, CID_ESP)
-#define ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET                 ESP_BLE_MESH_MODEL_OP_3(0x02, CID_ESP)
-#define ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET_UNACK           ESP_BLE_MESH_MODEL_OP_3(0x03, CID_ESP)
-#define ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS              ESP_BLE_MESH_MODEL_OP_3(0x04, CID_ESP)
-
-esp_ble_mesh_client_op_pair_t test_perf_cli_op_pair[] = {
-    {ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_GET, ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS},
-    {ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET, ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS},
-    {ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET_UNACK, ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS},
-};
-
-esp_ble_mesh_client_t test_perf_cli = {
-    .op_pair_size = ARRAY_SIZE(test_perf_cli_op_pair),
-    .op_pair = test_perf_cli_op_pair,
-};
-
-esp_ble_mesh_model_op_t test_perf_srv_op[] = {
-    ESP_BLE_MESH_MODEL_OP(ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_GET,       1),
-    ESP_BLE_MESH_MODEL_OP(ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET,       1),
-    ESP_BLE_MESH_MODEL_OP(ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET_UNACK, 1),
-    ESP_BLE_MESH_MODEL_OP_END,
-};
-
-esp_ble_mesh_model_op_t test_perf_cli_op[] = {
-    ESP_BLE_MESH_MODEL_OP(ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS, 1),
-    ESP_BLE_MESH_MODEL_OP_END,
-};
-
-esp_ble_mesh_model_t config_models[] = {
-    ESP_BLE_MESH_MODEL_CFG_SRV(&cfg_srv),
-    ESP_BLE_MESH_MODEL_CFG_CLI(&cfg_cli),
-};

+ 0 - 86
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_model.h

@@ -1,86 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#ifndef _BLE_MESH_CFG_SRV_MODEL_H_
-#define _BLE_MESH_CFG_SRV_MODEL_H_
-
-#include "esp_ble_mesh_defs.h"
-#if (CONFIG_BLE_MESH_CFG_CLI)
-#include "esp_ble_mesh_config_model_api.h"
-#endif
-#if (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
-#include "esp_ble_mesh_generic_model_api.h"
-#endif //CONFIG_BLE_MESH_GENERIC_ONOFF_CLI
-
-#define NODE_MAX_GROUP_CONFIG 3
-#define CID_ESP 0x02C4
-
-extern uint8_t dev_uuid[16];
-
-typedef struct {
-    uint16_t net_idx;
-    uint16_t unicast_addr;
-} ble_mesh_node_config_params;
-extern ble_mesh_node_config_params ble_mesh_node_prestore_params[NODE_MAX_GROUP_CONFIG];
-
-extern esp_ble_mesh_prov_t prov;
-
-extern esp_ble_mesh_model_pub_t vendor_model_pub_config;
-
-// Configuration Server model
-extern esp_ble_mesh_cfg_srv_t cfg_srv;
-extern esp_ble_mesh_model_t config_server_models[];
-extern esp_ble_mesh_elem_t config_server_elements[];
-extern esp_ble_mesh_comp_t config_server_comp;
-
-// Configuration Client model
-extern esp_ble_mesh_client_t cfg_cli;
-extern esp_ble_mesh_model_t config_client_models[];
-extern esp_ble_mesh_elem_t config_client_elements[];
-extern esp_ble_mesh_comp_t config_client_comp;
-
-// Generic OnOff Server model
-extern esp_ble_mesh_gen_onoff_srv_t onoff_server;
-extern esp_ble_mesh_model_op_t gen_onoff_srv_model_op_config[];
-
-// Generic OnOff Client model
-#if (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
-extern esp_ble_mesh_client_t gen_onoff_cli;
-extern esp_ble_mesh_model_t gen_onoff_cli_models[];
-#endif //CONFIG_BLE_MESH_GENERIC_ONOFF_CLI
-
-//CONFIG VENDOR MODEL TEST PERFORMANCE
-#define ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_SRV 0x2000
-#define ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_CLI 0x2001
-
-#define ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_GET                 ESP_BLE_MESH_MODEL_OP_3(0x01, CID_ESP)
-#define ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET                 ESP_BLE_MESH_MODEL_OP_3(0x02, CID_ESP)
-#define ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET_UNACK           ESP_BLE_MESH_MODEL_OP_3(0x03, CID_ESP)
-#define ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS              ESP_BLE_MESH_MODEL_OP_3(0x04, CID_ESP)
-
-extern esp_ble_mesh_client_t test_perf_cli;
-extern esp_ble_mesh_model_op_t test_perf_srv_op[];
-extern esp_ble_mesh_model_op_t test_perf_cli_op[];
-extern esp_ble_mesh_model_t config_models[];
-
-#if (CONFIG_BLE_MESH_CFG_CLI)
-void ble_mesh_configuration_client_model_cb(esp_ble_mesh_cfg_client_cb_event_t event,
-                                            esp_ble_mesh_cfg_client_cb_param_t *param);
-#endif
-
-#if (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
-void ble_mesh_generic_onoff_client_model_cb(esp_ble_mesh_generic_client_cb_event_t event,
-                                            esp_ble_mesh_generic_client_cb_param_t *param);
-#endif
-
-#if(CONFIG_BLE_MESH_GENERIC_SERVER)
-void ble_mesh_generic_server_model_cb(esp_ble_mesh_generic_server_cb_event_t event,
-                                      esp_ble_mesh_generic_server_cb_param_t *param);
-#endif
-
-void ble_mesh_vendor_model_cb(esp_ble_mesh_model_cb_event_t event, esp_ble_mesh_model_cb_param_t *param);
-
-#endif //_BLE_MESH_CFG_SRV_MODEL_H_

+ 0 - 405
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_reg_cfg_client_cmd.c

@@ -1,405 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "esp_ble_mesh_networking_api.h"
-#include "ble_mesh_adapter.h"
-
-#if (CONFIG_BLE_MESH_CFG_CLI)
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_str *set_state;
-    struct arg_int *opcode;
-    struct arg_int *count;
-    struct arg_int *feature;
-    struct arg_int *unicast_address;
-    struct arg_int *appkey_index;
-    struct arg_int *mod_id;
-    struct arg_int *addr;
-    struct arg_int *cid;
-    struct arg_int *value;
-    struct arg_int *relay_statue;
-    struct arg_int *relay_transmit;
-    struct arg_int *net_idx;
-    struct arg_end *end;
-} ble_mesh_client_get_set_state_t;
-ble_mesh_client_get_set_state_t configuration_client_model_operation;
-
-void ble_mesh_register_configuration_client_model_command(void);
-
-void ble_mesh_register_configuration_client_model(void)
-{
-    ble_mesh_register_configuration_client_model_command();
-}
-
-void ble_mesh_configuration_client_model_cb(esp_ble_mesh_cfg_client_cb_event_t event,
-                                            esp_ble_mesh_cfg_client_cb_param_t *param)
-{
-    uint32_t opcode;
-    ESP_LOGD(TAG, "enter %s, event = %x, error_code = %x", __func__, event, param->error_code);
-
-    if (!param->error_code) {
-        opcode = param->params->opcode;
-        switch (event) {
-        case ESP_BLE_MESH_CFG_CLIENT_GET_STATE_EVT:
-            switch (opcode) {
-            case ESP_BLE_MESH_MODEL_OP_BEACON_GET:
-                ESP_LOGI(TAG, "CfgClient:beacon,0x%x", param->status_cb.beacon_status.beacon);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET:
-                ESP_LOGI(TAG, "CfgClient:page,0x%x,len,0x%x", param->status_cb.comp_data_status.page, param->status_cb.comp_data_status.composition_data->len);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_GET:
-                ESP_LOGI(TAG, "CfgClient:ttl,0x%x", param->status_cb.default_ttl_status.default_ttl);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_GATT_PROXY_GET:
-                ESP_LOGI(TAG, "CfgClient:proxy,0x%x", param->status_cb.gatt_proxy_status.gatt_proxy);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_RELAY_GET:
-                ESP_LOGI(TAG, "CfgClient:relay,0x%x,retransmit,0x%x", param->status_cb.relay_status.relay, param->status_cb.relay_status.retransmit);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET:
-                if (param->status_cb.model_pub_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CfgClient:PublishGet,OK,0x%x", param->status_cb.model_pub_status.publish_addr);
-                } else {
-                    ESP_LOGI(TAG, "CfgClient:PublishGet,Fail");
-                }
-
-                break;
-            case ESP_BLE_MESH_MODEL_OP_FRIEND_GET:
-                ESP_LOGI(TAG, "CfgClient:friend,0x%x", param->status_cb.friend_status.friend_state);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_GET:
-                if (param->status_cb.heartbeat_pub_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CfgClient:HeartBeatPubGet,OK,destination:0x%x,countlog:0x%x,periodlog:0x%x,ttl:0x%x,features:0x%x,net_idx:0x%x",
-                             param->status_cb.heartbeat_pub_status.dst, param->status_cb.heartbeat_pub_status.count,  param->status_cb.heartbeat_pub_status.period,
-                             param->status_cb.heartbeat_pub_status.ttl, param->status_cb.heartbeat_pub_status.features, param->status_cb.heartbeat_pub_status.net_idx);
-                } else {
-                    ESP_LOGI(TAG, "CfgClient:HeartBeatGet,Fail,%d", param->status_cb.heartbeat_pub_status.status);
-                }
-                break;
-            case ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_GET:
-                if (param->status_cb.heartbeat_sub_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CfgClient:HeartBeatSubGet,OK,source:0x%x,destination:0x%x, periodlog:0x%x,countlog:0x%x,minhops:0x%x,maxhops:0x%x",
-                             param->status_cb.heartbeat_sub_status.src, param->status_cb.heartbeat_sub_status.dst, param->status_cb.heartbeat_sub_status.period,
-                             param->status_cb.heartbeat_sub_status.count, param->status_cb.heartbeat_sub_status.min_hops, param->status_cb.heartbeat_sub_status.max_hops);
-                } else {
-                    ESP_LOGI(TAG, "CfgClient:HeartBeatSubGet,Fail,%d", param->status_cb.heartbeat_sub_status.status);
-                }
-                break;
-            default:
-                ESP_LOGI(TAG, "Not supported config client get message opcode");
-                break;
-            }
-            break;
-        case ESP_BLE_MESH_CFG_CLIENT_SET_STATE_EVT:
-            switch (opcode) {
-            case ESP_BLE_MESH_MODEL_OP_BEACON_SET:
-                ESP_LOGI(TAG, "CfgClient:beacon,0x%x", param->status_cb.beacon_status.beacon);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_SET:
-                ESP_LOGI(TAG, "CfgClient:ttl,0x%x", param->status_cb.default_ttl_status.default_ttl);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_GATT_PROXY_SET:
-                ESP_LOGI(TAG, "CfgClient:proxy,0x%x", param->status_cb.gatt_proxy_status.gatt_proxy);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_RELAY_SET:
-                ESP_LOGI(TAG, "CfgClient:relay,0x%x, retransmit: 0x%x", param->status_cb.relay_status.relay, param->status_cb.relay_status.retransmit);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_PUB_SET:
-                if (param->status_cb.model_pub_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CfgClient:PublishSet,OK,0x%x", param->status_cb.model_pub_status.publish_addr);
-                } else {
-                    ESP_LOGI(TAG, "CfgClient:PublishSet,Fail,%d", param->status_cb.model_pub_status.status);
-                }
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD:
-                if (param->status_cb.model_sub_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CnfClient:SubAdd,OK,%x,%x", param->status_cb.model_sub_status.element_addr, param->status_cb.model_sub_status.sub_addr);
-                } else {
-                    ESP_LOGI(TAG, "CnfClient:SubAdd,Fail,%x", param->status_cb.model_sub_status.status);
-                }
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE:
-                if (param->status_cb.model_sub_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CnfClient:SubDel,OK,%x,%x", param->status_cb.model_sub_status.element_addr, param->status_cb.model_sub_status.sub_addr);
-                } else {
-                    ESP_LOGI(TAG, "CnfClient:SubDel,Fail,%x", param->status_cb.model_sub_status.status);
-                }
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_OVERWRITE:
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_ADD:
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_DELETE:
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_OVERWRITE:
-                break;
-            case ESP_BLE_MESH_MODEL_OP_NET_KEY_ADD:
-                if (param->status_cb.netkey_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CfgClient:NetKeyAdd,OK");
-                } else {
-                    ESP_LOGI(TAG, "CfgClient:NetKeyAdd,Fail,%d", param->status_cb.netkey_status.status);
-                }
-                break;
-            case ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD:
-                if (param->status_cb.appkey_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CnfClient:AddAppkey,OK,%x,%x,%x", param->status_cb.appkey_status.net_idx, param->status_cb.appkey_status.app_idx, param->params->ctx.addr);
-                } else {
-                    ESP_LOGI(TAG, "CnfClient:AddAppkey,Fail,%x", param->status_cb.appkey_status.status);
-                }
-                break;
-            case ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND:
-                if (param->status_cb.model_app_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CnfClient:AppkeyBind,OK,%x,%x,%x", param->status_cb.model_app_status.app_idx, param->status_cb.model_app_status.model_id, param->params->ctx.addr);
-                } else {
-                    ESP_LOGI(TAG, "CnfClient:AppkeyBind,Fail,%x", param->status_cb.model_app_status.status);
-                }
-                break;
-            case ESP_BLE_MESH_MODEL_OP_FRIEND_SET:
-                ESP_LOGI(TAG, "CfgClient:friend: 0x%x", param->status_cb.friend_status.friend_state);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_SET:
-                if (param->status_cb.heartbeat_pub_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CfgClient:HeartBeatPubSet,OK,destination:0x%x,countlog:0x%x, periodlog:0x%x,ttl:0x%x,features:0x%x,net_idx: 0x%x",
-                             param->status_cb.heartbeat_pub_status.dst, param->status_cb.heartbeat_pub_status.count, param->status_cb.heartbeat_pub_status.period,
-                             param->status_cb.heartbeat_pub_status.ttl, param->status_cb.heartbeat_pub_status.features, param->status_cb.heartbeat_pub_status.net_idx);
-                } else {
-                    ESP_LOGI(TAG, "CfgClient:HeartBeatSet,Fail,%d", param->status_cb.heartbeat_pub_status.status);
-                }
-                break;
-            case ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_SET:
-                if (param->status_cb.heartbeat_sub_status.status == ESP_OK) {
-                    ESP_LOGI(TAG, "CfgClient:HeartBeatSubSet,OK,source:0x%x,destination:0x%x, periodlog:0x%x,countlog:0x%x,minhops:0x%x,maxhops:0x%x",
-                             param->status_cb.heartbeat_sub_status.src, param->status_cb.heartbeat_sub_status.dst, param->status_cb.heartbeat_sub_status.period,
-                             param->status_cb.heartbeat_sub_status.count, param->status_cb.heartbeat_sub_status.min_hops, param->status_cb.heartbeat_sub_status.max_hops);
-                } else {
-                    ESP_LOGI(TAG, "CfgClient:HeartBeatSubSet,Fail,%d", param->status_cb.heartbeat_sub_status.status);
-                }
-                break;
-            default:
-                ESP_LOGI(TAG, "Not supported config client set message opcode");
-                break;
-            }
-            break;
-        case ESP_BLE_MESH_CFG_CLIENT_PUBLISH_EVT:
-            ESP_LOGI(TAG, "CnfClient:Publish,OK");
-            break;
-        case ESP_BLE_MESH_CFG_CLIENT_EVT_MAX:
-            ESP_LOGI(TAG, "CnfClient:MaxEvt");
-            break;
-        case ESP_BLE_MESH_CFG_CLIENT_TIMEOUT_EVT:
-            ESP_LOGI(TAG, "CfgClient:TimeOut");
-            break;
-        default:
-            ESP_LOGI(TAG, "CfgClient:InvalidEvent");
-            break;
-        }
-    } else {
-        ESP_LOGI(TAG, "CnfClient:Fail,%d", param->error_code);
-    }
-    ESP_LOGD(TAG, "exit %s", __func__);
-}
-
-int ble_mesh_configuration_client_model_operation(int argc, char **argv)
-{
-    int err = ESP_OK;
-    esp_ble_mesh_elem_t *element = NULL;
-    const uint8_t *app_key = NULL;
-    esp_ble_mesh_cfg_default_ttl_set_t ttl_set;
-    esp_ble_mesh_cfg_gatt_proxy_set_t proxy_set;
-    esp_ble_mesh_cfg_app_key_add_t app_key_add;
-    esp_ble_mesh_cfg_heartbeat_pub_set_t heartbeat_pub_set;
-    esp_ble_mesh_cfg_model_pub_set_t mod_pub_set = {
-        .company_id = 0xFFFF,
-        .cred_flag = false,
-        .publish_period = 0,
-        .publish_retransmit = 0,
-    };
-    esp_ble_mesh_cfg_model_sub_add_t mod_sub_add = {
-        .company_id = 0xFFFF,
-    };
-    esp_ble_mesh_cfg_model_sub_delete_t mod_sub_del = {
-        .company_id = 0xFFFF,
-    };
-    esp_ble_mesh_cfg_relay_set_t relay_set;
-    esp_ble_mesh_client_common_param_t client_common = {
-        .msg_role = ROLE_PROVISIONER,
-        .msg_timeout = 0,
-        .ctx.send_ttl = 7,
-    };
-    esp_ble_mesh_cfg_client_get_state_t get_state = {
-        .comp_data_get.page = 0,
-        .model_pub_get.company_id = 0xFFFF,
-    };
-    esp_ble_mesh_cfg_model_app_bind_t mod_app_bind = {
-        .company_id = 0xFFFF,
-    };
-
-    element = esp_ble_mesh_find_element(esp_ble_mesh_get_primary_element_address());
-    if (!element) {
-        ESP_LOGE(TAG, "Element 0x%04x not exists", esp_ble_mesh_get_primary_element_address());
-        return ESP_FAIL;
-    }
-
-    client_common.model = esp_ble_mesh_find_sig_model(element, ESP_BLE_MESH_MODEL_ID_CONFIG_CLI);
-    if (!client_common.model) {
-        ESP_LOGE(TAG, "CfgClient:LoadModel,Fail");
-        return ESP_FAIL;
-    }
-
-    int nerrors = arg_parse(argc, argv, (void **) &configuration_client_model_operation);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, configuration_client_model_operation.end, argv[0]);
-        return 1;
-    }
-
-    if (configuration_client_model_operation.opcode->count != 0) {
-        client_common.opcode = configuration_client_model_operation.opcode->ival[0];
-    }
-
-    if (configuration_client_model_operation.net_idx->count != 0) {
-        client_common.ctx.net_idx = configuration_client_model_operation.net_idx->ival[0];
-        app_key_add.net_idx = configuration_client_model_operation.net_idx->ival[0];
-        heartbeat_pub_set.net_idx = configuration_client_model_operation.net_idx->ival[0];
-    }
-
-    if (configuration_client_model_operation.unicast_address->count != 0) {
-        client_common.ctx.addr = configuration_client_model_operation.unicast_address->ival[0];
-        get_state.model_pub_get.element_addr = configuration_client_model_operation.unicast_address->ival[0];
-        mod_app_bind.element_addr = configuration_client_model_operation.unicast_address->ival[0];
-        mod_sub_add.element_addr = configuration_client_model_operation.unicast_address->ival[0];
-        mod_sub_del.element_addr = configuration_client_model_operation.unicast_address->ival[0];
-        mod_pub_set.element_addr = configuration_client_model_operation.unicast_address->ival[0];
-    }
-
-    if (configuration_client_model_operation.appkey_index->count != 0) {
-        client_common.ctx.app_idx = configuration_client_model_operation.appkey_index->ival[0];
-        mod_app_bind.model_app_idx = configuration_client_model_operation.appkey_index->ival[0];
-        app_key_add.app_idx = configuration_client_model_operation.appkey_index->ival[0];
-        mod_pub_set.publish_app_idx = configuration_client_model_operation.appkey_index->ival[0];
-    }
-
-    if (configuration_client_model_operation.value->count != 0) {
-        ttl_set.ttl = configuration_client_model_operation.value->ival[0];
-        proxy_set.gatt_proxy = configuration_client_model_operation.value->ival[0];
-        mod_pub_set.publish_ttl = configuration_client_model_operation.value->ival[0];
-        heartbeat_pub_set.ttl = configuration_client_model_operation.value->ival[0];
-    }
-
-    if (configuration_client_model_operation.addr->count != 0) {
-        mod_sub_del.sub_addr = configuration_client_model_operation.addr->ival[0];
-        mod_sub_add.sub_addr = configuration_client_model_operation.addr->ival[0];
-        mod_pub_set.publish_addr = configuration_client_model_operation.addr->ival[0];
-        heartbeat_pub_set.dst = configuration_client_model_operation.addr->ival[0];
-    }
-
-    if (configuration_client_model_operation.mod_id->count != 0) {
-        mod_app_bind.model_id = configuration_client_model_operation.mod_id->ival[0];
-        mod_sub_add.model_id = configuration_client_model_operation.mod_id->ival[0];
-        mod_sub_del.model_id = configuration_client_model_operation.mod_id->ival[0];
-        get_state.model_pub_get.model_id = configuration_client_model_operation.mod_id->ival[0];;
-        mod_pub_set.model_id = configuration_client_model_operation.mod_id->ival[0];
-    }
-
-    if (configuration_client_model_operation.relay_statue->count != 0) {
-        relay_set.relay = configuration_client_model_operation.relay_statue->ival[0];
-        mod_pub_set.publish_period = configuration_client_model_operation.relay_statue->ival[0];
-        heartbeat_pub_set.period = configuration_client_model_operation.relay_statue->ival[0];
-    }
-
-    if (configuration_client_model_operation.relay_transmit->count != 0) {
-        relay_set.relay_retransmit = configuration_client_model_operation.relay_transmit->ival[0];
-        mod_pub_set.publish_retransmit = configuration_client_model_operation.relay_transmit->ival[0];
-    }
-
-    if (configuration_client_model_operation.cid->count != 0) {
-        mod_app_bind.company_id = configuration_client_model_operation.cid->ival[0];
-        mod_sub_del.company_id = configuration_client_model_operation.cid->ival[0];
-        mod_sub_add.company_id = configuration_client_model_operation.cid->ival[0];
-        mod_pub_set.company_id = configuration_client_model_operation.cid->ival[0];
-    }
-
-    if (configuration_client_model_operation.count->count != 0) {
-        heartbeat_pub_set.count = configuration_client_model_operation.count->ival[0];
-    }
-
-    if (configuration_client_model_operation.feature->count != 0) {
-        heartbeat_pub_set.feature = configuration_client_model_operation.feature->ival[0];
-    }
-
-    if (configuration_client_model_operation.action_type->count != 0) {
-        if (strcmp(configuration_client_model_operation.action_type->sval[0], "get") == 0) {
-            err = esp_ble_mesh_config_client_get_state(&client_common, &get_state);
-        } else if (strcmp(configuration_client_model_operation.action_type->sval[0], "set") == 0) {
-            if (configuration_client_model_operation.set_state->count != 0) {
-                if (strcmp(configuration_client_model_operation.set_state->sval[0], "appkey") == 0) {
-                    app_key = esp_ble_mesh_provisioner_get_local_app_key(app_key_add.net_idx, app_key_add.app_idx);
-                    if (app_key == NULL) {
-                        ESP_LOGE(TAG, "CnfClient:AddAppkey,Fail,app key or network key NULL");
-                        return ESP_FAIL;
-                    } else {
-                        memcpy(app_key_add.app_key, app_key, 16);
-                    }
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&app_key_add);
-                } else if (strcmp(configuration_client_model_operation.set_state->sval[0], "appbind") == 0) {
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&mod_app_bind);
-                } else if (strcmp(configuration_client_model_operation.set_state->sval[0], "ttl") == 0) {
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&ttl_set);
-                } else if (strcmp(configuration_client_model_operation.set_state->sval[0], "proxy") == 0) {
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&proxy_set);
-                } else if (strcmp(configuration_client_model_operation.set_state->sval[0], "subadd") == 0) {
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&mod_sub_add);
-                } else if (strcmp(configuration_client_model_operation.set_state->sval[0], "subdel") == 0) {
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&mod_sub_del);
-                } else if (strcmp(configuration_client_model_operation.set_state->sval[0], "relay") == 0) {
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&relay_set);
-                } else if (strcmp(configuration_client_model_operation.set_state->sval[0], "pubset") == 0) {
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&mod_pub_set);
-                } else if (strcmp(configuration_client_model_operation.set_state->sval[0], "reset") == 0) {
-                    err = esp_ble_mesh_config_client_set_state(&client_common, NULL);
-                }else if(strcmp(configuration_client_model_operation.set_state->sval[0], "hbpub") == 0){
-                    err = esp_ble_mesh_config_client_set_state(&client_common, (esp_ble_mesh_cfg_client_set_state_t *)&heartbeat_pub_set);
-                }
-            }
-        }
-    }
-
-    if (err == ESP_OK) {
-        ESP_LOGI(TAG, "ConfigClient:OK");
-    } else {
-        ESP_LOGI(TAG, "ConfigClient:Fail");
-    }
-    return err;
-}
-
-void ble_mesh_register_configuration_client_model_command(void)
-{
-    configuration_client_model_operation.action_type = arg_str1("z", NULL, "<action>", "action type");
-    configuration_client_model_operation.set_state = arg_str0("x", NULL, "<state>", "set state");
-    configuration_client_model_operation.opcode = arg_int0("o", NULL, "<opcode>", "message opcode");
-    configuration_client_model_operation.unicast_address = arg_int0("u", NULL, "<address>", "unicast address");
-    configuration_client_model_operation.net_idx = arg_int0("n", NULL, "<network>", "net work index");
-    configuration_client_model_operation.appkey_index = arg_int0("i", NULL, "<index>", "appkey index");
-    configuration_client_model_operation.relay_statue = arg_int0("r", NULL, "<relay>", "relay statue");
-    configuration_client_model_operation.relay_transmit = arg_int0("t", NULL, "<transmit>", "relay transmit");
-    configuration_client_model_operation.cid = arg_int0("c", NULL, "<cid>", "company id");
-    configuration_client_model_operation.value = arg_int0("v", NULL, "<value>", "value");
-    configuration_client_model_operation.addr = arg_int0("a", NULL, "<address>", "address");
-    configuration_client_model_operation.mod_id = arg_int0("m", NULL, "<mod id>", "model id");
-    configuration_client_model_operation.count = arg_int0("b", NULL, "<heartbeat count>", "heartbeat count");
-    configuration_client_model_operation.feature = arg_int0("f", NULL, "<features>", "features");
-    configuration_client_model_operation.end = arg_end(1);
-
-    const esp_console_cmd_t client_stconfiguration_client_model_operationate_cmd = {
-        .command = "bmccm",
-        .help = "ble mesh configuration client model",
-        .hint = NULL,
-        .func = &ble_mesh_configuration_client_model_operation,
-        .argtable = &configuration_client_model_operation,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&client_stconfiguration_client_model_operationate_cmd));
-}
-#endif

+ 0 - 243
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_reg_gen_onoff_client_cmd.c

@@ -1,243 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <inttypes.h>
-
-#include "esp_timer.h"
-#include "ble_mesh_adapter.h"
-#include "esp_ble_mesh_defs.h"
-#include "esp_ble_mesh_networking_api.h"
-
-#if (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_int *op_en;
-    struct arg_int *unicast_address;
-    struct arg_int *onoff_state;
-    struct arg_int *trans_id;
-    struct arg_int *trans_time;
-    struct arg_int *delay;
-    struct arg_int *opcode;
-    struct arg_int *appkey_idx;
-    struct arg_int *role;
-    struct arg_int *net_idx;
-    struct arg_end *end;
-} ble_mesh_gen_onoff_state_t;
-static ble_mesh_gen_onoff_state_t gen_onoff_state;
-
-void ble_mesh_register_gen_onoff_client_command(void);
-
-void ble_mesh_register_gen_onoff_client(void)
-{
-    ble_mesh_register_gen_onoff_client_command();
-}
-
-void ble_mesh_generic_onoff_client_model_cb(esp_ble_mesh_generic_client_cb_event_t event,
-                                            esp_ble_mesh_generic_client_cb_param_t *param)
-{
-    uint32_t opcode = param->params->opcode;
-
-    ESP_LOGD(TAG, "enter %s: event is %d, error code is %d, opcode is 0x%" PRIx32,
-             __func__, event, param->error_code, opcode);
-
-    switch (event) {
-    case ESP_BLE_MESH_GENERIC_CLIENT_GET_STATE_EVT: {
-        switch (opcode) {
-        case ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET:
-            if (param->error_code == ESP_OK) {
-                ESP_LOGI(TAG, "GenOnOffClient:GetStatus,OK,%d", param->status_cb.onoff_status.present_onoff);
-            } else {
-                ESP_LOGE(TAG, "GenOnOffClient:GetStatus,Fail,%d", param->error_code);
-            }
-            break;
-        default:
-            break;
-        }
-        break;
-    }
-    case ESP_BLE_MESH_GENERIC_CLIENT_SET_STATE_EVT: {
-        switch (opcode) {
-        case ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET:
-            if (param->error_code == ESP_OK) {
-                ESP_LOGI(TAG, "GenOnOffClient:SetStatus,OK,%d", param->status_cb.onoff_status.present_onoff);
-            } else {
-                ESP_LOGE(TAG, "GenOnOffClient:SetStatus,Fail,%d", param->error_code);
-            }
-            break;
-        case ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK:
-            if (param->error_code == ESP_OK) {
-                ESP_LOGI(TAG, "GenOnOffClient:SetUNACK,OK");
-            } else {
-                ESP_LOGE(TAG, "GenOnOffClient:SetUNACK,Fail,%d", param->error_code);
-            }
-            break;
-        default:
-            break;
-        }
-        break;
-    }
-    case ESP_BLE_MESH_GENERIC_CLIENT_PUBLISH_EVT: {
-        if (param->error_code == ESP_OK) {
-            ESP_LOGI(TAG, "GenOnOffClient:Publish,OK");
-        } else {
-            ESP_LOGE(TAG, "GenOnOffClient:Publish,Fail,%d", param->error_code);
-        }
-        break;
-    }
-    case ESP_BLE_MESH_GENERIC_CLIENT_TIMEOUT_EVT:
-        ESP_LOGE(TAG, "GenOnOffClient:TimeOut,%d", param->error_code);
-        break;
-    case ESP_BLE_MESH_GENERIC_CLIENT_EVT_MAX:
-        ESP_LOGE(TAG, "GenONOFFClient:InvalidEvt,%d", param->error_code);
-        break;
-    default:
-        break;
-    }
-    ESP_LOGD(TAG, "exit %s", __func__);
-}
-
-void ble_mesh_generic_server_model_cb(esp_ble_mesh_generic_server_cb_event_t event,
-                                      esp_ble_mesh_generic_server_cb_param_t *param)
-{
-    uint32_t opcode = param->ctx.recv_op;
-    uint8_t status;
-
-    ESP_LOGD(TAG, "enter %s: event is %d, opcode is 0x%04" PRIx32, __func__, event, opcode);
-
-    switch (event) {
-        case ESP_BLE_MESH_GENERIC_SERVER_STATE_CHANGE_EVT:
-            if (opcode == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET) {
-                ESP_LOGI(TAG, "GenOnOffServer:Set,OK,%d", param->value.state_change.onoff_set.onoff);
-                ble_mesh_node_set_state(param->value.state_change.onoff_set.onoff);
-            } else if (opcode == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK) {
-                ESP_LOGI(TAG, "GenOnOffServer:SetUnAck,OK,%d", param->value.state_change.onoff_set.onoff);
-                ble_mesh_node_set_state(param->value.state_change.onoff_set.onoff);
-            }
-            break;
-    case ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT: {
-        switch (opcode) {
-        case ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET:
-            ESP_LOGI(TAG, "GenOnOffServer:Get,OK");
-            ble_mesh_node_get_state(status);
-            esp_ble_mesh_server_model_send_msg(param->model, &param->ctx, ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS,
-                                                   sizeof(status), &status);
-            break;
-        default:
-            break;
-        }
-        break;
-    }
-    case ESP_BLE_MESH_GENERIC_SERVER_RECV_SET_MSG_EVT: {
-        if (opcode == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET || opcode == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK) {
-            esp_ble_mesh_gen_onoff_srv_t *srv = param->model->user_data;
-            if (param->value.set.onoff.op_en == false) {
-                srv->state.onoff = param->value.set.onoff.onoff;
-            } else {
-                /* TODO: Delay and state transition */
-               srv->state.onoff = param->value.set.onoff.onoff;
-            }
-        }
-
-        switch (opcode) {
-            case ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET:
-                ESP_LOGI(TAG, "GenOnOffServer:Set,OK,%d", param->value.set.onoff.onoff);
-                ble_mesh_node_set_state(param->value.set.onoff.onoff);
-                ble_mesh_node_get_state(status);
-                esp_ble_mesh_server_model_send_msg(param->model, &param->ctx, ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS,
-                                                   sizeof(status), &status);
-                break;
-            case ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK:
-                ble_mesh_node_set_state(param->value.set.onoff.onoff);
-                ESP_LOGI(TAG, "GenOnOffServer:SetUnAck,OK,%d", param->value.set.onoff.onoff);
-                break;
-            default:
-                break;
-        }
-        break;
-    }
-    default:
-        break;
-    }
-    ESP_LOGD(TAG, "exit %s", __func__);
-}
-
-int ble_mesh_generic_onoff_client_model(int argc, char **argv)
-{
-    int err = ESP_OK;
-    esp_ble_mesh_elem_t *element = NULL;
-    esp_ble_mesh_generic_client_set_state_t gen_client_set;
-    esp_ble_mesh_generic_client_get_state_t gen_client_get;
-    esp_ble_mesh_client_common_param_t onoff_common = {
-        .msg_timeout = 0,
-        .ctx.send_ttl = 7,
-    };
-
-    int nerrors = arg_parse(argc, argv, (void **) &gen_onoff_state);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, gen_onoff_state.end, argv[0]);
-        return 1;
-    }
-
-    element = esp_ble_mesh_find_element(esp_ble_mesh_get_primary_element_address());
-    if (!element) {
-        ESP_LOGE(TAG, "Element 0x%04x not exists", esp_ble_mesh_get_primary_element_address());
-        return ESP_FAIL;
-    }
-
-    onoff_common.model = esp_ble_mesh_find_sig_model(element, ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_CLI);
-    if (!onoff_common.model) {
-        ESP_LOGI(TAG, "GenONOFFClient:LoadModel,Fail");
-        return ESP_FAIL;
-    }
-
-    arg_int_to_value(gen_onoff_state.appkey_idx, onoff_common.ctx.app_idx, "appkey_index");
-    arg_int_to_value(gen_onoff_state.opcode, onoff_common.opcode, "opcode");
-    arg_int_to_value(gen_onoff_state.role, onoff_common.msg_role, "role");
-    arg_int_to_value(gen_onoff_state.unicast_address, onoff_common.ctx.addr, "address");
-    arg_int_to_value(gen_onoff_state.net_idx, onoff_common.ctx.net_idx, "network key index");
-    arg_int_to_value(gen_onoff_state.op_en, gen_client_set.onoff_set.op_en, "op_en");
-    arg_int_to_value(gen_onoff_state.onoff_state, gen_client_set.onoff_set.onoff, "onoff");
-    arg_int_to_value(gen_onoff_state.trans_id, gen_client_set.onoff_set.tid, "tid");
-    arg_int_to_value(gen_onoff_state.trans_time, gen_client_set.onoff_set.trans_time, "trans_time");
-    arg_int_to_value(gen_onoff_state.delay, gen_client_set.onoff_set.delay, "delay");
-
-    if (gen_onoff_state.action_type->count != 0) {
-        if (strcmp(gen_onoff_state.action_type->sval[0], "get") == 0) {
-            err = esp_ble_mesh_generic_client_get_state(&onoff_common, &gen_client_get);
-        }
-        else if (strcmp(gen_onoff_state.action_type->sval[0], "set") == 0) {
-            err = esp_ble_mesh_generic_client_set_state(&onoff_common, &gen_client_set);
-        }
-    }
-    return err;
-}
-
-void ble_mesh_register_gen_onoff_client_command(void)
-{
-    gen_onoff_state.action_type = arg_str1("z", NULL, "<action>", "action type");
-    gen_onoff_state.opcode = arg_int0("o", NULL, "<opcode>", "message opcode");
-    gen_onoff_state.appkey_idx = arg_int0("a", NULL, "<appkey>", "appkey index");
-    gen_onoff_state.role = arg_int0("r", NULL, "<role>", "role");
-    gen_onoff_state.unicast_address = arg_int0("u", NULL, "<address>", "unicast address");
-    gen_onoff_state.net_idx = arg_int0("n", NULL, "<netkey index>", "network key index");
-    gen_onoff_state.op_en = arg_int0("e", NULL, "<optional>", "whether optional parameters included");
-    gen_onoff_state.onoff_state = arg_int0("s", NULL, "<state>", "present onoff state");
-    gen_onoff_state.trans_id = arg_int0("i", NULL, "<identifier>", "transaction identifier");
-    gen_onoff_state.trans_time = arg_int0("t", NULL, "<time>", "time to complete state transition");
-    gen_onoff_state.delay = arg_int0("d", NULL, "<delay>", "indicate message execution delay");
-    gen_onoff_state.end = arg_end(1);
-
-    const esp_console_cmd_t gen_onoff_state_cmd = {
-        .command = "bmgocm",
-        .help = "ble mesh generic onoff client model",
-        .hint = NULL,
-        .func = &ble_mesh_generic_onoff_client_model,
-        .argtable = &gen_onoff_state,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&gen_onoff_state_cmd));
-}
-
-#endif

+ 0 - 325
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_reg_test_perf_client_cmd.c

@@ -1,325 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "freertos/FreeRTOS.h"
-#include "freertos/task.h"
-#include "freertos/queue.h"
-#include "freertos/FreeRTOSConfig.h"
-#include "esp_timer.h"
-
-#include "esp_ble_mesh_networking_api.h"
-#include "ble_mesh_adapter.h"
-#include "transaction.h"
-
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_int *playload_byte;
-    struct arg_int *test_num;
-    struct arg_int *opcode;
-    struct arg_int *unicast_address;
-    struct arg_int *ttl;
-    struct arg_int *app_idx;
-    struct arg_int *net_idx;
-    struct arg_int *dev_role;
-    struct arg_end *end;
-} ble_mesh_test_perf_client_model_t;
-ble_mesh_test_perf_client_model_t test_perf_client_model;
-
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_int *test_size;
-    struct arg_int *node_num;
-    struct arg_int *ttl;
-    struct arg_end *end;
-} ble_mesh_test_perf_client_model_statistics_t;
-ble_mesh_test_perf_client_model_statistics_t test_perf_client_model_statistics;
-
-bool deinit_flag = false;
-
-void ble_mesh_performance_client_model_command(void);
-
-void ble_mesh_register_mesh_test_performance_client(void)
-{
-    ble_mesh_performance_client_model_command();
-}
-
-void ble_mesh_vendor_model_cb(esp_ble_mesh_model_cb_event_t event, esp_ble_mesh_model_cb_param_t *param)
-{
-    uint16_t result;
-    uint8_t data[4];
-    uint64_t *start_time = NULL;
-    transaction_t *trans = NULL;
-
-    ESP_LOGD(TAG, "enter %s, event=%x", __func__, event);
-    do {
-        trans = transaction_get(TRANS_TYPE_MESH_PERF, TRANS_MESH_SEND_MESSAGE, trans);
-        if (trans) {
-            start_time = (uint64_t *)trans->input;
-            break;
-        }
-    }while(trans);
-
-    switch (event) {
-    case ESP_BLE_MESH_MODEL_OPERATION_EVT:
-        if (param->model_operation.model != NULL && param->model_operation.model->op != NULL) {
-            if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET) {
-                ESP_LOGI(TAG, "VndSrvModel:SetAck,Success,%d", param->model_operation.ctx->recv_ttl);
-                data[0] = param->model_operation.msg[0];
-                data[1] = param->model_operation.msg[1];
-                data[2] = param->model_operation.msg[2];
-                data[3] = param->model_operation.ctx->recv_ttl;
-                result = ble_mesh_node_statistics_accumulate(param->model_operation.msg, param->model_operation.length, VENDOR_MODEL_PERF_OPERATION_TYPE_SET);
-                if (result == 0) {
-                    esp_ble_mesh_server_model_send_msg(param->model_operation.model, param->model_operation.ctx,
-                                                       ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS, sizeof(data), data);
-                }
-            } else if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET_UNACK) {
-                ESP_LOGI(TAG, "VndSrvModel:SetUnAck,Success,%d,%d", param->model_operation.ctx->recv_ttl, param->model_operation.length);
-                result = ble_mesh_node_statistics_accumulate(param->model_operation.msg, param->model_operation.length, VENDOR_MODEL_PERF_OPERATION_TYPE_SET_UNACK);
-            } else if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_STATUS) {
-                if (trans) {
-                    uint64_t current_time = esp_timer_get_time();
-                    result = ble_mesh_test_performance_client_model_accumulate_time(((uint32_t)(current_time - *start_time) / 1000), param->model_operation.msg,
-                        param->model_operation.ctx->recv_ttl, param->model_operation.length);
-                    transaction_set_events(trans, TRANS_MESH_SEND_MESSAGE_EVT);
-                }
-            }
-        }
-        break;
-    case ESP_BLE_MESH_MODEL_SEND_COMP_EVT:
-        if (param->model_send_comp.opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET_UNACK) {
-            transaction_set_events(trans, TRANS_MESH_SEND_MESSAGE_EVT);
-        }
-        if (param->model_send_comp.err_code == ESP_OK) {
-            ESP_LOGI(TAG, "VndModel:ModelSend,OK");
-        } else {
-            ESP_LOGE(TAG, "VndModel:ModelSend,Fail");
-        }
-        break;
-    case ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT:
-        ESP_LOGI(TAG, "VndModel:PublishSend,OK,0x%x,%d,", param->model_publish_comp.model->model_id, param->model_publish_comp.model->pub->msg->len);
-        break;
-    case ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT:
-        ESP_LOGI(TAG, "VndModel:PublishReceive,OK,0x%06" PRIx32 ",%d,%d", param->client_recv_publish_msg.opcode, param->client_recv_publish_msg.length, param->client_recv_publish_msg.msg[1]);
-        if (trans) {
-            uint64_t current_time = esp_timer_get_time();
-            result = ble_mesh_test_performance_client_model_accumulate_time(((uint32_t)(current_time - *start_time) / 2000), param->client_recv_publish_msg.msg,
-                param->client_recv_publish_msg.ctx->recv_ttl, param->client_recv_publish_msg.length);
-            transaction_set_events(trans, TRANS_MESH_SEND_MESSAGE_EVT);
-        }
-        break;
-    case ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT:
-        ESP_LOGI(TAG, "VndModel:PublishUpdate,OK");
-        break;
-    case ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT:
-        ESP_LOGI(TAG, "VndModel:TimeOut,0x%06" PRIx32, param->client_send_timeout.opcode);
-        if (trans) {
-            transaction_set_events(trans, TRANS_MESH_SEND_MESSAGE_EVT);
-        }
-        break;
-    case ESP_BLE_MESH_MODEL_EVT_MAX:
-        ESP_LOGI(TAG, "VndModel:MaxEvt");
-        break;
-    default:
-        break;
-    }
-
-}
-
-void ble_mesh_test_performance_client_model_throughput(void *params)
-{
-    uint16_t i;
-    uint8_t *data = NULL;
-    uint64_t start_time;
-    esp_ble_mesh_msg_ctx_t ctx;
-    transaction_t *trans = NULL;
-    ble_mesh_test_perf_throughput_data *profile_context = (ble_mesh_test_perf_throughput_data *)params;
-    esp_err_t result = ESP_OK;
-
-    ctx.net_idx = profile_context->net_idx;
-    ctx.app_idx = profile_context->app_idx;
-    ctx.addr = profile_context->address;
-    ctx.send_ttl = profile_context->ttl;
-    ctx.model = profile_context->model;
-    ctx.send_rel = 0;
-    test_perf_statistics.test_length = profile_context->length;
-    // create send data
-    data = malloc(profile_context->length);
-    if (data == NULL) {
-        ESP_LOGE(TAG, " %s, %d, malloc fail", __func__, __LINE__);
-        goto cleanup;
-    }
-
-    for (i = 1; i <= profile_context->test_num; i++) {
-        ble_mesh_create_send_data((char *)data, profile_context->length, i, profile_context->opcode);
-        start_time = esp_timer_get_time();
-        TRANSACTION_INIT(&trans, TRANS_TYPE_MESH_PERF, TRANS_MESH_SEND_MESSAGE,
-                    TRANS_MESH_SEND_MESSAGE_EVT, SEND_MESSAGE_TIMEOUT, &start_time, NULL);
-        //tx: data  profile_context->length
-        result = esp_ble_mesh_client_model_send_msg(profile_context->model, &ctx, profile_context->opcode,
-                                                    profile_context->length, data, 8000,
-                                                    profile_context->need_ack,
-                                                    profile_context->device_role);
-
-        if (result != ESP_OK) {
-            ESP_LOGE(TAG, "VendorModel:SendPackage,Fail");
-        }
-
-        ble_mesh_test_performance_client_model_accumulate_statistics(profile_context->length);
-
-        if (deinit_flag) {
-            ESP_LOGI(TAG, "Already deinit, stop sending message");
-            break;
-        }
-
-        result = transaction_run(trans);
-        if (result == ESP_ERR_INVALID_STATE) {
-            ESP_LOGI(TAG, "Already deinit, transactions abort");
-            break;
-        }
-    }
-
-    ESP_LOGI(TAG, "VendorModel:SendPackage,Finish");
-
-cleanup:
-    free(params);
-    if (data != NULL) {
-        free(data);
-    }
-    vTaskDelete(NULL);
-}
-
-int ble_mesh_test_performance_client_model(int argc, char **argv)
-{
-    esp_ble_mesh_elem_t *element = NULL;
-    esp_ble_mesh_model_t *model;
-    esp_err_t result = ESP_OK;
-    ble_mesh_test_perf_throughput_data *profile_data = NULL;
-    uint16_t company_id = CID_ESP;
-
-    int nerrors = arg_parse(argc, argv, (void **) &test_perf_client_model);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, test_perf_client_model.end, argv[0]);
-        return 1;
-    }
-
-    element = esp_ble_mesh_find_element(esp_ble_mesh_get_primary_element_address());
-    if (!element) {
-        ESP_LOGE(TAG, "Element 0x%04x not exists", esp_ble_mesh_get_primary_element_address());
-        return ESP_FAIL;
-    }
-
-    model = esp_ble_mesh_find_vendor_model(element, company_id, ESP_BLE_MESH_VND_MODEL_ID_TEST_PERF_CLI);
-    if (!model) {
-        ESP_LOGE(TAG, "VendorClient:LoadModel,Fail");
-        return ESP_FAIL;
-    }
-
-    if (strcmp(test_perf_client_model.action_type->sval[0], "init") == 0) {
-        result = esp_ble_mesh_client_model_init(model);
-        if (result == ESP_OK) {
-            ESP_LOGI(TAG, "VendorClientModel:Init,OK");
-        } else {
-            ESP_LOGE(TAG, "VendorClientModel:Init,Fail,%d", result);
-        }
-    } else if (strcmp(test_perf_client_model.action_type->sval[0], "start") == 0) {
-        profile_data = malloc(sizeof(ble_mesh_test_perf_throughput_data));
-        profile_data->model = model;
-        if (profile_data == NULL) {
-            ESP_LOGE(TAG, " %s, %d malloc fail", __func__, __LINE__);
-            return ESP_ERR_NO_MEM;
-        }
-
-        arg_int_to_value(test_perf_client_model.playload_byte, profile_data->length, "length");
-        arg_int_to_value(test_perf_client_model.opcode, profile_data->opcode, "opcode");
-        arg_int_to_value(test_perf_client_model.unicast_address, profile_data->address, "publish address");
-        arg_int_to_value(test_perf_client_model.ttl, profile_data->ttl, "model ttl");
-        arg_int_to_value(test_perf_client_model.app_idx, profile_data->app_idx, "appkey index");
-        arg_int_to_value(test_perf_client_model.net_idx, profile_data->net_idx, "network key index");
-        arg_int_to_value(test_perf_client_model.dev_role, profile_data->device_role, "device role");
-        arg_int_to_value(test_perf_client_model.test_num, profile_data->test_num, "test number");
-
-        if (profile_data->opcode == ESP_BLE_MESH_VND_MODEL_OP_TEST_PERF_SET) {
-            profile_data->need_ack = true;
-        } else {
-            profile_data->need_ack = false;
-        }
-
-        xTaskCreate(ble_mesh_test_performance_client_model_throughput, "MESHTHROUGHPUTSEND", 4048, profile_data, 1, NULL);
-    }
-
-    return result;
-}
-
-int ble_mesh_test_performance_client_model_performance(int argc, char **argv)
-{
-    uint8_t result = 0;
-
-    int nerrors = arg_parse(argc, argv, (void **) &test_perf_client_model_statistics);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, test_perf_client_model_statistics.end, argv[0]);
-        return 1;
-    }
-
-    if (strcmp(test_perf_client_model_statistics.action_type->sval[0], "init") == 0) {
-        result = ble_mesh_test_performance_client_model_init(test_perf_client_model_statistics.node_num->ival[0],
-                 test_perf_client_model_statistics.test_size->ival[0], test_perf_client_model_statistics.ttl->ival[0]);
-        if (result == 0) {
-            ESP_LOGI(TAG, "VendorPerfTest:InitStatistics,OK");
-        }
-    } else if (strcmp(test_perf_client_model_statistics.action_type->sval[0], "get") == 0) {
-        ble_mesh_test_performance_client_model_get();
-    } else if (strcmp(test_perf_client_model_statistics.action_type->sval[0], "destroy") == 0) {
-        ble_mesh_test_performance_client_model_destroy();
-        ESP_LOGI(TAG, "VendorPerfTest:DestroyStatistics,OK");
-    } else if (strcmp(test_perf_client_model_statistics.action_type->sval[0], "percent") == 0) {
-        ble_mesh_test_performance_client_model_get_received_percent();
-        ESP_LOGI(TAG, "VendorPerfTest:GetPercent,OK");
-    }
-
-    return 0;
-}
-
-void ble_mesh_performance_client_model_command(void)
-{
-    test_perf_client_model.action_type = arg_str1("z", NULL, "<action>", "action type");
-    test_perf_client_model.playload_byte = arg_int0("p", NULL, "<byte>", "playload byte");
-    test_perf_client_model.test_num = arg_int0("n", NULL, "<number>", "test number");
-    // set test num default to 1000
-    test_perf_client_model.test_num->ival[0] = 1000;
-    test_perf_client_model.opcode = arg_int0("o", NULL, "<opcode>", "opcode");
-    test_perf_client_model.unicast_address = arg_int0("u", NULL, "<address>", "unicast address");
-    test_perf_client_model.ttl = arg_int0("t", NULL, "<ttl>", "ttl");
-    test_perf_client_model.app_idx = arg_int0("a", NULL, "<appkey>", "appkey index");
-    test_perf_client_model.net_idx = arg_int0("i", NULL, "<network key>", "network key index");
-    test_perf_client_model.dev_role = arg_int0("d", NULL, "<role>", "device role");
-    test_perf_client_model.dev_role->ival[0] = ROLE_PROVISIONER;
-    test_perf_client_model.end = arg_end(1);
-
-    const esp_console_cmd_t test_perf_client_model_cmd = {
-        .command = "bmtpcvm",
-        .help = "ble mesh test performance client vendor model",
-        .hint = NULL,
-        .func = &ble_mesh_test_performance_client_model,
-        .argtable = &test_perf_client_model,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&test_perf_client_model_cmd));
-
-    test_perf_client_model_statistics.action_type = arg_str1("z", NULL, "<action>", "action type");
-    test_perf_client_model_statistics.test_size = arg_int0("s", NULL, "<test size>", "test size");
-    test_perf_client_model_statistics.node_num = arg_int0("n", NULL, "<node number>", "node number");
-    test_perf_client_model_statistics.ttl = arg_int0("l", NULL, "<test number>", "ttl");
-    test_perf_client_model_statistics.end = arg_end(1);
-
-    const esp_console_cmd_t test_perf_client_model_performance_cmd = {
-        .command = "bmcperf",
-        .help = "ble mesh client: test performance",
-        .hint = NULL,
-        .func = &ble_mesh_test_performance_client_model_performance,
-        .argtable = &test_perf_client_model_statistics,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&test_perf_client_model_performance_cmd));
-}

+ 0 - 1098
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_register_cmd.c

@@ -1,1098 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <inttypes.h>
-
-#include "esp_bt.h"
-#include "esp_timer.h"
-#include "soc/soc.h"
-
-#include "test.h"
-#include "esp_ble_mesh_networking_api.h"
-#include "esp_ble_mesh_defs.h"
-#include "esp_ble_mesh_common_api.h"
-#include "esp_ble_mesh_provisioning_api.h"
-#include "esp_ble_mesh_generic_model_api.h"
-#include "ble_mesh_console_lib.h"
-#include "ble_mesh_adapter.h"
-#include "transaction.h"
-#include "esp_ble_mesh_config_model_api.h"
-#include "ble_mesh_console_decl.h"
-#include "ble_mesh_model.h"
-
-/* We include the internal header file mesh_bearer_adapt.h here
-   just for some specific test purpose, which is not recommended for the other applications. */
-#include "mesh/adapter.h"
-
-typedef struct {
-    struct arg_str *static_val;
-    struct arg_int *static_val_len;
-    struct arg_int *output_size;
-    struct arg_int *output_actions;
-    struct arg_int *input_size;
-    struct arg_int *input_actions;
-    struct arg_int *prov_start_address;
-    struct arg_end *end;
-} ble_mesh_prov_t;
-static ble_mesh_prov_t oob;
-
-typedef struct {
-    struct arg_int *model_type;
-    struct arg_int *config_index;
-    struct arg_str *dev_uuid;
-    struct arg_int *pub_config;
-    struct arg_end *end;
-} ble_mesh_comp_t;
-static ble_mesh_comp_t component;
-
-typedef struct {
-    struct arg_int *action;
-    struct arg_end *end;
-} ble_mesh_deinit_t;
-static ble_mesh_deinit_t deinit;
-
-typedef struct {
-    struct arg_int *bearer;
-    struct arg_int *enable;
-    struct arg_end *end;
-} ble_mesh_bearer_t;
-static ble_mesh_bearer_t bearer;
-
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_int *package_num;
-    struct arg_end *end;
-} ble_mesh_node_statistices_t;
-ble_mesh_node_statistices_t node_statistices;
-
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_int *tx_sense_power;
-    struct arg_end *end;
-} ble_mesh_tx_sense_power;
-static ble_mesh_tx_sense_power power_set;
-
-typedef struct {
-    struct arg_str *net_key;
-    struct arg_int *net_idx;
-    struct arg_int *unicast_addr;
-    struct arg_str *dev_key;
-    struct arg_str *app_key;
-    struct arg_int *app_idx;
-    struct arg_int *group_addr;
-    struct arg_end *end;
-} ble_mesh_node_network_info_t;
-ble_mesh_node_network_info_t node_network_info;
-
-ble_mesh_node_status node_status = {
-    .previous = 0x0,
-    .current = 0x0,
-};
-SemaphoreHandle_t ble_mesh_node_sema = NULL;
-
-typedef struct {
-    struct arg_str *add_del;
-    struct arg_str *device_addr;
-    struct arg_str *device_uuid;
-    struct arg_int *addr_type;
-    struct arg_int *bearer;
-    struct arg_int *oob_info;
-    struct arg_int *flag;
-    struct arg_end *end;
-} ble_mesh_provisioner_addr_t;
-ble_mesh_provisioner_addr_t provisioner_addr;
-
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_int *net_idx;
-    struct arg_int *app_idx;
-    struct arg_str *key;
-    struct arg_end *end;
-} ble_mesh_provisioner_add_key_t;
-ble_mesh_provisioner_add_key_t provisioner_add_key;
-
-typedef struct {
-    struct arg_int *unicast_addr;
-    struct arg_end *end;
-} ble_mesh_provisioner_get_node_t;
-ble_mesh_provisioner_get_node_t provisioner_get_node;
-
-typedef struct {
-    struct arg_int *oob_info;
-    struct arg_int *unicast_addr;
-    struct arg_int *element_num;
-    struct arg_int *net_idx;
-    struct arg_str *dev_key;
-    struct arg_str *uuid;
-    struct arg_end *end;
-} ble_mesh_provisioner_add_node_t;
-ble_mesh_provisioner_add_node_t provisioner_add_node;
-
-typedef struct {
-    struct arg_int *appkey_index;
-    struct arg_int *element_address;
-    struct arg_int *network_index;
-    struct arg_int *mod_id;
-    struct arg_int *cid;
-    struct arg_end *end;
-} ble_mesh_provisioner_bind_model_t;
-ble_mesh_provisioner_bind_model_t provisioner_local_bind;
-
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_int *enable;
-    struct arg_int *op;
-    struct arg_int *hb_src;
-    struct arg_int *hb_dst;
-    struct arg_int *type;
-    struct arg_end *end;
-} ble_mesh_provisioner_heartbeat_t;
-static ble_mesh_provisioner_heartbeat_t heartbeat;
-
-#ifdef CONFIG_BLE_MESH_USE_DUPLICATE_SCAN
-typedef struct {
-    struct arg_str *action_type;
-    struct arg_int *type;
-    struct arg_str *info;
-    struct arg_end *end;
-} ble_mesh_exceptional_list_t;
-static ble_mesh_exceptional_list_t exceptional_list_test;
-#endif
-
-extern bool deinit_flag;
-extern void ble_mesh_generic_onoff_client_model_cb(esp_ble_mesh_generic_client_cb_event_t event,
-                                                   esp_ble_mesh_generic_client_cb_param_t *param);
-extern void ble_mesh_configuration_client_model_cb(esp_ble_mesh_cfg_client_cb_event_t event,
-                                                   esp_ble_mesh_cfg_client_cb_param_t *param);
-extern void ble_mesh_vendor_model_cb(esp_ble_mesh_model_cb_event_t event, esp_ble_mesh_model_cb_param_t *param);
-extern void ble_mesh_generic_server_model_cb(esp_ble_mesh_generic_server_cb_event_t event,
-                                             esp_ble_mesh_generic_server_cb_param_t *param);
-
-void ble_mesh_register_cmd(void);
-// Register callback function
-void ble_mesh_prov_cb(esp_ble_mesh_prov_cb_event_t event, esp_ble_mesh_prov_cb_param_t *param);
-
-void ble_mesh_register_mesh_node(void)
-{
-    ble_mesh_register_cmd();
-}
-
-int ble_mesh_register_cb(int argc, char** argv)
-{
-    esp_ble_mesh_register_prov_callback(ble_mesh_prov_cb);
-    esp_ble_mesh_register_custom_model_callback(ble_mesh_vendor_model_cb);
-    esp_ble_mesh_register_generic_server_callback(ble_mesh_generic_server_model_cb);
-    esp_ble_mesh_register_generic_client_callback(ble_mesh_generic_onoff_client_model_cb);
-    esp_ble_mesh_register_config_client_callback(ble_mesh_configuration_client_model_cb);
-    ESP_LOGI(TAG, "Bm:Reg,OK");
-    return 0;
-}
-
-void ble_mesh_prov_cb(esp_ble_mesh_prov_cb_event_t event, esp_ble_mesh_prov_cb_param_t *param)
-{
-    transaction_t *trans = NULL;
-    ESP_LOGD(TAG, "enter %s, event = %d", __func__, event);
-
-    switch (event) {
-    case ESP_BLE_MESH_PROV_REGISTER_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->prov_register_comp.err_code, "Bm:Init");
-        if (param->prov_register_comp.err_code == ESP_OK) {
-            deinit_flag = false;
-        }
-        break;
-    case ESP_BLE_MESH_DEINIT_MESH_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->deinit_mesh_comp.err_code, "Bm:DeInit");
-        if (param->deinit_mesh_comp.err_code == ESP_OK) {
-            deinit_flag = true;
-            do {
-                trans = transaction_get(TRANS_TYPE_MESH_PERF, TRANS_MESH_SEND_MESSAGE, trans);
-                if (trans) {
-                    transaction_abort(trans, ESP_ERR_INVALID_STATE);
-                }
-            }while(trans);
-        }
-        break;
-    case ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->node_prov_enable_comp.err_code, "Node:EnBearer");
-        break;
-    case ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->node_prov_disable_comp.err_code, "Node:DisBearer");
-        break;
-    case ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT:
-        ESP_LOGI(TAG, "Node:LinkOpen,OK,%d", param->node_prov_link_open.bearer);
-        break;
-    case ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT:
-        ESP_LOGI(TAG, "Node:LinkClose,OK,%d", param->node_prov_link_close.bearer);
-        break;
-    case ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT:
-        ESP_LOGI(TAG, "Node:OutPut,%d,%" PRIu32, param->node_prov_output_num.action, param->node_prov_output_num.number);
-        break;
-    case ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT:
-        ESP_LOGI(TAG, "Node:OutPutStr,%s", param->node_prov_output_str.string);
-        break;
-    case ESP_BLE_MESH_NODE_PROV_INPUT_EVT:
-        ESP_LOGI(TAG, "Node:InPut,%d,%d", param->node_prov_input.action, param->node_prov_input.size);
-        break;
-    case ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT:
-        ESP_LOGI(TAG, "Provisioning:Success,%d", param->node_prov_complete.addr);
-        ble_mesh_set_node_prestore_params(param->node_prov_complete.net_idx, param->node_prov_complete.addr);
-        break;
-    case ESP_BLE_MESH_NODE_PROV_RESET_EVT:
-        ESP_LOGI(TAG, "Bm:Reset");
-        break;
-    case ESP_BLE_MESH_NODE_PROV_INPUT_NUMBER_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->node_prov_input_num_comp.err_code, "Node:InputNum");
-        break;
-    case ESP_BLE_MESH_NODE_PROV_INPUT_STRING_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->node_prov_input_str_comp.err_code, "Node:InputStr");
-        break;
-    case ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->node_set_unprov_dev_name_comp.err_code, "Node:SetName");
-        break;
-    case ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->node_proxy_identity_enable_comp.err_code, "Node:ProxyIndentity");
-        break;
-    case ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->node_proxy_gatt_enable_comp.err_code, "Node:EnProxyGatt");
-        break;
-    case ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->node_proxy_gatt_disable_comp.err_code, "Node:DisProxyGatt");
-        break;
-#if (CONFIG_BLE_MESH_PROVISIONER)
-    case ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT:
-        ESP_LOGI(TAG, "Provisioner:%s,"MACSTR",0x%x,0x%04x,0x%x",
-            param->provisioner_recv_unprov_adv_pkt.bearer == ESP_BLE_MESH_PROV_ADV ? "PB-ADV" : "PB-GATT",
-            MAC2STR(param->provisioner_recv_unprov_adv_pkt.addr),
-            param->provisioner_recv_unprov_adv_pkt.addr_type,
-            param->provisioner_recv_unprov_adv_pkt.oob_info,
-            param->provisioner_recv_unprov_adv_pkt.adv_type);
-        break;
-    case ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT:
-        ESP_LOGI(TAG, "Provisioner:LinkOpen,OK,%d", param->provisioner_prov_link_open.bearer);
-        break;
-    case ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT:
-        ESP_LOGI(TAG, "Provisioner:LinkClose,OK,%d,%d",
-                 param->provisioner_prov_link_close.bearer, param->provisioner_prov_link_close.reason);
-        break;
-    case ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_add_unprov_dev_comp.err_code, "Provisioner:DevAdd");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_delete_dev_comp.err_code, "Provisioner:DevDel");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT:
-        ESP_LOGI(TAG, "Provisioner:OK,%d,%d", param->provisioner_prov_complete.netkey_idx, param->provisioner_prov_complete.unicast_addr);
-        break;
-    case ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_prov_enable_comp.err_code, "Provisioner:EnBearer");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_prov_disable_comp.err_code, "Provisioner:DisBearer");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_set_dev_uuid_match_comp.err_code, "Provisioner:UuidMatch");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_set_prov_data_info_comp.err_code, "Provisioner:DataInfo");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_set_node_name_comp.err_code, "Provisioner:NodeName");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_add_app_key_comp.err_code, "Provisioner:AppKeyAdd");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_bind_app_key_to_model_comp.err_code, "Provisioner:AppKeyBind");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_add_net_key_comp.err_code, "Provisioner:NetKeyAdd");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_ENABLE_HEARTBEAT_RECV_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_enable_heartbeat_recv_comp.err_code, "Provisioner:EnHbRecv");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_TYPE_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_set_heartbeat_filter_type_comp.err_code, "Provisioner:SetHbFilterType");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_INFO_COMP_EVT:
-        ble_mesh_callback_check_err_code(param->provisioner_set_heartbeat_filter_info_comp.err_code, "Provisioner:SetHbFilterInfo");
-        break;
-    case ESP_BLE_MESH_PROVISIONER_RECV_HEARTBEAT_MESSAGE_EVT:
-        ESP_LOGI(TAG, "Provisioner:HbRecv,OK,%d,%d", param->provisioner_recv_heartbeat.hb_src, param->provisioner_recv_heartbeat.hb_dst);
-        break;
-#endif
-    default:
-        break;
-    }
-    ESP_LOGD(TAG, "exit %s", __func__);
-}
-
-int ble_mesh_power_set(int argc, char **argv)
-{
-    esp_err_t result = ESP_OK;
-
-    int nerrors = arg_parse(argc, argv, (void **) &power_set);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, power_set.end, argv[0]);
-        return 1;
-    }
-
-    if (strcmp(power_set.action_type->sval[0], "tx") == 0) {
-        result = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, power_set.tx_sense_power->ival[0]);
-    } else if (strcmp(power_set.action_type->sval[0], "sense") == 0) {
-        uint32_t *reg = (uint32_t *)(0x6001c07c);
-        int reg_addr = 0x6001c07c;
-        uint32_t flag = 0x00FF0000;
-        uint32_t sense_new = power_set.tx_sense_power->ival[0];
-        uint32_t reg_to_write = ((*reg) &= ~flag) | ((256 - sense_new) << 16);
-        REG_WRITE(reg_addr, reg_to_write);
-
-    }
-
-    if (result == ESP_OK) {
-        ESP_LOGI(TAG, "Node:SetPower,OK");
-    }
-    return result;
-}
-
-static int get_dev_uuid(uint8_t uuid[16])
-{
-    uint8_t addr[6] = {0};
-
-    extern int get_bd_addr(uint8_t addr[6]);
-    if (get_bd_addr(addr)) {
-        return -1;
-    }
-
-    memcpy(uuid, addr, BD_ADDR_LEN);
-    return 0;
-}
-
-static int ble_mesh_load_oob(int argc, char **argv)
-{
-    uint8_t *static_val;
-
-    int nerrors = arg_parse(argc, argv, (void **) &oob);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, oob.end, argv[0]);
-        return 1;
-    }
-
-    //parsing prov
-#if CONFIG_BLE_MESH_NODE
-    prov.uuid = dev_uuid;
-    if (get_dev_uuid(dev_uuid)) {
-        return 1;
-    }
-    if (oob.static_val->count != 0) {
-        static_val = malloc(oob.static_val_len->ival[0] + 1);
-        if (static_val == NULL) {
-            ESP_LOGE(TAG, "malloc fail,%s,%d", __func__, __LINE__);
-            return ESP_ERR_NO_MEM;
-        }
-        get_value_string((char *)oob.static_val->sval[0], (char *)static_val);
-        prov.static_val = static_val;
-    }
-
-    arg_int_to_value(oob.static_val_len, prov.static_val_len, "static value length");
-    arg_int_to_value(oob.output_size, prov.output_size, "output size");
-    arg_int_to_value(oob.output_actions, prov.output_actions, "output actions");
-    arg_int_to_value(oob.input_size, prov.input_size, "input size");
-    arg_int_to_value(oob.input_actions, prov.input_actions, "input actions");
-#endif
-
-#if CONFIG_BLE_MESH_PROVISIONER
-    if (oob.static_val->count != 0) {
-        static_val = malloc(oob.static_val_len->ival[0] + 1);
-        if (static_val == NULL) {
-            ESP_LOGE(TAG, "malloc fail,%s,%d", __func__, __LINE__);
-            return ESP_ERR_NO_MEM;
-        }
-        get_value_string((char *)oob.static_val->sval[0], (char *)static_val);
-        prov.prov_static_oob_val = static_val;
-    }
-    arg_int_to_value(oob.prov_start_address, prov.prov_start_address, "provisioner start address");
-    arg_int_to_value(oob.static_val_len, prov.prov_static_oob_len, "provisioner static value length");
-#endif
-
-    ESP_LOGI(TAG, "OOB:Load,OK");
-    return 0;
-}
-
-int ble_mesh_init(int argc, char **argv)
-{
-    int err;
-    esp_ble_mesh_comp_t *local_component = NULL;
-    uint8_t *device_uuid =NULL;
-
-    int nerrors = arg_parse(argc, argv, (void **) &component);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, component.end, argv[0]);
-        return 1;
-    }
-
-    err = ble_mesh_init_node_prestore_params();
-    if (err != ESP_OK) {
-        ESP_LOGE(TAG, "Bm:NodeInitPreParam,Fail");
-        return err;
-    }
-
-    local_component = ble_mesh_get_component(component.model_type->ival[0]);
-
-    if (component.dev_uuid->count != 0) {
-        device_uuid = malloc((ESP_BLE_MESH_OCTET16_LEN + 1) * sizeof(uint8_t));
-        if (device_uuid == NULL) {
-            ESP_LOGE(TAG, "ble mesh malloc failed, %d", __LINE__);
-            return ESP_ERR_NO_MEM;
-        }
-        err = get_value_string((char *)component.dev_uuid->sval[0], (char *)device_uuid);
-        if (err == ESP_OK) {
-            memcpy(dev_uuid, device_uuid, ESP_BLE_MESH_OCTET16_LEN);
-        } else {
-            str_2_mac((uint8_t *)component.dev_uuid->sval[0], device_uuid);
-            memcpy(dev_uuid, device_uuid, BD_ADDR_LEN);
-        }
-    } else {
-        if (get_dev_uuid(dev_uuid)) {
-            return 1;
-        }
-    }
-
-    err = esp_ble_mesh_init(&prov, local_component);
-
-    free(device_uuid);
-    return err;
-}
-
-int ble_mesh_provisioner_heartbeat(int argc, char** argv)
-{
-    esp_err_t result = ESP_OK;
-    bool enable = 1;
-    uint8_t type = 0;
-    esp_ble_mesh_heartbeat_filter_info_t info;
-    uint8_t op = 0;
-
-    int nerrors = arg_parse(argc, argv, (void **) &heartbeat);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, heartbeat.end, argv[0]);
-        return 1;
-    }
-
-    arg_int_to_value(heartbeat.enable, enable, "enable/disable receiving heartbeat");
-    arg_int_to_value(heartbeat.type, type, "heartbeat filter type");
-    arg_int_to_value(heartbeat.hb_dst, info.hb_dst, "destination address");
-    arg_int_to_value(heartbeat.hb_src, info.hb_src, "source address");
-    arg_int_to_value(heartbeat.op, op, "op");
-
-    if (strcmp(heartbeat.action_type->sval[0], "recv") == 0){
-        result = esp_ble_mesh_provisioner_recv_heartbeat(enable);
-    }else if(strcmp(heartbeat.action_type->sval[0], "type") == 0){
-        result = esp_ble_mesh_provisioner_set_heartbeat_filter_type(type);
-    }else if(strcmp(heartbeat.action_type->sval[0], "info")== 0){
-        result = esp_ble_mesh_provisioner_set_heartbeat_filter_info(op, &info);
-    }
-
-    if(result == ESP_OK){
-        ESP_LOGI(TAG, "provisioner:OK");
-    }else{
-        ESP_LOGE(TAG, "provisioner:ERROR");
-    }
-    return result;
-}
-
-int ble_mesh_node_enable_bearer(int argc, char **argv)
-{
-    esp_err_t  err = 0;
-
-    int nerrors = arg_parse(argc, argv, (void **) &bearer);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, bearer.end, argv[0]);
-
-        return 1;
-    }
-
-    if (bearer.enable->count != 0) {
-        if (bearer.enable->ival[0]) {
-            //err = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_N12);
-            err = esp_ble_mesh_node_prov_enable(bearer.bearer->ival[0]);
-        } else {
-            err = esp_ble_mesh_node_prov_disable(bearer.bearer->ival[0]);
-        }
-    } else {
-        return 1;
-    }
-    return err;
-}
-
-#ifdef CONFIG_BLE_MESH_USE_DUPLICATE_SCAN
-int ble_mesh_exceptional_list_test(int argc, char **argv)
-{
-    esp_err_t err = ESP_FAIL;
-    uint32_t type = BLE_MESH_EXCEP_LIST_TYPE_MESH_BEACON;
-    uint8_t *info = NULL;
-
-    int nerrors = arg_parse(argc, argv, (void **) &exceptional_list_test);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, exceptional_list_test.end, argv[0]);
-        return 1;
-    }
-
-    arg_int_to_value(exceptional_list_test.type, type, "device info type");
-
-    if (exceptional_list_test.info->count != 0) {
-        info = malloc((BD_ADDR_LEN + 1) * sizeof(uint8_t));
-        if (info == NULL) {
-            ESP_LOGE(TAG, "ble mesh malloc failed, %d", __LINE__);
-            return ESP_ERR_NO_MEM;
-        } else {
-            get_value_string((char *)exceptional_list_test.info->sval[0], (char *)info);
-        }
-    }
-
-    if (strcmp(exceptional_list_test.action_type->sval[0], "add") == 0) {
-        err = bt_mesh_update_exceptional_list(BLE_MESH_EXCEP_LIST_SUB_CODE_ADD, type, info);
-    } else if (strcmp(exceptional_list_test.action_type->sval[0], "remove") == 0) {
-        err = bt_mesh_update_exceptional_list( BLE_MESH_EXCEP_LIST_SUB_CODE_REMOVE, type, info);
-    } else if (strcmp(exceptional_list_test.action_type->sval[0], "clean") == 0) {
-        err = bt_mesh_update_exceptional_list(BLE_MESH_EXCEP_LIST_SUB_CODE_CLEAN, type, NULL);
-    }
-
-    if (err == ESP_OK) {
-        ESP_LOGI(TAG, "Bm:UpdateExcepList,OK");
-    } else {
-        ESP_LOGE(TAG, "Bm:UpdateExcepList,Fail");
-    }
-
-    if (info != NULL) {
-        free(info);
-    }
-
-    return err;
-}
-#endif
-
-int ble_mesh_deinit(int argc, char **argv)
-{
-    int err;
-    esp_ble_mesh_deinit_param_t param = {};
-
-    int nerrors = arg_parse(argc, argv, (void **) &deinit);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, deinit.end, argv[0]);
-        return 1;
-    }
-
-    ble_mesh_deinit_node_prestore_params();
-
-    if (deinit.action->count != 0) {
-        param.erase_flash = deinit.action->ival[0];
-        err = esp_ble_mesh_deinit(&param);
-    } else {
-        return 1;
-    }
-    return err;
-}
-
-int ble_mesh_provisioner_enable_bearer(int argc, char **argv)
-{
-    esp_err_t  err = 0;
-
-    int nerrors = arg_parse(argc, argv, (void **) &bearer);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, bearer.end, argv[0]);
-        return 1;
-    }
-
-    if (bearer.enable->count != 0) {
-        if (bearer.enable->ival[0]) {
-            err = esp_ble_mesh_provisioner_prov_enable(bearer.bearer->ival[0]);
-        } else {
-            err = esp_ble_mesh_provisioner_prov_disable(bearer.bearer->ival[0]);
-        }
-    } else {
-        return 1;
-    }
-    return err;
-}
-
-int ble_mesh_node_reset(int argc, char** argv)
-{
-    esp_err_t err;
-
-    err = esp_ble_mesh_node_local_reset();
-    return err;
-}
-
-int ble_mesh_node_statistics_regist(int argc, char **argv)
-{
-    int result = ESP_OK;
-
-    int nerrors = arg_parse(argc, argv, (void **) &node_statistices);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, node_statistices.end, argv[0]);
-        return 1;
-    }
-
-    if (strcmp(node_statistices.action_type->sval[0], "init") == 0) {
-        result = ble_mesh_node_statistics_init(node_statistices.package_num->ival[0]);
-        ESP_LOGI(TAG, "Node:InitStatistics,OK");
-    } else if (strcmp(node_statistices.action_type->sval[0], "get") == 0) {
-        ble_mesh_node_statistics_get();
-        ESP_LOGI(TAG, "Node:GetStatistics,OK");
-    } else if (strcmp(node_statistices.action_type->sval[0], "destroy") == 0) {
-        ble_mesh_node_statistics_destroy();
-        ESP_LOGI(TAG, "Node:DestroyStatistics");
-    }
-
-    return result;
-}
-
-int ble_mesh_node_enter_network_auto(int argc, char **argv)
-{
-    esp_err_t err = ESP_OK;
-    struct bt_mesh_device_network_info info = {
-        .flags = 0,
-        .iv_index = 0,
-    };
-
-    int nerrors = arg_parse(argc, argv, (void **) &node_network_info);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, node_network_info.end, argv[0]);
-        return 1;
-    }
-
-    err = get_value_string((char *)node_network_info.net_key->sval[0], (char *)info.net_key);
-    err = get_value_string((char *)node_network_info.dev_key->sval[0], (char *)info.dev_key);
-    err = get_value_string((char *)node_network_info.app_key->sval[0], (char *)info.app_key);
-    arg_int_to_value(node_network_info.net_idx, info.net_idx, "network key index");
-    arg_int_to_value(node_network_info.unicast_addr, info.unicast_addr, "unicast address");
-    arg_int_to_value(node_network_info.app_idx, info.app_idx, "appkey index");
-    arg_int_to_value(node_network_info.group_addr, info.group_addr, "group address");
-
-    err = bt_mesh_device_auto_enter_network(&info);
-    if (err == ESP_OK) {
-        ESP_LOGD(TAG, "NODE:EnNetwork,OK");
-    } else {
-        ESP_LOGE(TAG, "NODE:EnNetwork,FAIL,%d", err);
-    }
-    return err;
-}
-
-int ble_mesh_provision_address(int argc, char **argv)
-{
-    esp_err_t err = ESP_OK;
-    esp_ble_mesh_unprov_dev_add_t device_addr = {0};
-    uint8_t  preset_addr_uuid[16] = {0x01, 0x02};
-    esp_ble_mesh_device_delete_t del_dev = {
-        .flag = BIT(0),
-    };
-
-    int nerrors = arg_parse(argc, argv, (void **) &provisioner_addr);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, provisioner_addr.end, argv[0]);
-        return 1;
-    }
-
-    memcpy(device_addr.uuid, preset_addr_uuid, BD_ADDR_LEN);
-    if (provisioner_addr.device_addr->count != 0) {
-        str_2_mac((uint8_t *)provisioner_addr.device_addr->sval[0], device_addr.addr);
-        str_2_mac((uint8_t *)provisioner_addr.device_addr->sval[0], del_dev.addr);
-        arg_int_to_value(provisioner_addr.addr_type, device_addr.addr_type, "address type");
-        arg_int_to_value(provisioner_addr.addr_type, del_dev.addr_type, "address type");
-    }
-    if (provisioner_addr.device_uuid->count != 0) {
-        uint8_t tmp_uuid[16] = {0};
-        err = get_value_string((char *)provisioner_addr.device_uuid->sval[0], (char *)tmp_uuid);
-        if (err != ESP_OK) {
-            str_2_mac((uint8_t *)provisioner_addr.device_uuid->sval[0], tmp_uuid);
-        }
-        memcpy(device_addr.uuid, tmp_uuid, 16);
-        memcpy(del_dev.uuid, tmp_uuid, 16);
-        del_dev.flag = BIT(1);
-    }
-
-#if CONFIG_BLE_MESH_PROVISIONER
-    if (strcmp(provisioner_addr.add_del->sval[0], "add") == 0) {
-        arg_int_to_value(provisioner_addr.bearer, device_addr.bearer, "bearer");
-        arg_int_to_value(provisioner_addr.oob_info, device_addr.oob_info, "oob information");
-        err = esp_ble_mesh_provisioner_add_unprov_dev(&device_addr, provisioner_addr.flag->ival[0]);
-    } else if (strcmp(provisioner_addr.add_del->sval[0], "del") == 0) {
-        err = esp_ble_mesh_provisioner_delete_dev(&del_dev);
-    }
-#endif
-    if (err != ESP_OK) {
-        ESP_LOGI(TAG, "Provisioner:AddDelAddr,Fail,%d", err);
-    } else {
-        ESP_LOGI(TAG, "Provisioner:AddDelAddr,OK");
-    }
-    return err;
-}
-
-int ble_mesh_provisioner_add_key(int argc, char **argv)
-{
-    esp_err_t err = ESP_OK;
-    uint8_t key[16] = {0};
-    esp_ble_mesh_prov_data_info_t info = {
-        .net_idx = 1,
-        .flag = PROV_DATA_NET_IDX_FLAG,
-    };
-
-    int nerrors = arg_parse(argc, argv, (void **) &provisioner_add_key);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, provisioner_add_key.end, argv[0]);
-        return 1;
-    }
-
-    err = get_value_string((char *)provisioner_add_key.key->sval[0], (char *) key);
-    if (strcmp(provisioner_add_key.action_type->sval[0], "appkey") == 0) {
-        err = esp_ble_mesh_provisioner_add_local_app_key(key, provisioner_add_key.net_idx->ival[0], provisioner_add_key.app_idx->ival[0]);
-    } else if (strcmp(provisioner_add_key.action_type->sval[0], "netkey") == 0) {
-        // choose network key
-        info.net_idx = provisioner_add_key.net_idx->ival[0];
-        err = esp_ble_mesh_provisioner_add_local_net_key(key, provisioner_add_key.net_idx->ival[0]);
-        err = err | esp_ble_mesh_provisioner_set_prov_data_info(&info);
-    }
-
-    if (err != ESP_OK) {
-        ESP_LOGI(TAG, "Provisioner:KeyAction,Fail,%d", err);
-    } else {
-        ESP_LOGI(TAG, "Provisioner:KeyAction,OK");
-    }
-    return err;
-}
-
-int ble_mesh_provisioner_get_node(int argc, char **argv)
-{
-    uint16_t unicast_addr = 0;
-    uint16_t i = 0;
-    esp_ble_mesh_node_t *node_info;
-
-    int nerrors = arg_parse(argc, argv, (void **) &provisioner_get_node);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, provisioner_get_node.end, argv[0]);
-        return 1;
-    }
-
-    arg_int_to_value(provisioner_get_node.unicast_addr, unicast_addr, "unicast address");
-    node_info = esp_ble_mesh_provisioner_get_node_with_addr(unicast_addr);
-
-    if (node_info == NULL) {
-        return ESP_FAIL;
-    } else {
-        printf("OobInfo:0x%x,Address:0x%x,EleNum:0x%x,NetIdx:0x%x,DevKey:",
-               node_info->oob_info, node_info->unicast_addr, node_info->element_num, node_info->net_idx);
-        for (i = 0; i < 16; i++) {
-            printf("%02x", node_info->dev_key[i]);
-        }
-        printf(",DevUuid:");
-        for (i = 0; i < 16; i++) {
-            printf("%02x", node_info->dev_uuid[i]);
-        }
-        printf("\n");
-    }
-    return ESP_OK;
-}
-
-int ble_mesh_provisioner_add_node(int argc, char **argv)
-{
-    struct bt_mesh_node node_info;
-    esp_err_t result;
-
-    int nerrors = arg_parse(argc, argv, (void **) &provisioner_add_node);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, provisioner_add_node.end, argv[0]);
-        return 1;
-    }
-
-    arg_int_to_value(provisioner_add_node.oob_info, node_info.oob_info, "oob information");
-    arg_int_to_value(provisioner_add_node.unicast_addr, node_info.unicast_addr, "unicast address");
-    arg_int_to_value(provisioner_add_node.element_num, node_info.element_num, "element number");
-    arg_int_to_value(provisioner_add_node.net_idx, node_info.net_idx, "network index");
-    if (provisioner_add_node.dev_key->count != 0) {
-        get_value_string((char *)provisioner_add_node.dev_key->sval[0], (char *)node_info.dev_key);
-    }
-    if (provisioner_add_node.uuid->count != 0) {
-        get_value_string((char *)provisioner_add_node.uuid->sval[0], (char *)node_info.dev_uuid);
-        get_value_string((char *)provisioner_add_node.uuid->sval[0], (char *)node_info.dev_uuid);
-    }
-
-    result = bt_mesh_provisioner_store_node_info(&node_info);
-    if (result == ESP_OK) {
-        ESP_LOGI(TAG, "Provisioner:AddNodeInfo,OK");
-    } else {
-        ESP_LOGI(TAG, "Provisioner:AddNodeInfo,ERROR,%d", result);
-    }
-    return result;
-}
-
-int ble_mesh_provision_bind_local_model(int argc, char **argv)
-{
-    esp_err_t err;
-    uint16_t element_addr = 0;
-    uint16_t app_idx = 0;
-    uint16_t model_id = 0;
-    uint16_t company_id = 0xFFFF;
-
-    int nerrors = arg_parse(argc, argv, (void **) &provisioner_local_bind);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, provisioner_local_bind.end, argv[0]);
-        return 1;
-    }
-
-    arg_int_to_value(provisioner_local_bind.element_address, element_addr, "element address");
-    arg_int_to_value(provisioner_local_bind.appkey_index, app_idx, "appkey index");
-    arg_int_to_value(provisioner_local_bind.mod_id, model_id, "model id");
-    arg_int_to_value(provisioner_local_bind.cid, company_id, "company id");
-    err = esp_ble_mesh_provisioner_bind_app_key_to_local_model(element_addr, app_idx, model_id, company_id);
-
-    if (err != ESP_OK) {
-        ESP_LOGE(TAG, "Provisioner:BindModel,Fail,%d", err);
-    } else {
-        ESP_LOGI(TAG, "Provisioner:BindModel,OK");
-    }
-    return err;
-}
-
-void ble_mesh_register_cmd(void)
-{
-    const esp_console_cmd_t register_cmd = {
-        .command  = "bmreg",
-        .help = "ble mesh: provisioner/node register callback",
-        .hint = NULL,
-        .func = &ble_mesh_register_cb,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&register_cmd));
-
-    component.model_type = arg_int0("m", NULL, "<model>", "mesh model");
-    component.config_index = arg_int0("c", NULL, "<index>", "mesh model op");
-    component.config_index->ival[0] = 0; // set default value
-    component.pub_config = arg_int0("p", NULL, "<publish>", "publish message buffer");
-    component.dev_uuid = arg_str0("d", NULL, "<uuid>", "device uuid");
-    component.end = arg_end(1);
-
-    const esp_console_cmd_t model_cmd = {
-        .command = "bminit",
-        .help = "ble mesh: provisioner/node init",
-        .hint = NULL,
-        .func = &ble_mesh_init,
-        .argtable = &component,
-    };
-    ESP_ERROR_CHECK( esp_console_cmd_register(&model_cmd));
-
-    deinit.action = arg_int0("o", NULL, "<action>", "deinit action");
-    deinit.end = arg_end(1);
-
-    const esp_console_cmd_t deinit_cmd = {
-        .command = "bmdeinit",
-        .help = "ble mesh: provisioner/node deinit",
-        .hint = NULL,
-        .func = &ble_mesh_deinit,
-        .argtable = &deinit,
-    };
-    ESP_ERROR_CHECK( esp_console_cmd_register(&deinit_cmd));
-
-    provisioner_addr.add_del = arg_str1("z", NULL, "<add/delete>", "action type");
-    provisioner_addr.device_addr = arg_str0("d", NULL, "<address>", "device address");
-    provisioner_addr.device_uuid = arg_str0("u", NULL, "<uuid>", "device uuid");
-    provisioner_addr.addr_type = arg_int0("a", NULL, "<type>", "address type");
-    provisioner_addr.flag = arg_int0("f", NULL, "<flag>", "address flag");
-    provisioner_addr.flag->ival[0] = ADD_DEV_RM_AFTER_PROV_FLAG | ADD_DEV_FLUSHABLE_DEV_FLAG;
-    provisioner_addr.bearer = arg_int0("b", NULL, "<bearer>", "used bearer");
-    provisioner_addr.oob_info = arg_int0("o", NULL, "<oob info>", "oob information");
-    provisioner_addr.end = arg_end(1);
-
-    const esp_console_cmd_t provisioner_addr_cmd = {
-        .command = "bmpdev",
-        .help = "ble mesh provisioner: add/delete unprovisioned device",
-        .hint = NULL,
-        .func = &ble_mesh_provision_address,
-        .argtable = &provisioner_addr,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&provisioner_addr_cmd));
-
-    oob.static_val = arg_str0("s", NULL, "<value>", "Static OOB value");
-    oob.static_val_len = arg_int0("l", NULL, "<length>", "Static OOB value length");
-    oob.output_size = arg_int0("x", NULL, "<size>", "Maximum size of Output OOB");
-    oob.output_actions = arg_int0("o", NULL, "<actions>", "Supported Output OOB Actions");
-    oob.input_size = arg_int0("y", NULL, "<size>", "Maximum size of Input OOB");
-    oob.input_actions = arg_int0("i", NULL, "<actions>", "Supported Input OOB Actions");
-    oob.prov_start_address = arg_int0("p", NULL, "<address>", "start address assigned by provisioner");
-    oob.prov_start_address->ival[0] = 0x0005;
-    oob.end = arg_end(1);
-
-    const esp_console_cmd_t oob_cmd = {
-        .command = "bmoob",
-        .help = "ble mesh: provisioner/node config OOB parameters",
-        .hint = NULL,
-        .func = &ble_mesh_load_oob,
-        .argtable = &oob,
-    };
-    ESP_ERROR_CHECK( esp_console_cmd_register(&oob_cmd));
-
-    bearer.bearer = arg_int0("b", NULL, "<bearer>", "supported bearer");
-    bearer.enable = arg_int0("e", NULL, "<enable/disable>", "bearers node supported");
-    bearer.end = arg_end(1);
-
-    const esp_console_cmd_t bearer_node_cmd = {
-        .command = "bmnbearer",
-        .help = "ble mesh node/porvisioner: enable/disable different bearer",
-        .hint = NULL,
-        .func = &ble_mesh_node_enable_bearer,
-        .argtable = &bearer,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&bearer_node_cmd));
-
-    const esp_console_cmd_t bearer_provisioner_cmd = {
-        .command = "bmpbearer",
-        .help = "ble mesh provisioner: enable/disable different bearers",
-        .hint = NULL,
-        .func = &ble_mesh_provisioner_enable_bearer,
-        .argtable = &bearer,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&bearer_provisioner_cmd));
-
-    provisioner_add_key.action_type = arg_str1("z", NULL, "<action type>", "add appkey or network key");
-    provisioner_add_key.net_idx = arg_int1("n", NULL, "<net key index>", "network key index");
-    provisioner_add_key.key = arg_str1("k", NULL, "<key>", "appkey or network");
-    provisioner_add_key.app_idx = arg_int0("a", NULL, "<app key index>", "appkey index");
-    provisioner_add_key.end = arg_end(1);
-
-    const esp_console_cmd_t provisioner_add_key_cmd = {
-        .command = "bmpkey",
-        .help = "ble mesh provisioner: key",
-        .func = &ble_mesh_provisioner_add_key,
-        .argtable = &provisioner_add_key,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&provisioner_add_key_cmd));
-
-    const esp_console_cmd_t reset_cmd = {
-        .command = "bmnreset",
-        .help = "ble mesh node: reset",
-        .hint = NULL,
-        .func = &ble_mesh_node_reset,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&reset_cmd));
-
-    node_statistices.action_type = arg_str1("z", NULL, "<action>", "action type");
-    node_statistices.package_num = arg_int0("p", NULL, "<package>", "package number");
-    node_statistices.end = arg_end(1);
-
-    const esp_console_cmd_t node_statistices_cmd = {
-        .command = "bmsperf",
-        .help = "ble mesh server: performance statistics",
-        .hint = NULL,
-        .func = &ble_mesh_node_statistics_regist,
-        .argtable = &node_statistices,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&node_statistices_cmd));
-
-    power_set.action_type = arg_str1("z", NULL, "<action>", "action type");
-    power_set.tx_sense_power = arg_int0("t", NULL, "<power>", "tx power or sense");
-    power_set.end = arg_end(1);
-
-    const esp_console_cmd_t power_set_cmd = {
-        .command = "bmtxpower",
-        .help = "ble mesh: set tx power or sense",
-        .hint = NULL,
-        .func = &ble_mesh_power_set,
-        .argtable = &power_set,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&power_set_cmd));
-
-    provisioner_get_node.unicast_addr = arg_int1("u", NULL, "<address>", "get node by unicast address");
-    provisioner_get_node.end = arg_end(1);
-
-    const esp_console_cmd_t provisioner_get_node_cmd = {
-        .command = "bmpgetn",
-        .help = "ble mesh provisioner: get node",
-        .func = &ble_mesh_provisioner_get_node,
-        .argtable = &provisioner_get_node,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&provisioner_get_node_cmd));
-
-    provisioner_add_node.oob_info = arg_int0("o", NULL, "<oob info>", "oob information");
-    provisioner_add_node.unicast_addr = arg_int0("a", NULL, "<unicast address>", "unicast address");
-    provisioner_add_node.element_num = arg_int0("e", NULL, "<element num>", "element num");
-    provisioner_add_node.net_idx = arg_int0("n", NULL, "<net index>", "net index");
-    provisioner_add_node.dev_key = arg_str0("d", NULL, "<device key>", "device key");
-    provisioner_add_node.uuid = arg_str0("u", NULL, "<device uuid>", "device uuid");
-    provisioner_add_node.end = arg_end(1);
-
-    const esp_console_cmd_t provisioner_add_node_cmd = {
-        .command = "bmpaddn",
-        .help = "ble mesh provisioner: add node",
-        .func = &ble_mesh_provisioner_add_node,
-        .argtable = &provisioner_add_node,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&provisioner_add_node_cmd));
-
-    provisioner_local_bind.appkey_index = arg_int1("a", NULL, "<appkey index>", "appkey index");
-    provisioner_local_bind.element_address = arg_int1("e", NULL, "<element address>", "element address");
-    provisioner_local_bind.network_index = arg_int1("n", NULL, "<network index>", "network index");
-    provisioner_local_bind.mod_id = arg_int1("m", NULL, "<model id>", "model id");
-    provisioner_local_bind.cid = arg_int0("c", NULL, "<model id>", "company id");
-    provisioner_local_bind.end = arg_end(1);
-
-    const esp_console_cmd_t provisioner_local_bind_cmd = {
-        .command = "bmpbind",
-        .help = "ble mesh provisioner: bind local model",
-        .func = &ble_mesh_provision_bind_local_model,
-        .argtable = &provisioner_local_bind,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&provisioner_local_bind_cmd));
-
-    node_network_info.net_key = arg_str1("k", NULL, "<net key>", "network key");
-    node_network_info.net_idx = arg_int1("n", NULL, "<net index>", "network key index");
-    node_network_info.unicast_addr = arg_int1("u", NULL, "<unicast address>", "unicast address");
-    node_network_info.dev_key = arg_str1("d", NULL, "<device key>", "device key");
-    node_network_info.app_key = arg_str1("a", NULL, "<appkey>", "app key");
-    node_network_info.app_idx = arg_int1("i", NULL, "<app index>", "appkey index");
-    node_network_info.group_addr = arg_int1("g", NULL, "<group address>", "group address");
-    node_network_info.end = arg_end(1);
-
-    const esp_console_cmd_t node_network_info_cmd = {
-        .command = "bmnnwk",
-        .help = "ble mesh node: auto join network",
-        .hint = NULL,
-        .func = &ble_mesh_node_enter_network_auto,
-        .argtable = &node_network_info,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&node_network_info_cmd));
-
-    heartbeat.action_type = arg_str0("z", NULL, "<action type>", "action type");
-    heartbeat.op = arg_int0("o", NULL, "<heartbeat filter>", "add or remove a heartbeat filter entry");
-    heartbeat.hb_src = arg_int0("s", NULL, "<source address>", "Heartbeat source address");
-    heartbeat.hb_dst = arg_int0("d", NULL, "<destination address>", "Heartbeat destination address");
-    heartbeat.type = arg_int0("t", NULL, "<heartbeat filter>", "set the heartbeat filter type");
-    heartbeat.enable = arg_int0("e", NULL, "<enable/disable>", "enable or disable receiving heartbeat messages");
-    heartbeat.end = arg_end(1);
-
-    const esp_console_cmd_t provisioner_heartbeat_cmd = {
-        .command = "bmphb",
-        .help = "ble mesh provisioner: support recv heartbeat",
-        .hint = NULL,
-        .func = &ble_mesh_provisioner_heartbeat,
-        .argtable = &heartbeat,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&provisioner_heartbeat_cmd));
-
-#ifdef CONFIG_BLE_MESH_USE_DUPLICATE_SCAN
-    exceptional_list_test.action_type = arg_str1("z", NULL, "<action type>", "action type");
-    exceptional_list_test.type = arg_int1("t", NULL, "<type>", "device info type");
-    exceptional_list_test.info = arg_str0("a", NULL, "<info>", "info");
-    exceptional_list_test.end = arg_end(1);
-
-    const esp_console_cmd_t ble_mesh_exceptional_list_test_cmd = {
-        .command = "bmel",
-        .help = "ble mesh: duplicate scan exceptional list test",
-        .hint = NULL,
-        .func = &ble_mesh_exceptional_list_test,
-        .argtable = &exceptional_list_test,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&ble_mesh_exceptional_list_test_cmd));
-#endif
-
-    init_transactions();
-}

+ 0 - 124
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_register_server_cmd.c

@@ -1,124 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "esp_ble_mesh_defs.h"
-#include "esp_ble_mesh_networking_api.h"
-
-#include "ble_mesh_console_lib.h"
-#include "ble_mesh_adapter.h"
-
-void ble_mesh_register_server_operation(void);
-
-typedef struct {
-    struct arg_str *data;
-    struct arg_int *opcode;
-    struct arg_int *model;
-    struct arg_int *role;
-    struct arg_int *pub_addr;
-    struct arg_int *app_index;
-    struct arg_int *period;
-    struct arg_end *end;
-} ble_mesh_publish_message;
-ble_mesh_publish_message msg_publish;
-
-void ble_mesh_register_server(void)
-{
-    ble_mesh_register_server_operation();
-}
-
-int ble_mesh_module_publish_message(int argc, char **argv)
-{
-    esp_err_t err;
-    esp_ble_mesh_elem_t *element = NULL;
-    esp_ble_mesh_model_t *model = NULL;
-    uint8_t *data = NULL;
-    uint8_t device_role = ROLE_NODE;
-    uint16_t length = 0;
-
-    ESP_LOGD(TAG, "enter %s", __func__);
-
-    int nerrors = arg_parse(argc, argv, (void **) &msg_publish);
-    if (nerrors != 0) {
-        arg_print_errors(stderr, msg_publish.end, argv[0]);
-        return 1;
-    }
-
-    data = malloc(strlen(msg_publish.data->sval[0]));
-    if (data == NULL) {
-        ESP_LOGE(TAG, "ble mesh malloc failed, %d", __LINE__);
-        return ESP_ERR_NO_MEM;
-    } else {
-        get_value_string((char *)msg_publish.data->sval[0], (char *) data);
-    }
-
-    arg_int_to_value(msg_publish.role, device_role, "device role");
-
-    element = esp_ble_mesh_find_element(esp_ble_mesh_get_primary_element_address());
-    if (!element) {
-        ESP_LOGE(TAG, "Element 0x%04x not exists", esp_ble_mesh_get_primary_element_address());
-        return ESP_FAIL;
-    }
-
-    model = esp_ble_mesh_find_sig_model(element, msg_publish.model->ival[0]);
-    if (!model) {
-        ESP_LOGE(TAG, "MsgPublish:Load Model Fail");
-        return ESP_FAIL;
-    }
-
-    if (msg_publish.role->count != 0) {
-        device_role = msg_publish.role->ival[0];
-    }
-
-    if (msg_publish.pub_addr->count != 0) {
-        model->pub->publish_addr = msg_publish.pub_addr->ival[0];
-    }
-
-    if (msg_publish.period->count != 0) {
-        model->pub->period = msg_publish.period->ival[0];
-    }
-
-    if (msg_publish.app_index->count != 0) {
-        model->pub->app_idx = msg_publish.app_index->ival[0];
-    }
-
-    if (msg_publish.data->count != 0) {
-        length = strlen(msg_publish.data->sval[0]);
-        data = malloc((length + 1) * sizeof(uint8_t));
-        if (data == NULL) {
-            ESP_LOGE(TAG, "ble mesh malloc failed, %d", __LINE__);
-            return ESP_ERR_NO_MEM;
-        } else {
-            get_value_string((char *)msg_publish.data->sval[0], (char *) data);
-        }
-    }
-
-    err = esp_ble_mesh_model_publish(model, msg_publish.opcode->ival[0], length, data, device_role);
-
-    ESP_LOGD(TAG, "exit %s", __func__);
-    free(data);
-    return err;
-}
-
-void ble_mesh_register_server_operation(void)
-{
-    msg_publish.data = arg_str1("d", NULL, "<data>", "message data");
-    msg_publish.opcode = arg_int1("o", NULL, "<opcode>", "operation opcode");
-    msg_publish.model = arg_int1("m", NULL, "<module>", "module published to");
-    msg_publish.role = arg_int1("r", NULL, "<role>", "device role");
-    msg_publish.pub_addr = arg_int1("a", NULL, "<address>", "unicast address");
-    msg_publish.app_index = arg_int1("i", NULL, "<app key>", "app key index");
-    msg_publish.period = arg_int1("p", NULL, "<period>", "period");
-    msg_publish.end = arg_end(1);
-
-    const esp_console_cmd_t msg_publish_cmd = {
-        .command = "bmpublish",
-        .help = "ble mesh: publish message",
-        .hint = NULL,
-        .func = &ble_mesh_module_publish_message,
-        .argtable = &msg_publish,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&msg_publish_cmd));
-}

+ 0 - 78
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/register_bluetooth.c

@@ -1,78 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Unlicense OR CC0-1.0
- */
-
-#include "string.h"
-#include "esp_console.h"
-#include "ble_mesh_console_lib.h"
-
-#ifdef CONFIG_BT_BLUEDROID_ENABLED
-#include "esp_bt_device.h"
-#endif
-
-#ifdef CONFIG_BT_NIMBLE_ENABLED
-#include "host/ble_hs.h"
-#endif
-
-void register_ble_address(void);
-
-void register_bluetooth(void)
-{
-    register_ble_address();
-}
-
-int get_bd_addr(uint8_t addr[6])
-{
-    if (addr) {
-#ifdef CONFIG_BT_BLUEDROID_ENABLED
-        memcpy(addr, esp_bt_dev_get_address(), 6);
-        return 0;
-#endif
-
-#ifdef CONFIG_BT_NIMBLE_ENABLED
-        uint8_t own_addr_type = 0;
-        uint8_t mac[6] = {0};
-        int rc = 0;
-
-        rc = ble_hs_id_infer_auto(0, &own_addr_type);
-        if (rc != 0) {
-            printf("error determining address type; rc=%d\n", rc);
-            return rc;
-        }
-
-        ble_hs_id_copy_addr(own_addr_type, mac, NULL);
-
-        uint8_t *src = addr;
-        uint8_t *dst = mac + 5;
-        for (uint8_t length = 6; length > 0; length--) {
-            *src++ = *dst--;
-        }
-        return 0;
-#endif
-    }
-
-    return -1;
-}
-
-int bt_mac(int argc, char** argv)
-{
-    uint8_t mac[6] = {0};
-
-    get_bd_addr(mac);
-
-    printf("+BTMAC:"MACSTR"\n", MAC2STR(mac));
-    return 0;
-}
-
-void register_ble_address(void)
-{
-    const esp_console_cmd_t cmd = {
-        .command = "btmac",
-        .help = "get BT mac address",
-        .hint = NULL,
-        .func = &bt_mac,
-    };
-    ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
-}

+ 0 - 267
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/transaction.c

@@ -1,267 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include <stdio.h>
-#include <inttypes.h>
-
-#include "sdkconfig.h"
-#include "freertos/FreeRTOS.h"
-#include "freertos/event_groups.h"
-#include "freertos/task.h"
-#include "freertos/semphr.h"
-#include "esp_timer.h"
-#include "esp_log.h"
-#include "esp_err.h"
-#include "transaction.h"
-#define TAG    "TRANS"
-
-static transaction_t transactions[MAX_TRANSACTION_COUNT];
-static SemaphoreHandle_t trans_mutex;
-
-static uint32_t utils_get_system_ts(void)
-{
-    return esp_log_timestamp();
-}
-
-static void transaction_reset(transaction_t *trans)
-{
-    EventBits_t bits;
-
-    ESP_LOGV(TAG, "transaction reset: %" PRIx32, (uint32_t)trans);
-    // set to inactive state and clear all bits of the transaction
-    xSemaphoreTakeRecursive(trans_mutex, portMAX_DELAY);
-    trans->type = 0;
-    trans->sub_type = 0;
-    trans->current_bits = 0;
-    bits = xEventGroupGetBits(trans->event_group);
-    xEventGroupClearBits(trans->event_group, bits);
-    trans->state = TRANSACTION_INACTIVE;
-    trans->ret = ESP_OK;
-    xSemaphoreGiveRecursive(trans_mutex);
-}
-
-void transaction_deinit(transaction_t *trans)
-{
-    if (trans != NULL) {
-        transaction_reset(trans);
-    }
-}
-
-esp_err_t transaction_set_events(transaction_t *trans, EventBits_t events)
-{
-    esp_err_t ret = ESP_OK;
-    xSemaphoreTakeRecursive(trans_mutex, portMAX_DELAY);
-    if (trans) {
-        if (trans->state == TRANSACTION_INACTIVE) {
-            ret = TRANS_RET_STATE_ERR;
-        } else {
-            // if the task (task A) setting current bits is with higher priority than the task (task B) run transaction,
-            // current_bits might not be updated until task A yield (not it's only update in run_transaction function).
-            // If task A set events and immediately use current_bits, current_bits is not correct.
-            // update current_bits here to make sure it's updated
-            trans->current_bits |= events;
-            xEventGroupSetBits(trans->event_group, events);
-        }
-        ESP_LOGD(TAG, "transactions set events: %" PRIx32 ", %x, %" PRIx32 ", %" PRIx32 "; ret: %x", (uint32_t)trans, trans->type, trans->sub_type, events, ret);
-    } else {
-        ret = TRANS_RET_INVALID_TRNSACTION;
-    }
-    xSemaphoreGiveRecursive(trans_mutex);
-    return ret;
-}
-
-esp_err_t transaction_test_events(transaction_t *trans, EventBits_t events)
-{
-    esp_err_t ret = TRANS_RET_TEST_EVENT_FAILED;
-
-    xSemaphoreTakeRecursive(trans_mutex, portMAX_DELAY);
-    if (trans) {
-        if (trans->state == TRANSACTION_INACTIVE) {
-            ret = TRANS_RET_STATE_ERR;
-        } else {
-            if ((trans->current_bits & events) == events) {
-                ret = ESP_OK;
-            }
-        }
-        ESP_LOGV(TAG, "transactions test events: %" PRIx32 ", %" PRIx32 "; ret: %x", (uint32_t)trans, events, ret);
-    } else {
-        ret = TRANS_RET_INVALID_TRNSACTION;
-    }
-    xSemaphoreGiveRecursive(trans_mutex);
-    return ret;
-}
-
-esp_err_t transaction_clear_events(transaction_t *trans, EventBits_t events)
-{
-    esp_err_t ret = ESP_OK;
-    xSemaphoreTakeRecursive(trans_mutex, portMAX_DELAY);
-    if (trans) {
-        if (trans->state == TRANSACTION_INACTIVE) {
-            ret = TRANS_RET_STATE_ERR;
-        } else {
-            trans->current_bits &= ~events;
-            xEventGroupClearBits(trans->event_group, events);
-        }
-        ESP_LOGD(TAG, "transactions clear events: %" PRIx32 ", %x, %" PRIx32 ", %" PRIx32 "; ret: %x", (uint32_t)trans, trans->type, trans->sub_type, events, ret);
-    } else {
-        ret = TRANS_RET_INVALID_TRNSACTION;
-    }
-    xSemaphoreGiveRecursive(trans_mutex);
-    return ret;
-}
-
-esp_err_t transaction_abort(transaction_t *trans, esp_err_t reason)
-{
-    esp_err_t ret = ESP_OK;
-    xSemaphoreTakeRecursive(trans_mutex, portMAX_DELAY);
-    if (trans) {
-        if (trans->state == TRANSACTION_INACTIVE) {
-            ret = TRANS_RET_STATE_ERR;
-        } else {
-            trans->ret = reason;
-            xEventGroupSetBits(trans->event_group, TRANSACTION_ABORT_EVENT);
-        }
-        ESP_LOGD(TAG, "transactions abort: %" PRIx32 ", %x, %" PRIx32 ", %x; ret: %x", (uint32_t)trans, trans->type, trans->sub_type, reason, ret);
-    } else {
-        ret = TRANS_RET_INVALID_TRNSACTION;
-    }
-    xSemaphoreGiveRecursive(trans_mutex);
-    return ret;
-}
-
-esp_err_t transaction_init(transaction_t **trans, uint8_t type, uint32_t sub_type, EventBits_t wait_events, uint32_t timeout, void *input, void *output)
-{
-    esp_err_t ret = ESP_OK;
-    uint8_t i;
-
-    if ((wait_events & TRANSACTION_EVENT_MASK)
-            && wait_events != TRANSACTION_TIMEOUT_EVENT) {
-        ret = TRANS_RET_EVENTS_CONFLICT;
-        return ret;
-    }
-
-    xSemaphoreTakeRecursive(trans_mutex, portMAX_DELAY);
-    for (i = 0; i < MAX_TRANSACTION_COUNT; i++) {
-        if ( transactions[i].state == TRANSACTION_INACTIVE ) {
-            transactions[i].state = TRANSACTION_ACTIVE;
-            *trans = &transactions[i];
-            break;
-        }
-    }
-
-    if ( i == MAX_TRANSACTION_COUNT ) {
-        ret = TRANS_RET_FAILED_TO_ALLOCATE;
-    } else {
-        // init transaction
-        transactions[i].type = type;
-        transactions[i].wait_events = wait_events;
-        transactions[i].sub_type = sub_type;
-        transactions[i].timeout = timeout;
-        transactions[i].ret = ESP_OK;
-        transactions[i].input = input;
-        transactions[i].output = output;
-    }
-    xSemaphoreGiveRecursive(trans_mutex);
-
-    if (ret == ESP_OK) {
-        ESP_LOGD(TAG, "transaction created: %x, %" PRIx32 ", %" PRIx32 "; ret: %x", type, sub_type, (uint32_t)*trans, ret);
-    }
-    return ret;
-}
-
-esp_err_t transaction_run(transaction_t *trans)
-{
-    esp_err_t ret = ESP_OK;
-    uint32_t start_time;
-    int32_t wait_time;
-    EventBits_t current_bits;
-
-    if (trans) {
-        start_time = utils_get_system_ts();
-        // wait for wait events
-        while (1) {
-            //TODO: we didn't handle ts overflow
-            wait_time = start_time + trans->timeout - utils_get_system_ts();
-
-            if ( wait_time < 0 ) {
-                ESP_LOGI(TAG, "transaction timeout: %" PRIx32 ", %x, %" PRIx32 ", %" PRIx32 ", %" PRIx32, (uint32_t)trans, trans->type, trans->sub_type, trans->wait_events, trans->current_bits);
-                ret = TRANS_RET_TIMEOUT;
-                break;
-            }
-
-            // trans->event_group and trans->wait_events will not be changed once trans is created, so we don't need protect them
-            current_bits = xEventGroupWaitBits(trans->event_group, trans->wait_events | TRANSACTION_ABORT_EVENT,
-                    1, 0, wait_time/portTICK_PERIOD_MS);
-
-            xSemaphoreTakeRecursive(trans_mutex, portMAX_DELAY);
-            trans->current_bits |= current_bits;
-
-            if (trans->current_bits == trans->wait_events) {
-                // wait succeeded, we copy the trans->ret as ret of run transaction. This value could be changed by
-                ret = trans->ret;
-                xSemaphoreGiveRecursive(trans_mutex);
-                break;
-            } else if ( trans->current_bits & TRANSACTION_ABORT_EVENT ) {
-                if ( trans->ret ) {
-                    // copy user defined ret value if it's set
-                    ret = trans->ret;
-                } else {
-                    ret = TRANS_RET_ABORTED;
-                }
-                xSemaphoreGiveRecursive(trans_mutex);
-                break;
-            }
-            xSemaphoreGiveRecursive(trans_mutex);
-        }
-        ESP_LOGD(TAG, "transaction run: %" PRIx32 ", %x, %" PRIx32 "; ret: %x", (uint32_t)trans, trans->type, trans->sub_type, ret);
-        // reset after it's finished
-        transaction_reset(trans);
-    } else {
-        ESP_LOGD(TAG, "transaction run: %" PRIx32 "; ret: %x", (uint32_t)trans, ret);
-        ret = TRANS_RET_INVALID_TRNSACTION;
-    }
-
-    return ret;
-}
-
-transaction_t *transaction_get(uint8_t type, uint32_t sub_type, transaction_t *start)
-{
-    uint8_t i, start_index;
-    transaction_t *trans = NULL;
-
-    if ( start == NULL ) {
-        start_index = 0;
-    } else {
-        start_index = (start - transactions) + 1;
-    }
-
-    xSemaphoreTakeRecursive(trans_mutex, portMAX_DELAY);
-    for (i = start_index; i < MAX_TRANSACTION_COUNT; i++) {
-        if ( transactions[i].state == TRANSACTION_ACTIVE ) {
-            if ( (transactions[i].type == type) && (transactions[i].sub_type & sub_type) ) {
-                trans = &transactions[i];
-                break;
-            }
-        }
-    }
-    xSemaphoreGiveRecursive(trans_mutex);
-    ESP_LOGV(TAG, "transaction get: %x, %" PRIx32 ", %" PRIx32 ", %" PRIx32, type, sub_type, (uint32_t) start, (uint32_t)trans);
-    return trans;
-}
-
-void init_transactions(void)
-{
-    uint8_t i;
-
-    ESP_LOGI(TAG, "init transactions");
-
-    trans_mutex = xSemaphoreCreateRecursiveMutex();
-
-    for (i = 0; i < MAX_TRANSACTION_COUNT; i++) {
-        transactions[i].event_group = xEventGroupCreate();
-        transaction_reset(&transactions[i]);
-    }
-}

+ 0 - 94
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/transaction.h

@@ -1,94 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#ifndef _BLE_MESH_CONSOLE_TRANSACTION_H_
-#define _BLE_MESH_CONSOLE_TRANSACTION_H_
-
-/* In esp-idf, bluetooth and wifi stack APIs are async (using callbacks).
- * transaction module provides a common method to let user transfer async APIs to sync transactions.
- */
-
-#include "sdkconfig.h"
-#include "esp_err.h"
-#include "freertos/event_groups.h"
-
-#define MAX_TRANSACTION_COUNT           5
-
-#define TRANSACTION_TYPE_ALL            0xFF
-
-#define TRANSACTION_SUB_TYPE_ALL        0xFFFFFFFF
-
-// The higher 12 bits of event is reversed for event group or transaction module.
-// Application can only use lower 20 bits of the event.
-#define TRANSACTION_TIMEOUT_EVENT           0x00100000UL  // only wait for timeout
-#define TRANSACTION_ABORT_EVENT             0x00800000UL  // this event is reserved for internal use only
-#define TRANSACTION_EVENT_MASK              0xFFF00000UL
-
-
-enum {
-    TRANS_RET_ERROR_START = 0x10000,
-    TRANS_RET_FAILED_TO_ALLOCATE,
-    TRANS_RET_STATE_ERR,
-    TRANS_RET_TEST_EVENT_FAILED,
-    TRANS_RET_EVENTS_CONFLICT,    // events bit conflicts with TRANSACTION_ABORT_EVENT
-    TRANS_RET_INVALID_TRNSACTION,
-    TRANS_RET_TIMEOUT,
-    TRANS_RET_ABORTED
-};
-
-typedef enum {
-    TRANSACTION_INACTIVE,
-    TRANSACTION_ACTIVE,
-} transaction_state_t;
-
-typedef struct {
-    /* input data passed to callback */
-    void                *input;
-    /* output data from callback */
-    void                *output;
-    /* retrun value, can be set by callback or transaction module (like timeout, or other common errors)
-     * transaction_run will return this member by default. */
-    esp_err_t           ret;
-    // private member
-    transaction_state_t state;
-    uint8_t             type;
-    uint32_t            sub_type;
-    uint32_t            timeout;
-    EventBits_t         wait_events;
-    EventGroupHandle_t  event_group;
-    EventBits_t         current_bits;
-} transaction_t;
-
-
-void init_transactions(void);
-
-esp_err_t transaction_init(transaction_t **trans, uint8_t type, uint32_t sub_type, EventBits_t wait_events, uint32_t timeout, void *input, void *output);
-esp_err_t transaction_run(transaction_t *trans);
-
-transaction_t *transaction_get(uint8_t type, uint32_t sub_type, transaction_t *start);
-
-esp_err_t transaction_set_events(transaction_t *trans, EventBits_t events);
-esp_err_t transaction_test_events(transaction_t *trans, EventBits_t events);
-esp_err_t transaction_clear_events(transaction_t *trans, EventBits_t events);
-
-esp_err_t transaction_abort(transaction_t *trans, esp_err_t reason);
-
-#define TRANSACTION_INIT(trans, type, sub_type, wait_events, timeout, input, output) \
-    ESP_ERROR_CHECK(transaction_init(trans, type, sub_type, wait_events, timeout, input, output))
-
-
-#define transaction_get_first(type, sub_type) transaction_get(type, sub_type, NULL)
-
-
-/* We declare all transaction type / sub type below */
-#define TRANS_TYPE_BLE_GAP        0x01
-#define TRANS_TYPE_BLE_GATTC      0x02
-#define TRANS_TYPE_BLE_GATTS      0x03
-#define TRANS_TYPE_WIFI           0x04
-#define TRANS_TYPE_BT             0x05
-
-
-#endif /* _BLE_MESH_CONSOLE_TRANSACTION_H_ */

+ 0 - 4
examples/bluetooth/esp_ble_mesh/ble_mesh_console/partitions.csv

@@ -1,4 +0,0 @@
-# Name,   Type, SubType, Offset,  Size, Flags
-nvs,      data, nvs,     0x9000,  0x6000,
-phy_init, data, phy,     0xf000,  0x1000,
-factory,  app,  factory, 0x10000, 2M,

+ 0 - 32
examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.ci.bluedroid

@@ -1,32 +0,0 @@
-# Override some defaults so BT stack is enabled
-CONFIG_BT_ENABLED=y
-CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
-CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
-CONFIG_BTDM_CTRL_MODE_BTDM=n
-CONFIG_CTRL_BTDM_MODEM_SLEEP=n
-CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y
-CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y
-CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
-CONFIG_BT_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=3
-CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=3
-CONFIG_BLE_MESH_CFG_CLI=y
-CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
-CONFIG_BLE_MESH_PROVISIONER=y
-CONFIG_BLE_MESH_PROVISIONER_RECV_HB=y
-CONFIG_BLE_MESH_PROVISIONER_RECV_HB_FILTER_SIZE=3
-CONFIG_BLE_MESH_SELF_TEST=y
-CONFIG_BLE_MESH_TEST_AUTO_ENTER_NETWORK=y
-CONFIG_BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM=80
-CONFIG_BLE_MESH_MAX_PROV_NODES=80
-
-# partitions
-CONFIG_PARTITION_TABLE_CUSTOM=y
-CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
-CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
-CONFIG_ESPTOOLPY_FLASHSIZE="4MB"

+ 0 - 32
examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.ci.nimble

@@ -1,32 +0,0 @@
-# Override some defaults so nimble is enabled
-CONFIG_BT_ENABLED=y
-CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
-CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
-CONFIG_BTDM_CTRL_MODE_BTDM=n
-CONFIG_CTRL_BTDM_MODEM_SLEEP=n
-CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y
-CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y
-CONFIG_BT_NIMBLE_ENABLED=y
-CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR=y
-
-# 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=3
-CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=3
-CONFIG_BLE_MESH_CFG_CLI=y
-CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
-CONFIG_BLE_MESH_PROVISIONER=y
-CONFIG_BLE_MESH_PROVISIONER_RECV_HB=y
-CONFIG_BLE_MESH_PROVISIONER_RECV_HB_FILTER_SIZE=3
-CONFIG_BLE_MESH_SELF_TEST=y
-CONFIG_BLE_MESH_TEST_AUTO_ENTER_NETWORK=y
-CONFIG_BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM=80
-CONFIG_BLE_MESH_MAX_PROV_NODES=80
-
-# partitions
-CONFIG_PARTITION_TABLE_CUSTOM=y
-CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
-CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
-CONFIG_ESPTOOLPY_FLASHSIZE="4MB"

+ 0 - 33
examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults

@@ -1,33 +0,0 @@
-# Override some defaults so BT stack is enabled
-# by default in this example
-CONFIG_BT_ENABLED=y
-CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
-CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
-CONFIG_BTDM_CTRL_MODE_BTDM=n
-CONFIG_CTRL_BTDM_MODEM_SLEEP=n
-CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y
-CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y
-CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
-CONFIG_BT_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=3
-CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=3
-CONFIG_BLE_MESH_CFG_CLI=y
-CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
-CONFIG_BLE_MESH_PROVISIONER=y
-CONFIG_BLE_MESH_PROVISIONER_RECV_HB=y
-CONFIG_BLE_MESH_PROVISIONER_RECV_HB_FILTER_SIZE=3
-CONFIG_BLE_MESH_SELF_TEST=y
-CONFIG_BLE_MESH_TEST_AUTO_ENTER_NETWORK=y
-CONFIG_BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM=80
-CONFIG_BLE_MESH_MAX_PROV_NODES=80
-
-# partitions
-CONFIG_PARTITION_TABLE_CUSTOM=y
-CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
-CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
-CONFIG_ESPTOOLPY_FLASHSIZE="4MB"

+ 0 - 27
examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults.esp32c3

@@ -1,27 +0,0 @@
-# ESP32C3-specific
-##Override some defaults so BT stack is enabled
-# by default in this example
-CONFIG_BT_ENABLED=y
-CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE=y
-CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN=y
-CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
-CONFIG_BT_BTU_TASK_STACK_SIZE=4512
-CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
-
-# 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=3
-CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=3
-CONFIG_BLE_MESH_CFG_CLI=y
-CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
-CONFIG_BLE_MESH_PROVISIONER=y
-CONFIG_BLE_MESH_SELF_TEST=y
-CONFIG_BLE_MESH_TEST_AUTO_ENTER_NETWORK=y
-CONFIG_BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM=80
-CONFIG_BLE_MESH_MAX_PROV_NODES=80
-
-CONFIG_PARTITION_TABLE_CUSTOM=y
-CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
-# end of ESP32C3-specific

+ 0 - 30
examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults.esp32c6

@@ -1,30 +0,0 @@
-# ESP32C6-specific
-##Override some defaults so BT stack is enabled
-# by default in this example
-CONFIG_BT_ENABLED=y
-CONFIG_BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE=y
-CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN=y
-CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
-CONFIG_BT_BTU_TASK_STACK_SIZE=4512
-CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
-CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n
-CONFIG_BT_LE_50_FEATURE_SUPPORT=n
-
-# 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=3
-CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=3
-CONFIG_BLE_MESH_CFG_CLI=y
-CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
-CONFIG_BLE_MESH_PROVISIONER=y
-CONFIG_BLE_MESH_SELF_TEST=y
-CONFIG_BLE_MESH_TEST_AUTO_ENTER_NETWORK=y
-CONFIG_BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM=80
-CONFIG_BLE_MESH_MAX_PROV_NODES=80
-
-CONFIG_PARTITION_TABLE_CUSTOM=y
-CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
-
-# end of ESP32C6-specific

+ 0 - 30
examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults.esp32h2

@@ -1,30 +0,0 @@
-# ESP32H2-specific
-##Override some defaults so BT stack is enabled
-# by default in this example
-CONFIG_BT_ENABLED=y
-CONFIG_BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE=y
-CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN=y
-CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
-CONFIG_BT_BTU_TASK_STACK_SIZE=4512
-CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
-CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n
-CONFIG_BT_LE_50_FEATURE_SUPPORT=n
-
-# 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=3
-CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=3
-CONFIG_BLE_MESH_CFG_CLI=y
-CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
-CONFIG_BLE_MESH_PROVISIONER=y
-CONFIG_BLE_MESH_SELF_TEST=y
-CONFIG_BLE_MESH_TEST_AUTO_ENTER_NETWORK=y
-CONFIG_BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM=80
-CONFIG_BLE_MESH_MAX_PROV_NODES=80
-
-CONFIG_PARTITION_TABLE_CUSTOM=y
-CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
-
-# end of ESP32H2-specific

+ 0 - 27
examples/bluetooth/esp_ble_mesh/ble_mesh_console/sdkconfig.defaults.esp32s3

@@ -1,27 +0,0 @@
-# ESP32S3-specific
-# Override some defaults so BT stack is enabled
-# by default in this example
-CONFIG_BT_ENABLED=y
-CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE=y
-CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN=y
-CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
-CONFIG_BT_BTU_TASK_STACK_SIZE=4512
-CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
-
-# 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=3
-CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=3
-CONFIG_BLE_MESH_CFG_CLI=y
-CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y
-CONFIG_BLE_MESH_PROVISIONER=y
-CONFIG_BLE_MESH_SELF_TEST=y
-CONFIG_BLE_MESH_TEST_AUTO_ENTER_NETWORK=y
-CONFIG_BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM=80
-CONFIG_BLE_MESH_MAX_PROV_NODES=80
-
-CONFIG_PARTITION_TABLE_CUSTOM=y
-CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
-# end of ESP32S3-specific