Skip to content

Commit

Permalink
tests: bluetooth: mesh: Removed native_posix and renamed sim_ids
Browse files Browse the repository at this point in the history
Removed deprecated native_posix as test platform.
Added unique sim_ids for tests with the psa as a overlay.
Fixed clang-format issues.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
  • Loading branch information
Balaklaka authored and nashif committed Sep 17, 2024
1 parent e0f5f3a commit d41e834
Show file tree
Hide file tree
Showing 23 changed files with 454 additions and 512 deletions.
6 changes: 3 additions & 3 deletions include/zephyr/bluetooth/mesh/brg_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ struct bt_mesh_bridging_table_status {

/** Used to filter set of pairs of NetKey Indexes from the Bridging Table */
struct bt_mesh_filter_netkey {
uint16_t filter:2, /* Filter applied to the set of pairs of NetKey Indexes */
prohibited:2, /* Prohibited */
net_idx:12; /* NetKey Index used for filtering or ignored */
uint16_t filter: 2, /* Filter applied to the set of pairs of NetKey Indexes */
prohibited: 2, /* Prohibited */
net_idx: 12; /* NetKey Index used for filtering or ignored */
};

/** Bridged Subnets List response */
Expand Down
6 changes: 3 additions & 3 deletions include/zephyr/bluetooth/mesh/brg_cfg_srv.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ extern "C" {
*
* @brief Bridge Configuration Server model Composition Data entry.
*/
#define BT_MESH_MODEL_BRG_CFG_SRV \
BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_BRG_CFG_SRV, _bt_mesh_brg_cfg_srv_op, \
NULL, NULL, &_bt_mesh_brg_cfg_srv_cb)
#define BT_MESH_MODEL_BRG_CFG_SRV \
BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_BRG_CFG_SRV, _bt_mesh_brg_cfg_srv_op, NULL, NULL, \
&_bt_mesh_brg_cfg_srv_cb)

/** @cond INTERNAL_HIDDEN */
extern const struct bt_mesh_model_op _bt_mesh_brg_cfg_srv_op[];
Expand Down
38 changes: 16 additions & 22 deletions subsys/bluetooth/mesh/brg_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ static void brg_tbl_netkey_removed_evt(struct bt_mesh_subnet *sub, enum bt_mesh_
}

for (int i = 0; i < CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX; i++) {
if (brg_tbl[i].direction && (
brg_tbl[i].net_idx1 == sub->net_idx ||
brg_tbl[i].net_idx2 == sub->net_idx)) {
if (brg_tbl[i].direction &&
(brg_tbl[i].net_idx1 == sub->net_idx || brg_tbl[i].net_idx2 == sub->net_idx)) {
memset(&brg_tbl[i], 0, sizeof(brg_tbl[i]));
brg_tbl_compact();
}
Expand Down Expand Up @@ -229,21 +228,18 @@ int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx
uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status)
{
/* Sanity checks */
if (!BT_MESH_ADDR_IS_UNICAST(addr1) || net_idx1 == net_idx2 ||
addr1 == addr2 || net_idx1 > BT_MESH_BRG_CFG_KEY_INDEX_MAX ||
net_idx2 > BT_MESH_BRG_CFG_KEY_INDEX_MAX) {
if (!BT_MESH_ADDR_IS_UNICAST(addr1) || net_idx1 == net_idx2 || addr1 == addr2 ||
net_idx1 > BT_MESH_BRG_CFG_KEY_INDEX_MAX || net_idx2 > BT_MESH_BRG_CFG_KEY_INDEX_MAX) {
return -EINVAL;
}

if (direction != BT_MESH_BRG_CFG_DIR_ONEWAY &&
direction != BT_MESH_BRG_CFG_DIR_TWOWAY) {
if (direction != BT_MESH_BRG_CFG_DIR_ONEWAY && direction != BT_MESH_BRG_CFG_DIR_TWOWAY) {
return -EINVAL;
}

if ((direction == BT_MESH_BRG_CFG_DIR_ONEWAY &&
(addr2 == BT_MESH_ADDR_UNASSIGNED || addr2 == BT_MESH_ADDR_ALL_NODES)) ||
(direction == BT_MESH_BRG_CFG_DIR_TWOWAY &&
!BT_MESH_ADDR_IS_UNICAST(addr2))) {
(direction == BT_MESH_BRG_CFG_DIR_TWOWAY && !BT_MESH_ADDR_IS_UNICAST(addr2))) {
return -EINVAL;
}

Expand All @@ -259,9 +255,8 @@ int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx
* in the received message."
*/
for (int i = 0; i < bt_mesh_brg_cfg_row_cnt; i++) {
if (brg_tbl[i].net_idx1 == net_idx1 &&
brg_tbl[i].net_idx2 == net_idx2 && brg_tbl[i].addr1 == addr1 &&
brg_tbl[i].addr2 == addr2) {
if (brg_tbl[i].net_idx1 == net_idx1 && brg_tbl[i].net_idx2 == net_idx2 &&
brg_tbl[i].addr1 == addr1 && brg_tbl[i].addr2 == addr2) {
brg_tbl[i].direction = direction;
goto store;
}
Expand Down Expand Up @@ -295,28 +290,27 @@ void bt_mesh_brg_cfg_tbl_foreach_subnet(uint16_t src, uint16_t dst, uint16_t net
bt_mesh_brg_cfg_cb_t cb, void *user_data)
{
for (int i = 0; i < bt_mesh_brg_cfg_row_cnt; i++) {
if ((brg_tbl[i].direction == BT_MESH_BRG_CFG_DIR_ONEWAY ||
if ((brg_tbl[i].direction == BT_MESH_BRG_CFG_DIR_ONEWAY ||
brg_tbl[i].direction == BT_MESH_BRG_CFG_DIR_TWOWAY) &&
brg_tbl[i].net_idx1 == net_idx && brg_tbl[i].addr1 == src &&
brg_tbl[i].addr2 == dst) {
brg_tbl[i].net_idx1 == net_idx && brg_tbl[i].addr1 == src &&
brg_tbl[i].addr2 == dst) {
cb(brg_tbl[i].net_idx2, user_data);
} else if ((brg_tbl[i].direction == BT_MESH_BRG_CFG_DIR_TWOWAY &&
brg_tbl[i].net_idx2 == net_idx && brg_tbl[i].addr2 == src &&
brg_tbl[i].addr1 == dst)) {
brg_tbl[i].net_idx2 == net_idx && brg_tbl[i].addr2 == src &&
brg_tbl[i].addr1 == dst)) {
cb(brg_tbl[i].net_idx1, user_data);
}
}
}

int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1,
uint16_t addr2, uint8_t *status)
int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, uint16_t addr2,
uint8_t *status)
{
bool store = false;

/* Sanity checks */
if ((!BT_MESH_ADDR_IS_UNICAST(addr1) && addr1 != BT_MESH_ADDR_UNASSIGNED) ||
(BT_MESH_ADDR_IS_UNICAST(addr1) && addr1 == addr2) ||
addr2 == BT_MESH_ADDR_ALL_NODES) {
(BT_MESH_ADDR_IS_UNICAST(addr1) && addr1 == addr2) || addr2 == BT_MESH_ADDR_ALL_NODES) {
return -EINVAL;
}

Expand Down
10 changes: 5 additions & 5 deletions subsys/bluetooth/mesh/brg_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ struct bt_mesh_brg_cfg_row {
* 1 - bridge messages with src as addr1 and dst as addr2
* 2 - bridge messages with src as addr1 and dst as addr2 and vice-versa
*/
uint32_t direction:8;
uint32_t net_idx1:12;
uint32_t net_idx2:12;
uint32_t direction: 8;
uint32_t net_idx1: 12;
uint32_t net_idx2: 12;
uint16_t addr1;
uint16_t addr2;
};
Expand All @@ -53,8 +53,8 @@ int bt_mesh_brg_cfg_tbl_get(const struct bt_mesh_brg_cfg_row **rows);
int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx1,
uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status);

int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1,
uint16_t addr2, uint8_t *status);
int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, uint16_t addr2,
uint8_t *status);

typedef void (*bt_mesh_brg_cfg_cb_t)(uint16_t new_netidx, void *user_data);

Expand Down
16 changes: 8 additions & 8 deletions subsys/bluetooth/mesh/brg_cfg_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static int subnet_bridge_status(const struct bt_mesh_model *model, struct bt_mes
}

static int bridging_table_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
struct net_buf_simple *buf)
{
struct bt_mesh_bridging_table_status table_status;
struct bt_mesh_bridging_table_status *rsp;
Expand All @@ -49,7 +49,7 @@ static int bridging_table_status(const struct bt_mesh_model *model, struct bt_me
table_status.entry.addr2 = net_buf_simple_pull_le16(buf);

if (!(table_status.entry.addr1 == BT_MESH_ADDR_UNASSIGNED ||
BT_MESH_ADDR_IS_UNICAST(table_status.entry.addr1))) {
BT_MESH_ADDR_IS_UNICAST(table_status.entry.addr1))) {
LOG_ERR("addr1 shall be a unicast address or unassigned.");
return -EINVAL;
} else if (table_status.entry.addr2 == BT_MESH_ADDR_ALL_NODES) {
Expand Down Expand Up @@ -109,7 +109,7 @@ static int bridged_subnets_list(const struct bt_mesh_model *model, struct bt_mes
}

static int bridging_table_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
struct net_buf_simple *buf)
{
struct bt_mesh_bridging_table_list table_list;
struct bt_mesh_bridging_table_list *rsp;
Expand Down Expand Up @@ -166,11 +166,11 @@ static int bridging_table_size_status(const struct bt_mesh_model *model,
}

const struct bt_mesh_model_op _bt_mesh_brg_cfg_cli_op[] = {
{ OP_SUBNET_BRIDGE_STATUS, BT_MESH_LEN_EXACT(1), subnet_bridge_status },
{ OP_BRIDGING_TABLE_STATUS, BT_MESH_LEN_EXACT(9), bridging_table_status },
{ OP_BRIDGED_SUBNETS_LIST, BT_MESH_LEN_MIN(3), bridged_subnets_list },
{ OP_BRIDGING_TABLE_LIST, BT_MESH_LEN_MIN(6), bridging_table_list },
{ OP_BRIDGING_TABLE_SIZE_STATUS, BT_MESH_LEN_EXACT(2), bridging_table_size_status },
{OP_SUBNET_BRIDGE_STATUS, BT_MESH_LEN_EXACT(1), subnet_bridge_status},
{OP_BRIDGING_TABLE_STATUS, BT_MESH_LEN_EXACT(9), bridging_table_status},
{OP_BRIDGED_SUBNETS_LIST, BT_MESH_LEN_MIN(3), bridged_subnets_list},
{OP_BRIDGING_TABLE_LIST, BT_MESH_LEN_MIN(6), bridging_table_list},
{OP_BRIDGING_TABLE_SIZE_STATUS, BT_MESH_LEN_EXACT(2), bridging_table_size_status},
BT_MESH_MODEL_OP_END,
};

Expand Down
29 changes: 14 additions & 15 deletions subsys/bluetooth/mesh/brg_cfg_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ static int subnet_bridge_set(const struct bt_mesh_model *model, struct bt_mesh_m
}

static void bridging_table_status_send(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, uint8_t status,
struct bt_mesh_bridging_table_entry *entry)
struct bt_mesh_msg_ctx *ctx, uint8_t status,
struct bt_mesh_bridging_table_entry *entry)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_STATUS, 9);

Expand Down Expand Up @@ -123,7 +123,8 @@ static int bridged_subnets_get(const struct bt_mesh_model *model, struct bt_mesh
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGED_SUBNETS_LIST,
BT_MESH_TX_SDU_MAX - BT_MESH_MODEL_OP_LEN(OP_BRIDGED_SUBNETS_LIST));
BT_MESH_TX_SDU_MAX -
BT_MESH_MODEL_OP_LEN(OP_BRIDGED_SUBNETS_LIST));
bt_mesh_model_msg_init(&msg, OP_BRIDGED_SUBNETS_LIST);

const struct bt_mesh_brg_cfg_row *brg_tbl;
Expand Down Expand Up @@ -209,10 +210,10 @@ static int bridged_subnets_get(const struct bt_mesh_model *model, struct bt_mesh
}

static int bridging_table_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_LIST,
BT_MESH_TX_SDU_MAX - BT_MESH_MODEL_OP_LEN(OP_BRIDGING_TABLE_LIST));
BT_MESH_TX_SDU_MAX - BT_MESH_MODEL_OP_LEN(OP_BRIDGING_TABLE_LIST));
uint8_t status = STATUS_SUCCESS;
uint16_t net_idx1, net_idx2;

Expand Down Expand Up @@ -252,7 +253,6 @@ static int bridging_table_get(const struct bt_mesh_model *model, struct bt_mesh_
}
cnt++;
}

}

tbl_get_respond:
Expand All @@ -264,7 +264,7 @@ static int bridging_table_get(const struct bt_mesh_model *model, struct bt_mesh_
}

static int bridging_table_size_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_SIZE_STATUS, 2);
bt_mesh_model_msg_init(&msg, OP_BRIDGING_TABLE_SIZE_STATUS);
Expand All @@ -278,15 +278,14 @@ static int bridging_table_size_get(const struct bt_mesh_model *model, struct bt_
return 0;
}


const struct bt_mesh_model_op _bt_mesh_brg_cfg_srv_op[] = {
{ OP_SUBNET_BRIDGE_GET, BT_MESH_LEN_EXACT(0), subnet_bridge_get },
{ OP_SUBNET_BRIDGE_SET, BT_MESH_LEN_EXACT(1), subnet_bridge_set },
{ OP_BRIDGING_TABLE_ADD, BT_MESH_LEN_EXACT(8), bridging_table_add },
{ OP_BRIDGING_TABLE_REMOVE, BT_MESH_LEN_EXACT(7), bridging_table_remove },
{ OP_BRIDGED_SUBNETS_GET, BT_MESH_LEN_EXACT(3), bridged_subnets_get },
{ OP_BRIDGING_TABLE_GET, BT_MESH_LEN_EXACT(5), bridging_table_get },
{ OP_BRIDGING_TABLE_SIZE_GET, BT_MESH_LEN_EXACT(0), bridging_table_size_get },
{OP_SUBNET_BRIDGE_GET, BT_MESH_LEN_EXACT(0), subnet_bridge_get},
{OP_SUBNET_BRIDGE_SET, BT_MESH_LEN_EXACT(1), subnet_bridge_set},
{OP_BRIDGING_TABLE_ADD, BT_MESH_LEN_EXACT(8), bridging_table_add},
{OP_BRIDGING_TABLE_REMOVE, BT_MESH_LEN_EXACT(7), bridging_table_remove},
{OP_BRIDGED_SUBNETS_GET, BT_MESH_LEN_EXACT(3), bridged_subnets_get},
{OP_BRIDGING_TABLE_GET, BT_MESH_LEN_EXACT(5), bridging_table_get},
{OP_BRIDGING_TABLE_SIZE_GET, BT_MESH_LEN_EXACT(0), bridging_table_size_get},
BT_MESH_MODEL_OP_END,
};

