Bluetooth: Mesh: Add macros to initialize bt_mesh_msg_ctx struct
The macros are added to make clear which fields of `struct bt_mesh_msg_ctx` needs to be initialized by an application. Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
parent
081b83531b
commit
932e57396f
6 changed files with 105 additions and 295 deletions
|
@ -99,6 +99,50 @@ struct bt_mesh_msg_ctx {
|
||||||
uint8_t send_ttl;
|
uint8_t send_ttl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper for bt_mesh_msg_ctx structure initialization.
|
||||||
|
*
|
||||||
|
* @param net_key_idx NetKey Index of the subnet to send the message on. Only used if
|
||||||
|
* @c app_key_idx points to devkey.
|
||||||
|
* @param app_key_idx AppKey Index to encrypt the message with.
|
||||||
|
* @param dst Remote addr.
|
||||||
|
* @param ttl Time To Live.
|
||||||
|
*/
|
||||||
|
#define BT_MESH_MSG_CTX_INIT(net_key_idx, app_key_idx, dst, ttl) \
|
||||||
|
{ \
|
||||||
|
.net_idx = (net_key_idx), \
|
||||||
|
.app_idx = (app_key_idx), \
|
||||||
|
.addr = (dst), \
|
||||||
|
.send_ttl = (ttl), \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper for bt_mesh_msg_ctx structure initialization secured with Application Key.
|
||||||
|
*
|
||||||
|
* @param app_key_idx AppKey Index to encrypt the message with.
|
||||||
|
* @param dst Remote addr.
|
||||||
|
*/
|
||||||
|
#define BT_MESH_MSG_CTX_INIT_APP(app_key_idx, dst) \
|
||||||
|
BT_MESH_MSG_CTX_INIT(0, app_key_idx, dst, BT_MESH_TTL_DEFAULT)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper for bt_mesh_msg_ctx structure initialization secured with Device Key of a remote
|
||||||
|
* device.
|
||||||
|
*
|
||||||
|
* @param net_key_idx NetKey Index of the subnet to send the message on.
|
||||||
|
* @param dst Remote addr.
|
||||||
|
*/
|
||||||
|
#define BT_MESH_MSG_CTX_INIT_DEV(net_key_idx, dst) \
|
||||||
|
BT_MESH_MSG_CTX_INIT(net_key_idx, BT_MESH_KEY_DEV_REMOTE, dst, BT_MESH_TTL_DEFAULT)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper for bt_mesh_msg_ctx structure initialization using Model Publication context.
|
||||||
|
*
|
||||||
|
* @param pub Pointer to a model publication context.
|
||||||
|
*/
|
||||||
|
#define BT_MESH_MSG_CTX_INIT_PUB(pub) \
|
||||||
|
BT_MESH_MSG_CTX_INIT(0, (pub)->key, (pub)->addr, (pub)->ttl)
|
||||||
|
|
||||||
/** @brief Initialize a model message.
|
/** @brief Initialize a model message.
|
||||||
*
|
*
|
||||||
* Clears the message buffer contents, and encodes the given opcode.
|
* Clears the message buffer contents, and encodes the given opcode.
|
||||||
|
|
|
@ -188,11 +188,7 @@ static int publish_transmit(struct bt_mesh_model *mod)
|
||||||
{
|
{
|
||||||
NET_BUF_SIMPLE_DEFINE(sdu, BT_MESH_TX_SDU_MAX);
|
NET_BUF_SIMPLE_DEFINE(sdu, BT_MESH_TX_SDU_MAX);
|
||||||
struct bt_mesh_model_pub *pub = mod->pub;
|
struct bt_mesh_model_pub *pub = mod->pub;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_PUB(pub);
|
||||||
.addr = pub->addr,
|
|
||||||
.send_ttl = pub->ttl,
|
|
||||||
.app_idx = pub->key,
|
|
||||||
};
|
|
||||||
struct bt_mesh_net_tx tx = {
|
struct bt_mesh_net_tx tx = {
|
||||||
.ctx = &ctx,
|
.ctx = &ctx,
|
||||||
.src = bt_mesh_model_elem(mod)->addr,
|
.src = bt_mesh_model_elem(mod)->addr,
|
||||||
|
|
|
@ -1372,12 +1372,7 @@ int bt_mesh_cfg_cli_comp_data_get(uint16_t net_idx, uint16_t addr, uint8_t page,
|
||||||
struct net_buf_simple *comp)
|
struct net_buf_simple *comp)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_DEV_COMP_DATA_GET, 1);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_DEV_COMP_DATA_GET, 1);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct comp_data param = {
|
struct comp_data param = {
|
||||||
.page = rsp,
|
.page = rsp,
|
||||||
.comp = comp,
|
.comp = comp,
|
||||||
|
@ -1398,12 +1393,7 @@ int bt_mesh_cfg_cli_comp_data_get(uint16_t net_idx, uint16_t addr, uint8_t page,
|
||||||
static int get_state_u8(uint16_t net_idx, uint16_t addr, uint32_t op, uint32_t rsp, uint8_t *val)
|
static int get_state_u8(uint16_t net_idx, uint16_t addr, uint32_t op, uint32_t rsp, uint8_t *val)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 0);
|
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 0);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
const struct bt_mesh_msg_rsp_ctx rsp_ctx = {
|
const struct bt_mesh_msg_rsp_ctx rsp_ctx = {
|
||||||
.ack = &cli->ack_ctx,
|
.ack = &cli->ack_ctx,
|
||||||
.op = rsp,
|
.op = rsp,
|
||||||
|
@ -1419,12 +1409,7 @@ static int set_state_u8(uint16_t net_idx, uint16_t addr, uint32_t op, uint32_t r
|
||||||
uint8_t *val)
|
uint8_t *val)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 1);
|
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 1);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
const struct bt_mesh_msg_rsp_ctx rsp_ctx = {
|
const struct bt_mesh_msg_rsp_ctx rsp_ctx = {
|
||||||
.ack = &cli->ack_ctx,
|
.ack = &cli->ack_ctx,
|
||||||
.op = rsp,
|
.op = rsp,
|
||||||
|
@ -1447,12 +1432,7 @@ int bt_mesh_cfg_cli_krp_get(uint16_t net_idx, uint16_t addr, uint16_t key_net_id
|
||||||
uint8_t *phase)
|
uint8_t *phase)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_KRP_GET, 2);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_KRP_GET, 2);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct krp_param param = {
|
struct krp_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.phase = phase,
|
.phase = phase,
|
||||||
|
@ -1474,12 +1454,7 @@ int bt_mesh_cfg_cli_krp_set(uint16_t net_idx, uint16_t addr, uint16_t key_net_id
|
||||||
uint8_t transition, uint8_t *status, uint8_t *phase)
|
uint8_t transition, uint8_t *status, uint8_t *phase)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_KRP_SET, 3);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_KRP_SET, 3);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct krp_param param = {
|
struct krp_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.phase = phase,
|
.phase = phase,
|
||||||
|
@ -1548,12 +1523,7 @@ int bt_mesh_cfg_cli_net_transmit_get(uint16_t net_idx, uint16_t addr, uint8_t *t
|
||||||
int bt_mesh_cfg_cli_relay_get(uint16_t net_idx, uint16_t addr, uint8_t *status, uint8_t *transmit)
|
int bt_mesh_cfg_cli_relay_get(uint16_t net_idx, uint16_t addr, uint8_t *status, uint8_t *transmit)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_RELAY_GET, 0);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_RELAY_GET, 0);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct relay_param param = {
|
struct relay_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.transmit = transmit,
|
.transmit = transmit,
|
||||||
|
@ -1574,12 +1544,7 @@ int bt_mesh_cfg_cli_relay_set(uint16_t net_idx, uint16_t addr, uint8_t new_relay
|
||||||
uint8_t new_transmit, uint8_t *status, uint8_t *transmit)
|
uint8_t new_transmit, uint8_t *status, uint8_t *transmit)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_RELAY_SET, 2);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_RELAY_SET, 2);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct relay_param param = {
|
struct relay_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.transmit = transmit,
|
.transmit = transmit,
|
||||||
|
@ -1602,12 +1567,7 @@ int bt_mesh_cfg_cli_net_key_add(uint16_t net_idx, uint16_t addr, uint16_t key_ne
|
||||||
const uint8_t net_key[16], uint8_t *status)
|
const uint8_t net_key[16], uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_ADD, 18);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_ADD, 18);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct net_key_param param = {
|
struct net_key_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
|
@ -1630,12 +1590,7 @@ int bt_mesh_cfg_cli_net_key_update(uint16_t net_idx, uint16_t addr, uint16_t key
|
||||||
const uint8_t net_key[16], uint8_t *status)
|
const uint8_t net_key[16], uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_UPDATE, 18);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_UPDATE, 18);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct net_key_param param = {
|
struct net_key_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
|
@ -1657,12 +1612,7 @@ int bt_mesh_cfg_cli_net_key_update(uint16_t net_idx, uint16_t addr, uint16_t key
|
||||||
int bt_mesh_cfg_cli_net_key_get(uint16_t net_idx, uint16_t addr, uint16_t *keys, size_t *key_cnt)
|
int bt_mesh_cfg_cli_net_key_get(uint16_t net_idx, uint16_t addr, uint16_t *keys, size_t *key_cnt)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_GET, 0);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_GET, 0);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct net_key_list_param param = {
|
struct net_key_list_param param = {
|
||||||
.keys = keys,
|
.keys = keys,
|
||||||
.key_cnt = key_cnt,
|
.key_cnt = key_cnt,
|
||||||
|
@ -1683,12 +1633,7 @@ int bt_mesh_cfg_cli_net_key_del(uint16_t net_idx, uint16_t addr, uint16_t key_ne
|
||||||
uint8_t *status)
|
uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_DEL, 2);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_DEL, 2);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct net_key_param param = {
|
struct net_key_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
|
@ -1710,12 +1655,7 @@ int bt_mesh_cfg_cli_app_key_add(uint16_t net_idx, uint16_t addr, uint16_t key_ne
|
||||||
uint16_t key_app_idx, const uint8_t app_key[16], uint8_t *status)
|
uint16_t key_app_idx, const uint8_t app_key[16], uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_ADD, 19);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_ADD, 19);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct app_key_param param = {
|
struct app_key_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
|
@ -1739,12 +1679,7 @@ int bt_mesh_cfg_cli_app_key_update(uint16_t net_idx, uint16_t addr, uint16_t key
|
||||||
uint16_t key_app_idx, const uint8_t app_key[16], uint8_t *status)
|
uint16_t key_app_idx, const uint8_t app_key[16], uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_UPDATE, 19);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_UPDATE, 19);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct app_key_param param = {
|
struct app_key_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
|
@ -1767,12 +1702,7 @@ int bt_mesh_cfg_cli_app_key_update(uint16_t net_idx, uint16_t addr, uint16_t key
|
||||||
int bt_mesh_cfg_cli_node_reset(uint16_t net_idx, uint16_t addr, bool *status)
|
int bt_mesh_cfg_cli_node_reset(uint16_t net_idx, uint16_t addr, bool *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_RESET, 0);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_RESET, 0);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
*status = false;
|
*status = false;
|
||||||
|
@ -1794,12 +1724,7 @@ int bt_mesh_cfg_cli_app_key_get(uint16_t net_idx, uint16_t addr, uint16_t key_ne
|
||||||
uint8_t *status, uint16_t *keys, size_t *key_cnt)
|
uint8_t *status, uint16_t *keys, size_t *key_cnt)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_GET, 2);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_GET, 2);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct app_key_list_param param = {
|
struct app_key_list_param param = {
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
.status = status,
|
.status = status,
|
||||||
|
@ -1824,12 +1749,7 @@ int bt_mesh_cfg_cli_app_key_del(uint16_t net_idx, uint16_t addr, uint16_t key_ne
|
||||||
uint16_t key_app_idx, uint8_t *status)
|
uint16_t key_app_idx, uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_DEL, 3);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_DEL, 3);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct app_key_param param = {
|
struct app_key_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
|
@ -1852,12 +1772,7 @@ static int mod_app_bind(uint16_t net_idx, uint16_t addr, uint16_t elem_addr, uin
|
||||||
uint16_t mod_id, uint16_t cid, uint8_t *status)
|
uint16_t mod_id, uint16_t cid, uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_BIND, 8);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_BIND, 8);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct mod_app_param param = {
|
struct mod_app_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.elem_addr = elem_addr,
|
.elem_addr = elem_addr,
|
||||||
|
@ -1906,12 +1821,7 @@ static int mod_app_unbind(uint16_t net_idx, uint16_t addr, uint16_t elem_addr, u
|
||||||
uint16_t mod_id, uint16_t cid, uint8_t *status)
|
uint16_t mod_id, uint16_t cid, uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_UNBIND, 8);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_UNBIND, 8);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct mod_app_param param = {
|
struct mod_app_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.elem_addr = elem_addr,
|
.elem_addr = elem_addr,
|
||||||
|
@ -1961,12 +1871,7 @@ static int mod_member_list_get(uint32_t op, uint32_t expect_op, uint16_t net_idx
|
||||||
uint16_t *apps, size_t *app_cnt)
|
uint16_t *apps, size_t *app_cnt)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 6);
|
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 6);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct mod_member_list_param param = {
|
struct mod_member_list_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.elem_addr = elem_addr,
|
.elem_addr = elem_addr,
|
||||||
|
@ -2021,12 +1926,7 @@ static int mod_sub(uint32_t op, uint16_t net_idx, uint16_t addr, uint16_t elem_a
|
||||||
uint16_t sub_addr, uint16_t mod_id, uint16_t cid, uint8_t *status)
|
uint16_t sub_addr, uint16_t mod_id, uint16_t cid, uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 8);
|
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 8);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct mod_sub_param param = {
|
struct mod_sub_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.elem_addr = elem_addr,
|
.elem_addr = elem_addr,
|
||||||
|
@ -2150,12 +2050,7 @@ static int mod_sub_va(uint32_t op, uint16_t net_idx, uint16_t addr, uint16_t ele
|
||||||
uint8_t *status)
|
uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 22);
|
BT_MESH_MODEL_BUF_DEFINE(msg, DUMMY_2_BYTE_OP, 22);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct mod_sub_param param = {
|
struct mod_sub_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.elem_addr = elem_addr,
|
.elem_addr = elem_addr,
|
||||||
|
@ -2270,12 +2165,7 @@ static int mod_pub_get(uint16_t net_idx, uint16_t addr, uint16_t elem_addr, uint
|
||||||
uint16_t cid, struct bt_mesh_cfg_cli_mod_pub *pub, uint8_t *status)
|
uint16_t cid, struct bt_mesh_cfg_cli_mod_pub *pub, uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_GET, 6);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_GET, 6);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct mod_pub_param param = {
|
struct mod_pub_param param = {
|
||||||
.mod_id = mod_id,
|
.mod_id = mod_id,
|
||||||
.cid = cid,
|
.cid = cid,
|
||||||
|
@ -2325,12 +2215,7 @@ static int mod_pub_set(uint16_t net_idx, uint16_t addr, uint16_t elem_addr, uint
|
||||||
uint16_t cid, struct bt_mesh_cfg_cli_mod_pub *pub, uint8_t *status)
|
uint16_t cid, struct bt_mesh_cfg_cli_mod_pub *pub, uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_SET, 13);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_SET, 13);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct mod_pub_param param = {
|
struct mod_pub_param param = {
|
||||||
.mod_id = mod_id,
|
.mod_id = mod_id,
|
||||||
.cid = cid,
|
.cid = cid,
|
||||||
|
@ -2367,12 +2252,7 @@ static int mod_pub_va_set(uint16_t net_idx, uint16_t addr, uint16_t elem_addr, u
|
||||||
uint16_t cid, struct bt_mesh_cfg_cli_mod_pub *pub, uint8_t *status)
|
uint16_t cid, struct bt_mesh_cfg_cli_mod_pub *pub, uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_VA_SET, 27);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_VA_SET, 27);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct mod_pub_param param = {
|
struct mod_pub_param param = {
|
||||||
.mod_id = mod_id,
|
.mod_id = mod_id,
|
||||||
.cid = cid,
|
.cid = cid,
|
||||||
|
@ -2444,12 +2324,7 @@ int bt_mesh_cfg_cli_hb_sub_set(uint16_t net_idx, uint16_t addr, struct bt_mesh_c
|
||||||
uint8_t *status)
|
uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_SUB_SET, 5);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_SUB_SET, 5);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct hb_sub_param param = {
|
struct hb_sub_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.sub = sub,
|
.sub = sub,
|
||||||
|
@ -2478,12 +2353,7 @@ int bt_mesh_cfg_cli_hb_sub_get(uint16_t net_idx, uint16_t addr, struct bt_mesh_c
|
||||||
uint8_t *status)
|
uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_SUB_GET, 0);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_SUB_GET, 0);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct hb_sub_param param = {
|
struct hb_sub_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.sub = sub,
|
.sub = sub,
|
||||||
|
@ -2504,12 +2374,7 @@ int bt_mesh_cfg_cli_hb_pub_set(uint16_t net_idx, uint16_t addr,
|
||||||
const struct bt_mesh_cfg_cli_hb_pub *pub, uint8_t *status)
|
const struct bt_mesh_cfg_cli_hb_pub *pub, uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_PUB_SET, 9);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_PUB_SET, 9);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct hb_pub_param param = {
|
struct hb_pub_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
};
|
};
|
||||||
|
@ -2540,12 +2405,7 @@ int bt_mesh_cfg_cli_hb_pub_get(uint16_t net_idx, uint16_t addr, struct bt_mesh_c
|
||||||
uint8_t *status)
|
uint8_t *status)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_PUB_GET, 0);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_PUB_GET, 0);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct hb_pub_param param = {
|
struct hb_pub_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.pub = pub,
|
.pub = pub,
|
||||||
|
@ -2566,12 +2426,7 @@ int bt_mesh_cfg_cli_node_identity_set(uint16_t net_idx, uint16_t addr, uint16_t
|
||||||
uint8_t new_identity, uint8_t *status, uint8_t *identity)
|
uint8_t new_identity, uint8_t *status, uint8_t *identity)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_SET, 4);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_SET, 4);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct node_idt_param param = {
|
struct node_idt_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
|
@ -2595,12 +2450,7 @@ int bt_mesh_cfg_cli_node_identity_get(uint16_t net_idx, uint16_t addr, uint16_t
|
||||||
uint8_t *status, uint8_t *identity)
|
uint8_t *status, uint8_t *identity)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_GET, 2);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_GET, 2);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct node_idt_param param = {
|
struct node_idt_param param = {
|
||||||
.status = status,
|
.status = status,
|
||||||
.net_idx = key_net_idx,
|
.net_idx = key_net_idx,
|
||||||
|
@ -2623,12 +2473,7 @@ int bt_mesh_cfg_cli_lpn_timeout_get(uint16_t net_idx, uint16_t addr, uint16_t un
|
||||||
int32_t *polltimeout)
|
int32_t *polltimeout)
|
||||||
{
|
{
|
||||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_LPN_TIMEOUT_GET, 2);
|
BT_MESH_MODEL_BUF_DEFINE(msg, OP_LPN_TIMEOUT_GET, 2);
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr);
|
||||||
.net_idx = net_idx,
|
|
||||||
.app_idx = BT_MESH_KEY_DEV_REMOTE,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
struct lpn_timeout_param param = {
|
struct lpn_timeout_param param = {
|
||||||
.unicast_addr = unicast_addr,
|
.unicast_addr = unicast_addr,
|
||||||
.polltimeout = polltimeout,
|
.polltimeout = polltimeout,
|
||||||
|
|
|
@ -191,11 +191,7 @@ const struct bt_mesh_model_op bt_mesh_health_cli_op[] = {
|
||||||
|
|
||||||
int bt_mesh_health_attention_get(uint16_t addr, uint16_t app_idx, uint8_t *attention)
|
int bt_mesh_health_attention_get(uint16_t addr, uint16_t app_idx, uint8_t *attention)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_attention_get(health_cli, &ctx, attention);
|
return bt_mesh_health_cli_attention_get(health_cli, &ctx, attention);
|
||||||
}
|
}
|
||||||
|
@ -203,33 +199,21 @@ int bt_mesh_health_attention_get(uint16_t addr, uint16_t app_idx, uint8_t *atten
|
||||||
int bt_mesh_health_attention_set(uint16_t addr, uint16_t app_idx,
|
int bt_mesh_health_attention_set(uint16_t addr, uint16_t app_idx,
|
||||||
uint8_t attention, uint8_t *updated_attention)
|
uint8_t attention, uint8_t *updated_attention)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_attention_set(health_cli, &ctx, attention, updated_attention);
|
return bt_mesh_health_cli_attention_set(health_cli, &ctx, attention, updated_attention);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mesh_health_attention_set_unack(uint16_t addr, uint16_t app_idx, uint8_t attention)
|
int bt_mesh_health_attention_set_unack(uint16_t addr, uint16_t app_idx, uint8_t attention)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_attention_set_unack(health_cli, &ctx, attention);
|
return bt_mesh_health_cli_attention_set_unack(health_cli, &ctx, attention);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mesh_health_period_get(uint16_t addr, uint16_t app_idx, uint8_t *divisor)
|
int bt_mesh_health_period_get(uint16_t addr, uint16_t app_idx, uint8_t *divisor)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_period_get(health_cli, &ctx, divisor);
|
return bt_mesh_health_cli_period_get(health_cli, &ctx, divisor);
|
||||||
}
|
}
|
||||||
|
@ -237,22 +221,14 @@ int bt_mesh_health_period_get(uint16_t addr, uint16_t app_idx, uint8_t *divisor)
|
||||||
int bt_mesh_health_period_set(uint16_t addr, uint16_t app_idx, uint8_t divisor,
|
int bt_mesh_health_period_set(uint16_t addr, uint16_t app_idx, uint8_t divisor,
|
||||||
uint8_t *updated_divisor)
|
uint8_t *updated_divisor)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_period_set(health_cli, &ctx, divisor, updated_divisor);
|
return bt_mesh_health_cli_period_set(health_cli, &ctx, divisor, updated_divisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mesh_health_period_set_unack(uint16_t addr, uint16_t app_idx, uint8_t divisor)
|
int bt_mesh_health_period_set_unack(uint16_t addr, uint16_t app_idx, uint8_t divisor)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_period_set_unack(health_cli, &ctx, divisor);
|
return bt_mesh_health_cli_period_set_unack(health_cli, &ctx, divisor);
|
||||||
}
|
}
|
||||||
|
@ -260,22 +236,14 @@ int bt_mesh_health_period_set_unack(uint16_t addr, uint16_t app_idx, uint8_t div
|
||||||
int bt_mesh_health_fault_test(uint16_t addr, uint16_t app_idx, uint16_t cid, uint8_t test_id,
|
int bt_mesh_health_fault_test(uint16_t addr, uint16_t app_idx, uint16_t cid, uint8_t test_id,
|
||||||
uint8_t *faults, size_t *fault_count)
|
uint8_t *faults, size_t *fault_count)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_fault_test(health_cli, &ctx, cid, test_id, faults, fault_count);
|
return bt_mesh_health_cli_fault_test(health_cli, &ctx, cid, test_id, faults, fault_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mesh_health_fault_test_unack(uint16_t addr, uint16_t app_idx, uint16_t cid, uint8_t test_id)
|
int bt_mesh_health_fault_test_unack(uint16_t addr, uint16_t app_idx, uint16_t cid, uint8_t test_id)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_fault_test_unack(health_cli, &ctx, cid, test_id);
|
return bt_mesh_health_cli_fault_test_unack(health_cli, &ctx, cid, test_id);
|
||||||
}
|
}
|
||||||
|
@ -284,11 +252,7 @@ int bt_mesh_health_fault_clear(uint16_t addr, uint16_t app_idx, uint16_t cid,
|
||||||
uint8_t *test_id, uint8_t *faults,
|
uint8_t *test_id, uint8_t *faults,
|
||||||
size_t *fault_count)
|
size_t *fault_count)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_fault_clear(health_cli, &ctx, cid, test_id, faults, fault_count);
|
return bt_mesh_health_cli_fault_clear(health_cli, &ctx, cid, test_id, faults, fault_count);
|
||||||
}
|
}
|
||||||
|
@ -296,11 +260,7 @@ int bt_mesh_health_fault_clear(uint16_t addr, uint16_t app_idx, uint16_t cid,
|
||||||
int bt_mesh_health_fault_clear_unack(uint16_t addr, uint16_t app_idx,
|
int bt_mesh_health_fault_clear_unack(uint16_t addr, uint16_t app_idx,
|
||||||
uint16_t cid)
|
uint16_t cid)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_fault_clear_unack(health_cli, &ctx, cid);
|
return bt_mesh_health_cli_fault_clear_unack(health_cli, &ctx, cid);
|
||||||
}
|
}
|
||||||
|
@ -309,11 +269,7 @@ int bt_mesh_health_fault_get(uint16_t addr, uint16_t app_idx, uint16_t cid,
|
||||||
uint8_t *test_id, uint8_t *faults,
|
uint8_t *test_id, uint8_t *faults,
|
||||||
size_t *fault_count)
|
size_t *fault_count)
|
||||||
{
|
{
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(app_idx, addr);
|
||||||
.app_idx = app_idx,
|
|
||||||
.addr = addr,
|
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
|
||||||
};
|
|
||||||
|
|
||||||
return bt_mesh_health_cli_fault_get(health_cli, &ctx, cid, test_id, faults, fault_count);
|
return bt_mesh_health_cli_fault_get(health_cli, &ctx, cid, test_id, faults, fault_count);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,8 @@ static int cmd_fault_get(const struct shell *sh, size_t argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bt_mesh_health_cli *cli = mod->user_data;
|
struct bt_mesh_health_cli *cli = mod->user_data;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
|
||||||
.net_idx = bt_mesh_shell_target_ctx.net_idx,
|
bt_mesh_shell_target_ctx.dst);
|
||||||
.addr = bt_mesh_shell_target_ctx.dst,
|
|
||||||
.app_idx = bt_mesh_shell_target_ctx.app_idx,
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t faults[32];
|
uint8_t faults[32];
|
||||||
size_t fault_count;
|
size_t fault_count;
|
||||||
uint8_t test_id;
|
uint8_t test_id;
|
||||||
|
@ -79,12 +75,8 @@ static int fault_clear(const struct shell *sh, size_t argc, char *argv[], bool a
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bt_mesh_health_cli *cli = mod->user_data;
|
struct bt_mesh_health_cli *cli = mod->user_data;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
|
||||||
.net_idx = bt_mesh_shell_target_ctx.net_idx,
|
bt_mesh_shell_target_ctx.dst);
|
||||||
.addr = bt_mesh_shell_target_ctx.dst,
|
|
||||||
.app_idx = bt_mesh_shell_target_ctx.app_idx,
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t test_id;
|
uint8_t test_id;
|
||||||
uint16_t cid;
|
uint16_t cid;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
@ -135,12 +127,8 @@ static int fault_test(const struct shell *sh, size_t argc, char *argv[], bool ac
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bt_mesh_health_cli *cli = mod->user_data;
|
struct bt_mesh_health_cli *cli = mod->user_data;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
|
||||||
.net_idx = bt_mesh_shell_target_ctx.net_idx,
|
bt_mesh_shell_target_ctx.dst);
|
||||||
.addr = bt_mesh_shell_target_ctx.dst,
|
|
||||||
.app_idx = bt_mesh_shell_target_ctx.app_idx,
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t test_id;
|
uint8_t test_id;
|
||||||
uint16_t cid;
|
uint16_t cid;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
@ -192,12 +180,8 @@ static int cmd_period_get(const struct shell *sh, size_t argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bt_mesh_health_cli *cli = mod->user_data;
|
struct bt_mesh_health_cli *cli = mod->user_data;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
|
||||||
.net_idx = bt_mesh_shell_target_ctx.net_idx,
|
bt_mesh_shell_target_ctx.dst);
|
||||||
.addr = bt_mesh_shell_target_ctx.dst,
|
|
||||||
.app_idx = bt_mesh_shell_target_ctx.app_idx,
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t divisor;
|
uint8_t divisor;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -218,12 +202,8 @@ static int period_set(const struct shell *sh, size_t argc, char *argv[], bool ac
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bt_mesh_health_cli *cli = mod->user_data;
|
struct bt_mesh_health_cli *cli = mod->user_data;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
|
||||||
.net_idx = bt_mesh_shell_target_ctx.net_idx,
|
bt_mesh_shell_target_ctx.dst);
|
||||||
.addr = bt_mesh_shell_target_ctx.dst,
|
|
||||||
.app_idx = bt_mesh_shell_target_ctx.app_idx,
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t divisor;
|
uint8_t divisor;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -272,12 +252,8 @@ static int cmd_attention_get(const struct shell *sh, size_t argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bt_mesh_health_cli *cli = mod->user_data;
|
struct bt_mesh_health_cli *cli = mod->user_data;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
|
||||||
.net_idx = bt_mesh_shell_target_ctx.net_idx,
|
bt_mesh_shell_target_ctx.dst);
|
||||||
.addr = bt_mesh_shell_target_ctx.dst,
|
|
||||||
.app_idx = bt_mesh_shell_target_ctx.app_idx,
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t attention;
|
uint8_t attention;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -298,12 +274,8 @@ static int attention_set(const struct shell *sh, size_t argc, char *argv[], bool
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bt_mesh_health_cli *cli = mod->user_data;
|
struct bt_mesh_health_cli *cli = mod->user_data;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
|
||||||
.net_idx = bt_mesh_shell_target_ctx.net_idx,
|
bt_mesh_shell_target_ctx.dst);
|
||||||
.addr = bt_mesh_shell_target_ctx.dst,
|
|
||||||
.app_idx = bt_mesh_shell_target_ctx.app_idx,
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t attention;
|
uint8_t attention;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
|
|
@ -882,13 +882,10 @@ static int cmd_net_send(const struct shell *sh, size_t argc, char *argv[])
|
||||||
{
|
{
|
||||||
NET_BUF_SIMPLE_DEFINE(msg, 32);
|
NET_BUF_SIMPLE_DEFINE(msg, 32);
|
||||||
|
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT(bt_mesh_shell_target_ctx.net_idx,
|
||||||
.send_ttl = BT_MESH_TTL_DEFAULT,
|
bt_mesh_shell_target_ctx.app_idx,
|
||||||
.net_idx = bt_mesh_shell_target_ctx.net_idx,
|
bt_mesh_shell_target_ctx.dst,
|
||||||
.addr = bt_mesh_shell_target_ctx.dst,
|
BT_MESH_TTL_DEFAULT);
|
||||||
.app_idx = bt_mesh_shell_target_ctx.app_idx,
|
|
||||||
|
|
||||||
};
|
|
||||||
struct bt_mesh_net_tx tx = {
|
struct bt_mesh_net_tx tx = {
|
||||||
.ctx = &ctx,
|
.ctx = &ctx,
|
||||||
.src = bt_mesh_primary_addr(),
|
.src = bt_mesh_primary_addr(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue