From c1e5584cd8a14692dac53daffdd37a691ccf1fc8 Mon Sep 17 00:00:00 2001 From: luchangjie Date: Mon, 3 Aug 2020 19:12:12 +0800 Subject: [PATCH] backport_test/merge_ble_mesh_node_and_provioner_in_console_4.0 --- .../esp-ble-mesh/ble-mesh-index.rst | 2 +- .../{ble_mesh_node => }/CMakeLists.txt | 2 +- .../{ble_mesh_node => }/Makefile | 2 +- .../{ble_mesh_node => }/README.md | 3 + .../ble_mesh_commands_README.md | 166 ++++++ .../ble_mesh_node/main/CMakeLists.txt | 13 - .../ble_mesh_node/main/ble_mesh_adapter.c | 165 ------ .../ble_mesh_node/main/ble_mesh_adapter.h | 97 ---- .../main/ble_mesh_reg_gen_onoff_client_cmd.c | 180 ------ .../ble_mesh_provisioner/CMakeLists.txt | 6 - .../ble_mesh_provisioner/Makefile | 10 - .../ble_mesh_provisioner/README.md | 10 - .../ble_mesh_provisioner/main/CMakeLists.txt | 16 - .../main/ble_mesh_cfg_srv_model.c | 205 ------- .../main/ble_mesh_cfg_srv_model.h | 107 ---- .../main/ble_mesh_console_decl.h | 38 -- .../main/ble_mesh_console_lib.c | 124 ----- .../main/ble_mesh_console_lib.h | 29 - .../main/ble_mesh_console_main.c | 231 -------- .../main/ble_mesh_console_system.c | 179 ------ .../main/ble_mesh_register_node_cmd.c | 491 ----------------- .../main/ble_mesh_register_provisioner_cmd.c | 391 -------------- .../ble_mesh_provisioner/main/component.mk | 5 - .../main/register_bluetooth.c | 45 -- .../ble_mesh_provisioner/sdkconfig.defaults | 26 - .../ble_mesh_console/main/CMakeLists.txt | 16 + .../main/ble_mesh_adapter.c | 91 +++- .../main/ble_mesh_adapter.h | 31 +- .../main/ble_mesh_cfg_srv_model.c | 21 +- .../main/ble_mesh_cfg_srv_model.h | 0 .../main/ble_mesh_console_decl.h | 8 + .../main/ble_mesh_console_lib.c | 0 .../main/ble_mesh_console_lib.h | 0 .../main/ble_mesh_console_main.c | 10 +- .../main/ble_mesh_console_system.c | 0 .../main/ble_mesh_reg_cfg_client_cmd.c | 1 - .../main/ble_mesh_reg_gen_onoff_client_cmd.c | 3 +- .../main/ble_mesh_reg_test_perf_client_cmd.c | 0 .../ble_mesh_register_cmd.c} | 511 ++++++++++++++++-- .../main/ble_mesh_register_server_cmd.c | 0 .../{ble_mesh_node => }/main/component.mk | 0 .../main/register_bluetooth.c | 0 .../main/transaction.c | 0 .../main/transaction.h | 0 .../ble_mesh_console/partitions.csv | 4 + .../{ble_mesh_node => }/sdkconfig.defaults | 8 + 46 files changed, 796 insertions(+), 2451 deletions(-) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/CMakeLists.txt (87%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/Makefile (84%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/README.md (87%) create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_commands_README.md delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/CMakeLists.txt delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/ble_mesh_adapter.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/ble_mesh_adapter.h delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/ble_mesh_reg_gen_onoff_client_cmd.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/CMakeLists.txt delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/Makefile delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/README.md delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/CMakeLists.txt delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_cfg_srv_model.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_cfg_srv_model.h delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_decl.h delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_lib.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_lib.h delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_main.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_system.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_register_node_cmd.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_register_provisioner_cmd.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/component.mk delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/register_bluetooth.c delete mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/sdkconfig.defaults create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/CMakeLists.txt rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_provisioner => }/main/ble_mesh_adapter.c (77%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_provisioner => }/main/ble_mesh_adapter.h (77%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/ble_mesh_cfg_srv_model.c (96%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/ble_mesh_cfg_srv_model.h (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/ble_mesh_console_decl.h (80%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/ble_mesh_console_lib.c (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/ble_mesh_console_lib.h (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/ble_mesh_console_main.c (95%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/ble_mesh_console_system.c (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_provisioner => }/main/ble_mesh_reg_cfg_client_cmd.c (99%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_provisioner => }/main/ble_mesh_reg_gen_onoff_client_cmd.c (98%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_provisioner => }/main/ble_mesh_reg_test_perf_client_cmd.c (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node/main/ble_mesh_register_node_cmd.c => main/ble_mesh_register_cmd.c} (54%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/ble_mesh_register_server_cmd.c (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/component.mk (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/main/register_bluetooth.c (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_provisioner => }/main/transaction.c (100%) rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_provisioner => }/main/transaction.h (100%) create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_console/partitions.csv rename examples/bluetooth/esp_ble_mesh/ble_mesh_console/{ble_mesh_node => }/sdkconfig.defaults (73%) diff --git a/docs/en/api-guides/esp-ble-mesh/ble-mesh-index.rst b/docs/en/api-guides/esp-ble-mesh/ble-mesh-index.rst index b74cb24d56..deec3cc7d2 100644 --- a/docs/en/api-guides/esp-ble-mesh/ble-mesh-index.rst +++ b/docs/en/api-guides/esp-ble-mesh/ble-mesh-index.rst @@ -219,7 +219,7 @@ ESP-BLE-MESH Examples * :example:`ESP-BLE-MESH and Wi-Fi Coexistence ` - an example that demonstrates the Wi-Fi and Bluetooth (BLE/BR/EDR) coexistence feature of ESP32. Simply put, users can use the Wi-Fi while operating Bluetooth, see :example:`example code `. -* ESP-BLE-MESH Node Console - an example that implements BLE Mesh node 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 ` and :example:`example Provisioner code `. +* ESP-BLE-MESH Node Console - an example that implements BLE Mesh node 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 `. .. _esp-ble-mesh-demo-videos: diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/CMakeLists.txt similarity index 87% rename from examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/CMakeLists.txt rename to examples/bluetooth/esp_ble_mesh/ble_mesh_console/CMakeLists.txt index 74361e558c..ec534dfbf5 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/CMakeLists.txt @@ -3,4 +3,4 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(ble_mesh_console_node) +project(ble_mesh_console) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/Makefile b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/Makefile similarity index 84% rename from examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/Makefile rename to examples/bluetooth/esp_ble_mesh/ble_mesh_console/Makefile index 209aa2e0cc..718b7922d2 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/Makefile +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/Makefile @@ -3,7 +3,7 @@ # project subdirectory. # -PROJECT_NAME := ble_mesh_console_node +PROJECT_NAME := ble_mesh_console COMPONENT_ADD_INCLUDEDIRS := components/include diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/README.md b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/README.md similarity index 87% rename from examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/README.md rename to examples/bluetooth/esp_ble_mesh/ble_mesh_console/README.md index 0bb260c816..86a244b8f7 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/README.md +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/README.md @@ -1,3 +1,6 @@ +| Supported Targets | ESP32 | +| ----------------- | ----- | + # 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. diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_commands_README.md b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_commands_README.md new file mode 100644 index 0000000000..b9277422ad --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_commands_README.md @@ -0,0 +1,166 @@ +# 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` + * `-e`: `:element address` + * `-n`: `:network index` + * `-m`: `:model id` + * `-c`: `: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 ` + * `-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`: `:add app key or network key` + * `-n`: `:network key index` + * `-k`: `:appkey or network` + * `-a`: `:appkey index` + * Example: `bmpkey -z netkey -n 1 -k ` + * Result: `provisioner:NetKeyAdd,OK` + +* `bmccm`: BLE Mesh configuration client model operations + * `-z`: `:action type`:add or del client model + * `-x`: `:set state` + * `-o`: `:message opcode` + * `-u`: `
:unicast address` + * `-n`: `:net work index` + * `-i`: `:appkey index` + * `-r`: `:relay statue` + * `-t`: `:relay transmit` + * `-c`: `:company id` + * `-v`: `:value` + * `-a`: `
:address` + * `-m`: `:model id` + * Example: `bmccm -z reg` + * Result: `ConfigClient:OK` + +* `bmgocm`: BLE Mesh onoff client model operations + * `-z`: `:action type`: on or off client model + * `-o`: `:message opcode` + * `-u`: `
:unicast address` + * `-n`: `:network key index` + * `-a`: `:appkey index` + * `-r`: `:role` + * `-t`: `