Expand Down
24 changes: 12 additions & 12 deletions subsys/bluetooth/mesh/foundation.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@
#define OP_SOL_PDU_RPL_ITEM_CLEAR_UNACKED BT_MESH_MODEL_OP_2(0x80, 0x79)
#define OP_SOL_PDU_RPL_ITEM_STATUS BT_MESH_MODEL_OP_2(0x80, 0x7a)

#define OP_SUBNET_BRIDGE_GET BT_MESH_MODEL_OP_2(0x80, 0xb1)
#define OP_SUBNET_BRIDGE_SET BT_MESH_MODEL_OP_2(0x80, 0xb2)
#define OP_SUBNET_BRIDGE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xb3)
#define OP_BRIDGING_TABLE_ADD BT_MESH_MODEL_OP_2(0x80, 0xb4)
#define OP_BRIDGING_TABLE_REMOVE BT_MESH_MODEL_OP_2(0x80, 0xb5)
#define OP_BRIDGING_TABLE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xb6)
#define OP_BRIDGED_SUBNETS_GET BT_MESH_MODEL_OP_2(0x80, 0xb7)
#define OP_BRIDGED_SUBNETS_LIST BT_MESH_MODEL_OP_2(0x80, 0xb8)
#define OP_BRIDGING_TABLE_GET BT_MESH_MODEL_OP_2(0x80, 0xb9)
#define OP_BRIDGING_TABLE_LIST BT_MESH_MODEL_OP_2(0x80, 0xba)
#define OP_BRIDGING_TABLE_SIZE_GET BT_MESH_MODEL_OP_2(0x80, 0xbb)
#define OP_BRIDGING_TABLE_SIZE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xbc)
#define OP_SUBNET_BRIDGE_GET BT_MESH_MODEL_OP_2(0x80, 0xb1)
#define OP_SUBNET_BRIDGE_SET BT_MESH_MODEL_OP_2(0x80, 0xb2)
#define OP_SUBNET_BRIDGE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xb3)
#define OP_BRIDGING_TABLE_ADD BT_MESH_MODEL_OP_2(0x80, 0xb4)
#define OP_BRIDGING_TABLE_REMOVE BT_MESH_MODEL_OP_2(0x80, 0xb5)
#define OP_BRIDGING_TABLE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xb6)
#define OP_BRIDGED_SUBNETS_GET BT_MESH_MODEL_OP_2(0x80, 0xb7)
#define OP_BRIDGED_SUBNETS_LIST BT_MESH_MODEL_OP_2(0x80, 0xb8)
#define OP_BRIDGING_TABLE_GET BT_MESH_MODEL_OP_2(0x80, 0xb9)
#define OP_BRIDGING_TABLE_LIST BT_MESH_MODEL_OP_2(0x80, 0xba)
#define OP_BRIDGING_TABLE_SIZE_GET BT_MESH_MODEL_OP_2(0x80, 0xbb)
#define OP_BRIDGING_TABLE_SIZE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xbc)

