Bluetooth: Mesh: Make element as rodata
the reason is that the Mesh Profile clearly stipulates that Mesh nodes cannot change their own element definitions. Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
parent
9369c6f8e1
commit
5f1c2f199b
29 changed files with 130 additions and 126 deletions
|
@ -115,7 +115,7 @@ static const struct {
|
|||
};
|
||||
|
||||
void bt_mesh_model_foreach(void (*func)(const struct bt_mesh_model *mod,
|
||||
struct bt_mesh_elem *elem,
|
||||
const struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary,
|
||||
void *user_data),
|
||||
void *user_data)
|
||||
|
@ -123,7 +123,7 @@ void bt_mesh_model_foreach(void (*func)(const struct bt_mesh_model *mod,
|
|||
int i, j;
|
||||
|
||||
for (i = 0; i < dev_comp->elem_count; i++) {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
const struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
|
||||
for (j = 0; j < elem->model_count; j++) {
|
||||
const struct bt_mesh_model *model = &elem->models[j];
|
||||
|
@ -181,7 +181,7 @@ static void data_buf_add_mem_offset(struct net_buf_simple *buf, uint8_t *data, s
|
|||
*offset = 0;
|
||||
}
|
||||
|
||||
static void comp_add_model(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
static void comp_add_model(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem,
|
||||
bool vnd, void *user_data)
|
||||
{
|
||||
struct comp_foreach_model_arg *arg = user_data;
|
||||
|
@ -197,7 +197,7 @@ static void comp_add_model(const struct bt_mesh_model *mod, struct bt_mesh_elem
|
|||
#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV)
|
||||
|
||||
static size_t metadata_model_size(const struct bt_mesh_model *mod,
|
||||
struct bt_mesh_elem *elem, bool vnd)
|
||||
const struct bt_mesh_elem *elem, bool vnd)
|
||||
{
|
||||
const struct bt_mesh_models_metadata_entry *entry;
|
||||
size_t size = 0;
|
||||
|
@ -231,7 +231,7 @@ size_t bt_mesh_metadata_page_0_size(void)
|
|||
comp = bt_mesh_comp_get();
|
||||
|
||||
for (i = 0; i < dev_comp->elem_count; i++) {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
const struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
|
||||
size += sizeof(elem->model_count) +
|
||||
sizeof(elem->vnd_model_count);
|
||||
|
@ -253,7 +253,7 @@ size_t bt_mesh_metadata_page_0_size(void)
|
|||
}
|
||||
|
||||
static int metadata_add_model(const struct bt_mesh_model *mod,
|
||||
struct bt_mesh_elem *elem, bool vnd,
|
||||
const struct bt_mesh_elem *elem, bool vnd,
|
||||
void *user_data)
|
||||
{
|
||||
const struct bt_mesh_models_metadata_entry *entry;
|
||||
|
@ -310,7 +310,7 @@ int bt_mesh_metadata_get_page_0(struct net_buf_simple *buf, size_t offset)
|
|||
comp = bt_mesh_comp_get();
|
||||
|
||||
for (i = 0; i < comp->elem_count; i++) {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
const struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
|
||||
/* Check that the buffer has available tailroom for metadata item counts */
|
||||
if (net_buf_simple_tailroom(buf) < (((offset == 0) ? 2 : (offset == 1) ? 1 : 0)
|
||||
|
@ -360,7 +360,7 @@ int bt_mesh_metadata_get_page_0(struct net_buf_simple *buf, size_t offset)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int comp_add_elem(struct net_buf_simple *buf, struct bt_mesh_elem *elem,
|
||||
static int comp_add_elem(struct net_buf_simple *buf, const struct bt_mesh_elem *elem,
|
||||
size_t *offset)
|
||||
{
|
||||
struct comp_foreach_model_arg arg = {
|
||||
|
@ -382,7 +382,7 @@ static int comp_add_elem(struct net_buf_simple *buf, struct bt_mesh_elem *elem,
|
|||
* the element shall not be reported.
|
||||
*/
|
||||
LOG_DBG("Element 0x%04x didn't fit in the Data field",
|
||||
elem->addr);
|
||||
elem->rt->addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ static size_t mod_items_size(const struct bt_mesh_model *mod, uint8_t sig_offset
|
|||
return temp_size;
|
||||
}
|
||||
|
||||
static size_t page1_elem_size(struct bt_mesh_elem *elem)
|
||||
static size_t page1_elem_size(const struct bt_mesh_elem *elem)
|
||||
{
|
||||
size_t temp_size = 2;
|
||||
|
||||
|
@ -618,7 +618,7 @@ static int bt_mesh_comp_data_get_page_1(struct net_buf_simple *buf, size_t offse
|
|||
* the element shall not be reported.
|
||||
*/
|
||||
LOG_DBG("Element 0x%04x didn't fit in the Data field",
|
||||
comp->elem[i].addr);
|
||||
comp->elem[i].rt->addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -821,7 +821,7 @@ static int publish_transmit(const struct bt_mesh_model *mod)
|
|||
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_PUB(pub);
|
||||
struct bt_mesh_net_tx tx = {
|
||||
.ctx = &ctx,
|
||||
.src = bt_mesh_model_elem(mod)->addr,
|
||||
.src = bt_mesh_model_elem(mod)->rt->addr,
|
||||
.friend_cred = pub->cred,
|
||||
};
|
||||
|
||||
|
@ -899,14 +899,14 @@ static void mod_publish(struct k_work *work)
|
|||
}
|
||||
}
|
||||
|
||||
struct bt_mesh_elem *bt_mesh_model_elem(const struct bt_mesh_model *mod)
|
||||
const struct bt_mesh_elem *bt_mesh_model_elem(const struct bt_mesh_model *mod)
|
||||
{
|
||||
return &dev_comp->elem[mod->rt->elem_idx];
|
||||
}
|
||||
|
||||
const struct bt_mesh_model *bt_mesh_model_get(bool vnd, uint8_t elem_idx, uint8_t mod_idx)
|
||||
{
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
|
||||
if (elem_idx >= dev_comp->elem_count) {
|
||||
LOG_ERR("Invalid element index %u", elem_idx);
|
||||
|
@ -956,7 +956,7 @@ static int bt_mesh_vnd_mod_msg_cid_check(const struct bt_mesh_model *mod)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void mod_init(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
static void mod_init(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary, void *user_data)
|
||||
{
|
||||
int i;
|
||||
|
@ -1057,12 +1057,12 @@ void bt_mesh_comp_provision(uint16_t addr)
|
|||
LOG_DBG("addr 0x%04x elem_count %zu", addr, dev_comp->elem_count);
|
||||
|
||||
for (i = 0; i < dev_comp->elem_count; i++) {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
const struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
|
||||
elem->addr = addr++;
|
||||
elem->rt->addr = addr++;
|
||||
|
||||
LOG_DBG("addr 0x%04x mod_count %u vnd_mod_count %u", elem->addr, elem->model_count,
|
||||
elem->vnd_model_count);
|
||||
LOG_DBG("addr 0x%04x mod_count %u vnd_mod_count %u", elem->rt->addr,
|
||||
elem->model_count, elem->vnd_model_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1073,9 +1073,9 @@ void bt_mesh_comp_unprovision(void)
|
|||
dev_primary_addr = BT_MESH_ADDR_UNASSIGNED;
|
||||
|
||||
for (int i = 0; i < dev_comp->elem_count; i++) {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
const struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
|
||||
elem->addr = BT_MESH_ADDR_UNASSIGNED;
|
||||
elem->rt->addr = BT_MESH_ADDR_UNASSIGNED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1197,7 +1197,7 @@ const uint8_t **bt_mesh_model_find_uuid(const struct bt_mesh_model **mod, const
|
|||
#endif
|
||||
}
|
||||
|
||||
static const struct bt_mesh_model *bt_mesh_elem_find_group(struct bt_mesh_elem *elem,
|
||||
static const struct bt_mesh_model *bt_mesh_elem_find_group(const struct bt_mesh_elem *elem,
|
||||
uint16_t group_addr)
|
||||
{
|
||||
const struct bt_mesh_model *model;
|
||||
|
@ -1225,7 +1225,7 @@ static const struct bt_mesh_model *bt_mesh_elem_find_group(struct bt_mesh_elem *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct bt_mesh_elem *bt_mesh_elem_find(uint16_t addr)
|
||||
const struct bt_mesh_elem *bt_mesh_elem_find(uint16_t addr)
|
||||
{
|
||||
uint16_t index;
|
||||
|
||||
|
@ -1233,7 +1233,7 @@ struct bt_mesh_elem *bt_mesh_elem_find(uint16_t addr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
index = addr - dev_comp->elem[0].addr;
|
||||
index = addr - dev_comp->elem[0].rt->addr;
|
||||
if (index >= dev_comp->elem_count) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1254,7 +1254,7 @@ bool bt_mesh_has_addr(uint16_t addr)
|
|||
}
|
||||
|
||||
for (index = 0; index < dev_comp->elem_count; index++) {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[index];
|
||||
const struct bt_mesh_elem *elem = &dev_comp->elem[index];
|
||||
|
||||
if (bt_mesh_elem_find_group(elem, addr)) {
|
||||
return true;
|
||||
|
@ -1315,7 +1315,7 @@ bool bt_mesh_model_has_key(const struct bt_mesh_model *mod, uint16_t key)
|
|||
static bool model_has_dst(const struct bt_mesh_model *mod, uint16_t dst, const uint8_t *uuid)
|
||||
{
|
||||
if (BT_MESH_ADDR_IS_UNICAST(dst)) {
|
||||
return (dev_comp->elem[mod->rt->elem_idx].addr == dst);
|
||||
return (dev_comp->elem[mod->rt->elem_idx].rt->addr == dst);
|
||||
} else if (BT_MESH_ADDR_IS_VIRTUAL(dst)) {
|
||||
return !!bt_mesh_model_find_uuid(&mod, uuid);
|
||||
} else if (BT_MESH_ADDR_IS_GROUP(dst) ||
|
||||
|
@ -1330,7 +1330,7 @@ static bool model_has_dst(const struct bt_mesh_model *mod, uint16_t dst, const u
|
|||
return mod->rt->elem_idx == 0;
|
||||
}
|
||||
|
||||
static const struct bt_mesh_model_op *find_op(struct bt_mesh_elem *elem,
|
||||
static const struct bt_mesh_model_op *find_op(const struct bt_mesh_elem *elem,
|
||||
uint32_t opcode, const struct bt_mesh_model **model)
|
||||
{
|
||||
uint8_t i;
|
||||
|
@ -1415,7 +1415,7 @@ static int get_opcode(struct net_buf_simple *buf, uint32_t *opcode)
|
|||
}
|
||||
|
||||
static int element_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf,
|
||||
struct bt_mesh_elem *elem, uint32_t opcode)
|
||||
const struct bt_mesh_elem *elem, uint32_t opcode)
|
||||
{
|
||||
const struct bt_mesh_model_op *op;
|
||||
const struct bt_mesh_model *model;
|
||||
|
@ -1424,7 +1424,7 @@ static int element_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple
|
|||
|
||||
op = find_op(elem, opcode, &model);
|
||||
if (!op) {
|
||||
LOG_ERR("No OpCode 0x%08x for elem 0x%02x", opcode, elem->addr);
|
||||
LOG_ERR("No OpCode 0x%08x for elem 0x%02x", opcode, elem->rt->addr);
|
||||
return ACCESS_STATUS_WRONG_OPCODE;
|
||||
}
|
||||
|
||||
|
@ -1479,19 +1479,19 @@ int bt_mesh_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf)
|
|||
LOG_DBG("OpCode 0x%08x", opcode);
|
||||
|
||||
if (BT_MESH_ADDR_IS_UNICAST(ctx->recv_dst)) {
|
||||
index = ctx->recv_dst - dev_comp->elem[0].addr;
|
||||
index = ctx->recv_dst - dev_comp->elem[0].rt->addr;
|
||||
|
||||
if (index >= dev_comp->elem_count) {
|
||||
LOG_ERR("Invalid address 0x%02x", ctx->recv_dst);
|
||||
err = ACCESS_STATUS_INVALID_ADDRESS;
|
||||
} else {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[index];
|
||||
const struct bt_mesh_elem *elem = &dev_comp->elem[index];
|
||||
|
||||
err = element_model_recv(ctx, buf, elem, opcode);
|
||||
}
|
||||
} else {
|
||||
for (index = 0; index < dev_comp->elem_count; index++) {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[index];
|
||||
const struct bt_mesh_elem *elem = &dev_comp->elem[index];
|
||||
|
||||
(void)element_model_recv(ctx, buf, elem, opcode);
|
||||
}
|
||||
|
@ -1519,7 +1519,7 @@ int bt_mesh_model_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return bt_mesh_access_send(ctx, msg, bt_mesh_model_elem(model)->addr, cb, cb_data);
|
||||
return bt_mesh_access_send(ctx, msg, bt_mesh_model_elem(model)->rt->addr, cb, cb_data);
|
||||
}
|
||||
|
||||
int bt_mesh_model_publish(const struct bt_mesh_model *model)
|
||||
|
@ -2171,7 +2171,7 @@ static void store_pending_mod_pub(const struct bt_mesh_model *mod, bool vnd)
|
|||
}
|
||||
|
||||
static void store_pending_mod(const struct bt_mesh_model *mod,
|
||||
struct bt_mesh_elem *elem, bool vnd,
|
||||
const struct bt_mesh_elem *elem, bool vnd,
|
||||
bool primary, void *user_data)
|
||||
{
|
||||
if (!mod->rt->flags) {
|
||||
|
@ -2553,7 +2553,7 @@ int bt_mesh_models_metadata_change_prepare(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void commit_mod(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
static void commit_mod(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary, void *user_data)
|
||||
{
|
||||
if (mod->pub && mod->pub->update &&
|
||||
|
|
|
@ -20,7 +20,7 @@ enum {
|
|||
BT_MESH_MOD_DATA_PENDING = BIT(5),
|
||||
};
|
||||
|
||||
void bt_mesh_elem_register(struct bt_mesh_elem *elem, uint8_t count);
|
||||
void bt_mesh_elem_register(const struct bt_mesh_elem *elem, uint8_t count);
|
||||
|
||||
uint8_t bt_mesh_elem_count(void);
|
||||
size_t bt_mesh_comp_page_size(uint8_t page);
|
||||
|
@ -29,7 +29,7 @@ size_t bt_mesh_metadata_page_0_size(void);
|
|||
int bt_mesh_metadata_get_page_0(struct net_buf_simple *buf, size_t offset);
|
||||
|
||||
/* Find local element based on unicast address */
|
||||
struct bt_mesh_elem *bt_mesh_elem_find(uint16_t addr);
|
||||
const struct bt_mesh_elem *bt_mesh_elem_find(uint16_t addr);
|
||||
|
||||
bool bt_mesh_has_addr(uint16_t addr);
|
||||
bool bt_mesh_model_has_key(const struct bt_mesh_model *mod, uint16_t key);
|
||||
|
@ -43,7 +43,7 @@ uint16_t *bt_mesh_model_find_group(const struct bt_mesh_model **mod, uint16_t ad
|
|||
const uint8_t **bt_mesh_model_find_uuid(const struct bt_mesh_model **mod, const uint8_t *uuid);
|
||||
|
||||
void bt_mesh_model_foreach(void (*func)(const struct bt_mesh_model *mod,
|
||||
struct bt_mesh_elem *elem,
|
||||
const struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary,
|
||||
void *user_data),
|
||||
void *user_data);
|
||||
|
|
|
@ -86,7 +86,7 @@ static int dev_comp_data_get(const struct bt_mesh_model *model,
|
|||
return err;
|
||||
}
|
||||
|
||||
static const struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
|
||||
static const struct bt_mesh_model *get_model(const struct bt_mesh_elem *elem,
|
||||
struct net_buf_simple *buf, bool *vnd)
|
||||
{
|
||||
if (buf->len < 4) {
|
||||
|
@ -94,7 +94,7 @@ static const struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
|
|||
|
||||
id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
LOG_DBG("ID 0x%04x addr 0x%04x", id, elem->addr);
|
||||
LOG_DBG("ID 0x%04x addr 0x%04x", id, elem->rt->addr);
|
||||
|
||||
*vnd = false;
|
||||
|
||||
|
@ -105,7 +105,7 @@ static const struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
|
|||
company = net_buf_simple_pull_le16(buf);
|
||||
id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
LOG_DBG("Company 0x%04x ID 0x%04x addr 0x%04x", company, id, elem->addr);
|
||||
LOG_DBG("Company 0x%04x ID 0x%04x addr 0x%04x", company, id, elem->rt->addr);
|
||||
|
||||
*vnd = true;
|
||||
|
||||
|
@ -336,7 +336,7 @@ static int app_key_update(const struct bt_mesh_model *model,
|
|||
}
|
||||
|
||||
static void mod_app_key_del(const struct bt_mesh_model *mod,
|
||||
struct bt_mesh_elem *elem, bool vnd, bool primary,
|
||||
const struct bt_mesh_elem *elem, bool vnd, bool primary,
|
||||
void *user_data)
|
||||
{
|
||||
uint16_t *app_idx = user_data;
|
||||
|
@ -696,7 +696,7 @@ static int mod_pub_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx
|
|||
{
|
||||
uint16_t elem_addr, pub_addr = 0U;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint8_t *mod_id, status;
|
||||
bool vnd;
|
||||
|
||||
|
@ -749,7 +749,7 @@ static int mod_pub_set(const struct bt_mesh_model *model,
|
|||
uint8_t retransmit, status, pub_ttl, pub_period, cred_flag;
|
||||
uint16_t elem_addr, pub_addr, pub_app_idx;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint8_t *mod_id;
|
||||
bool vnd;
|
||||
|
||||
|
@ -847,7 +847,7 @@ static int mod_pub_va_set(const struct bt_mesh_model *model,
|
|||
uint16_t elem_addr, pub_app_idx;
|
||||
uint16_t pub_addr = 0U;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
const uint8_t *uuid;
|
||||
uint8_t *mod_id;
|
||||
bool vnd;
|
||||
|
@ -949,7 +949,7 @@ static int mod_sub_add(const struct bt_mesh_model *model,
|
|||
{
|
||||
uint16_t elem_addr, sub_addr;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint8_t *mod_id;
|
||||
uint8_t status;
|
||||
uint16_t *entry;
|
||||
|
@ -1027,7 +1027,7 @@ static int mod_sub_del(const struct bt_mesh_model *model,
|
|||
{
|
||||
uint16_t elem_addr, sub_addr;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint8_t *mod_id;
|
||||
uint16_t *match;
|
||||
uint8_t status;
|
||||
|
@ -1109,7 +1109,7 @@ static int mod_sub_overwrite(const struct bt_mesh_model *model,
|
|||
{
|
||||
uint16_t elem_addr, sub_addr;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint8_t *mod_id;
|
||||
uint8_t status;
|
||||
bool vnd;
|
||||
|
@ -1179,7 +1179,7 @@ static int mod_sub_del_all(const struct bt_mesh_model *model,
|
|||
struct net_buf_simple *buf)
|
||||
{
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint16_t elem_addr;
|
||||
uint8_t *mod_id;
|
||||
uint8_t status;
|
||||
|
@ -1269,7 +1269,7 @@ static int mod_sub_get(const struct bt_mesh_model *model,
|
|||
NET_BUF_SIMPLE_DEFINE(msg, BT_MESH_TX_SDU_MAX);
|
||||
struct mod_sub_list_ctx visit_ctx;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint16_t addr, id;
|
||||
|
||||
addr = net_buf_simple_pull_le16(buf);
|
||||
|
@ -1324,7 +1324,7 @@ static int mod_sub_get_vnd(const struct bt_mesh_model *model,
|
|||
NET_BUF_SIMPLE_DEFINE(msg, BT_MESH_TX_SDU_MAX);
|
||||
struct mod_sub_list_ctx visit_ctx;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint16_t company, addr, id;
|
||||
|
||||
addr = net_buf_simple_pull_le16(buf);
|
||||
|
@ -1383,7 +1383,7 @@ static int mod_sub_va_add(const struct bt_mesh_model *model,
|
|||
const struct bt_mesh_va *va;
|
||||
uint16_t elem_addr, sub_addr = BT_MESH_ADDR_UNASSIGNED;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
const uint8_t *uuid;
|
||||
uint8_t *mod_id;
|
||||
uint16_t *group_entry;
|
||||
|
@ -1485,7 +1485,7 @@ static int mod_sub_va_del(const struct bt_mesh_model *model,
|
|||
const struct bt_mesh_va *va;
|
||||
uint16_t elem_addr, sub_addr = BT_MESH_ADDR_UNASSIGNED;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
const uint8_t *uuid;
|
||||
uint8_t *mod_id;
|
||||
const uint8_t **label_match;
|
||||
|
@ -1569,7 +1569,7 @@ static int mod_sub_va_overwrite(const struct bt_mesh_model *model,
|
|||
const struct bt_mesh_va *va;
|
||||
uint16_t elem_addr, sub_addr = BT_MESH_ADDR_UNASSIGNED;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
const uint8_t *uuid;
|
||||
uint8_t *mod_id;
|
||||
uint8_t status;
|
||||
|
@ -1848,7 +1848,7 @@ static int mod_app_bind(const struct bt_mesh_model *model,
|
|||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_STATUS, 9);
|
||||
uint16_t elem_addr, key_app_idx;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint8_t *mod_id, status;
|
||||
bool vnd;
|
||||
|
||||
|
@ -1912,7 +1912,7 @@ static int mod_app_unbind(const struct bt_mesh_model *model,
|
|||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_STATUS, 9);
|
||||
uint16_t elem_addr, key_app_idx;
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint8_t *mod_id, status;
|
||||
bool vnd;
|
||||
|
||||
|
@ -1974,7 +1974,7 @@ static int mod_app_get(const struct bt_mesh_model *model,
|
|||
BT_MESH_MODEL_BUF_LEN(OP_SIG_MOD_APP_LIST,
|
||||
9 + KEY_LIST_LEN)));
|
||||
const struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
uint8_t *mod_id, status;
|
||||
uint16_t elem_addr;
|
||||
bool vnd;
|
||||
|
@ -2529,7 +2529,7 @@ const struct bt_mesh_model_cb bt_mesh_cfg_srv_cb = {
|
|||
.init = cfg_srv_init,
|
||||
};
|
||||
|
||||
static void mod_reset(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
static void mod_reset(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary, void *user_data)
|
||||
{
|
||||
size_t clear_count;
|
||||
|
|
|
@ -384,7 +384,7 @@ static int health_pub_update(const struct bt_mesh_model *mod)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_mesh_health_srv_fault_update(struct bt_mesh_elem *elem)
|
||||
int bt_mesh_health_srv_fault_update(const struct bt_mesh_elem *elem)
|
||||
{
|
||||
const struct bt_mesh_model *mod;
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ bool bt_mesh_is_provisioned(void)
|
|||
return atomic_test_bit(bt_mesh.flags, BT_MESH_VALID);
|
||||
}
|
||||
|
||||
static void model_suspend(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
static void model_suspend(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary, void *user_data)
|
||||
{
|
||||
if (mod->pub && mod->pub->update) {
|
||||
|
@ -463,7 +463,7 @@ int bt_mesh_suspend(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void model_resume(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
static void model_resume(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary, void *user_data)
|
||||
{
|
||||
if (mod->pub && mod->pub->update) {
|
||||
|
@ -552,7 +552,7 @@ int bt_mesh_init(const struct bt_mesh_prov *prov,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void model_start(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
static void model_start(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary, void *user_data)
|
||||
{
|
||||
if (mod->cb && mod->cb->start) {
|
||||
|
|
|
@ -205,7 +205,7 @@ void bt_mesh_op_agg_cli_timeout_set(int32_t timeout)
|
|||
|
||||
int bt_mesh_op_agg_cli_send(const struct bt_mesh_model *model, struct net_buf_simple *msg)
|
||||
{
|
||||
uint16_t src = bt_mesh_model_elem(model)->addr;
|
||||
uint16_t src = bt_mesh_model_elem(model)->rt->addr;
|
||||
|
||||
if (net_buf_simple_tailroom(&srcs) < 2) {
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -1070,7 +1070,7 @@ static int cmd_rpl_clear(const struct shell *sh, size_t argc, char *argv[])
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_MESH_SHELL_HEALTH_SRV_INSTANCE)
|
||||
static struct bt_mesh_elem *primary_element(void)
|
||||
static const struct bt_mesh_elem *primary_element(void)
|
||||
{
|
||||
const struct bt_mesh_comp *comp = bt_mesh_comp_get();
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ static int cmd_add_fault(const struct shell *sh, size_t argc, char *argv[])
|
|||
{
|
||||
uint8_t fault_id;
|
||||
uint8_t i;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
int err = 0;
|
||||
|
||||
elem = primary_element();
|
||||
|
@ -1138,7 +1138,7 @@ static int cmd_del_fault(const struct shell *sh, size_t argc, char *argv[])
|
|||
{
|
||||
uint8_t fault_id;
|
||||
uint8_t i;
|
||||
struct bt_mesh_elem *elem;
|
||||
const struct bt_mesh_elem *elem;
|
||||
int err = 0;
|
||||
|
||||
elem = primary_element();
|
||||
|
|
|
@ -60,7 +60,7 @@ int bt_mesh_shell_mdl_print_all(const struct shell *sh, uint16_t mod_id)
|
|||
if (mod) {
|
||||
shell_print(sh,
|
||||
"Client model instance found at addr 0x%.4X. Element index: %d",
|
||||
comp->elem[i].addr, mod->rt->elem_idx);
|
||||
comp->elem[i].rt->addr, mod->rt->elem_idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue