tests: Bluetooth: Mesh: OD priv proxy pst test
Adds test for persistent storage in On-Demand Private Proxy implementation. Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This commit is contained in:
parent
c80a52a1e3
commit
cf8301d01e
3 changed files with 39 additions and 0 deletions
|
@ -61,6 +61,8 @@ CONFIG_BT_MESH_DFD_SRV=y
|
|||
CONFIG_BT_MESH_DFU_SLOT_CNT=3
|
||||
CONFIG_BT_MESH_PRIV_BEACON_SRV=y
|
||||
CONFIG_BT_MESH_PRIV_BEACON_CLI=y
|
||||
CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y
|
||||
CONFIG_BT_MESH_OD_PRIV_PROXY_CLI=y
|
||||
CONFIG_BT_MESH_COMP_PAGE_1=y
|
||||
CONFIG_BT_MESH_COMP_PAGE_2=y
|
||||
|
||||
|
|
|
@ -170,6 +170,9 @@ static struct bt_mesh_sar_cfg_cli sar_cfg_cli;
|
|||
static struct bt_mesh_priv_beacon_cli priv_beacon_cli;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI)
|
||||
static struct bt_mesh_od_priv_proxy_cli priv_proxy_cli;
|
||||
#endif
|
||||
|
||||
static struct bt_mesh_model models[] = {
|
||||
BT_MESH_MODEL_CFG_SRV,
|
||||
|
@ -184,6 +187,12 @@ static struct bt_mesh_model models[] = {
|
|||
BT_MESH_MODEL_PRIV_BEACON_SRV,
|
||||
BT_MESH_MODEL_PRIV_BEACON_CLI(&priv_beacon_cli),
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV)
|
||||
BT_MESH_MODEL_OD_PRIV_PROXY_SRV,
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI)
|
||||
BT_MESH_MODEL_OD_PRIV_PROXY_CLI(&priv_proxy_cli),
|
||||
#endif
|
||||
};
|
||||
|
||||
struct bt_mesh_model *test_model = &models[2];
|
||||
|
|
|
@ -209,6 +209,9 @@ static const struct stack_cfg {
|
|||
uint8_t priv_beacon_int;
|
||||
uint8_t priv_beacon_gatt;
|
||||
#endif
|
||||
#ifdef CONFIG_BT_MESH_OD_PRIV_PROXY_SRV
|
||||
uint8_t priv_proxy_val;
|
||||
#endif
|
||||
} stack_cfgs[] = {
|
||||
{
|
||||
.beacon = 1,
|
||||
|
@ -221,6 +224,9 @@ static const struct stack_cfg {
|
|||
.priv_beacon = 1,
|
||||
.priv_beacon_int = 123,
|
||||
.priv_beacon_gatt = 0,
|
||||
#endif
|
||||
#ifdef CONFIG_BT_MESH_OD_PRIV_PROXY_SRV
|
||||
.priv_proxy_val = 10,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
|
@ -234,6 +240,9 @@ static const struct stack_cfg {
|
|||
.priv_beacon = 1,
|
||||
.priv_beacon_int = 100,
|
||||
.priv_beacon_gatt = 1,
|
||||
#endif
|
||||
#ifdef CONFIG_BT_MESH_OD_PRIV_PROXY_SRV
|
||||
.priv_proxy_val = 20,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
@ -946,6 +955,16 @@ static void test_cfg_save(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) && defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI)
|
||||
uint8_t priv_proxy_val;
|
||||
|
||||
err = bt_mesh_od_priv_proxy_cli_set(test_netkey_idx, TEST_ADDR,
|
||||
current_stack_cfg->priv_proxy_val, &priv_proxy_val);
|
||||
if (err || priv_proxy_val != current_stack_cfg->priv_proxy_val) {
|
||||
FAIL("Failed to set OD Private proxy (err %d, value %d)", err, priv_proxy_val);
|
||||
}
|
||||
#endif
|
||||
|
||||
k_sleep(K_SECONDS(CONFIG_BT_MESH_STORE_TIMEOUT));
|
||||
|
||||
PASS();
|
||||
|
@ -1015,6 +1034,15 @@ static void test_cfg_load(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) && defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI)
|
||||
uint8_t priv_proxy_val;
|
||||
|
||||
err = bt_mesh_od_priv_proxy_cli_get(test_netkey_idx, TEST_ADDR, &priv_proxy_val);
|
||||
if (err || priv_proxy_val != current_stack_cfg->priv_proxy_val) {
|
||||
FAIL("Private proxy get failed (err %d, value %u)", err, priv_proxy_val);
|
||||
}
|
||||
#endif
|
||||
|
||||
PASS();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue