-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit. Unmodified copy of NCS 2.9.0 zephyr/tests/bluetooth/mes…
…h_shell.
- Loading branch information
0 parents
commit 013f0da
Showing
5 changed files
with
279 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(mesh_shell) | ||
|
||
FILE(GLOB app_sources src/*.c) | ||
target_sources(app PRIVATE ${app_sources}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
CONFIG_TEST=y | ||
CONFIG_TEST_LOGGING_DEFAULTS=n | ||
#CONFIG_INIT_STACKS=y | ||
CONFIG_MAIN_STACK_SIZE=2048 | ||
CONFIG_ISR_STACK_SIZE=1500 | ||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=3048 | ||
CONFIG_SHELL_STACK_SIZE=2200 | ||
|
||
CONFIG_SHELL=y | ||
CONFIG_SHELL_CMD_BUFF_SIZE=128 | ||
|
||
CONFIG_BT_SETTINGS=y | ||
CONFIG_FLASH=y | ||
CONFIG_FLASH_MAP=y | ||
CONFIG_NVS=y | ||
CONFIG_SETTINGS=y | ||
|
||
CONFIG_BT=y | ||
CONFIG_BT_OBSERVER=y | ||
CONFIG_BT_PERIPHERAL=y | ||
CONFIG_BT_DEVICE_NAME="Zephyr Mesh" | ||
CONFIG_BT_GATT_CACHING=n | ||
|
||
CONFIG_BT_CTLR_DUP_FILTER_LEN=0 | ||
CONFIG_BT_CTLR_LE_ENC=n | ||
CONFIG_BT_CTLR_LE_PING=n | ||
CONFIG_BT_DATA_LEN_UPDATE=n | ||
CONFIG_BT_PHY_UPDATE=n | ||
CONFIG_BT_CTLR_MIN_USED_CHAN=n | ||
CONFIG_BT_CTLR_PRIVACY=n | ||
CONFIG_BT_CTLR_DTM_HCI=n | ||
CONFIG_BT_CTLR_EXT_SCAN_FP=n | ||
CONFIG_BT_DATA_LEN_UPDATE=n | ||
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=n | ||
CONFIG_BT_CTLR_ADVANCED_FEATURES=y | ||
CONFIG_BT_CTLR_FILTER_ACCEPT_LIST=n | ||
|
||
CONFIG_BT_L2CAP_TX_BUF_COUNT=4 | ||
|
||
CONFIG_BT_MESH=y | ||
CONFIG_BT_MESH_SHELL=y | ||
CONFIG_BT_MESH_SHELL_HEALTH_SRV_INSTANCE=y | ||
CONFIG_BT_MESH_SHELL_PROV_CTX_INSTANCE=y | ||
CONFIG_BT_MESH_RELAY=y | ||
CONFIG_BT_MESH_LOW_POWER=y | ||
CONFIG_BT_MESH_LPN_AUTO=n | ||
CONFIG_BT_MESH_FRIEND=y | ||
CONFIG_BT_MESH_FRIEND_QUEUE_SIZE=16 | ||
CONFIG_BT_MESH_ADV_BUF_COUNT=9 | ||
CONFIG_BT_MESH_CFG_CLI=y | ||
CONFIG_BT_MESH_CFG_CLI_TIMEOUT=6000 | ||
CONFIG_BT_MESH_HEALTH_CLI=y | ||
CONFIG_BT_MESH_TX_SEG_MSG_COUNT=2 | ||
CONFIG_BT_MESH_RX_SEG_MSG_COUNT=2 | ||
CONFIG_BT_MESH_RX_SEG_MAX=32 | ||
CONFIG_BT_MESH_TX_SEG_MAX=32 | ||
|
||
CONFIG_BT_MESH_PB_GATT=y | ||
CONFIG_BT_MESH_PB_ADV=y | ||
CONFIG_BT_MESH_GATT_PROXY=y | ||
CONFIG_BT_MESH_NODE_ID_TIMEOUT=10 | ||
|
||
CONFIG_BT_MESH_SUBNET_COUNT=2 | ||
CONFIG_BT_MESH_APP_KEY_COUNT=2 | ||
# PTS requires more key slots when using Opcodes Aggregator. | ||
# First one is implicitly taken by Device Key. | ||
CONFIG_BT_MESH_MODEL_KEY_COUNT=3 | ||
CONFIG_BT_MESH_MODEL_GROUP_COUNT=2 | ||
CONFIG_BT_MESH_LABEL_COUNT=1 | ||
|
||
CONFIG_LOG=y | ||
CONFIG_LOG_BUFFER_SIZE=4000 | ||
CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=250 | ||
|
||
CONFIG_BT_MESH_IV_UPDATE_TEST=y | ||
CONFIG_BT_MESH_LOG_LEVEL_DBG=y | ||
CONFIG_BT_MESH_CDB=y | ||
CONFIG_BT_MESH_PROVISIONER=y | ||
CONFIG_BT_MESH_STATISTIC=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CONFIG_BT_CENTRAL=y | ||
CONFIG_BT_MESH_PROXY_CLIENT=y | ||
CONFIG_BT_MESH_PROXY_SOLICITATION=y | ||
CONFIG_BT_MESH_PRIV_BEACON_SRV=y | ||
CONFIG_BT_MESH_OD_PRIV_PROXY_CLI=y | ||
CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y | ||
CONFIG_BT_MESH_SOL_PDU_RPL_CLI=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
/* | ||
* Copyright (c) 2017 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/sys/printk.h> | ||
#include <stdlib.h> | ||
#include <zephyr/kernel.h> | ||
|
||
#include <zephyr/shell/shell.h> | ||
|
||
#include <zephyr/bluetooth/bluetooth.h> | ||
#include <zephyr/bluetooth/mesh.h> | ||
#include <zephyr/bluetooth/mesh/shell.h> | ||
|
||
static struct bt_mesh_cfg_cli cfg_cli; | ||
|
||
#if defined(CONFIG_BT_MESH_DFD_SRV) | ||
static struct bt_mesh_dfd_srv dfd_srv; | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_SAR_CFG_CLI) | ||
static struct bt_mesh_sar_cfg_cli sar_cfg_cli; | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_PRIV_BEACON_CLI) | ||
static struct bt_mesh_priv_beacon_cli priv_beacon_cli; | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_SOL_PDU_RPL_CLI) | ||
static struct bt_mesh_sol_pdu_rpl_cli srpl_cli; | ||
#endif | ||
|
||
|
||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI) | ||
static struct bt_mesh_od_priv_proxy_cli od_priv_proxy_cli; | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_CLI) | ||
struct bt_mesh_large_comp_data_cli large_comp_data_cli; | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_BRG_CFG_CLI) | ||
static struct bt_mesh_brg_cfg_cli brg_cfg_cli; | ||
#endif | ||
|
||
BT_MESH_SHELL_HEALTH_PUB_DEFINE(health_pub); | ||
|
||
static const struct bt_mesh_model root_models[] = { | ||
BT_MESH_MODEL_CFG_SRV, | ||
BT_MESH_MODEL_CFG_CLI(&cfg_cli), | ||
BT_MESH_MODEL_HEALTH_SRV(&bt_mesh_shell_health_srv, &health_pub, health_srv_meta), | ||
BT_MESH_MODEL_HEALTH_CLI(&bt_mesh_shell_health_cli), | ||
#if defined(CONFIG_BT_MESH_DFD_SRV) | ||
BT_MESH_MODEL_DFD_SRV(&dfd_srv), | ||
#else | ||
#if defined(CONFIG_BT_MESH_SHELL_DFU_SRV) | ||
BT_MESH_MODEL_DFU_SRV(&bt_mesh_shell_dfu_srv), | ||
#elif defined(CONFIG_BT_MESH_SHELL_BLOB_SRV) | ||
BT_MESH_MODEL_BLOB_SRV(&bt_mesh_shell_blob_srv), | ||
#endif | ||
#if defined(CONFIG_BT_MESH_SHELL_DFU_CLI) | ||
BT_MESH_MODEL_DFU_CLI(&bt_mesh_shell_dfu_cli), | ||
#elif defined(CONFIG_BT_MESH_SHELL_BLOB_CLI) | ||
BT_MESH_MODEL_BLOB_CLI(&bt_mesh_shell_blob_cli), | ||
#endif | ||
#endif /* CONFIG_BT_MESH_DFD_SRV */ | ||
#if defined(CONFIG_BT_MESH_SHELL_RPR_CLI) | ||
BT_MESH_MODEL_RPR_CLI(&bt_mesh_shell_rpr_cli), | ||
#endif | ||
#if defined(CONFIG_BT_MESH_RPR_SRV) | ||
BT_MESH_MODEL_RPR_SRV, | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_SAR_CFG_SRV) | ||
BT_MESH_MODEL_SAR_CFG_SRV, | ||
#endif | ||
#if defined(CONFIG_BT_MESH_SAR_CFG_CLI) | ||
BT_MESH_MODEL_SAR_CFG_CLI(&sar_cfg_cli), | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_OP_AGG_SRV) | ||
BT_MESH_MODEL_OP_AGG_SRV, | ||
#endif | ||
#if defined(CONFIG_BT_MESH_OP_AGG_CLI) | ||
BT_MESH_MODEL_OP_AGG_CLI, | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV) | ||
BT_MESH_MODEL_LARGE_COMP_DATA_SRV, | ||
#endif | ||
#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_CLI) | ||
BT_MESH_MODEL_LARGE_COMP_DATA_CLI(&large_comp_data_cli), | ||
#endif | ||
|
||
#if defined(CONFIG_BT_MESH_PRIV_BEACON_SRV) | ||
BT_MESH_MODEL_PRIV_BEACON_SRV, | ||
#endif | ||
#if defined(CONFIG_BT_MESH_PRIV_BEACON_CLI) | ||
BT_MESH_MODEL_PRIV_BEACON_CLI(&priv_beacon_cli), | ||
#endif | ||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI) | ||
BT_MESH_MODEL_OD_PRIV_PROXY_CLI(&od_priv_proxy_cli), | ||
#endif | ||
#if defined(CONFIG_BT_MESH_SOL_PDU_RPL_CLI) | ||
BT_MESH_MODEL_SOL_PDU_RPL_CLI(&srpl_cli), | ||
#endif | ||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) | ||
BT_MESH_MODEL_OD_PRIV_PROXY_SRV, | ||
#endif | ||
#if defined(CONFIG_BT_MESH_BRG_CFG_SRV) | ||
BT_MESH_MODEL_BRG_CFG_SRV, | ||
#endif | ||
#if defined(CONFIG_BT_MESH_BRG_CFG_CLI) | ||
BT_MESH_MODEL_BRG_CFG_CLI(&brg_cfg_cli), | ||
#endif | ||
}; | ||
|
||
static const struct bt_mesh_elem elements[] = { | ||
BT_MESH_ELEM(0, root_models, BT_MESH_MODEL_NONE), | ||
}; | ||
|
||
static const struct bt_mesh_comp comp = { | ||
.cid = CONFIG_BT_COMPANY_ID, | ||
.elem = elements, | ||
.elem_count = ARRAY_SIZE(elements), | ||
}; | ||
|
||
static void bt_ready(int err) | ||
{ | ||
if (err && err != -EALREADY) { | ||
printk("Bluetooth init failed (err %d)\n", err); | ||
return; | ||
} | ||
|
||
printk("Bluetooth initialized\n"); | ||
|
||
err = bt_mesh_init(&bt_mesh_shell_prov, &comp); | ||
if (err) { | ||
printk("Initializing mesh failed (err %d)\n", err); | ||
return; | ||
} | ||
|
||
if (IS_ENABLED(CONFIG_SETTINGS)) { | ||
settings_load(); | ||
} | ||
|
||
printk("Mesh initialized\n"); | ||
|
||
if (bt_mesh_is_provisioned()) { | ||
printk("Mesh network restored from flash\n"); | ||
} else { | ||
printk("Use \"prov pb-adv on\" or \"prov pb-gatt on\" to " | ||
"enable advertising\n"); | ||
} | ||
} | ||
|
||
int main(void) | ||
{ | ||
int err; | ||
|
||
printk("Initializing...\n"); | ||
|
||
/* Initialize the Bluetooth Subsystem */ | ||
err = bt_enable(bt_ready); | ||
if (err && err != -EALREADY) { | ||
printk("Bluetooth init failed (err %d)\n", err); | ||
} | ||
|
||
printk("Press the <Tab> button for supported commands.\n"); | ||
printk("Before any Mesh commands you must run \"mesh init\"\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
common: | ||
tags: bluetooth | ||
harness: keyboard | ||
tests: | ||
bluetooth.mesh.mesh_shell: | ||
platform_allow: | ||
- qemu_x86 | ||
- nrf52840dk/nrf52840 | ||
integration_platforms: | ||
- qemu_x86 | ||
platform_exclude: nrf52dk/nrf52810 |