#define STATUS_SUCCESS 0x00
#define STATUS_INVALID_ADDRESS 0x01
Expand Down
9 changes: 3 additions & 6 deletions subsys/bluetooth/mesh/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,7 @@ static bool relay_to_adv(enum bt_mesh_net_if net_if)
}
}

static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
struct bt_mesh_net_rx *rx, bool bridge)
static void bt_mesh_net_relay(struct net_buf_simple *sbuf, struct bt_mesh_net_rx *rx, bool bridge)
{
const struct bt_mesh_net_cred *cred;
struct bt_mesh_adv *adv;
Expand All @@ -693,9 +692,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
return;
}

if (rx->net_if == BT_MESH_NET_IF_ADV &&
!rx->friend_cred &&
!bridge &&
if (rx->net_if == BT_MESH_NET_IF_ADV && !rx->friend_cred && !bridge &&
bt_mesh_relay_get() != BT_MESH_RELAY_ENABLED &&
bt_mesh_gatt_proxy_get() != BT_MESH_GATT_PROXY_ENABLED &&
bt_mesh_priv_gatt_proxy_get() != BT_MESH_PRIV_GATT_PROXY_ENABLED) {
Expand Down Expand Up @@ -949,7 +946,7 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
}

bt_mesh_brg_cfg_tbl_foreach_subnet(rx.ctx.addr, rx.ctx.recv_dst, rx.ctx.net_idx,
bt_mesh_sbr_check_cb, &tx_ctx);
bt_mesh_sbr_check_cb, &tx_ctx);
#endif
}

Expand Down
19 changes: 7 additions & 12 deletions subsys/bluetooth/mesh/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,12 @@ SETTINGS_STATIC_HANDLER_DEFINE(bt_mesh, "bt/mesh", NULL, NULL, mesh_commit,
BIT(BT_MESH_SETTINGS_CDB_PENDING))

/* Pending flags that use CONFIG_BT_MESH_STORE_TIMEOUT */
#define GENERIC_PENDING_BITS (BIT(BT_MESH_SETTINGS_NET_KEYS_PENDING) | \
BIT(BT_MESH_SETTINGS_APP_KEYS_PENDING) | \
BIT(BT_MESH_SETTINGS_HB_PUB_PENDING) | \
BIT(BT_MESH_SETTINGS_CFG_PENDING) | \
BIT(BT_MESH_SETTINGS_MOD_PENDING) | \
BIT(BT_MESH_SETTINGS_VA_PENDING) | \
BIT(BT_MESH_SETTINGS_SSEQ_PENDING) | \
BIT(BT_MESH_SETTINGS_COMP_PENDING) | \
BIT(BT_MESH_SETTINGS_DEV_KEY_CAND_PENDING) | \
BIT(BT_MESH_SETTINGS_BRG_PENDING))
#define GENERIC_PENDING_BITS \
(BIT(BT_MESH_SETTINGS_NET_KEYS_PENDING) | BIT(BT_MESH_SETTINGS_APP_KEYS_PENDING) | \
BIT(BT_MESH_SETTINGS_HB_PUB_PENDING) | BIT(BT_MESH_SETTINGS_CFG_PENDING) | \
BIT(BT_MESH_SETTINGS_MOD_PENDING) | BIT(BT_MESH_SETTINGS_VA_PENDING) | \
BIT(BT_MESH_SETTINGS_SSEQ_PENDING) | BIT(BT_MESH_SETTINGS_COMP_PENDING) | \
BIT(BT_MESH_SETTINGS_DEV_KEY_CAND_PENDING) | BIT(BT_MESH_SETTINGS_BRG_PENDING))

void bt_mesh_settings_store_schedule(enum bt_mesh_settings_flag flag)
{
Expand Down Expand Up @@ -266,8 +262,7 @@ static void store_pending(struct k_work *work)
}

if (IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV) &&
atomic_test_and_clear_bit(pending_flags,
BT_MESH_SETTINGS_BRG_PENDING)) {
atomic_test_and_clear_bit(pending_flags, BT_MESH_SETTINGS_BRG_PENDING)) {
bt_mesh_brg_cfg_pending_store();
}
}
Expand Down
19 changes: 9 additions & 10 deletions subsys/bluetooth/mesh/shell/brg_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ static int cmd_subnet_bridge_set(const struct shell *sh, size_t argc, char *argv
enum bt_mesh_subnet_bridge_state set, rsp;
int err = 0;

set = shell_strtobool(argv[1], 0, &err) ? BT_MESH_SUBNET_BRIDGE_ENABLED :
BT_MESH_SUBNET_BRIDGE_DISABLED;
set = shell_strtobool(argv[1], 0, &err) ? BT_MESH_SUBNET_BRIDGE_ENABLED
: BT_MESH_SUBNET_BRIDGE_DISABLED;

if (err) {
shell_warn(sh, "Unable to parse input string argument");
Expand Down Expand Up @@ -231,17 +231,16 @@ static int cmd_bridging_table_get(const struct shell *sh, size_t argc, char *arg
}

SHELL_STATIC_SUBCMD_SET_CREATE(
brg_cfg_cmds,
SHELL_CMD_ARG(bridge-get, NULL, NULL, cmd_subnet_bridge_get, 1, 0),
SHELL_CMD_ARG(bridge-set, NULL, "<State(disable, enable)>", cmd_subnet_bridge_set, 2, 0),
SHELL_CMD_ARG(table-size-get, NULL, NULL, cmd_bridging_table_size_get, 1, 0),
SHELL_CMD_ARG(table-add, NULL, "<Directions> <NetIdx1> <NetIdx2> <Addr1> <Addr2>",
brg_cfg_cmds, SHELL_CMD_ARG(bridge - get, NULL, NULL, cmd_subnet_bridge_get, 1, 0),
SHELL_CMD_ARG(bridge - set, NULL, "<State(disable, enable)>", cmd_subnet_bridge_set, 2, 0),
SHELL_CMD_ARG(table - size - get, NULL, NULL, cmd_bridging_table_size_get, 1, 0),
SHELL_CMD_ARG(table - add, NULL, "<Directions> <NetIdx1> <NetIdx2> <Addr1> <Addr2>",
cmd_bridging_table_add, 6, 0),
SHELL_CMD_ARG(table-remove, NULL, "<NetIdx1> <NetIdx2> <Addr1> <Addr2>",
SHELL_CMD_ARG(table - remove, NULL, "<NetIdx1> <NetIdx2> <Addr1> <Addr2>",
cmd_bridging_table_remove, 5, 0),
SHELL_CMD_ARG(subnets-get, NULL, "<Filter> <NetIdx> <StartIdx>", cmd_bridged_subnets_get,
SHELL_CMD_ARG(subnets - get, NULL, "<Filter> <NetIdx> <StartIdx>", cmd_bridged_subnets_get,
4, 0),
SHELL_CMD_ARG(table-get, NULL, "<NetIdx1> <NetIdx2> <StartIdx>", cmd_bridging_table_get,
SHELL_CMD_ARG(table - get, NULL, "<NetIdx1> <NetIdx2> <StartIdx>", cmd_bridging_table_get,
4, 0),
SHELL_SUBCMD_SET_END);

Expand Down
1 change: 0 additions & 1 deletion tests/bluetooth/mesh/brg/prj.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_MOCKING=y
CONFIG_BT_MESH_BRG_CFG_SRV=y
Loading

0 comments on commit d41e834

Please sign in to comment.