Bluetooth: Mesh: Make bt_mesh_model as rodata

Since model struct most of member should not change at run time,
so mark as const will be suitable and safely.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
Lingao Meng 2023-11-14 12:00:30 +08:00 committed by Carles Cufí
commit ab08f34fd9
79 changed files with 929 additions and 887 deletions

View file

@ -92,12 +92,12 @@ static struct mod_relation mod_rel_list[MOD_REL_LIST_SIZE];
(idx)++)
#define IS_MOD_BASE(mod, idx, offset) \
(mod_rel_list[(idx)].elem_base == (mod)->elem_idx && \
mod_rel_list[(idx)].idx_base == (mod)->mod_idx + (offset))
(mod_rel_list[(idx)].elem_base == *((mod)->elem_idx) && \
mod_rel_list[(idx)].idx_base == *((mod)->mod_idx) + (offset))
#define IS_MOD_EXTENSION(mod, idx, offset) \
(mod_rel_list[(idx)].elem_ext == (mod)->elem_idx && \
mod_rel_list[(idx)].idx_ext == (mod)->mod_idx + (offset))
(mod_rel_list[(idx)].elem_ext == *((mod)->elem_idx) && \
mod_rel_list[(idx)].idx_ext == *((mod)->mod_idx) + (offset))
#define RELATION_TYPE_EXT 0xFF
@ -114,7 +114,7 @@ static const struct {
#endif
};
void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
void bt_mesh_model_foreach(void (*func)(const struct bt_mesh_model *mod,
struct bt_mesh_elem *elem,
bool vnd, bool primary,
void *user_data),
@ -126,13 +126,13 @@ void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
struct bt_mesh_elem *elem = &dev_comp->elem[i];
for (j = 0; j < elem->model_count; j++) {
struct bt_mesh_model *model = &elem->models[j];
const struct bt_mesh_model *model = &elem->models[j];
func(model, elem, false, i == 0, user_data);
}
for (j = 0; j < elem->vnd_model_count; j++) {
struct bt_mesh_model *model = &elem->vnd_models[j];
const struct bt_mesh_model *model = &elem->vnd_models[j];
func(model, elem, true, i == 0, user_data);
}
@ -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(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
static void comp_add_model(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
bool vnd, void *user_data)
{
struct comp_foreach_model_arg *arg = user_data;
@ -196,7 +196,7 @@ static void comp_add_model(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV)
static size_t metadata_model_size(struct bt_mesh_model *mod,
static size_t metadata_model_size(const struct bt_mesh_model *mod,
struct bt_mesh_elem *elem, bool vnd)
{
const struct bt_mesh_models_metadata_entry *entry;
@ -237,13 +237,13 @@ size_t bt_mesh_metadata_page_0_size(void)
sizeof(elem->vnd_model_count);
for (j = 0; j < elem->model_count; j++) {
struct bt_mesh_model *model = &elem->models[j];
const struct bt_mesh_model *model = &elem->models[j];
size += metadata_model_size(model, elem, false);
}
for (j = 0; j < elem->vnd_model_count; j++) {
struct bt_mesh_model *model = &elem->vnd_models[j];
const struct bt_mesh_model *model = &elem->vnd_models[j];
size += metadata_model_size(model, elem, true);
}
@ -252,7 +252,7 @@ size_t bt_mesh_metadata_page_0_size(void)
return size;
}
static int metadata_add_model(struct bt_mesh_model *mod,
static int metadata_add_model(const struct bt_mesh_model *mod,
struct bt_mesh_elem *elem, bool vnd,
void *user_data)
{
@ -322,7 +322,7 @@ int bt_mesh_metadata_get_page_0(struct net_buf_simple *buf, size_t offset)
vnd_count_ptr = data_buf_add_u8_offset(buf, 0, &offset);
for (j = 0; j < elem->model_count; j++) {
struct bt_mesh_model *model = &elem->models[j];
const struct bt_mesh_model *model = &elem->models[j];
if (!model->metadata) {
continue;
@ -339,7 +339,7 @@ int bt_mesh_metadata_get_page_0(struct net_buf_simple *buf, size_t offset)
}
for (j = 0; j < elem->vnd_model_count; j++) {
struct bt_mesh_model *model = &elem->vnd_models[j];
const struct bt_mesh_model *model = &elem->vnd_models[j];
if (!model->metadata) {
continue;
@ -396,13 +396,13 @@ static int comp_add_elem(struct net_buf_simple *buf, struct bt_mesh_elem *elem,
data_buf_add_u8_offset(buf, elem->vnd_model_count, offset);
for (i = 0; i < elem->model_count; i++) {
struct bt_mesh_model *model = &elem->models[i];
const struct bt_mesh_model *model = &elem->models[i];
comp_add_model(model, elem, false, &arg);
}
for (i = 0; i < elem->vnd_model_count; i++) {
struct bt_mesh_model *model = &elem->vnd_models[i];
const struct bt_mesh_model *model = &elem->vnd_models[i];
comp_add_model(model, elem, true, &arg);
}
@ -452,7 +452,8 @@ int bt_mesh_comp_data_get_page_0(struct net_buf_simple *buf, size_t offset)
return 0;
}
static uint8_t count_mod_ext(struct bt_mesh_model *mod, uint8_t *max_offset, uint8_t sig_offset)
static uint8_t count_mod_ext(const struct bt_mesh_model *mod,
uint8_t *max_offset, uint8_t sig_offset)
{
int i;
uint8_t extensions = 0;
@ -476,7 +477,7 @@ static uint8_t count_mod_ext(struct bt_mesh_model *mod, uint8_t *max_offset, uin
return extensions;
}
static bool is_cor_present(struct bt_mesh_model *mod, uint8_t *cor_id, uint8_t sig_offset)
static bool is_cor_present(const struct bt_mesh_model *mod, uint8_t *cor_id, uint8_t sig_offset)
{
int i;
@ -494,8 +495,9 @@ static bool is_cor_present(struct bt_mesh_model *mod, uint8_t *cor_id, uint8_t s
return false;
}
static void prep_model_item_header(struct bt_mesh_model *mod, uint8_t *cor_id, uint8_t *mod_cnt,
struct net_buf_simple *buf, size_t *offset, uint8_t sig_offset)
static void prep_model_item_header(const struct bt_mesh_model *mod, uint8_t *cor_id,
uint8_t *mod_cnt, struct net_buf_simple *buf,
size_t *offset, uint8_t sig_offset)
{
uint8_t ext_mod_cnt;
bool cor_present;
@ -522,7 +524,7 @@ static void prep_model_item_header(struct bt_mesh_model *mod, uint8_t *cor_id, u
memset(mod_cnt, ext_mod_cnt, sizeof(uint8_t));
}
static void add_items_to_page(struct net_buf_simple *buf, struct bt_mesh_model *mod,
static void add_items_to_page(struct net_buf_simple *buf, const struct bt_mesh_model *mod,
uint8_t ext_mod_cnt, size_t *offset, uint8_t sig_offset)
{
int i, elem_offset;
@ -531,7 +533,7 @@ static void add_items_to_page(struct net_buf_simple *buf, struct bt_mesh_model *
MOD_REL_LIST_FOR_EACH(i) {
if (IS_MOD_EXTENSION(mod, i, sig_offset) &&
mod_rel_list[i].type == RELATION_TYPE_EXT) {
elem_offset = mod->elem_idx - mod_rel_list[i].elem_base;
elem_offset = *(mod->elem_idx) - mod_rel_list[i].elem_base;
mod_idx = mod_rel_list[i].idx_base;
if (ext_mod_cnt < 32 &&
elem_offset < 4 &&
@ -555,7 +557,7 @@ static void add_items_to_page(struct net_buf_simple *buf, struct bt_mesh_model *
}
}
static size_t mod_items_size(struct bt_mesh_model *mod, uint8_t sig_offset)
static size_t mod_items_size(const struct bt_mesh_model *mod, uint8_t sig_offset)
{
int i, offset;
size_t temp_size = 0;
@ -567,7 +569,7 @@ static size_t mod_items_size(struct bt_mesh_model *mod, uint8_t sig_offset)
MOD_REL_LIST_FOR_EACH(i) {
if (IS_MOD_EXTENSION(mod, i, sig_offset)) {
offset = mod->elem_idx - mod_rel_list[i].elem_base;
offset = *(mod->elem_idx) - mod_rel_list[i].elem_base;
temp_size += (ext_mod_cnt < 32 && offset < 4 && offset > -5) ? 1 : 2;
}
}
@ -701,7 +703,7 @@ static int bt_mesh_comp_data_get_page_2(struct net_buf_simple *buf, size_t offse
return 0;
}
int32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod)
int32_t bt_mesh_model_pub_period_get(const struct bt_mesh_model *mod)
{
int32_t period;
@ -741,7 +743,7 @@ int32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod)
}
}
static int32_t next_period(struct bt_mesh_model *mod)
static int32_t next_period(const struct bt_mesh_model *mod)
{
struct bt_mesh_model_pub *pub = mod->pub;
uint32_t period = 0;
@ -782,7 +784,7 @@ static int32_t next_period(struct bt_mesh_model *mod)
static void publish_sent(int err, void *user_data)
{
struct bt_mesh_model *mod = user_data;
const struct bt_mesh_model *mod = user_data;
int32_t delay;
LOG_DBG("err %d, time %u", err, k_uptime_get_32());
@ -812,7 +814,7 @@ static const struct bt_mesh_send_cb pub_sent_cb = {
.end = publish_sent,
};
static int publish_transmit(struct bt_mesh_model *mod)
static int publish_transmit(const struct bt_mesh_model *mod)
{
NET_BUF_SIMPLE_DEFINE(sdu, BT_MESH_TX_SDU_MAX);
struct bt_mesh_model_pub *pub = mod->pub;
@ -825,7 +827,7 @@ static int publish_transmit(struct bt_mesh_model *mod)
net_buf_simple_add_mem(&sdu, pub->msg->data, pub->msg->len);
return bt_mesh_trans_send(&tx, &sdu, &pub_sent_cb, mod);
return bt_mesh_trans_send(&tx, &sdu, &pub_sent_cb, (void *)mod);
}
static int pub_period_start(struct bt_mesh_model_pub *pub)
@ -846,7 +848,7 @@ static int pub_period_start(struct bt_mesh_model_pub *pub)
/* Skip this publish attempt. */
LOG_DBG("Update failed, skipping publish (err: %d)", err);
pub->count = 0;
publish_sent(err, pub->mod);
publish_sent(err, (void *)pub->mod);
return err;
}
@ -878,7 +880,7 @@ static void mod_publish(struct k_work *work)
bt_mesh_model_pub_is_retransmission(pub->mod)) {
err = pub->update(pub->mod);
if (err) {
publish_sent(err, pub->mod);
publish_sent(err, (void *)pub->mod);
return;
}
}
@ -893,16 +895,16 @@ static void mod_publish(struct k_work *work)
err = publish_transmit(pub->mod);
if (err) {
LOG_ERR("Failed to publish (err %d)", err);
publish_sent(err, pub->mod);
publish_sent(err, (void *)pub->mod);
}
}
struct bt_mesh_elem *bt_mesh_model_elem(struct bt_mesh_model *mod)
struct bt_mesh_elem *bt_mesh_model_elem(const struct bt_mesh_model *mod)
{
return &dev_comp->elem[mod->elem_idx];
return &dev_comp->elem[*(mod->elem_idx)];
}
struct bt_mesh_model *bt_mesh_model_get(bool vnd, uint8_t elem_idx, uint8_t mod_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;
@ -931,7 +933,7 @@ struct bt_mesh_model *bt_mesh_model_get(bool vnd, uint8_t elem_idx, uint8_t mod_
}
#if defined(CONFIG_BT_MESH_MODEL_VND_MSG_CID_FORCE)
static int bt_mesh_vnd_mod_msg_cid_check(struct bt_mesh_model *mod)
static int bt_mesh_vnd_mod_msg_cid_check(const struct bt_mesh_model *mod)
{
uint16_t cid;
const struct bt_mesh_model_op *op;
@ -954,7 +956,7 @@ static int bt_mesh_vnd_mod_msg_cid_check(struct bt_mesh_model *mod)
}
#endif
static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
static void mod_init(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
bool vnd, bool primary, void *user_data)
{
int i;
@ -973,9 +975,9 @@ static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
mod->keys[i] = BT_MESH_KEY_UNUSED;
}
mod->elem_idx = elem - dev_comp->elem;
*(mod->elem_idx) = elem - dev_comp->elem;
if (vnd) {
mod->mod_idx = mod - elem->vnd_models;
*(mod->mod_idx) = mod - elem->vnd_models;
if (IS_ENABLED(CONFIG_BT_MESH_MODEL_VND_MSG_CID_FORCE)) {
*err = bt_mesh_vnd_mod_msg_cid_check(mod);
@ -985,7 +987,7 @@ static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
}
} else {
mod->mod_idx = mod - elem->models;
*(mod->mod_idx) = mod - elem->models;
}
if (mod->cb && mod->cb->init) {
@ -1082,7 +1084,7 @@ uint16_t bt_mesh_primary_addr(void)
return dev_primary_addr;
}
static uint16_t *model_group_get(struct bt_mesh_model *mod, uint16_t addr)
static uint16_t *model_group_get(const struct bt_mesh_model *mod, uint16_t addr)
{
int i;
@ -1097,15 +1099,15 @@ static uint16_t *model_group_get(struct bt_mesh_model *mod, uint16_t addr)
struct find_group_visitor_ctx {
uint16_t *entry;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
uint16_t addr;
};
static enum bt_mesh_walk find_group_mod_visitor(struct bt_mesh_model *mod, void *user_data)
static enum bt_mesh_walk find_group_mod_visitor(const struct bt_mesh_model *mod, void *user_data)
{
struct find_group_visitor_ctx *ctx = user_data;
if (mod->elem_idx != ctx->mod->elem_idx) {
if (*(mod->elem_idx) != *(ctx->mod->elem_idx)) {
return BT_MESH_WALK_CONTINUE;
}
@ -1118,7 +1120,7 @@ static enum bt_mesh_walk find_group_mod_visitor(struct bt_mesh_model *mod, void
return BT_MESH_WALK_CONTINUE;
}
uint16_t *bt_mesh_model_find_group(struct bt_mesh_model **mod, uint16_t addr)
uint16_t *bt_mesh_model_find_group(const struct bt_mesh_model **mod, uint16_t addr)
{
struct find_group_visitor_ctx ctx = {
.mod = *mod,
@ -1133,7 +1135,7 @@ uint16_t *bt_mesh_model_find_group(struct bt_mesh_model **mod, uint16_t addr)
}
#if CONFIG_BT_MESH_LABEL_COUNT > 0
static const uint8_t **model_uuid_get(struct bt_mesh_model *mod, const uint8_t *uuid)
static const uint8_t **model_uuid_get(const struct bt_mesh_model *mod, const uint8_t *uuid)
{
int i;
@ -1155,15 +1157,15 @@ static const uint8_t **model_uuid_get(struct bt_mesh_model *mod, const uint8_t *
struct find_uuid_visitor_ctx {
const uint8_t **entry;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
const uint8_t *uuid;
};
static enum bt_mesh_walk find_uuid_mod_visitor(struct bt_mesh_model *mod, void *user_data)
static enum bt_mesh_walk find_uuid_mod_visitor(const struct bt_mesh_model *mod, void *user_data)
{
struct find_uuid_visitor_ctx *ctx = user_data;
if (mod->elem_idx != ctx->mod->elem_idx) {
if (*(mod->elem_idx) != *(ctx->mod->elem_idx)) {
return BT_MESH_WALK_CONTINUE;
}
@ -1177,7 +1179,7 @@ static enum bt_mesh_walk find_uuid_mod_visitor(struct bt_mesh_model *mod, void *
}
#endif /* CONFIG_BT_MESH_LABEL_COUNT > 0 */
const uint8_t **bt_mesh_model_find_uuid(struct bt_mesh_model **mod, const uint8_t *uuid)
const uint8_t **bt_mesh_model_find_uuid(const struct bt_mesh_model **mod, const uint8_t *uuid)
{
#if CONFIG_BT_MESH_LABEL_COUNT > 0
struct find_uuid_visitor_ctx ctx = {
@ -1195,10 +1197,10 @@ const uint8_t **bt_mesh_model_find_uuid(struct bt_mesh_model **mod, const uint8_
#endif
}
static 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(struct bt_mesh_elem *elem,
uint16_t group_addr)
{
struct bt_mesh_model *model;
const struct bt_mesh_model *model;
uint16_t *match;
int i;
@ -1295,7 +1297,7 @@ uint8_t bt_mesh_elem_count(void)
return dev_comp->elem_count;
}
bool bt_mesh_model_has_key(struct bt_mesh_model *mod, uint16_t key)
bool bt_mesh_model_has_key(const struct bt_mesh_model *mod, uint16_t key)
{
int i;
@ -1310,14 +1312,14 @@ bool bt_mesh_model_has_key(struct bt_mesh_model *mod, uint16_t key)
return false;
}
static bool model_has_dst(struct bt_mesh_model *mod, uint16_t dst, const uint8_t *uuid)
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->elem_idx].addr == dst);
return (dev_comp->elem[*(mod->elem_idx)].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) ||
(BT_MESH_ADDR_IS_FIXED_GROUP(dst) && mod->elem_idx != 0)) {
(BT_MESH_ADDR_IS_FIXED_GROUP(dst) && *(mod->elem_idx) != 0)) {
return !!bt_mesh_model_find_group(&mod, dst);
}
@ -1325,17 +1327,17 @@ static bool model_has_dst(struct bt_mesh_model *mod, uint16_t dst, const uint8_t
* the lower layers have already confirmed that we are subscribing to
* it. All models on the primary element should receive the message.
*/
return mod->elem_idx == 0;
return *(mod->elem_idx) == 0;
}
static const struct bt_mesh_model_op *find_op(struct bt_mesh_elem *elem,
uint32_t opcode, struct bt_mesh_model **model)
uint32_t opcode, const struct bt_mesh_model **model)
{
uint8_t i;
uint8_t count;
/* This value shall not be used in shipping end products. */
uint32_t cid = UINT32_MAX;
struct bt_mesh_model *models;
const struct bt_mesh_model *models;
/* SIG models cannot contain 3-byte (vendor) OpCodes, and
* vendor models cannot contain SIG (1- or 2-byte) OpCodes, so
@ -1416,7 +1418,7 @@ static int element_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple
struct bt_mesh_elem *elem, uint32_t opcode)
{
const struct bt_mesh_model_op *op;
struct bt_mesh_model *model;
const struct bt_mesh_model *model;
struct net_buf_simple_state state;
int err;
@ -1502,7 +1504,7 @@ int bt_mesh_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf)
return err;
}
int bt_mesh_model_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
int bt_mesh_model_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *msg,
const struct bt_mesh_send_cb *cb, void *cb_data)
{
@ -1520,7 +1522,7 @@ int bt_mesh_model_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
return bt_mesh_access_send(ctx, msg, bt_mesh_model_elem(model)->addr, cb, cb_data);
}
int bt_mesh_model_publish(struct bt_mesh_model *model)
int bt_mesh_model_publish(const struct bt_mesh_model *model)
{
struct bt_mesh_model_pub *pub = model->pub;
@ -1560,7 +1562,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
return 0;
}
struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem,
const struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem,
uint16_t company, uint16_t id)
{
uint8_t i;
@ -1575,7 +1577,7 @@ struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem,
return NULL;
}
struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem,
const struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem,
uint16_t id)
{
uint8_t i;
@ -1594,8 +1596,8 @@ const struct bt_mesh_comp *bt_mesh_comp_get(void)
return dev_comp;
}
void bt_mesh_model_extensions_walk(struct bt_mesh_model *model,
enum bt_mesh_walk (*cb)(struct bt_mesh_model *mod,
void bt_mesh_model_extensions_walk(const struct bt_mesh_model *model,
enum bt_mesh_walk (*cb)(const struct bt_mesh_model *mod,
void *user_data),
void *user_data)
{
@ -1603,14 +1605,14 @@ void bt_mesh_model_extensions_walk(struct bt_mesh_model *model,
(void)cb(model, user_data);
return;
#else
struct bt_mesh_model *it;
const struct bt_mesh_model *it;
if (cb(model, user_data) == BT_MESH_WALK_STOP || !model->next) {
if (cb(model, user_data) == BT_MESH_WALK_STOP || !*(model->next)) {
return;
}
/* List is circular. Step through all models until we reach the start: */
for (it = model->next; it != model; it = it->next) {
for (it = *(model->next); it != model; it = *(it->next)) {
if (cb(it, user_data) == BT_MESH_WALK_STOP) {
return;
}
@ -1622,7 +1624,7 @@ void bt_mesh_model_extensions_walk(struct bt_mesh_model *model,
/* For vendor models, determine the offset within the model relation list
* by counting the number of standard SIG models in the associated element.
*/
static uint8_t get_sig_offset(struct bt_mesh_model *mod)
static uint8_t get_sig_offset(const struct bt_mesh_model *mod)
{
const struct bt_mesh_elem *elem = bt_mesh_model_elem(mod);
uint8_t i;
@ -1635,16 +1637,16 @@ static uint8_t get_sig_offset(struct bt_mesh_model *mod)
return 0;
}
static int mod_rel_register(struct bt_mesh_model *base,
struct bt_mesh_model *ext,
static int mod_rel_register(const struct bt_mesh_model *base,
const struct bt_mesh_model *ext,
uint8_t type)
{
LOG_DBG("");
struct mod_relation extension = {
base->elem_idx,
base->mod_idx + get_sig_offset(base),
ext->elem_idx,
ext->mod_idx + get_sig_offset(ext),
*(base->elem_idx),
*(base->mod_idx) + get_sig_offset(base),
*(ext->elem_idx),
*(ext->mod_idx) + get_sig_offset(ext),
type,
};
int i;
@ -1663,22 +1665,23 @@ static int mod_rel_register(struct bt_mesh_model *base,
return -ENOMEM;
}
int bt_mesh_model_extend(struct bt_mesh_model *extending_mod, struct bt_mesh_model *base_mod)
int bt_mesh_model_extend(const struct bt_mesh_model *extending_mod,
const struct bt_mesh_model *base_mod)
{
struct bt_mesh_model *a = extending_mod;
struct bt_mesh_model *b = base_mod;
struct bt_mesh_model *a_next = a->next;
struct bt_mesh_model *b_next = b->next;
struct bt_mesh_model *it;
const struct bt_mesh_model *a = extending_mod;
const struct bt_mesh_model *b = base_mod;
const struct bt_mesh_model *a_next = *(a->next);
const struct bt_mesh_model *b_next = *(b->next);
const struct bt_mesh_model *it;
base_mod->flags |= BT_MESH_MOD_EXTENDED;
*(base_mod->flags) |= BT_MESH_MOD_EXTENDED;
if (a == b) {
return 0;
}
/* Check if a's list contains b */
for (it = a; (it != NULL) && (it->next != a); it = it->next) {
for (it = a; (it != NULL) && (*(it->next) != a); it = *(it->next)) {
if (it == b) {
goto register_extension;
}
@ -1686,15 +1689,15 @@ int bt_mesh_model_extend(struct bt_mesh_model *extending_mod, struct bt_mesh_mod
/* Merge lists */
if (a_next) {
b->next = a_next;
*(b->next) = a_next;
} else {
b->next = a;
*(b->next) = a;
}
if (b_next) {
a->next = b_next;
*(a->next) = b_next;
} else {
a->next = b;
*(a->next) = b;
}
register_extension:
@ -1705,8 +1708,8 @@ register_extension:
return 0;
}
int bt_mesh_model_correspond(struct bt_mesh_model *corresponding_mod,
struct bt_mesh_model *base_mod)
int bt_mesh_model_correspond(const struct bt_mesh_model *corresponding_mod,
const struct bt_mesh_model *base_mod)
{
int i, err;
uint8_t cor_id = 0;
@ -1740,12 +1743,12 @@ int bt_mesh_model_correspond(struct bt_mesh_model *corresponding_mod,
}
#endif /* CONFIG_BT_MESH_MODEL_EXTENSIONS */
bool bt_mesh_model_is_extended(struct bt_mesh_model *model)
bool bt_mesh_model_is_extended(const struct bt_mesh_model *model)
{
return model->flags & BT_MESH_MOD_EXTENDED;
return *(model->flags) & BT_MESH_MOD_EXTENDED;
}
static int mod_set_bind(struct bt_mesh_model *mod, size_t len_rd,
static int mod_set_bind(const struct bt_mesh_model *mod, size_t len_rd,
settings_read_cb read_cb, void *cb_arg)
{
ssize_t len;
@ -1773,7 +1776,7 @@ static int mod_set_bind(struct bt_mesh_model *mod, size_t len_rd,
return 0;
}
static int mod_set_sub(struct bt_mesh_model *mod, size_t len_rd,
static int mod_set_sub(const struct bt_mesh_model *mod, size_t len_rd,
settings_read_cb read_cb, void *cb_arg)
{
size_t size = mod->groups_cnt * sizeof(mod->groups[0]);
@ -1820,7 +1823,7 @@ static int mod_set_sub(struct bt_mesh_model *mod, size_t len_rd,
return 0;
}
static int mod_set_sub_va(struct bt_mesh_model *mod, size_t len_rd,
static int mod_set_sub_va(const struct bt_mesh_model *mod, size_t len_rd,
settings_read_cb read_cb, void *cb_arg)
{
#if CONFIG_BT_MESH_LABEL_COUNT > 0
@ -1857,7 +1860,7 @@ static int mod_set_sub_va(struct bt_mesh_model *mod, size_t len_rd,
return 0;
}
static int mod_set_pub(struct bt_mesh_model *mod, size_t len_rd,
static int mod_set_pub(const struct bt_mesh_model *mod, size_t len_rd,
settings_read_cb read_cb, void *cb_arg)
{
struct mod_pub_val pub;
@ -1927,7 +1930,7 @@ pub_base_set:
return 0;
}
static int mod_data_set(struct bt_mesh_model *mod,
static int mod_data_set(const struct bt_mesh_model *mod,
const char *name, size_t len_rd,
settings_read_cb read_cb, void *cb_arg)
{
@ -1946,7 +1949,7 @@ static int mod_data_set(struct bt_mesh_model *mod,
static int mod_set(bool vnd, const char *name, size_t len_rd,
settings_read_cb read_cb, void *cb_arg)
{
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
uint8_t elem_idx, mod_idx;
uint16_t mod_key;
int len;
@ -2035,10 +2038,10 @@ static int comp_set(const char *name, size_t len_rd, settings_read_cb read_cb,
}
BT_MESH_SETTINGS_DEFINE(comp, "cmp", comp_set);
static void encode_mod_path(struct bt_mesh_model *mod, bool vnd,
static void encode_mod_path(const struct bt_mesh_model *mod, bool vnd,
const char *key, char *path, size_t path_len)
{
uint16_t mod_key = (((uint16_t)mod->elem_idx << 8) | mod->mod_idx);
uint16_t mod_key = (((uint16_t)*(mod->elem_idx) << 8) | *(mod->mod_idx));
if (vnd) {
snprintk(path, path_len, "bt/mesh/v/%x/%s", mod_key, key);
@ -2047,7 +2050,7 @@ static void encode_mod_path(struct bt_mesh_model *mod, bool vnd,
}
}
static void store_pending_mod_bind(struct bt_mesh_model *mod, bool vnd)
static void store_pending_mod_bind(const struct bt_mesh_model *mod, bool vnd)
{
uint16_t keys[CONFIG_BT_MESH_MODEL_KEY_COUNT];
char path[20];
@ -2075,7 +2078,7 @@ static void store_pending_mod_bind(struct bt_mesh_model *mod, bool vnd)
}
}
static void store_pending_mod_sub(struct bt_mesh_model *mod, bool vnd)
static void store_pending_mod_sub(const struct bt_mesh_model *mod, bool vnd)
{
uint16_t groups[CONFIG_BT_MESH_MODEL_GROUP_COUNT];
char path[20];
@ -2102,7 +2105,7 @@ static void store_pending_mod_sub(struct bt_mesh_model *mod, bool vnd)
}
}
static void store_pending_mod_sub_va(struct bt_mesh_model *mod, bool vnd)
static void store_pending_mod_sub_va(const struct bt_mesh_model *mod, bool vnd)
{
#if CONFIG_BT_MESH_LABEL_COUNT > 0
uint16_t uuidxs[CONFIG_BT_MESH_LABEL_COUNT];
@ -2134,7 +2137,7 @@ static void store_pending_mod_sub_va(struct bt_mesh_model *mod, bool vnd)
#endif /* CONFIG_BT_MESH_LABEL_COUNT > 0 */
}
static void store_pending_mod_pub(struct bt_mesh_model *mod, bool vnd)
static void store_pending_mod_pub(const struct bt_mesh_model *mod, bool vnd)
{
struct mod_pub_val pub = {0};
char path[20];
@ -2167,32 +2170,32 @@ static void store_pending_mod_pub(struct bt_mesh_model *mod, bool vnd)
}
}
static void store_pending_mod(struct bt_mesh_model *mod,
static void store_pending_mod(const struct bt_mesh_model *mod,
struct bt_mesh_elem *elem, bool vnd,
bool primary, void *user_data)
{
if (!mod->flags) {
if (!*(mod->flags)) {
return;
}
if (mod->flags & BT_MESH_MOD_BIND_PENDING) {
mod->flags &= ~BT_MESH_MOD_BIND_PENDING;
if (*(mod->flags) & BT_MESH_MOD_BIND_PENDING) {
*(mod->flags) &= ~BT_MESH_MOD_BIND_PENDING;
store_pending_mod_bind(mod, vnd);
}
if (mod->flags & BT_MESH_MOD_SUB_PENDING) {
mod->flags &= ~BT_MESH_MOD_SUB_PENDING;
if (*(mod->flags) & BT_MESH_MOD_SUB_PENDING) {
*(mod->flags) &= ~BT_MESH_MOD_SUB_PENDING;
store_pending_mod_sub(mod, vnd);
store_pending_mod_sub_va(mod, vnd);
}
if (mod->flags & BT_MESH_MOD_PUB_PENDING) {
mod->flags &= ~BT_MESH_MOD_PUB_PENDING;
if (*(mod->flags) & BT_MESH_MOD_PUB_PENDING) {
*(mod->flags) &= ~BT_MESH_MOD_PUB_PENDING;
store_pending_mod_pub(mod, vnd);
}
if (mod->flags & BT_MESH_MOD_DATA_PENDING) {
mod->flags &= ~BT_MESH_MOD_DATA_PENDING;
if (*(mod->flags) & BT_MESH_MOD_DATA_PENDING) {
*(mod->flags) &= ~BT_MESH_MOD_DATA_PENDING;
mod->cb->pending_store(mod);
}
}
@ -2202,21 +2205,21 @@ void bt_mesh_model_pending_store(void)
bt_mesh_model_foreach(store_pending_mod, NULL);
}
void bt_mesh_model_bind_store(struct bt_mesh_model *mod)
void bt_mesh_model_bind_store(const struct bt_mesh_model *mod)
{
mod->flags |= BT_MESH_MOD_BIND_PENDING;
*(mod->flags) |= BT_MESH_MOD_BIND_PENDING;
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_MOD_PENDING);
}
void bt_mesh_model_sub_store(struct bt_mesh_model *mod)
void bt_mesh_model_sub_store(const struct bt_mesh_model *mod)
{
mod->flags |= BT_MESH_MOD_SUB_PENDING;
*(mod->flags) |= BT_MESH_MOD_SUB_PENDING;
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_MOD_PENDING);
}
void bt_mesh_model_pub_store(struct bt_mesh_model *mod)
void bt_mesh_model_pub_store(const struct bt_mesh_model *mod)
{
mod->flags |= BT_MESH_MOD_PUB_PENDING;
*(mod->flags) |= BT_MESH_MOD_PUB_PENDING;
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_MOD_PENDING);
}
@ -2401,7 +2404,7 @@ int bt_mesh_comp_read(struct net_buf_simple *buf, uint8_t page)
return 0;
}
int bt_mesh_model_data_store(struct bt_mesh_model *mod, bool vnd,
int bt_mesh_model_data_store(const struct bt_mesh_model *mod, bool vnd,
const char *name, const void *data,
size_t data_len)
{
@ -2550,7 +2553,7 @@ int bt_mesh_models_metadata_change_prepare(void)
#endif
}
static void commit_mod(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
static void commit_mod(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
bool vnd, bool primary, void *user_data)
{
if (mod->pub && mod->pub->update &&
@ -2579,9 +2582,9 @@ void bt_mesh_model_settings_commit(void)
bt_mesh_model_foreach(commit_mod, NULL);
}
void bt_mesh_model_data_store_schedule(struct bt_mesh_model *mod)
void bt_mesh_model_data_store_schedule(const struct bt_mesh_model *mod)
{
mod->flags |= BT_MESH_MOD_DATA_PENDING;
*(mod->flags) |= BT_MESH_MOD_DATA_PENDING;
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_MOD_PENDING);
}

View file

@ -32,23 +32,23 @@ int bt_mesh_metadata_get_page_0(struct net_buf_simple *buf, size_t offset);
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(struct bt_mesh_model *mod, uint16_t key);
bool bt_mesh_model_has_key(const struct bt_mesh_model *mod, uint16_t key);
void bt_mesh_model_extensions_walk(struct bt_mesh_model *root,
enum bt_mesh_walk (*cb)(struct bt_mesh_model *mod,
void bt_mesh_model_extensions_walk(const struct bt_mesh_model *root,
enum bt_mesh_walk (*cb)(const struct bt_mesh_model *mod,
void *user_data),
void *user_data);
uint16_t *bt_mesh_model_find_group(struct bt_mesh_model **mod, uint16_t addr);
const uint8_t **bt_mesh_model_find_uuid(struct bt_mesh_model **mod, const uint8_t *uuid);
uint16_t *bt_mesh_model_find_group(const struct bt_mesh_model **mod, uint16_t addr);
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)(struct bt_mesh_model *mod,
void bt_mesh_model_foreach(void (*func)(const struct bt_mesh_model *mod,
struct bt_mesh_elem *elem,
bool vnd, bool primary,
void *user_data),
void *user_data);
int32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod);
int32_t bt_mesh_model_pub_period_get(const struct bt_mesh_model *mod);
void bt_mesh_comp_provision(uint16_t addr);
void bt_mesh_comp_unprovision(void);
@ -57,7 +57,7 @@ uint16_t bt_mesh_primary_addr(void);
const struct bt_mesh_comp *bt_mesh_comp_get(void);
struct bt_mesh_model *bt_mesh_model_get(bool vnd, uint8_t elem_idx, uint8_t mod_idx);
const struct bt_mesh_model *bt_mesh_model_get(bool vnd, uint8_t elem_idx, uint8_t mod_idx);
int bt_mesh_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf);
@ -74,9 +74,9 @@ void bt_mesh_comp_data_clear(void);
int bt_mesh_comp_data_get_page(struct net_buf_simple *buf, size_t page, size_t offset);
void bt_mesh_model_pending_store(void);
void bt_mesh_model_bind_store(struct bt_mesh_model *mod);
void bt_mesh_model_sub_store(struct bt_mesh_model *mod);
void bt_mesh_model_pub_store(struct bt_mesh_model *mod);
void bt_mesh_model_bind_store(const struct bt_mesh_model *mod);
void bt_mesh_model_sub_store(const struct bt_mesh_model *mod);
void bt_mesh_model_pub_store(const struct bt_mesh_model *mod);
void bt_mesh_model_settings_commit(void);
/** @brief Register a callback function hook for mesh model messages.

View file

@ -1204,10 +1204,10 @@ static void rx_block_status(struct bt_mesh_blob_cli *cli,
blob_cli_broadcast_rsp(cli, target);
}
static int handle_xfer_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_xfer_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_cli *cli = mod->user_data;
struct bt_mesh_blob_cli *cli = *(mod->user_data);
enum bt_mesh_blob_xfer_phase expected_phase;
struct bt_mesh_blob_target *target;
struct bt_mesh_blob_xfer_info info = { 0 };
@ -1276,10 +1276,10 @@ static int handle_xfer_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
return 0;
}
static int handle_block_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_block_report(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_cli *cli = mod->user_data;
struct bt_mesh_blob_cli *cli = *(mod->user_data);
struct block_status status = {
.status = BT_MESH_BLOB_SUCCESS,
.block.number = cli->block.number,
@ -1330,10 +1330,10 @@ static int handle_block_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
return 0;
}
static int handle_block_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_block_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_cli *cli = mod->user_data;
struct bt_mesh_blob_cli *cli = *(mod->user_data);
struct bt_mesh_blob_target *target;
struct block_status status = { 0 };
uint8_t status_and_format;
@ -1401,10 +1401,10 @@ static int handle_block_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
return 0;
}
static int handle_info_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_info_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_cli *cli = mod->user_data;
struct bt_mesh_blob_cli *cli = *(mod->user_data);
struct bt_mesh_blob_cli_caps caps;
enum bt_mesh_blob_status status;
struct bt_mesh_blob_target *target;
@ -1458,9 +1458,9 @@ const struct bt_mesh_model_op _bt_mesh_blob_cli_op[] = {
BT_MESH_MODEL_OP_END,
};
static int blob_cli_init(struct bt_mesh_model *mod)
static int blob_cli_init(const struct bt_mesh_model *mod)
{
struct bt_mesh_blob_cli *cli = mod->user_data;
struct bt_mesh_blob_cli *cli = *(mod->user_data);
cli->mod = mod;
@ -1471,9 +1471,9 @@ static int blob_cli_init(struct bt_mesh_model *mod)
return 0;
}
static void blob_cli_reset(struct bt_mesh_model *mod)
static void blob_cli_reset(const struct bt_mesh_model *mod)
{
struct bt_mesh_blob_cli *cli = mod->user_data;
struct bt_mesh_blob_cli *cli = *(mod->user_data);
cli_state_reset(cli);
}

View file

@ -415,10 +415,10 @@ static void block_status_rsp(struct bt_mesh_blob_srv *srv,
(void)bt_mesh_model_send(srv->mod, ctx, &buf, NULL, NULL);
}
static int handle_xfer_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_xfer_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
LOG_DBG("");
@ -435,10 +435,10 @@ static int handle_xfer_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ct
return 0;
}
static int handle_xfer_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_xfer_start(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
enum bt_mesh_blob_status status;
enum bt_mesh_blob_xfer_mode mode;
uint64_t id;
@ -566,11 +566,11 @@ rsp:
return 0;
}
static int handle_xfer_cancel(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_xfer_cancel(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
enum bt_mesh_blob_status status = BT_MESH_BLOB_SUCCESS;
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
uint64_t id;
id = net_buf_simple_pull_le64(buf);
@ -594,11 +594,11 @@ rsp:
return 0;
}
static int handle_block_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_block_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
enum bt_mesh_blob_status status;
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
switch (srv->phase) {
case BT_MESH_BLOB_XFER_PHASE_WAITING_FOR_BLOCK:
@ -625,10 +625,10 @@ static int handle_block_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *c
return 0;
}
static int handle_block_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_block_start(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
enum bt_mesh_blob_status status;
uint16_t block_number, chunk_size;
int err;
@ -720,10 +720,10 @@ rsp:
return 0;
}
static int handle_chunk(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_chunk(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
struct bt_mesh_blob_chunk chunk;
size_t expected_size = 0;
uint16_t idx;
@ -810,10 +810,10 @@ static int handle_chunk(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
return 0;
}
static int handle_info_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_info_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
LOG_DBG("");
@ -847,9 +847,9 @@ const struct bt_mesh_model_op _bt_mesh_blob_srv_op[] = {
BT_MESH_MODEL_OP_END,
};
static int blob_srv_init(struct bt_mesh_model *mod)
static int blob_srv_init(const struct bt_mesh_model *mod)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
srv->mod = mod;
srv->state.ttl = BT_MESH_TTL_DEFAULT;
@ -861,11 +861,11 @@ static int blob_srv_init(struct bt_mesh_model *mod)
return 0;
}
static int blob_srv_settings_set(struct bt_mesh_model *mod, const char *name,
static int blob_srv_settings_set(const struct bt_mesh_model *mod, const char *name,
size_t len_rd, settings_read_cb read_cb,
void *cb_arg)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
ssize_t len;
if (len_rd < offsetof(struct bt_mesh_blob_srv_state, blocks)) {
@ -903,9 +903,9 @@ static int blob_srv_settings_set(struct bt_mesh_model *mod, const char *name,
return 0;
}
static int blob_srv_start(struct bt_mesh_model *mod)
static int blob_srv_start(const struct bt_mesh_model *mod)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
int err = -ENOTSUP;
if (srv->phase == BT_MESH_BLOB_XFER_PHASE_INACTIVE) {
@ -931,9 +931,9 @@ static int blob_srv_start(struct bt_mesh_model *mod)
return 0;
}
static void blob_srv_reset(struct bt_mesh_model *mod)
static void blob_srv_reset(const struct bt_mesh_model *mod)
{
struct bt_mesh_blob_srv *srv = mod->user_data;
struct bt_mesh_blob_srv *srv = *(mod->user_data);
phase_set(srv, BT_MESH_BLOB_XFER_PHASE_INACTIVE);
srv->state.xfer.mode = BT_MESH_BLOB_XFER_MODE_NONE;

View file

@ -48,7 +48,7 @@ static int32_t msg_timeout;
static struct bt_mesh_cfg_cli *cli;
static int comp_data_status(struct bt_mesh_model *model,
static int comp_data_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -85,7 +85,7 @@ static int comp_data_status(struct bt_mesh_model *model,
return 0;
}
static uint8_t state_status_u8(struct bt_mesh_model *model,
static uint8_t state_status_u8(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf,
uint32_t expect_status)
@ -111,7 +111,7 @@ static uint8_t state_status_u8(struct bt_mesh_model *model,
return status;
}
static int beacon_status(struct bt_mesh_model *model,
static int beacon_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -126,7 +126,7 @@ static int beacon_status(struct bt_mesh_model *model,
return 0;
}
static int ttl_status(struct bt_mesh_model *model,
static int ttl_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -141,7 +141,7 @@ static int ttl_status(struct bt_mesh_model *model,
return 0;
}
static int friend_status(struct bt_mesh_model *model,
static int friend_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -156,7 +156,7 @@ static int friend_status(struct bt_mesh_model *model,
return 0;
}
static int gatt_proxy_status(struct bt_mesh_model *model,
static int gatt_proxy_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -178,7 +178,7 @@ struct krp_param {
uint8_t *phase;
};
static int krp_status(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int krp_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
int err = 0;
@ -223,7 +223,7 @@ struct relay_param {
uint8_t *transmit;
};
static int relay_status(struct bt_mesh_model *model,
static int relay_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -257,7 +257,7 @@ static int relay_status(struct bt_mesh_model *model,
return 0;
}
static int net_transmit_status(struct bt_mesh_model *model,
static int net_transmit_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -277,7 +277,7 @@ struct net_key_param {
uint16_t net_idx;
};
static int net_key_status(struct bt_mesh_model *model,
static int net_key_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -345,7 +345,7 @@ int bt_mesh_key_idx_unpack_list(struct net_buf_simple *buf, uint16_t *dst_arr,
return buf->len > 0 ? -EMSGSIZE : 0;
}
static int net_key_list(struct bt_mesh_model *model,
static int net_key_list(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -381,7 +381,7 @@ done:
return err;
}
static int node_reset_status(struct bt_mesh_model *model,
static int node_reset_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -412,7 +412,7 @@ struct app_key_param {
uint16_t app_idx;
};
static int app_key_status(struct bt_mesh_model *model,
static int app_key_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -461,7 +461,7 @@ struct app_key_list_param {
size_t *key_cnt;
};
static int app_key_list(struct bt_mesh_model *model,
static int app_key_list(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -521,7 +521,7 @@ struct mod_app_param {
uint16_t cid;
};
static int mod_app_status(struct bt_mesh_model *model,
static int mod_app_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -695,7 +695,7 @@ done:
return err;
}
static int mod_app_list(struct bt_mesh_model *model,
static int mod_app_list(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf)
{
LOG_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", ctx->net_idx, ctx->app_idx,
@ -704,7 +704,7 @@ static int mod_app_list(struct bt_mesh_model *model,
return mod_app_list_handle(ctx, buf, OP_SIG_MOD_APP_LIST, false);
}
static int mod_app_list_vnd(struct bt_mesh_model *model,
static int mod_app_list_vnd(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -722,7 +722,7 @@ struct mod_pub_param {
struct bt_mesh_cfg_cli_mod_pub *pub;
};
static int mod_pub_status(struct bt_mesh_model *model,
static int mod_pub_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -807,7 +807,7 @@ struct mod_sub_param {
uint16_t cid;
};
static int mod_sub_status(struct bt_mesh_model *model,
static int mod_sub_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -866,7 +866,7 @@ done:
return err;
}
static int mod_sub_list(struct bt_mesh_model *model,
static int mod_sub_list(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf)
{
LOG_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", ctx->net_idx, ctx->app_idx,
@ -875,7 +875,7 @@ static int mod_sub_list(struct bt_mesh_model *model,
return mod_sub_list_handle(ctx, buf, OP_MOD_SUB_LIST, false);
}
static int mod_sub_list_vnd(struct bt_mesh_model *model,
static int mod_sub_list_vnd(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -890,7 +890,7 @@ struct hb_sub_param {
struct bt_mesh_cfg_cli_hb_sub *sub;
};
static int hb_sub_status(struct bt_mesh_model *model,
static int hb_sub_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -934,7 +934,7 @@ struct hb_pub_param {
struct bt_mesh_cfg_cli_hb_pub *pub;
};
static int hb_pub_status(struct bt_mesh_model *model,
static int hb_pub_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -979,7 +979,7 @@ struct node_idt_param {
uint8_t *identity;
};
static int node_identity_status(struct bt_mesh_model *model,
static int node_identity_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -1020,7 +1020,7 @@ struct lpn_timeout_param {
int32_t *polltimeout;
};
static int lpn_timeout_status(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int lpn_timeout_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct lpn_timeout_param *param;
@ -1087,19 +1087,19 @@ const struct bt_mesh_model_op bt_mesh_cfg_cli_op[] = {
BT_MESH_MODEL_OP_END,
};
static int cfg_cli_init(struct bt_mesh_model *model)
static int cfg_cli_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("Configuration Client only allowed in primary element");
return -EINVAL;
}
if (!model->user_data) {
if (!*(model->user_data)) {
LOG_ERR("No Configuration Client context provided");
return -EINVAL;
}
cli = model->user_data;
cli = *(model->user_data);
cli->model = model;
msg_timeout = CONFIG_BT_MESH_CFG_CLI_TIMEOUT;
@ -1108,7 +1108,7 @@ static int cfg_cli_init(struct bt_mesh_model *model)
* and remote keys are allowed to access this model.
*/
model->keys[0] = BT_MESH_KEY_DEV_ANY;
model->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(model->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
bt_mesh_msg_ack_ctx_init(&cli->ack_ctx);

View file

@ -48,7 +48,7 @@ static void node_reset_pending_handler(struct k_work *work)
static K_WORK_DEFINE(node_reset_pending, node_reset_pending_handler);
static int dev_comp_data_get(struct bt_mesh_model *model,
static int dev_comp_data_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -86,7 +86,7 @@ static int dev_comp_data_get(struct bt_mesh_model *model,
return err;
}
static struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
static const struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
struct net_buf_simple *buf, bool *vnd)
{
if (buf->len < 4) {
@ -113,9 +113,9 @@ static struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
}
}
static uint8_t _mod_pub_set(struct bt_mesh_model *model, uint16_t pub_addr, const uint8_t *uuid,
uint16_t app_idx, uint8_t cred_flag, uint8_t ttl, uint8_t period,
uint8_t retransmit, bool store)
static uint8_t _mod_pub_set(const struct bt_mesh_model *model, uint16_t pub_addr,
const uint8_t *uuid, uint16_t app_idx, uint8_t cred_flag,
uint8_t ttl, uint8_t period, uint8_t retransmit, bool store)
{
if (!model->pub) {
return STATUS_NVAL_PUB_PARAM;
@ -199,7 +199,7 @@ static uint8_t _mod_pub_set(struct bt_mesh_model *model, uint16_t pub_addr, cons
return STATUS_SUCCESS;
}
static uint8_t mod_bind(struct bt_mesh_model *model, uint16_t key_idx)
static uint8_t mod_bind(const struct bt_mesh_model *model, uint16_t key_idx)
{
int i;
@ -232,7 +232,7 @@ static uint8_t mod_bind(struct bt_mesh_model *model, uint16_t key_idx)
return STATUS_INSUFF_RESOURCES;
}
static uint8_t mod_unbind(struct bt_mesh_model *model, uint16_t key_idx, bool store)
static uint8_t mod_unbind(const struct bt_mesh_model *model, uint16_t key_idx, bool store)
{
int i;
@ -284,7 +284,7 @@ static void key_idx_pack_list(struct net_buf_simple *buf, uint16_t *arr, size_t
}
static int send_app_key_status(struct bt_mesh_model *model,
static int send_app_key_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
uint8_t status,
uint16_t app_idx, uint16_t net_idx)
@ -302,7 +302,7 @@ static int send_app_key_status(struct bt_mesh_model *model,
return 0;
}
static int app_key_add(struct bt_mesh_model *model,
static int app_key_add(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -318,7 +318,7 @@ static int app_key_add(struct bt_mesh_model *model,
return send_app_key_status(model, ctx, status, key_app_idx, key_net_idx);
}
static int app_key_update(struct bt_mesh_model *model,
static int app_key_update(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -335,7 +335,7 @@ static int app_key_update(struct bt_mesh_model *model,
return send_app_key_status(model, ctx, status, key_app_idx, key_net_idx);
}
static void mod_app_key_del(struct bt_mesh_model *mod,
static void mod_app_key_del(const struct bt_mesh_model *mod,
struct bt_mesh_elem *elem, bool vnd, bool primary,
void *user_data)
{
@ -354,7 +354,7 @@ static void app_key_evt(uint16_t app_idx, uint16_t net_idx,
BT_MESH_APP_KEY_CB_DEFINE(app_key_evt);
static int app_key_del(struct bt_mesh_model *model,
static int app_key_del(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -373,7 +373,7 @@ static int app_key_del(struct bt_mesh_model *model,
/* Index list length: 3 bytes for every pair and 2 bytes for an odd idx */
#define IDX_LEN(num) (((num) / 2) * 3 + ((num) % 2) * 2)
static int app_key_get(struct bt_mesh_model *model,
static int app_key_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -422,7 +422,7 @@ send_status:
return 0;
}
static int beacon_get(struct bt_mesh_model *model,
static int beacon_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -441,7 +441,7 @@ static int beacon_get(struct bt_mesh_model *model,
return 0;
}
static int beacon_set(struct bt_mesh_model *model,
static int beacon_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -467,7 +467,7 @@ static int beacon_set(struct bt_mesh_model *model,
return 0;
}
static int default_ttl_get(struct bt_mesh_model *model,
static int default_ttl_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -486,7 +486,7 @@ static int default_ttl_get(struct bt_mesh_model *model,
return 0;
}
static int default_ttl_set(struct bt_mesh_model *model,
static int default_ttl_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -512,7 +512,7 @@ static int default_ttl_set(struct bt_mesh_model *model,
return 0;
}
static int send_gatt_proxy_status(struct bt_mesh_model *model,
static int send_gatt_proxy_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_GATT_PROXY_STATUS, 1);
@ -527,7 +527,7 @@ static int send_gatt_proxy_status(struct bt_mesh_model *model,
return 0;
}
static int gatt_proxy_get(struct bt_mesh_model *model,
static int gatt_proxy_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -537,7 +537,7 @@ static int gatt_proxy_get(struct bt_mesh_model *model,
return send_gatt_proxy_status(model, ctx);
}
static int gatt_proxy_set(struct bt_mesh_model *model,
static int gatt_proxy_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -561,7 +561,7 @@ static int gatt_proxy_set(struct bt_mesh_model *model,
return send_gatt_proxy_status(model, ctx);
}
static int net_transmit_get(struct bt_mesh_model *model,
static int net_transmit_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -580,7 +580,7 @@ static int net_transmit_get(struct bt_mesh_model *model,
return 0;
}
static int net_transmit_set(struct bt_mesh_model *model,
static int net_transmit_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -604,7 +604,7 @@ static int net_transmit_set(struct bt_mesh_model *model,
return 0;
}
static int relay_get(struct bt_mesh_model *model,
static int relay_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -624,7 +624,7 @@ static int relay_get(struct bt_mesh_model *model,
return 0;
}
static int relay_set(struct bt_mesh_model *model,
static int relay_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -651,10 +651,10 @@ static int relay_set(struct bt_mesh_model *model,
return 0;
}
static int send_mod_pub_status(struct bt_mesh_model *cfg_mod,
static int send_mod_pub_status(const struct bt_mesh_model *cfg_mod,
struct bt_mesh_msg_ctx *ctx, uint16_t elem_addr,
uint16_t pub_addr, bool vnd,
struct bt_mesh_model *mod, uint8_t status,
const struct bt_mesh_model *mod, uint8_t status,
uint8_t *mod_id)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_STATUS, 14);
@ -691,11 +691,11 @@ static int send_mod_pub_status(struct bt_mesh_model *cfg_mod,
return 0;
}
static int mod_pub_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int mod_pub_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
uint16_t elem_addr, pub_addr = 0U;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint8_t *mod_id, status;
bool vnd;
@ -742,13 +742,13 @@ send_status:
status, mod_id);
}
static int mod_pub_set(struct bt_mesh_model *model,
static int mod_pub_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
uint8_t retransmit, status, pub_ttl, pub_period, cred_flag;
uint16_t elem_addr, pub_addr, pub_app_idx;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint8_t *mod_id;
bool vnd;
@ -807,7 +807,7 @@ send_status:
status, mod_id);
}
static size_t mod_sub_list_clear(struct bt_mesh_model *mod)
static size_t mod_sub_list_clear(const struct bt_mesh_model *mod)
{
size_t clear_count;
int i;
@ -838,7 +838,7 @@ static size_t mod_sub_list_clear(struct bt_mesh_model *mod)
return clear_count;
}
static int mod_pub_va_set(struct bt_mesh_model *model,
static int mod_pub_va_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -846,7 +846,7 @@ static int mod_pub_va_set(struct bt_mesh_model *model,
uint8_t retransmit, status, pub_ttl, pub_period, cred_flag;
uint16_t elem_addr, pub_app_idx;
uint16_t pub_addr = 0U;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
const uint8_t *uuid;
uint8_t *mod_id;
@ -915,7 +915,7 @@ send_status:
status, mod_id);
}
static int send_mod_sub_status(struct bt_mesh_model *model,
static int send_mod_sub_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, uint8_t status,
uint16_t elem_addr, uint16_t sub_addr, uint8_t *mod_id,
bool vnd)
@ -943,12 +943,12 @@ static int send_mod_sub_status(struct bt_mesh_model *model,
return 0;
}
static int mod_sub_add(struct bt_mesh_model *model,
static int mod_sub_add(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
uint16_t elem_addr, sub_addr;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint8_t *mod_id;
uint8_t status;
@ -1021,12 +1021,12 @@ send_status:
mod_id, vnd);
}
static int mod_sub_del(struct bt_mesh_model *model,
static int mod_sub_del(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
uint16_t elem_addr, sub_addr;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint8_t *mod_id;
uint16_t *match;
@ -1092,7 +1092,7 @@ send_status:
mod_id, vnd);
}
static enum bt_mesh_walk mod_sub_clear_visitor(struct bt_mesh_model *mod, void *user_data)
static enum bt_mesh_walk mod_sub_clear_visitor(const struct bt_mesh_model *mod, void *user_data)
{
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) {
bt_mesh_lpn_group_del(mod->groups, mod->groups_cnt);
@ -1103,12 +1103,12 @@ static enum bt_mesh_walk mod_sub_clear_visitor(struct bt_mesh_model *mod, void *
return BT_MESH_WALK_CONTINUE;
}
static int mod_sub_overwrite(struct bt_mesh_model *model,
static int mod_sub_overwrite(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
uint16_t elem_addr, sub_addr;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint8_t *mod_id;
uint8_t status;
@ -1174,11 +1174,11 @@ send_status:
mod_id, vnd);
}
static int mod_sub_del_all(struct bt_mesh_model *model,
static int mod_sub_del_all(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint16_t elem_addr;
uint8_t *mod_id;
@ -1232,13 +1232,13 @@ struct mod_sub_list_ctx {
struct net_buf_simple *msg;
};
static enum bt_mesh_walk mod_sub_list_visitor(struct bt_mesh_model *mod, void *ctx)
static enum bt_mesh_walk mod_sub_list_visitor(const struct bt_mesh_model *mod, void *ctx)
{
struct mod_sub_list_ctx *visit = ctx;
int count = 0;
int i;
if (mod->elem_idx != visit->elem_idx) {
if (*(mod->elem_idx) != visit->elem_idx) {
return BT_MESH_WALK_CONTINUE;
}
@ -1257,18 +1257,18 @@ static enum bt_mesh_walk mod_sub_list_visitor(struct bt_mesh_model *mod, void *c
count++;
}
LOG_DBG("sublist: model %u:%x: %u groups", mod->elem_idx, mod->id, count);
LOG_DBG("sublist: model %u:%x: %u groups", *(mod->elem_idx), mod->id, count);
return BT_MESH_WALK_CONTINUE;
}
static int mod_sub_get(struct bt_mesh_model *model,
static int mod_sub_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
NET_BUF_SIMPLE_DEFINE(msg, BT_MESH_TX_SDU_MAX);
struct mod_sub_list_ctx visit_ctx;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint16_t addr, id;
@ -1306,7 +1306,7 @@ static int mod_sub_get(struct bt_mesh_model *model,
net_buf_simple_add_le16(&msg, id);
visit_ctx.msg = &msg;
visit_ctx.elem_idx = mod->elem_idx;
visit_ctx.elem_idx = *(mod->elem_idx);
bt_mesh_model_extensions_walk(mod, mod_sub_list_visitor, &visit_ctx);
send_list:
@ -1317,13 +1317,13 @@ send_list:
return 0;
}
static int mod_sub_get_vnd(struct bt_mesh_model *model,
static int mod_sub_get_vnd(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
NET_BUF_SIMPLE_DEFINE(msg, BT_MESH_TX_SDU_MAX);
struct mod_sub_list_ctx visit_ctx;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint16_t company, addr, id;
@ -1365,7 +1365,7 @@ static int mod_sub_get_vnd(struct bt_mesh_model *model,
net_buf_simple_add_le16(&msg, id);
visit_ctx.msg = &msg;
visit_ctx.elem_idx = mod->elem_idx;
visit_ctx.elem_idx = *(mod->elem_idx);
bt_mesh_model_extensions_walk(mod, mod_sub_list_visitor, &visit_ctx);
send_list:
@ -1376,13 +1376,13 @@ send_list:
return 0;
}
static int mod_sub_va_add(struct bt_mesh_model *model,
static int mod_sub_va_add(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
const struct bt_mesh_va *va;
uint16_t elem_addr, sub_addr = BT_MESH_ADDR_UNASSIGNED;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
const uint8_t *uuid;
uint8_t *mod_id;
@ -1478,13 +1478,13 @@ send_status:
mod_id, vnd);
}
static int mod_sub_va_del(struct bt_mesh_model *model,
static int mod_sub_va_del(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
const struct bt_mesh_va *va;
uint16_t elem_addr, sub_addr = BT_MESH_ADDR_UNASSIGNED;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
const uint8_t *uuid;
uint8_t *mod_id;
@ -1562,13 +1562,13 @@ send_status:
mod_id, vnd);
}
static int mod_sub_va_overwrite(struct bt_mesh_model *model,
static int mod_sub_va_overwrite(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
const struct bt_mesh_va *va;
uint16_t elem_addr, sub_addr = BT_MESH_ADDR_UNASSIGNED;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
const uint8_t *uuid;
uint8_t *mod_id;
@ -1638,7 +1638,7 @@ send_status:
mod_id, vnd);
}
static int send_net_key_status(struct bt_mesh_model *model,
static int send_net_key_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, uint16_t idx,
uint8_t status)
{
@ -1656,7 +1656,7 @@ static int send_net_key_status(struct bt_mesh_model *model,
return 0;
}
static int net_key_add(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int net_key_add(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
uint8_t status;
@ -1675,7 +1675,7 @@ static int net_key_add(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
return send_net_key_status(model, ctx, idx, status);
}
static int net_key_update(struct bt_mesh_model *model,
static int net_key_update(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -1693,7 +1693,7 @@ static int net_key_update(struct bt_mesh_model *model,
return send_net_key_status(model, ctx, idx, status);
}
static int net_key_del(struct bt_mesh_model *model,
static int net_key_del(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -1720,7 +1720,7 @@ static int net_key_del(struct bt_mesh_model *model,
return send_net_key_status(model, ctx, del_idx, STATUS_SUCCESS);
}
static int net_key_get(struct bt_mesh_model *model,
static int net_key_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -1745,7 +1745,7 @@ static int net_key_get(struct bt_mesh_model *model,
return 0;
}
static int send_node_id_status(struct bt_mesh_model *model,
static int send_node_id_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
uint8_t status,
uint16_t net_idx, uint8_t node_id)
@ -1764,7 +1764,7 @@ static int send_node_id_status(struct bt_mesh_model *model,
return 0;
}
static int node_identity_get(struct bt_mesh_model *model,
static int node_identity_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -1786,7 +1786,7 @@ static int node_identity_get(struct bt_mesh_model *model,
return send_node_id_status(model, ctx, status, idx, node_id);
}
static int node_identity_set(struct bt_mesh_model *model,
static int node_identity_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -1824,7 +1824,7 @@ static int node_identity_set(struct bt_mesh_model *model,
}
static void create_mod_app_status(struct net_buf_simple *msg,
struct bt_mesh_model *mod, bool vnd,
const struct bt_mesh_model *mod, bool vnd,
uint16_t elem_addr, uint16_t app_idx,
uint8_t status, uint8_t *mod_id)
{
@ -1841,13 +1841,13 @@ static void create_mod_app_status(struct net_buf_simple *msg,
}
}
static int mod_app_bind(struct bt_mesh_model *model,
static int mod_app_bind(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_STATUS, 9);
uint16_t elem_addr, key_app_idx;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint8_t *mod_id, status;
bool vnd;
@ -1881,7 +1881,7 @@ static int mod_app_bind(struct bt_mesh_model *model,
}
/* Some models only allow device key based access */
if (mod->flags & BT_MESH_MOD_DEVKEY_ONLY) {
if (*(mod->flags) & BT_MESH_MOD_DEVKEY_ONLY) {
LOG_ERR("Client tried to bind AppKey to DevKey based model");
status = STATUS_CANNOT_BIND;
goto send_status;
@ -1905,13 +1905,13 @@ send_status:
return 0;
}
static int mod_app_unbind(struct bt_mesh_model *model,
static int mod_app_unbind(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_STATUS, 9);
uint16_t elem_addr, key_app_idx;
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint8_t *mod_id, status;
bool vnd;
@ -1964,7 +1964,7 @@ send_status:
#define KEY_LIST_LEN (CONFIG_BT_MESH_MODEL_KEY_COUNT * 2)
static int mod_app_get(struct bt_mesh_model *model,
static int mod_app_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -1973,7 +1973,7 @@ static int mod_app_get(struct bt_mesh_model *model,
9 + KEY_LIST_LEN),
BT_MESH_MODEL_BUF_LEN(OP_SIG_MOD_APP_LIST,
9 + KEY_LIST_LEN)));
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
struct bt_mesh_elem *elem;
uint8_t *mod_id, status;
uint16_t elem_addr;
@ -2050,7 +2050,7 @@ static void reset_send_end(int err, void *cb_data)
k_work_submit(&node_reset_pending);
}
static int node_reset(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int node_reset(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
static const struct bt_mesh_send_cb reset_cb = {
@ -2072,7 +2072,7 @@ static int node_reset(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
return 0;
}
static int send_friend_status(struct bt_mesh_model *model,
static int send_friend_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_FRIEND_STATUS, 1);
@ -2087,7 +2087,7 @@ static int send_friend_status(struct bt_mesh_model *model,
return 0;
}
static int friend_get(struct bt_mesh_model *model,
static int friend_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -2097,7 +2097,7 @@ static int friend_get(struct bt_mesh_model *model,
return send_friend_status(model, ctx);
}
static int friend_set(struct bt_mesh_model *model,
static int friend_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -2114,7 +2114,7 @@ static int friend_set(struct bt_mesh_model *model,
return send_friend_status(model, ctx);
}
static int lpn_timeout_get(struct bt_mesh_model *model,
static int lpn_timeout_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -2160,7 +2160,7 @@ send_rsp:
return 0;
}
static int send_krp_status(struct bt_mesh_model *model,
static int send_krp_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, uint16_t idx,
uint8_t phase, uint8_t status)
{
@ -2179,7 +2179,7 @@ static int send_krp_status(struct bt_mesh_model *model,
return 0;
}
static int krp_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int krp_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
uint8_t kr_phase, status;
@ -2198,7 +2198,7 @@ static int krp_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
return send_krp_status(model, ctx, idx, kr_phase, status);
}
static int krp_set(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int krp_set(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
uint8_t phase, status;
@ -2254,7 +2254,7 @@ struct hb_pub_param {
uint16_t net_idx;
} __packed;
static int hb_pub_send_status(struct bt_mesh_model *model,
static int hb_pub_send_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, uint8_t status,
const struct bt_mesh_hb_pub *pub)
{
@ -2284,7 +2284,7 @@ static int hb_pub_send_status(struct bt_mesh_model *model,
return 0;
}
static int heartbeat_pub_get(struct bt_mesh_model *model,
static int heartbeat_pub_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -2297,7 +2297,7 @@ static int heartbeat_pub_get(struct bt_mesh_model *model,
return hb_pub_send_status(model, ctx, STATUS_SUCCESS, &pub);
}
static int heartbeat_pub_set(struct bt_mesh_model *model,
static int heartbeat_pub_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -2357,7 +2357,7 @@ rsp:
return hb_pub_send_status(model, ctx, status, &pub);
}
static int hb_sub_send_status(struct bt_mesh_model *model,
static int hb_sub_send_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
const struct bt_mesh_hb_sub *sub)
{
@ -2382,7 +2382,7 @@ static int hb_sub_send_status(struct bt_mesh_model *model,
return 0;
}
static int heartbeat_sub_get(struct bt_mesh_model *model,
static int heartbeat_sub_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -2395,7 +2395,7 @@ static int heartbeat_sub_get(struct bt_mesh_model *model,
return hb_sub_send_status(model, ctx, &sub);
}
static int heartbeat_sub_set(struct bt_mesh_model *model,
static int heartbeat_sub_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -2508,7 +2508,7 @@ const struct bt_mesh_model_op bt_mesh_cfg_srv_op[] = {
BT_MESH_MODEL_OP_END,
};
static int cfg_srv_init(struct bt_mesh_model *model)
static int cfg_srv_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("Configuration Server only allowed in primary element");
@ -2520,7 +2520,7 @@ static int cfg_srv_init(struct bt_mesh_model *model)
* device-key is allowed to access this model.
*/
model->keys[0] = BT_MESH_KEY_DEV_LOCAL;
model->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(model->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
return 0;
}
@ -2529,7 +2529,7 @@ const struct bt_mesh_model_cb bt_mesh_cfg_srv_cb = {
.init = cfg_srv_init,
};
static void mod_reset(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
static void mod_reset(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
bool vnd, bool primary, void *user_data)
{
size_t clear_count;

View file

@ -112,11 +112,11 @@ static void receivers_status_rsp(struct bt_mesh_dfd_srv *srv,
bt_mesh_model_send(srv->mod, ctx, &buf, NULL, NULL);
}
static int handle_receivers_add(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_receivers_add(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
enum bt_mesh_dfd_status status = BT_MESH_DFD_SUCCESS;
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
if (buf->len % 3) {
return -EINVAL;
@ -143,20 +143,20 @@ static int handle_receivers_add(struct bt_mesh_model *mod, struct bt_mesh_msg_ct
return 0;
}
static int handle_receivers_delete_all(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_receivers_delete_all(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
receivers_status_rsp(srv, ctx, bt_mesh_dfd_srv_receivers_delete_all(srv));
return 0;
}
static int handle_receivers_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_receivers_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
uint16_t first, cnt;
uint8_t progress;
int i;
@ -206,7 +206,7 @@ static enum bt_mesh_dfu_iter slot_space_cb(const struct bt_mesh_dfu_slot *slot,
return BT_MESH_DFU_ITER_CONTINUE;
}
static int handle_capabilities_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_capabilities_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
size_t size = 0;
@ -226,7 +226,7 @@ static int handle_capabilities_get(struct bt_mesh_model *mod, struct bt_mesh_msg
net_buf_simple_add_le32(&rsp, CONFIG_BT_MESH_DFD_SRV_SLOT_SPACE - size);
#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
if (srv->oob_schemes.count > 0) {
net_buf_simple_add_u8(&rsp, 1);
@ -268,20 +268,20 @@ static void status_rsp(struct bt_mesh_dfd_srv *srv, struct bt_mesh_msg_ctx *ctx,
bt_mesh_model_send(srv->mod, ctx, &rsp, NULL, NULL);
}
static int handle_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
status_rsp(srv, ctx, BT_MESH_DFD_SUCCESS);
return 0;
}
static int handle_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_start(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
struct bt_mesh_dfd_start_params params;
uint8_t byte;
@ -310,31 +310,31 @@ static int handle_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
return 0;
}
static int handle_suspend(struct bt_mesh_model *mod,
static int handle_suspend(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
status_rsp(srv, ctx, bt_mesh_dfd_srv_suspend(srv));
return 0;
}
static int handle_cancel(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_cancel(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
bt_mesh_dfd_srv_cancel(srv, ctx);
return 0;
}
static int handle_apply(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_apply(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
status_rsp(srv, ctx, bt_mesh_dfd_srv_apply(srv));
@ -393,10 +393,10 @@ static void upload_status_rsp(struct bt_mesh_dfd_srv *srv,
upload_status_rsp_with_progress(srv, ctx, status, progress);
}
static int handle_upload_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_upload_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
upload_status_rsp(srv, ctx, BT_MESH_DFD_SUCCESS);
@ -438,10 +438,10 @@ static inline int set_upload_fwid(struct bt_mesh_dfd_srv *srv, struct bt_mesh_ms
return err;
}
static int handle_upload_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_upload_start(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
size_t meta_len, fwid_len, size;
const uint8_t *meta, *fwid;
uint16_t timeout_base;
@ -560,10 +560,10 @@ static int handle_upload_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
return 0;
}
static int handle_upload_start_oob(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_upload_start_oob(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
uint8_t uri_len;
uint8_t *uri;
uint16_t fwid_len;
@ -651,10 +651,10 @@ static int handle_upload_start_oob(struct bt_mesh_model *mod, struct bt_mesh_msg
return 0;
}
static int handle_upload_cancel(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_upload_cancel(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_IDLE;
#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
@ -690,10 +690,10 @@ static void fw_status_rsp(struct bt_mesh_dfd_srv *srv,
bt_mesh_model_send(srv->mod, ctx, &rsp, NULL, NULL);
}
static int handle_fw_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_fw_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
struct bt_mesh_dfu_slot *slot;
const uint8_t *fwid;
size_t fwid_len;
@ -714,10 +714,10 @@ static int handle_fw_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
return 0;
}
static int handle_fw_get_by_index(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_fw_get_by_index(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
const struct bt_mesh_dfu_slot *slot;
uint16_t idx;
@ -735,10 +735,10 @@ static int handle_fw_get_by_index(struct bt_mesh_model *mod, struct bt_mesh_msg_
return 0;
}
static int handle_fw_delete(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_fw_delete(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
const uint8_t *fwid;
size_t fwid_len;
@ -764,10 +764,10 @@ static enum bt_mesh_dfu_iter slot_del_cb(const struct bt_mesh_dfu_slot *slot,
return BT_MESH_DFU_ITER_CONTINUE;
}
static int handle_fw_delete_all(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_fw_delete_all(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
fw_status_rsp(srv, ctx, bt_mesh_dfd_srv_fw_delete_all(srv), 0xffff, NULL, 0);
@ -923,9 +923,9 @@ const struct bt_mesh_blob_srv_cb _bt_mesh_dfd_srv_blob_cb = {
.suspended = upload_timeout,
};
static int dfd_srv_init(struct bt_mesh_model *mod)
static int dfd_srv_init(const struct bt_mesh_model *mod)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
srv->mod = mod;
@ -936,9 +936,9 @@ static int dfd_srv_init(struct bt_mesh_model *mod)
return 0;
}
static void dfd_srv_reset(struct bt_mesh_model *mod)
static void dfd_srv_reset(const struct bt_mesh_model *mod)
{
struct bt_mesh_dfd_srv *srv = mod->user_data;
struct bt_mesh_dfd_srv *srv = *(mod->user_data);
dfd_phase_set(srv, BT_MESH_DFD_PHASE_IDLE);
srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_IDLE;

View file

@ -305,8 +305,9 @@ static void tx_end(int err, void *cb_data)
blob_cli_broadcast_tx_complete(&cli->blob);
}
static int tx(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf,
const struct bt_mesh_send_cb *cb, struct bt_mesh_dfu_cli *cli)
static int tx(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf, const struct bt_mesh_send_cb *cb,
struct bt_mesh_dfu_cli *cli)
{
int err;
@ -698,10 +699,10 @@ static void cancelled(struct bt_mesh_blob_cli *b)
* Message handlers
******************************************************************************/
static int handle_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_cli *cli = mod->user_data;
struct bt_mesh_dfu_cli *cli = *(mod->user_data);
enum bt_mesh_dfu_status status;
enum bt_mesh_dfu_phase phase;
struct bt_mesh_dfu_target *target;
@ -824,10 +825,10 @@ static int handle_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
return 0;
}
static int handle_info_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_info_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_cli *cli = mod->user_data;
struct bt_mesh_dfu_cli *cli = *(mod->user_data);
struct bt_mesh_dfu_target *target;
enum bt_mesh_dfu_iter it = BT_MESH_DFU_ITER_CONTINUE;
uint8_t img_cnt, idx;
@ -923,10 +924,10 @@ static int handle_info_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
return 0;
}
static int handle_metadata_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_metadata_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_cli *cli = mod->user_data;
struct bt_mesh_dfu_cli *cli = *(mod->user_data);
struct bt_mesh_dfu_metadata_status *rsp = cli->req.params;
uint8_t hdr, idx;
@ -960,11 +961,11 @@ const struct bt_mesh_model_op _bt_mesh_dfu_cli_op[] = {
BT_MESH_MODEL_OP_END,
};
static int dfu_cli_init(struct bt_mesh_model *mod)
static int dfu_cli_init(const struct bt_mesh_model *mod)
{
struct bt_mesh_dfu_cli *cli = mod->user_data;
struct bt_mesh_dfu_cli *cli = *(mod->user_data);
if (mod->elem_idx != 0) {
if (*(mod->elem_idx) != 0) {
LOG_ERR("DFU update client must be instantiated on first elem");
return -EINVAL;
}
@ -980,9 +981,9 @@ static int dfu_cli_init(struct bt_mesh_model *mod)
return 0;
}
static void dfu_cli_reset(struct bt_mesh_model *mod)
static void dfu_cli_reset(const struct bt_mesh_model *mod)
{
struct bt_mesh_dfu_cli *cli = mod->user_data;
struct bt_mesh_dfu_cli *cli = *(mod->user_data);
cli->req.type = REQ_NONE;
cli->req.addr = BT_MESH_ADDR_UNASSIGNED;

View file

@ -125,10 +125,10 @@ static void verify(struct bt_mesh_dfu_srv *srv)
}
}
static int handle_info_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_info_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
uint8_t idx, limit;
if (srv->update.phase == BT_MESH_DFU_PHASE_APPLYING) {
@ -187,10 +187,10 @@ static int handle_info_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ct
return 0;
}
static int handle_metadata_check(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_metadata_check(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
enum bt_mesh_dfu_status status;
enum bt_mesh_dfu_effect effect;
uint8_t idx;
@ -239,10 +239,10 @@ static void update_status_rsp(struct bt_mesh_dfu_srv *srv,
bt_mesh_model_send(srv->mod, ctx, &buf, send_cb, srv);
}
static int handle_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
LOG_DBG("");
@ -262,10 +262,10 @@ static inline bool is_active_update(struct bt_mesh_dfu_srv *srv, uint8_t idx,
srv->update.meta != meta_checksum);
}
static int handle_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_start(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
const struct bt_mesh_blob_io *io;
uint16_t timeout_base, meta_checksum;
enum bt_mesh_dfu_status status;
@ -371,10 +371,10 @@ rsp:
return 0;
}
static int handle_cancel(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_cancel(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
if (srv->update.idx == UPDATE_IDX_NONE) {
goto rsp;
@ -392,10 +392,10 @@ rsp:
return 0;
}
static int handle_apply(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_apply(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
static const struct bt_mesh_send_cb send_cb = {
.start = apply_rsp_sending,
.end = apply_rsp_sent,
@ -435,9 +435,9 @@ const struct bt_mesh_model_op _bt_mesh_dfu_srv_op[] = {
BT_MESH_MODEL_OP_END,
};
static int dfu_srv_init(struct bt_mesh_model *mod)
static int dfu_srv_init(const struct bt_mesh_model *mod)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
srv->mod = mod;
srv->update.idx = UPDATE_IDX_NONE;
@ -455,11 +455,11 @@ static int dfu_srv_init(struct bt_mesh_model *mod)
return 0;
}
static int dfu_srv_settings_set(struct bt_mesh_model *mod, const char *name,
static int dfu_srv_settings_set(const struct bt_mesh_model *mod, const char *name,
size_t len_rd, settings_read_cb read_cb,
void *cb_arg)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
ssize_t len;
if (len_rd < sizeof(srv->update)) {
@ -484,9 +484,9 @@ static int dfu_srv_settings_set(struct bt_mesh_model *mod, const char *name,
return 0;
}
static void dfu_srv_reset(struct bt_mesh_model *mod)
static void dfu_srv_reset(const struct bt_mesh_model *mod)
{
struct bt_mesh_dfu_srv *srv = mod->user_data;
struct bt_mesh_dfu_srv *srv = *(mod->user_data);
srv->update.phase = BT_MESH_DFU_PHASE_IDLE;
erase_state(srv);

View file

@ -150,7 +150,7 @@
void bt_mesh_model_reset(void);
void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time);
void bt_mesh_attention(const struct bt_mesh_model *model, uint8_t time);
#include <zephyr/sys/byteorder.h>

View file

@ -36,11 +36,11 @@ struct health_fault_param {
size_t *fault_count;
};
static int health_fault_status(struct bt_mesh_model *model,
static int health_fault_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_health_cli *cli = model->user_data;
struct bt_mesh_health_cli *cli = *(model->user_data);
struct health_fault_param *param;
uint8_t test_id;
uint16_t cid;
@ -89,11 +89,11 @@ done:
return 0;
}
static int health_current_status(struct bt_mesh_model *model,
static int health_current_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_health_cli *cli = model->user_data;
struct bt_mesh_health_cli *cli = *(model->user_data);
uint8_t test_id;
uint16_t cid;
@ -117,11 +117,11 @@ struct health_period_param {
uint8_t *divisor;
};
static int health_period_status(struct bt_mesh_model *model,
static int health_period_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_health_cli *cli = model->user_data;
struct bt_mesh_health_cli *cli = *(model->user_data);
struct health_period_param *param;
uint8_t divisor;
@ -151,11 +151,11 @@ struct health_attention_param {
uint8_t *attention;
};
static int health_attention_status(struct bt_mesh_model *model,
static int health_attention_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_health_cli *cli = model->user_data;
struct bt_mesh_health_cli *cli = *(model->user_data);
struct health_attention_param *param;
uint8_t attention;
@ -402,9 +402,9 @@ void bt_mesh_health_cli_timeout_set(int32_t timeout)
msg_timeout = timeout;
}
static int health_cli_init(struct bt_mesh_model *model)
static int health_cli_init(const struct bt_mesh_model *model)
{
struct bt_mesh_health_cli *cli = model->user_data;
struct bt_mesh_health_cli *cli = *(model->user_data);
LOG_DBG("primary %u", bt_mesh_model_in_primary(model));
@ -423,9 +423,9 @@ static int health_cli_init(struct bt_mesh_model *model)
return 0;
}
static void health_cli_reset(struct bt_mesh_model *model)
static void health_cli_reset(const struct bt_mesh_model *model)
{
struct bt_mesh_health_cli *cli = model->user_data;
struct bt_mesh_health_cli *cli = *(model->user_data);
net_buf_simple_reset(cli->pub.msg);
}

View file

@ -31,11 +31,11 @@ LOG_MODULE_REGISTER(bt_mesh_health_srv);
/* Health Server context of the primary element */
struct bt_mesh_health_srv *health_srv;
static void health_get_registered(struct bt_mesh_model *mod,
static void health_get_registered(const struct bt_mesh_model *mod,
uint16_t company_id,
struct net_buf_simple *msg)
{
struct bt_mesh_health_srv *srv = mod->user_data;
struct bt_mesh_health_srv *srv = *(mod->user_data);
uint8_t *test_id;
LOG_DBG("Company ID 0x%04x", company_id);
@ -64,10 +64,10 @@ static void health_get_registered(struct bt_mesh_model *mod,
}
}
static size_t health_get_current(struct bt_mesh_model *mod,
static size_t health_get_current(const struct bt_mesh_model *mod,
struct net_buf_simple *msg)
{
struct bt_mesh_health_srv *srv = mod->user_data;
struct bt_mesh_health_srv *srv = *(mod->user_data);
const struct bt_mesh_comp *comp;
uint8_t *test_id, *company_ptr;
uint16_t company_id;
@ -105,7 +105,7 @@ static size_t health_get_current(struct bt_mesh_model *mod,
return fault_count;
}
static int health_fault_get(struct bt_mesh_model *model,
static int health_fault_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -125,11 +125,11 @@ static int health_fault_get(struct bt_mesh_model *model,
return 0;
}
static int health_fault_clear_unrel(struct bt_mesh_model *model,
static int health_fault_clear_unrel(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_health_srv *srv = model->user_data;
struct bt_mesh_health_srv *srv = *(model->user_data);
uint16_t company_id;
company_id = net_buf_simple_pull_le16(buf);
@ -143,12 +143,12 @@ static int health_fault_clear_unrel(struct bt_mesh_model *model,
return 0;
}
static int health_fault_clear(struct bt_mesh_model *model,
static int health_fault_clear(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
NET_BUF_SIMPLE_DEFINE(sdu, BT_MESH_TX_SDU_MAX);
struct bt_mesh_health_srv *srv = model->user_data;
struct bt_mesh_health_srv *srv = *(model->user_data);
uint16_t company_id;
company_id = net_buf_simple_pull_le16(buf);
@ -173,11 +173,11 @@ static int health_fault_clear(struct bt_mesh_model *model,
return 0;
}
static int health_fault_test_unrel(struct bt_mesh_model *model,
static int health_fault_test_unrel(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_health_srv *srv = model->user_data;
struct bt_mesh_health_srv *srv = *(model->user_data);
uint16_t company_id;
uint8_t test_id;
@ -193,12 +193,12 @@ static int health_fault_test_unrel(struct bt_mesh_model *model,
return 0;
}
static int health_fault_test(struct bt_mesh_model *model,
static int health_fault_test(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
NET_BUF_SIMPLE_DEFINE(sdu, BT_MESH_TX_SDU_MAX);
struct bt_mesh_health_srv *srv = model->user_data;
struct bt_mesh_health_srv *srv = *(model->user_data);
uint16_t company_id;
uint8_t test_id;
@ -228,12 +228,12 @@ static int health_fault_test(struct bt_mesh_model *model,
return 0;
}
static int send_attention_status(struct bt_mesh_model *model,
static int send_attention_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx)
{
/* Needed size: opcode (2 bytes) + msg + MIC */
BT_MESH_MODEL_BUF_DEFINE(msg, OP_ATTENTION_STATUS, 1);
struct bt_mesh_health_srv *srv = model->user_data;
struct bt_mesh_health_srv *srv = *(model->user_data);
uint8_t time;
time = k_ticks_to_ms_floor32(
@ -251,7 +251,7 @@ static int send_attention_status(struct bt_mesh_model *model,
return 0;
}
static int attention_get(struct bt_mesh_model *model,
static int attention_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -260,7 +260,7 @@ static int attention_get(struct bt_mesh_model *model,
return send_attention_status(model, ctx);
}
static int attention_set_unrel(struct bt_mesh_model *model,
static int attention_set_unrel(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -275,7 +275,7 @@ static int attention_set_unrel(struct bt_mesh_model *model,
return 0;
}
static int attention_set(struct bt_mesh_model *model,
static int attention_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -291,7 +291,7 @@ static int attention_set(struct bt_mesh_model *model,
return send_attention_status(model, ctx);
}
static int send_health_period_status(struct bt_mesh_model *model,
static int send_health_period_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx)
{
/* Needed size: opcode (2 bytes) + msg + MIC */
@ -308,7 +308,7 @@ static int send_health_period_status(struct bt_mesh_model *model,
return 0;
}
static int health_period_get(struct bt_mesh_model *model,
static int health_period_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -317,7 +317,7 @@ static int health_period_get(struct bt_mesh_model *model,
return send_health_period_status(model, ctx);
}
static int health_period_set_unrel(struct bt_mesh_model *model,
static int health_period_set_unrel(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -336,7 +336,7 @@ static int health_period_set_unrel(struct bt_mesh_model *model,
return 0;
}
static int health_period_set(struct bt_mesh_model *model,
static int health_period_set(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -367,7 +367,7 @@ const struct bt_mesh_model_op bt_mesh_health_srv_op[] = {
BT_MESH_MODEL_OP_END,
};
static int health_pub_update(struct bt_mesh_model *mod)
static int health_pub_update(const struct bt_mesh_model *mod)
{
struct bt_mesh_model_pub *pub = mod->pub;
size_t count;
@ -386,7 +386,7 @@ static int health_pub_update(struct bt_mesh_model *mod)
int bt_mesh_health_srv_fault_update(struct bt_mesh_elem *elem)
{
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
mod = bt_mesh_model_find(elem, BT_MESH_MODEL_ID_HEALTH_SRV);
if (!mod) {
@ -418,9 +418,9 @@ static void attention_off(struct k_work *work)
}
}
static int health_srv_init(struct bt_mesh_model *model)
static int health_srv_init(const struct bt_mesh_model *model)
{
struct bt_mesh_health_srv *srv = model->user_data;
struct bt_mesh_health_srv *srv = *(model->user_data);
if (!srv) {
LOG_ERR("No Health Server context provided");
@ -449,7 +449,7 @@ const struct bt_mesh_model_cb bt_mesh_health_srv_cb = {
.init = health_srv_init,
};
void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time)
void bt_mesh_attention(const struct bt_mesh_model *model, uint8_t time)
{
struct bt_mesh_health_srv *srv;
@ -462,7 +462,7 @@ void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time)
model = srv->model;
} else {
srv = model->user_data;
srv = *(model->user_data);
}
if ((time > 0) && srv->cb && srv->cb->attn_on) {

View file

@ -33,7 +33,7 @@ LOG_MODULE_REGISTER(bt_mesh_large_comp_data_cli);
static struct bt_mesh_large_comp_data_cli *cli;
static int32_t msg_timeout;
static int data_status(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int data_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf, uint32_t op,
void (*cb)(struct bt_mesh_large_comp_data_cli *cli, uint16_t addr,
struct bt_mesh_large_comp_data_rsp *rsp))
@ -78,7 +78,7 @@ static int data_status(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
return 0;
}
static int large_comp_data_status(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int large_comp_data_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
return data_status(model, ctx, buf, OP_LARGE_COMP_DATA_STATUS,
@ -86,7 +86,7 @@ static int large_comp_data_status(struct bt_mesh_model *model, struct bt_mesh_ms
cli->cb->large_comp_data_status : NULL));
}
static int models_metadata_status(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int models_metadata_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
return data_status(model, ctx, buf, OP_MODELS_METADATA_STATUS,
@ -100,7 +100,7 @@ const struct bt_mesh_model_op _bt_mesh_large_comp_data_cli_op[] = {
BT_MESH_MODEL_OP_END,
};
static int large_comp_data_cli_init(struct bt_mesh_model *model)
static int large_comp_data_cli_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("Large Comp Data Client only allowed in primary element");
@ -108,9 +108,9 @@ static int large_comp_data_cli_init(struct bt_mesh_model *model)
}
model->keys[0] = BT_MESH_KEY_DEV_ANY;
model->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(model->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
cli = model->user_data;
cli = *(model->user_data);
cli->model = model;
msg_timeout = 5000;

View file

@ -37,10 +37,11 @@ LOG_MODULE_REGISTER(bt_mesh_large_comp_data_srv);
/** Mesh Large Composition Data Server Model Context */
static struct bt_mesh_large_comp_data_srv {
/** Composition data model entry pointer. */
struct bt_mesh_model *model;
const struct bt_mesh_model *model;
} srv;
static int handle_large_comp_data_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int handle_large_comp_data_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(rsp, OP_LARGE_COMP_DATA_STATUS,
@ -101,7 +102,8 @@ static int handle_large_comp_data_get(struct bt_mesh_model *model, struct bt_mes
return 0;
}
static int handle_models_metadata_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int handle_models_metadata_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(rsp, OP_MODELS_METADATA_STATUS,
@ -166,7 +168,7 @@ const struct bt_mesh_model_op _bt_mesh_large_comp_data_srv_op[] = {
BT_MESH_MODEL_OP_END,
};
static int large_comp_data_srv_init(struct bt_mesh_model *model)
static int large_comp_data_srv_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("Large Composition Data Server only allowed in primary element");
@ -175,7 +177,7 @@ static int large_comp_data_srv_init(struct bt_mesh_model *model)
/* Large Composition Data Server model shall use the device key */
model->keys[0] = BT_MESH_KEY_DEV;
model->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(model->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
srv.model = model;

View file

@ -419,7 +419,7 @@ bool bt_mesh_is_provisioned(void)
return atomic_test_bit(bt_mesh.flags, BT_MESH_VALID);
}
static void model_suspend(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
static void model_suspend(const struct bt_mesh_model *mod, 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(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
static void model_resume(const struct bt_mesh_model *mod, 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(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
static void model_start(const struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
bool vnd, bool primary, void *user_data)
{
if (mod->cb && mod->cb->start) {

View file

@ -87,7 +87,7 @@ bool bt_mesh_msg_ack_ctx_match(const struct bt_mesh_msg_ack_ctx *ack,
return true;
}
int bt_mesh_msg_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
int bt_mesh_msg_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
if (!ctx && !model->pub) {
@ -104,7 +104,7 @@ int bt_mesh_msg_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
return bt_mesh_model_publish(model);
}
int bt_mesh_msg_ackd_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
int bt_mesh_msg_ackd_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf, const struct bt_mesh_msg_rsp_ctx *rsp)
{
int err;

View file

@ -18,7 +18,7 @@
* @retval -EADDRNOTAVAIL A message context was not provided and publishing is not configured.
* @retval -EAGAIN The device has not been provisioned.
*/
int bt_mesh_msg_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
int bt_mesh_msg_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf);
/**
@ -51,5 +51,5 @@ struct bt_mesh_msg_rsp_ctx {
* @retval -EAGAIN The device has not been provisioned.
* @retval -ETIMEDOUT The request timed out without a response.
*/
int bt_mesh_msg_ackd_send(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
int bt_mesh_msg_ackd_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf, const struct bt_mesh_msg_rsp_ctx *rsp);

View file

@ -20,7 +20,7 @@ static struct bt_mesh_od_priv_proxy_cli *cli;
static int32_t msg_timeout;
static int handle_proxy_status(struct bt_mesh_model *mod,
static int handle_proxy_status(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -93,17 +93,17 @@ void bt_mesh_od_priv_proxy_cli_timeout_set(int32_t timeout)
msg_timeout = timeout;
}
static int on_demand_proxy_cli_init(struct bt_mesh_model *mod)
static int on_demand_proxy_cli_init(const struct bt_mesh_model *mod)
{
if (!bt_mesh_model_in_primary(mod)) {
LOG_ERR("On-Demand Private Proxy client not in primary element");
return -EINVAL;
}
cli = mod->user_data;
cli = *(mod->user_data);
cli->model = mod;
mod->keys[0] = BT_MESH_KEY_DEV_ANY;
mod->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(mod->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
msg_timeout = CONFIG_BT_MESH_OD_PRIV_PROXY_CLI_TIMEOUT;
bt_mesh_msg_ack_ctx_init(&cli->ack_ctx);

View file

@ -16,7 +16,7 @@
LOG_MODULE_REGISTER(bt_mesh_od_priv_proxy_srv);
static struct bt_mesh_model *od_priv_proxy_srv;
static const struct bt_mesh_model *od_priv_proxy_srv;
static uint8_t on_demand_state;
static int od_priv_proxy_store(bool delete)
@ -31,7 +31,7 @@ static int od_priv_proxy_store(bool delete)
return bt_mesh_model_data_store(od_priv_proxy_srv, false, "pp", data, len);
}
static int proxy_status_rsp(struct bt_mesh_model *mod,
static int proxy_status_rsp(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx)
{
BT_MESH_MODEL_BUF_DEFINE(buf, OP_OD_PRIV_PROXY_STATUS, 1);
@ -44,7 +44,7 @@ static int proxy_status_rsp(struct bt_mesh_model *mod,
return 0;
}
static int handle_proxy_get(struct bt_mesh_model *mod,
static int handle_proxy_get(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -55,7 +55,7 @@ static int handle_proxy_get(struct bt_mesh_model *mod,
return 0;
}
static int handle_proxy_set(struct bt_mesh_model *mod,
static int handle_proxy_set(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -79,13 +79,13 @@ const struct bt_mesh_model_op _bt_mesh_od_priv_proxy_srv_op[] = {
BT_MESH_MODEL_OP_END
};
static int od_priv_proxy_srv_init(struct bt_mesh_model *mod)
static int od_priv_proxy_srv_init(const struct bt_mesh_model *mod)
{
od_priv_proxy_srv = mod;
struct bt_mesh_model *priv_beacon_srv = bt_mesh_model_find(
const struct bt_mesh_model *priv_beacon_srv = bt_mesh_model_find(
bt_mesh_model_elem(mod), BT_MESH_MODEL_ID_PRIV_BEACON_SRV);
struct bt_mesh_model *sol_pdu_rpl_srv = bt_mesh_model_find(
const struct bt_mesh_model *sol_pdu_rpl_srv = bt_mesh_model_find(
bt_mesh_model_elem(mod), BT_MESH_MODEL_ID_SOL_PDU_RPL_SRV);
if (priv_beacon_srv == NULL) {
@ -98,7 +98,7 @@ static int od_priv_proxy_srv_init(struct bt_mesh_model *mod)
}
mod->keys[0] = BT_MESH_KEY_DEV_LOCAL;
mod->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(mod->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
if (IS_ENABLED(CONFIG_BT_MESH_MODEL_EXTENSIONS)) {
bt_mesh_model_extend(mod, priv_beacon_srv);
@ -108,14 +108,14 @@ static int od_priv_proxy_srv_init(struct bt_mesh_model *mod)
return 0;
}
static void od_priv_proxy_srv_reset(struct bt_mesh_model *model)
static void od_priv_proxy_srv_reset(const struct bt_mesh_model *model)
{
on_demand_state = 0;
od_priv_proxy_store(true);
}
#ifdef CONFIG_BT_SETTINGS
static int od_priv_proxy_srv_settings_set(struct bt_mesh_model *model, const char *name,
static int od_priv_proxy_srv_settings_set(const struct bt_mesh_model *model, const char *name,
size_t len_rd, settings_read_cb read_cb, void *cb_data)
{
int err;
@ -135,7 +135,7 @@ static int od_priv_proxy_srv_settings_set(struct bt_mesh_model *model, const cha
return 0;
}
static void od_priv_proxy_srv_pending_store(struct bt_mesh_model *model)
static void od_priv_proxy_srv_pending_store(const struct bt_mesh_model *model)
{
on_demand_state = bt_mesh_od_priv_proxy_get();
od_priv_proxy_store(false);

View file

@ -19,8 +19,8 @@ struct op_agg_ctx {
int bt_mesh_op_agg_encode_msg(struct net_buf_simple *msg, struct net_buf_simple *buf);
int bt_mesh_op_agg_decode_msg(struct net_buf_simple *msg, struct net_buf_simple *buf);
int bt_mesh_op_agg_cli_send(struct bt_mesh_model *model, struct net_buf_simple *msg);
int bt_mesh_op_agg_cli_send(const struct bt_mesh_model *model, struct net_buf_simple *msg);
int bt_mesh_op_agg_cli_accept(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf);
int bt_mesh_op_agg_srv_send(struct bt_mesh_model *model, struct net_buf_simple *msg);
int bt_mesh_op_agg_srv_send(const struct bt_mesh_model *model, struct net_buf_simple *msg);
int bt_mesh_op_agg_srv_accept(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf);
bool bt_mesh_op_agg_is_op_agg_msg(struct net_buf_simple *buf);

View file

@ -24,7 +24,7 @@ NET_BUF_SIMPLE_DEFINE_STATIC(sdu, BT_MESH_TX_SDU_MAX);
/** Mesh Opcodes Aggregator Client Model Context */
static struct bt_mesh_op_agg_cli {
/** Composition data model entry pointer. */
struct bt_mesh_model *model;
const struct bt_mesh_model *model;
/** Acknowledge context. */
struct bt_mesh_msg_ack_ctx ack_ctx;
/** List of source element addresses.
@ -39,7 +39,7 @@ static struct bt_mesh_op_agg_cli {
static int32_t msg_timeout;
static int handle_status(struct bt_mesh_model *model,
static int handle_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -102,7 +102,7 @@ const struct bt_mesh_model_op _bt_mesh_op_agg_cli_op[] = {
BT_MESH_MODEL_OP_END,
};
static int op_agg_cli_init(struct bt_mesh_model *model)
static int op_agg_cli_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("Opcodes Aggregator Client only allowed in primary element");
@ -203,7 +203,7 @@ void bt_mesh_op_agg_cli_timeout_set(int32_t timeout)
msg_timeout = timeout;
}
int bt_mesh_op_agg_cli_send(struct bt_mesh_model *model, struct net_buf_simple *msg)
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;

View file

@ -22,7 +22,7 @@ NET_BUF_SIMPLE_DEFINE_STATIC(sdu, BT_MESH_TX_SDU_MAX);
/** Mesh Opcodes Aggragator Server Model Context */
static struct bt_mesh_op_agg_srv {
/** Composition data model entry pointer. */
struct bt_mesh_model *model;
const struct bt_mesh_model *model;
/** Response error code. */
int rsp_err;
/** Indicates that the received aggregated message
@ -33,7 +33,7 @@ static struct bt_mesh_op_agg_srv {
struct op_agg_ctx ctx;
} srv = {.ctx.sdu = &sdu};
static int handle_sequence(struct bt_mesh_model *model,
static int handle_sequence(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -114,7 +114,7 @@ const struct bt_mesh_model_op _bt_mesh_op_agg_srv_op[] = {
BT_MESH_MODEL_OP_END,
};
static int op_agg_srv_init(struct bt_mesh_model *model)
static int op_agg_srv_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("Opcodes Aggregator Server only allowed in primary element");
@ -131,7 +131,7 @@ static int op_agg_srv_init(struct bt_mesh_model *model)
return 0;
}
int bt_mesh_op_agg_srv_send(struct bt_mesh_model *model, struct net_buf_simple *msg)
int bt_mesh_op_agg_srv_send(const struct bt_mesh_model *model, struct net_buf_simple *msg)
{
int err;

View file

@ -18,7 +18,7 @@ static struct bt_mesh_priv_beacon_cli *cli;
static int32_t msg_timeout;
static int handle_beacon_status(struct bt_mesh_model *model,
static int handle_beacon_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -56,7 +56,7 @@ static int handle_beacon_status(struct bt_mesh_model *model,
return 0;
}
static int handle_gatt_proxy_status(struct bt_mesh_model *model,
static int handle_gatt_proxy_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -86,7 +86,7 @@ static int handle_gatt_proxy_status(struct bt_mesh_model *model,
return 0;
}
static int handle_node_id_status(struct bt_mesh_model *model,
static int handle_node_id_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -134,18 +134,18 @@ const struct bt_mesh_model_op bt_mesh_priv_beacon_cli_op[] = {
BT_MESH_MODEL_OP_END,
};
static int priv_beacon_cli_init(struct bt_mesh_model *model)
static int priv_beacon_cli_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("Private Beacon Client only allowed in primary element");
return -EINVAL;
}
cli = model->user_data;
cli = *(model->user_data);
cli->model = model;
msg_timeout = 2 * MSEC_PER_SEC;
model->keys[0] = BT_MESH_KEY_DEV_ANY;
model->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(model->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
bt_mesh_msg_ack_ctx_init(&cli->ack_ctx);

View file

@ -17,7 +17,7 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_mesh_priv_beacon_srv);
static struct bt_mesh_model *priv_beacon_srv;
static const struct bt_mesh_model *priv_beacon_srv;
/* Private Beacon configuration server model states */
struct {
@ -38,7 +38,7 @@ static int priv_beacon_store(bool delete)
return bt_mesh_model_data_store(priv_beacon_srv, false, "pb", data, len);
}
static int beacon_status_rsp(struct bt_mesh_model *mod,
static int beacon_status_rsp(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx)
{
BT_MESH_MODEL_BUF_DEFINE(buf, OP_PRIV_BEACON_STATUS, 2);
@ -52,7 +52,7 @@ static int beacon_status_rsp(struct bt_mesh_model *mod,
return 0;
}
static int handle_beacon_get(struct bt_mesh_model *mod,
static int handle_beacon_get(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -63,7 +63,7 @@ static int handle_beacon_get(struct bt_mesh_model *mod,
return 0;
}
static int handle_beacon_set(struct bt_mesh_model *mod,
static int handle_beacon_set(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -90,7 +90,7 @@ static int handle_beacon_set(struct bt_mesh_model *mod,
return 0;
}
static void gatt_proxy_status_rsp(struct bt_mesh_model *mod,
static void gatt_proxy_status_rsp(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx)
{
BT_MESH_MODEL_BUF_DEFINE(buf, OP_PRIV_GATT_PROXY_STATUS, 1);
@ -101,7 +101,7 @@ static void gatt_proxy_status_rsp(struct bt_mesh_model *mod,
bt_mesh_model_send(mod, ctx, &buf, NULL, NULL);
}
static int handle_gatt_proxy_get(struct bt_mesh_model *mod,
static int handle_gatt_proxy_get(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -112,7 +112,7 @@ static int handle_gatt_proxy_get(struct bt_mesh_model *mod,
return 0;
}
static int handle_gatt_proxy_set(struct bt_mesh_model *mod,
static int handle_gatt_proxy_set(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -134,7 +134,7 @@ static int handle_gatt_proxy_set(struct bt_mesh_model *mod,
return 0;
}
static void node_id_status_rsp(struct bt_mesh_model *mod,
static void node_id_status_rsp(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx, uint8_t status,
uint16_t net_idx, uint8_t node_id)
{
@ -148,7 +148,7 @@ static void node_id_status_rsp(struct bt_mesh_model *mod,
bt_mesh_model_send(mod, ctx, &buf, NULL, NULL);
}
static int handle_node_id_get(struct bt_mesh_model *mod,
static int handle_node_id_get(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -163,7 +163,7 @@ static int handle_node_id_get(struct bt_mesh_model *mod,
return 0;
}
static int handle_node_id_set(struct bt_mesh_model *mod,
static int handle_node_id_set(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -194,7 +194,7 @@ const struct bt_mesh_model_op bt_mesh_priv_beacon_srv_op[] = {
BT_MESH_MODEL_OP_END
};
static int priv_beacon_srv_init(struct bt_mesh_model *mod)
static int priv_beacon_srv_init(const struct bt_mesh_model *mod)
{
if (!bt_mesh_model_in_primary(mod)) {
LOG_ERR("Priv beacon server not in primary element");
@ -207,14 +207,14 @@ static int priv_beacon_srv_init(struct bt_mesh_model *mod)
return 0;
}
static void priv_beacon_srv_reset(struct bt_mesh_model *model)
static void priv_beacon_srv_reset(const struct bt_mesh_model *model)
{
(void)memset(&priv_beacon_state, 0, sizeof(priv_beacon_state));
priv_beacon_store(true);
}
#ifdef CONFIG_BT_SETTINGS
static int priv_beacon_srv_settings_set(struct bt_mesh_model *model, const char *name,
static int priv_beacon_srv_settings_set(const struct bt_mesh_model *model, const char *name,
size_t len_rd, settings_read_cb read_cb, void *cb_data)
{
int err;
@ -236,7 +236,7 @@ static int priv_beacon_srv_settings_set(struct bt_mesh_model *model, const char
return 0;
}
static void priv_beacon_srv_pending_store(struct bt_mesh_model *model)
static void priv_beacon_srv_pending_store(const struct bt_mesh_model *model)
{
priv_beacon_state.state = bt_mesh_priv_beacon_get();
priv_beacon_state.interval = bt_mesh_priv_beacon_update_interval_get();

View file

@ -90,11 +90,11 @@ static void tx_complete(struct bt_mesh_rpr_cli *cli, int err, void *cb_data)
}
}
static int handle_extended_scan_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_extended_scan_report(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
struct bt_mesh_rpr_unprov dev = { 0 };
enum bt_mesh_rpr_status status;
bool found_dev = false;
@ -123,11 +123,11 @@ static int handle_extended_scan_report(struct bt_mesh_model *mod, struct bt_mesh
return 0;
}
static int handle_link_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_link_report(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
struct bt_mesh_rpr_link link;
uint8_t reason = PROV_BEARER_LINK_STATUS_SUCCESS;
@ -161,10 +161,10 @@ static int handle_link_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
return 0;
}
static int handle_link_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_link_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
struct bt_mesh_rpr_link *rsp;
struct bt_mesh_rpr_link link;
@ -195,10 +195,10 @@ static int handle_link_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
return 0;
}
static int handle_pdu_outbound_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_pdu_outbound_report(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
void *cb_data;
uint8_t num;
@ -226,10 +226,10 @@ static int handle_pdu_outbound_report(struct bt_mesh_model *mod, struct bt_mesh_
return 0;
}
static int handle_pdu_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_pdu_report(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
struct pb_remote_ctx cb_ctx = {
cli,
@ -257,10 +257,10 @@ static int handle_pdu_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *
return 0;
}
static int handle_scan_caps_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_scan_caps_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
struct bt_mesh_rpr_caps *caps;
@ -281,10 +281,10 @@ static int handle_scan_caps_status(struct bt_mesh_model *mod, struct bt_mesh_msg
return 0;
}
static int handle_scan_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_scan_report(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
struct bt_mesh_rpr_unprov dev = { 0 };
@ -313,10 +313,10 @@ static int handle_scan_report(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx
return 0;
}
static int handle_scan_status(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_scan_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
struct bt_mesh_rpr_scan_status *status;
struct bt_mesh_rpr_node srv = RPR_NODE(ctx);
@ -361,15 +361,15 @@ static void link_timeout(struct k_work *work)
}
}
static int rpr_cli_init(struct bt_mesh_model *mod)
static int rpr_cli_init(const struct bt_mesh_model *mod)
{
if (mod->elem_idx) {
if (*(mod->elem_idx)) {
LOG_ERR("Remote provisioning client must be initialized "
"on first element");
return -EINVAL;
}
struct bt_mesh_rpr_cli *cli = mod->user_data;
struct bt_mesh_rpr_cli *cli = *(mod->user_data);
cli->mod = mod;
cli->link.time = LINK_TIMEOUT_SECONDS_DEFAULT;
@ -378,7 +378,7 @@ static int rpr_cli_init(struct bt_mesh_model *mod)
bt_mesh_msg_ack_ctx_init(&cli->prov_ack_ctx);
k_work_init_delayable(&cli->link.timeout, link_timeout);
mod->keys[0] = BT_MESH_KEY_DEV_ANY;
mod->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(mod->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
return 0;
}

View file

@ -47,7 +47,7 @@ enum {
/** Remote provisioning server instance. */
static struct {
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
ATOMIC_DEFINE(flags, RPR_SRV_NUM_FLAGS);
@ -536,7 +536,7 @@ static const struct prov_bearer_cb prov_bearer_cb = {
* Message handlers
******************************************************************************/
static int handle_scan_caps_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_scan_caps_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(rsp, RPR_OP_SCAN_CAPS_STATUS, 2);
@ -549,7 +549,7 @@ static int handle_scan_caps_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ct
return 0;
}
static int handle_scan_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_scan_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
scan_status_send(ctx, BT_MESH_RPR_SUCCESS);
@ -557,7 +557,7 @@ static int handle_scan_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ct
return 0;
}
static int handle_scan_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_scan_start(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_node cli = RPR_NODE(ctx);
@ -621,7 +621,7 @@ rsp:
return 0;
}
static int handle_extended_scan_start(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_extended_scan_start(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
BT_MESH_MODEL_BUF_DEFINE(rsp, RPR_OP_EXTENDED_SCAN_REPORT,
@ -784,7 +784,7 @@ rsp:
return 0;
}
static int handle_scan_stop(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_scan_stop(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
if (atomic_test_bit(srv.flags, SCANNING)) {
@ -797,7 +797,7 @@ static int handle_scan_stop(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *c
return 0;
}
static int handle_link_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_link_get(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
LOG_DBG("");
@ -807,7 +807,7 @@ static int handle_link_get(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ct
return 0;
}
static int handle_link_open(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_link_open(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
bool is_refresh_procedure = (buf->len == 1);
@ -938,7 +938,7 @@ rsp:
return 0;
}
static int handle_link_close(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_link_close(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_node cli = RPR_NODE(ctx);
@ -975,7 +975,7 @@ static int handle_link_close(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *
return 0;
}
static int handle_pdu_send(struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
static int handle_pdu_send(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_rpr_node cli = RPR_NODE(ctx);
@ -1303,9 +1303,9 @@ static struct bt_le_scan_cb scan_cb = {
.recv = scan_packet_recv,
};
static int rpr_srv_init(struct bt_mesh_model *mod)
static int rpr_srv_init(const struct bt_mesh_model *mod)
{
if (mod->elem_idx || srv.mod) {
if (*(mod->elem_idx) || srv.mod) {
LOG_ERR("Remote provisioning server must be initialized "
"on first element");
return -EINVAL;
@ -1320,12 +1320,12 @@ static int rpr_srv_init(struct bt_mesh_model *mod)
k_work_init(&srv.link.report, link_report_send_and_clear);
bt_le_scan_cb_register(&scan_cb);
mod->keys[0] = BT_MESH_KEY_DEV_LOCAL;
mod->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(mod->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
return 0;
}
static void rpr_srv_reset(struct bt_mesh_model *mod)
static void rpr_srv_reset(const struct bt_mesh_model *mod)
{
cli_link_clear();
cli_scan_clear();

View file

@ -21,7 +21,7 @@ LOG_MODULE_REGISTER(bt_mesh_sar_cfg_cli);
static struct bt_mesh_sar_cfg_cli *cli;
static int transmitter_status(struct bt_mesh_model *model,
static int transmitter_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -45,7 +45,7 @@ static int transmitter_status(struct bt_mesh_model *model,
return 0;
}
static int receiver_status(struct bt_mesh_model *model,
static int receiver_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -87,35 +87,35 @@ void bt_mesh_sar_cfg_cli_timeout_set(int32_t timeout)
cli->timeout = timeout;
}
static int bt_mesh_sar_cfg_cli_init(struct bt_mesh_model *model)
static int bt_mesh_sar_cfg_cli_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("SAR Configuration Client only allowed in primary element");
return -EINVAL;
}
if (!model->user_data) {
if (!*(model->user_data)) {
LOG_ERR("No SAR Configuration Client context provided");
return -EINVAL;
}
cli = model->user_data;
cli = *(model->user_data);
cli->model = model;
cli->timeout = 2 * MSEC_PER_SEC;
model->keys[0] = BT_MESH_KEY_DEV_ANY;
model->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(model->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
bt_mesh_msg_ack_ctx_init(&cli->ack_ctx);
return 0;
}
static void bt_mesh_sar_cfg_cli_reset(struct bt_mesh_model *model)
static void bt_mesh_sar_cfg_cli_reset(const struct bt_mesh_model *model)
{
struct bt_mesh_sar_cfg_cli *model_cli;
model_cli = model->user_data;
model_cli = *(model->user_data);
bt_mesh_msg_ack_ctx_clear(&model_cli->ack_ctx);
}

View file

@ -27,7 +27,7 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_mesh_sar_cfg_srv);
static int sar_rx_store(struct bt_mesh_model *model, bool delete)
static int sar_rx_store(const struct bt_mesh_model *model, bool delete)
{
const void *data = delete ? NULL : &bt_mesh.sar_rx;
size_t len = delete ? 0 : sizeof(struct bt_mesh_sar_rx);
@ -35,7 +35,7 @@ static int sar_rx_store(struct bt_mesh_model *model, bool delete)
return bt_mesh_model_data_store(model, false, "sar_rx", data, len);
}
static int sar_tx_store(struct bt_mesh_model *model, bool delete)
static int sar_tx_store(const struct bt_mesh_model *model, bool delete)
{
const void *data = delete ? NULL : &bt_mesh.sar_tx;
size_t len = delete ? 0 : sizeof(struct bt_mesh_sar_tx);
@ -43,7 +43,7 @@ static int sar_tx_store(struct bt_mesh_model *model, bool delete)
return bt_mesh_model_data_store(model, false, "sar_tx", data, len);
}
static void transmitter_status(struct bt_mesh_model *model,
static void transmitter_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_SAR_CFG_TX_STATUS, BT_MESH_SAR_TX_LEN);
@ -63,7 +63,7 @@ static void transmitter_status(struct bt_mesh_model *model,
}
}
static void receiver_status(struct bt_mesh_model *model,
static void receiver_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx)
{
BT_MESH_MODEL_BUF_DEFINE(msg, OP_SAR_CFG_RX_STATUS, BT_MESH_SAR_RX_LEN);
@ -81,7 +81,7 @@ static void receiver_status(struct bt_mesh_model *model,
}
}
static int transmitter_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int transmitter_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
LOG_DBG("src 0x%04x", ctx->addr);
@ -91,7 +91,7 @@ static int transmitter_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *
return 0;
}
static int transmitter_set(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int transmitter_set(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_sar_tx *tx = &bt_mesh.sar_tx;
@ -108,7 +108,7 @@ static int transmitter_set(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *
return 0;
}
static int receiver_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int receiver_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
LOG_DBG("src 0x%04x", ctx->addr);
@ -118,7 +118,7 @@ static int receiver_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx
return 0;
}
static int receiver_set(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
static int receiver_set(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
struct bt_mesh_sar_rx *rx = &bt_mesh.sar_rx;
@ -143,7 +143,7 @@ const struct bt_mesh_model_op bt_mesh_sar_cfg_srv_op[] = {
BT_MESH_MODEL_OP_END,
};
static int sar_cfg_srv_init(struct bt_mesh_model *model)
static int sar_cfg_srv_init(const struct bt_mesh_model *model)
{
if (!bt_mesh_model_in_primary(model)) {
LOG_ERR("Configuration Server only allowed in primary element");
@ -155,12 +155,12 @@ static int sar_cfg_srv_init(struct bt_mesh_model *model)
* device-key is allowed to access this model.
*/
model->keys[0] = BT_MESH_KEY_DEV_LOCAL;
model->flags |= BT_MESH_MOD_DEVKEY_ONLY;
*(model->flags) |= BT_MESH_MOD_DEVKEY_ONLY;
return 0;
}
static void sar_cfg_srv_reset(struct bt_mesh_model *model)
static void sar_cfg_srv_reset(const struct bt_mesh_model *model)
{
struct bt_mesh_sar_tx sar_tx = BT_MESH_SAR_TX_INIT;
struct bt_mesh_sar_rx sar_rx = BT_MESH_SAR_RX_INIT;
@ -175,8 +175,9 @@ static void sar_cfg_srv_reset(struct bt_mesh_model *model)
}
#ifdef CONFIG_BT_SETTINGS
static int sar_cfg_srv_settings_set(struct bt_mesh_model *model, const char *name, size_t len_rd,
settings_read_cb read_cb, void *cb_data)
static int sar_cfg_srv_settings_set(const struct bt_mesh_model *model, const char *name,
size_t len_rd, settings_read_cb read_cb,
void *cb_data)
{
if (!strncmp(name, "sar_rx", 5)) {
return bt_mesh_settings_set(read_cb, cb_data, &bt_mesh.sar_rx,

View file

@ -271,7 +271,7 @@ static int cmd_flash_stream_unset(const struct shell *sh, size_t argc, char *arg
#if defined(CONFIG_BT_MESH_SHELL_BLOB_CLI)
static struct bt_mesh_model *mod_cli;
static const struct bt_mesh_model *mod_cli;
static void blob_cli_inputs_prepare(uint16_t group)
{
@ -351,7 +351,7 @@ static int cmd_tx(const struct shell *sh, size_t argc, char *argv[])
"pull",
blob_cli_xfer.xfer.size, group);
err = bt_mesh_blob_cli_send((struct bt_mesh_blob_cli *)mod_cli->user_data,
err = bt_mesh_blob_cli_send((struct bt_mesh_blob_cli *)*(mod_cli->user_data),
&blob_cli_xfer.inputs,
&blob_cli_xfer.xfer, bt_mesh_shell_blob_io);
if (err) {
@ -421,7 +421,7 @@ static int cmd_caps(const struct shell *sh, size_t argc, char *argv[])
blob_cli_inputs_prepare(group);
err = bt_mesh_blob_cli_caps_get((struct bt_mesh_blob_cli *)mod_cli->user_data,
err = bt_mesh_blob_cli_caps_get((struct bt_mesh_blob_cli *)*(mod_cli->user_data),
&blob_cli_xfer.inputs);
if (err) {
shell_print(sh, "Boundary check start failed (err: %d)", err);
@ -438,7 +438,7 @@ static int cmd_tx_cancel(const struct shell *sh, size_t argc,
}
shell_print(sh, "Cancelling transfer");
bt_mesh_blob_cli_cancel((struct bt_mesh_blob_cli *)mod_cli->user_data);
bt_mesh_blob_cli_cancel((struct bt_mesh_blob_cli *)*(mod_cli->user_data));
return 0;
}
@ -465,7 +465,7 @@ static int cmd_tx_get(const struct shell *sh, size_t argc, char *argv[])
blob_cli_inputs_prepare(group);
err = bt_mesh_blob_cli_xfer_progress_get((struct bt_mesh_blob_cli *)mod_cli->user_data,
err = bt_mesh_blob_cli_xfer_progress_get((struct bt_mesh_blob_cli *)*(mod_cli->user_data),
&blob_cli_xfer.inputs);
if (err) {
shell_print(sh, "ERR %d", err);
@ -482,7 +482,7 @@ static int cmd_tx_suspend(const struct shell *sh, size_t argc,
}
shell_print(sh, "Suspending transfer");
bt_mesh_blob_cli_suspend((struct bt_mesh_blob_cli *)mod_cli->user_data);
bt_mesh_blob_cli_suspend((struct bt_mesh_blob_cli *)*(mod_cli->user_data));
return 0;
}
@ -494,7 +494,7 @@ static int cmd_tx_resume(const struct shell *sh, size_t argc, char *argv[])
}
shell_print(sh, "Resuming transfer");
bt_mesh_blob_cli_resume((struct bt_mesh_blob_cli *)mod_cli->user_data);
bt_mesh_blob_cli_resume((struct bt_mesh_blob_cli *)*(mod_cli->user_data));
return 0;
}
@ -503,7 +503,7 @@ static int cmd_tx_resume(const struct shell *sh, size_t argc, char *argv[])
#if defined(CONFIG_BT_MESH_SHELL_BLOB_SRV)
static struct bt_mesh_model *mod_srv;
static const struct bt_mesh_model *mod_srv;
static int cmd_rx(const struct shell *sh, size_t argc, char *argv[])
{
@ -530,7 +530,7 @@ static int cmd_rx(const struct shell *sh, size_t argc, char *argv[])
}
shell_print(sh, "Receive BLOB 0x%x", id);
err = bt_mesh_blob_srv_recv((struct bt_mesh_blob_srv *)mod_srv->user_data,
err = bt_mesh_blob_srv_recv((struct bt_mesh_blob_srv *)*(mod_srv->user_data),
id, bt_mesh_shell_blob_io, BT_MESH_TTL_MAX, timeout_base);
if (err) {
shell_print(sh, "BLOB RX setup failed (%d)", err);
@ -548,7 +548,7 @@ static int cmd_rx_cancel(const struct shell *sh, size_t argc, char *argv[])
}
shell_print(sh, "Cancelling BLOB rx");
err = bt_mesh_blob_srv_cancel((struct bt_mesh_blob_srv *)mod_srv->user_data);
err = bt_mesh_blob_srv_cancel((struct bt_mesh_blob_srv *)*(mod_srv->user_data));
if (err) {
shell_print(sh, "BLOB cancel failed (%d)", err);
}

View file

@ -14,7 +14,7 @@
#include "../dfd_srv_internal.h"
#include "../access.h"
static struct bt_mesh_model *mod;
static const struct bt_mesh_model *mod;
static void print_receivers_status(const struct shell *sh, struct bt_mesh_dfd_srv *srv,
enum bt_mesh_dfd_status status)
@ -70,7 +70,7 @@ static int cmd_dfd_receivers_add(const struct shell *sh, size_t argc, char *argv
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
if (bt_mesh_dfu_cli_is_busy(&dfd_srv->dfu)) {
print_receivers_status(sh, dfd_srv,
@ -122,7 +122,7 @@ static int cmd_dfd_receivers_delete_all(const struct shell *sh, size_t argc, cha
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
enum bt_mesh_dfd_status status = bt_mesh_dfd_srv_receivers_delete_all(
dfd_srv);
@ -142,7 +142,7 @@ static int cmd_dfd_receivers_get(const struct shell *sh, size_t argc, char *argv
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
int err = 0;
uint16_t first = shell_strtoul(argv[1], 0, &err);
@ -197,7 +197,7 @@ static int cmd_dfd_get(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
print_dfd_status(sh, dfd_srv, BT_MESH_DFD_SUCCESS);
@ -210,7 +210,7 @@ static int cmd_dfd_start(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
struct bt_mesh_dfd_start_params params;
int err = 0;
@ -267,7 +267,7 @@ static int cmd_dfd_suspend(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
enum bt_mesh_dfd_status status = bt_mesh_dfd_srv_suspend(dfd_srv);
@ -285,7 +285,7 @@ static int cmd_dfd_cancel(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
enum bt_mesh_dfd_status status = bt_mesh_dfd_srv_cancel(dfd_srv, NULL);
@ -303,7 +303,7 @@ static int cmd_dfd_apply(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
enum bt_mesh_dfd_status status = bt_mesh_dfd_srv_apply(dfd_srv);
@ -364,7 +364,7 @@ static int cmd_dfd_fw_delete(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
uint8_t fwid_buf[CONFIG_BT_MESH_DFU_FWID_MAXLEN];
size_t hexlen = strlen(argv[1]);
@ -394,7 +394,7 @@ static int cmd_dfd_fw_delete_all(const struct shell *sh, size_t argc, char *argv
return -ENODEV;
}
struct bt_mesh_dfd_srv *dfd_srv = mod->user_data;
struct bt_mesh_dfd_srv *dfd_srv = *(mod->user_data);
enum bt_mesh_dfd_status status = bt_mesh_dfd_srv_fw_delete_all(dfd_srv);

View file

@ -505,7 +505,7 @@ static int cmd_dfu_slot_get(const struct shell *sh, size_t argc, char *argv[])
#if defined(CONFIG_BT_MESH_SHELL_DFU_CLI)
static struct bt_mesh_model *mod_cli;
static const struct bt_mesh_model *mod_cli;
static struct {
struct bt_mesh_dfu_target targets[32];
@ -587,7 +587,7 @@ static int cmd_dfu_target_state(const struct shell *sh, size_t argc, char *argv[
return -ENODEV;
}
err = bt_mesh_dfu_cli_status_get((struct bt_mesh_dfu_cli *)mod_cli->user_data,
err = bt_mesh_dfu_cli_status_get((struct bt_mesh_dfu_cli *)*(mod_cli->user_data),
&ctx, &rsp);
if (err) {
shell_print(sh, "Failed getting target status (err: %d)",
@ -654,7 +654,7 @@ static int cmd_dfu_target_imgs(const struct shell *sh, size_t argc, char *argv[]
shell_print(sh, "Requesting DFU images in 0x%04x", bt_mesh_shell_target_ctx.dst);
err = bt_mesh_dfu_cli_imgs_get((struct bt_mesh_dfu_cli *)mod_cli->user_data,
err = bt_mesh_dfu_cli_imgs_get((struct bt_mesh_dfu_cli *)*(mod_cli->user_data),
&ctx, dfu_img_cb, NULL, img_cnt);
if (err) {
shell_print(sh, "Request failed (err: %d)", err);
@ -694,7 +694,7 @@ static int cmd_dfu_target_check(const struct shell *sh, size_t argc, char *argv[
return 0;
}
err = bt_mesh_dfu_cli_metadata_check((struct bt_mesh_dfu_cli *)mod_cli->user_data,
err = bt_mesh_dfu_cli_metadata_check((struct bt_mesh_dfu_cli *)*(mod_cli->user_data),
&ctx, img_idx, slot, &rsp);
if (err) {
shell_print(sh, "Metadata check failed. err: %d", err);
@ -765,7 +765,7 @@ static int cmd_dfu_send(const struct shell *sh, size_t argc, char *argv[])
dfu_tx.inputs.app_idx = bt_mesh_shell_target_ctx.app_idx;
dfu_tx.inputs.ttl = BT_MESH_TTL_DEFAULT;
err = bt_mesh_dfu_cli_send((struct bt_mesh_dfu_cli *)mod_cli->user_data,
err = bt_mesh_dfu_cli_send((struct bt_mesh_dfu_cli *)*(mod_cli->user_data),
&dfu_tx.inputs, bt_mesh_shell_blob_io, &xfer);
if (err) {
shell_print(sh, "Failed (err: %d)", err);
@ -800,7 +800,7 @@ static int cmd_dfu_tx_cancel(const struct shell *sh, size_t argc, char *argv[])
shell_print(sh, "Cancelling DFU");
}
err = bt_mesh_dfu_cli_cancel((struct bt_mesh_dfu_cli *)mod_cli->user_data,
err = bt_mesh_dfu_cli_cancel((struct bt_mesh_dfu_cli *)*(mod_cli->user_data),
(argc == 2) ? &ctx : NULL);
if (err) {
shell_print(sh, "Failed (err: %d)", err);
@ -819,7 +819,7 @@ static int cmd_dfu_apply(const struct shell *sh, size_t argc, char *argv[])
shell_print(sh, "Applying DFU");
err = bt_mesh_dfu_cli_apply((struct bt_mesh_dfu_cli *)mod_cli->user_data);
err = bt_mesh_dfu_cli_apply((struct bt_mesh_dfu_cli *)*(mod_cli->user_data));
if (err) {
shell_print(sh, "Failed (err: %d)", err);
}
@ -837,7 +837,7 @@ static int cmd_dfu_confirm(const struct shell *sh, size_t argc, char *argv[])
shell_print(sh, "Confirming DFU");
err = bt_mesh_dfu_cli_confirm((struct bt_mesh_dfu_cli *)mod_cli->user_data);
err = bt_mesh_dfu_cli_confirm((struct bt_mesh_dfu_cli *)*(mod_cli->user_data));
if (err) {
shell_print(sh, "Failed (err: %d)", err);
}
@ -855,7 +855,7 @@ static int cmd_dfu_suspend(const struct shell *sh, size_t argc, char *argv[])
shell_print(sh, "Suspending DFU");
err = bt_mesh_dfu_cli_suspend((struct bt_mesh_dfu_cli *)mod_cli->user_data);
err = bt_mesh_dfu_cli_suspend((struct bt_mesh_dfu_cli *)*(mod_cli->user_data));
if (err) {
shell_print(sh, "Failed (err: %d)", err);
}
@ -873,7 +873,7 @@ static int cmd_dfu_resume(const struct shell *sh, size_t argc, char *argv[])
shell_print(sh, "Resuming DFU");
err = bt_mesh_dfu_cli_resume((struct bt_mesh_dfu_cli *)mod_cli->user_data);
err = bt_mesh_dfu_cli_resume((struct bt_mesh_dfu_cli *)*(mod_cli->user_data));
if (err) {
shell_print(sh, "Failed (err: %d)", err);
}
@ -888,7 +888,7 @@ static int cmd_dfu_tx_progress(const struct shell *sh, size_t argc, char *argv[]
}
shell_print(sh, "DFU progress: %u %%",
bt_mesh_dfu_cli_progress((struct bt_mesh_dfu_cli *)mod_cli->user_data));
bt_mesh_dfu_cli_progress((struct bt_mesh_dfu_cli *)*(mod_cli->user_data)));
return 0;
}
@ -896,7 +896,7 @@ static int cmd_dfu_tx_progress(const struct shell *sh, size_t argc, char *argv[]
#if defined(CONFIG_BT_MESH_SHELL_DFU_SRV)
static struct bt_mesh_model *mod_srv;
static const struct bt_mesh_model *mod_srv;
static int cmd_dfu_applied(const struct shell *sh, size_t argc, char *argv[])
{
@ -904,7 +904,7 @@ static int cmd_dfu_applied(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
bt_mesh_dfu_srv_applied((struct bt_mesh_dfu_srv *)mod_srv->user_data);
bt_mesh_dfu_srv_applied((struct bt_mesh_dfu_srv *)*(mod_srv->user_data));
return 0;
}
@ -914,7 +914,7 @@ static int cmd_dfu_rx_cancel(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
bt_mesh_dfu_srv_cancel((struct bt_mesh_dfu_srv *)mod_srv->user_data);
bt_mesh_dfu_srv_cancel((struct bt_mesh_dfu_srv *)*(mod_srv->user_data));
return 0;
}
@ -925,7 +925,7 @@ static int cmd_dfu_rx_progress(const struct shell *sh, size_t argc, char *argv[]
}
shell_print(sh, "DFU progress: %u %%",
bt_mesh_dfu_srv_progress((struct bt_mesh_dfu_srv *)mod_srv->user_data));
bt_mesh_dfu_srv_progress((struct bt_mesh_dfu_srv *)*(mod_srv->user_data)));
return 0;
}

View file

@ -13,7 +13,7 @@
#include "utils.h"
#include <zephyr/bluetooth/mesh/shell.h>
static struct bt_mesh_model *mod;
static const struct bt_mesh_model *mod;
static void show_faults(const struct shell *sh, uint8_t test_id, uint16_t cid, uint8_t *faults,
size_t fault_count)
@ -40,7 +40,7 @@ static int cmd_fault_get(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_health_cli *cli = mod->user_data;
struct bt_mesh_health_cli *cli = *(mod->user_data);
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
bt_mesh_shell_target_ctx.dst);
uint8_t faults[32];
@ -74,7 +74,7 @@ static int fault_clear(const struct shell *sh, size_t argc, char *argv[], bool a
return -ENODEV;
}
struct bt_mesh_health_cli *cli = mod->user_data;
struct bt_mesh_health_cli *cli = *(mod->user_data);
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
bt_mesh_shell_target_ctx.dst);
uint8_t test_id;
@ -126,7 +126,7 @@ static int fault_test(const struct shell *sh, size_t argc, char *argv[], bool ac
return -ENODEV;
}
struct bt_mesh_health_cli *cli = mod->user_data;
struct bt_mesh_health_cli *cli = *(mod->user_data);
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
bt_mesh_shell_target_ctx.dst);
uint8_t test_id;
@ -179,7 +179,7 @@ static int cmd_period_get(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_health_cli *cli = mod->user_data;
struct bt_mesh_health_cli *cli = *(mod->user_data);
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
bt_mesh_shell_target_ctx.dst);
uint8_t divisor;
@ -201,7 +201,7 @@ static int period_set(const struct shell *sh, size_t argc, char *argv[], bool ac
return -ENODEV;
}
struct bt_mesh_health_cli *cli = mod->user_data;
struct bt_mesh_health_cli *cli = *(mod->user_data);
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
bt_mesh_shell_target_ctx.dst);
uint8_t divisor;
@ -251,7 +251,7 @@ static int cmd_attention_get(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
struct bt_mesh_health_cli *cli = mod->user_data;
struct bt_mesh_health_cli *cli = *(mod->user_data);
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
bt_mesh_shell_target_ctx.dst);
uint8_t attention;
@ -273,7 +273,7 @@ static int attention_set(const struct shell *sh, size_t argc, char *argv[], bool
return -ENODEV;
}
struct bt_mesh_health_cli *cli = mod->user_data;
struct bt_mesh_health_cli *cli = *(mod->user_data);
struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_APP(bt_mesh_shell_target_ctx.app_idx,
bt_mesh_shell_target_ctx.dst);
uint8_t attention;

View file

@ -11,7 +11,7 @@
#include "utils.h"
static struct bt_mesh_model *mod;
static const struct bt_mesh_model *mod;
/***************************************************************************************************
* Implementation of the model's instance
@ -108,7 +108,7 @@ static int cmd_scan(const struct shell *sh, size_t argc, char *argv[])
hex2bin(argv[2], strlen(argv[2]), uuid, 16);
}
err = bt_mesh_rpr_scan_start((struct bt_mesh_rpr_cli *)mod->user_data,
err = bt_mesh_rpr_scan_start((struct bt_mesh_rpr_cli *)*(mod->user_data),
&srv, argc > 2 ? uuid : NULL, timeout,
BT_MESH_RPR_SCAN_MAX_DEVS_ANY, &rsp);
if (err) {
@ -153,7 +153,7 @@ static int cmd_scan_ext(const struct shell *sh, size_t argc, char *argv[])
return err;
}
err = bt_mesh_rpr_scan_start_ext((struct bt_mesh_rpr_cli *)mod->user_data,
err = bt_mesh_rpr_scan_start_ext((struct bt_mesh_rpr_cli *)*(mod->user_data),
&srv, uuid, timeout, ad_types,
(argc - 3));
if (err) {
@ -189,7 +189,7 @@ static int cmd_scan_srv(const struct shell *sh, size_t argc, char *argv[])
return err;
}
err = bt_mesh_rpr_scan_start_ext((struct bt_mesh_rpr_cli *)mod->user_data,
err = bt_mesh_rpr_scan_start_ext((struct bt_mesh_rpr_cli *)*(mod->user_data),
&srv, NULL, 0, ad_types, (argc - 1));
if (err) {
shell_print(sh, "Scan start failed: %d", err);
@ -213,7 +213,7 @@ static int cmd_scan_caps(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
err = bt_mesh_rpr_scan_caps_get((struct bt_mesh_rpr_cli *)mod->user_data, &srv, &caps);
err = bt_mesh_rpr_scan_caps_get((struct bt_mesh_rpr_cli *)*(mod->user_data), &srv, &caps);
if (err) {
shell_print(sh, "Scan capabilities get failed: %d", err);
return err;
@ -241,7 +241,7 @@ static int cmd_scan_get(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
err = bt_mesh_rpr_scan_get((struct bt_mesh_rpr_cli *)mod->user_data, &srv, &rsp);
err = bt_mesh_rpr_scan_get((struct bt_mesh_rpr_cli *)*(mod->user_data), &srv, &rsp);
if (err) {
shell_print(sh, "Scan get failed: %d", err);
return err;
@ -269,7 +269,7 @@ static int cmd_scan_stop(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
err = bt_mesh_rpr_scan_stop((struct bt_mesh_rpr_cli *)mod->user_data, &srv, &rsp);
err = bt_mesh_rpr_scan_stop((struct bt_mesh_rpr_cli *)*(mod->user_data), &srv, &rsp);
if (err || rsp.status) {
shell_print(sh, "Scan stop failed: %d %u", err, rsp.status);
return err;
@ -294,7 +294,7 @@ static int cmd_link_get(const struct shell *sh, size_t argc, char *argv[])
return -ENODEV;
}
err = bt_mesh_rpr_link_get((struct bt_mesh_rpr_cli *)mod->user_data, &srv, &rsp);
err = bt_mesh_rpr_link_get((struct bt_mesh_rpr_cli *)*(mod->user_data), &srv, &rsp);
if (err) {
shell_print(sh, "Link get failed: %d %u", err, rsp.status);
return err;
@ -316,7 +316,7 @@ static int cmd_link_close(const struct shell *sh, size_t argc, char *argv[])
};
int err;
err = bt_mesh_rpr_link_close((struct bt_mesh_rpr_cli *)mod->user_data, &srv, &rsp);
err = bt_mesh_rpr_link_close((struct bt_mesh_rpr_cli *)*(mod->user_data), &srv, &rsp);
if (err) {
shell_print(sh, "Link close failed: %d %u", err, rsp.status);
return err;
@ -355,7 +355,7 @@ static int cmd_provision_remote(const struct shell *sh, size_t argc, char *argv[
return err;
}
err = bt_mesh_provision_remote((struct bt_mesh_rpr_cli *)mod->user_data,
err = bt_mesh_provision_remote((struct bt_mesh_rpr_cli *)*(mod->user_data),
&srv, uuid, net_idx, addr);
if (err) {
shell_print(sh, "Prov remote start failed: %d", err);
@ -396,7 +396,7 @@ static int cmd_reprovision_remote(const struct shell *sh, size_t argc, char *arg
return err;
}
err = bt_mesh_reprovision_remote((struct bt_mesh_rpr_cli *)mod->user_data,
err = bt_mesh_reprovision_remote((struct bt_mesh_rpr_cli *)*(mod->user_data),
&srv, addr, composition_changed);
if (err) {
shell_print(sh, "Reprovisioning failed: %d", err);

View file

@ -68,7 +68,7 @@ static void get_faults(uint8_t *faults, uint8_t faults_size, uint8_t *dst, uint8
}
}
static int fault_get_cur(struct bt_mesh_model *model, uint8_t *test_id,
static int fault_get_cur(const struct bt_mesh_model *model, uint8_t *test_id,
uint16_t *company_id, uint8_t *faults, uint8_t *fault_count)
{
shell_print_ctx("Sending current faults");
@ -81,7 +81,7 @@ static int fault_get_cur(struct bt_mesh_model *model, uint8_t *test_id,
return 0;
}
static int fault_get_reg(struct bt_mesh_model *model, uint16_t cid,
static int fault_get_reg(const struct bt_mesh_model *model, uint16_t cid,
uint8_t *test_id, uint8_t *faults, uint8_t *fault_count)
{
if (cid != CONFIG_BT_COMPANY_ID) {
@ -99,7 +99,7 @@ static int fault_get_reg(struct bt_mesh_model *model, uint16_t cid,
return 0;
}
static int fault_clear(struct bt_mesh_model *model, uint16_t cid)
static int fault_clear(const struct bt_mesh_model *model, uint16_t cid)
{
if (cid != CONFIG_BT_COMPANY_ID) {
return -EINVAL;
@ -110,7 +110,7 @@ static int fault_clear(struct bt_mesh_model *model, uint16_t cid)
return 0;
}
static int fault_test(struct bt_mesh_model *model, uint8_t test_id,
static int fault_test(const struct bt_mesh_model *model, uint8_t test_id,
uint16_t cid)
{
if (cid != CONFIG_BT_COMPANY_ID) {
@ -124,12 +124,12 @@ static int fault_test(struct bt_mesh_model *model, uint8_t test_id,
return 0;
}
static void attention_on(struct bt_mesh_model *model)
static void attention_on(const struct bt_mesh_model *model)
{
shell_print_ctx("Attention On");
}
static void attention_off(struct bt_mesh_model *model)
static void attention_off(const struct bt_mesh_model *model)
{
shell_print_ctx("Attention Off");
}

View file

@ -13,7 +13,7 @@
#include "mesh/access.h"
#include "utils.h"
bool bt_mesh_shell_mdl_first_get(uint16_t id, struct bt_mesh_model **mod)
bool bt_mesh_shell_mdl_first_get(uint16_t id, const struct bt_mesh_model **mod)
{
const struct bt_mesh_comp *comp = bt_mesh_comp_get();
@ -27,10 +27,10 @@ bool bt_mesh_shell_mdl_first_get(uint16_t id, struct bt_mesh_model **mod)
return false;
}
int bt_mesh_shell_mdl_instance_set(const struct shell *sh, struct bt_mesh_model **mod,
int bt_mesh_shell_mdl_instance_set(const struct shell *sh, const struct bt_mesh_model **mod,
uint16_t mod_id, uint8_t elem_idx)
{
struct bt_mesh_model *mod_temp;
const struct bt_mesh_model *mod_temp;
const struct bt_mesh_comp *comp = bt_mesh_comp_get();
if (elem_idx >= comp->elem_count) {
@ -53,14 +53,14 @@ int bt_mesh_shell_mdl_instance_set(const struct shell *sh, struct bt_mesh_model
int bt_mesh_shell_mdl_print_all(const struct shell *sh, uint16_t mod_id)
{
const struct bt_mesh_comp *comp = bt_mesh_comp_get();
struct bt_mesh_model *mod;
const struct bt_mesh_model *mod;
for (int i = 0; i < comp->elem_count; i++) {
mod = bt_mesh_model_find(&comp->elem[i], mod_id);
if (mod) {
shell_print(sh,
"Client model instance found at addr 0x%.4X. Element index: %d",
comp->elem[i].addr, mod->elem_idx);
comp->elem[i].addr, *(mod->elem_idx));
}
}

View file

@ -34,9 +34,9 @@
0), \
SHELL_SUBCMD_SET_END);
bool bt_mesh_shell_mdl_first_get(uint16_t id, struct bt_mesh_model **mod);
bool bt_mesh_shell_mdl_first_get(uint16_t id, const struct bt_mesh_model **mod);
int bt_mesh_shell_mdl_instance_set(const struct shell *sh, struct bt_mesh_model **mod,
int bt_mesh_shell_mdl_instance_set(const struct shell *sh, const struct bt_mesh_model **mod,
uint16_t mod_id, uint8_t elem_idx);
int bt_mesh_shell_mdl_print_all(const struct shell *sh, uint16_t mod_id);

View file

@ -22,7 +22,7 @@ struct sol_rpl_param {
uint8_t *len;
};
static int handle_status(struct bt_mesh_model *mod,
static int handle_status(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -160,7 +160,7 @@ void bt_mesh_sol_pdu_rpl_cli_timeout_set(int32_t timeout)
msg_timeout = timeout;
}
static int sol_pdu_rpl_cli_init(struct bt_mesh_model *mod)
static int sol_pdu_rpl_cli_init(const struct bt_mesh_model *mod)
{
if (!bt_mesh_model_in_primary(mod)) {
LOG_ERR("Solicitation PDU RPL Configuration client not in primary element");
@ -169,7 +169,7 @@ static int sol_pdu_rpl_cli_init(struct bt_mesh_model *mod)
msg_timeout = CONFIG_BT_MESH_SOL_PDU_RPL_CLI_TIMEOUT;
cli = mod->user_data;
cli = *(mod->user_data);
cli->model = mod;
bt_mesh_msg_ack_ctx_init(&cli->ack_ctx);
return 0;

View file

@ -14,7 +14,7 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_mesh_sol_pdu_rpl_srv);
static void sol_rpl_status_rsp(struct bt_mesh_model *mod,
static void sol_rpl_status_rsp(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
uint16_t range,
uint8_t len)
@ -32,7 +32,7 @@ static void sol_rpl_status_rsp(struct bt_mesh_model *mod,
bt_mesh_model_send(mod, ctx, &buf, NULL, NULL);
}
static int item_clear(struct bt_mesh_model *mod,
static int item_clear(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf,
bool acked)
@ -78,14 +78,14 @@ static int item_clear(struct bt_mesh_model *mod,
return 0;
}
static int handle_item_clear(struct bt_mesh_model *mod,
static int handle_item_clear(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
return item_clear(mod, ctx, buf, true);
}
static int handle_item_clear_unacked(struct bt_mesh_model *mod,
static int handle_item_clear_unacked(const struct bt_mesh_model *mod,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
@ -99,7 +99,7 @@ const struct bt_mesh_model_op _bt_mesh_sol_pdu_rpl_srv_op[] = {
BT_MESH_MODEL_OP_END
};
static int sol_pdu_rpl_srv_init(struct bt_mesh_model *mod)
static int sol_pdu_rpl_srv_init(const struct bt_mesh_model *mod)
{
if (!bt_mesh_model_in_primary(mod)) {
LOG_ERR("Solicitation PDU RPL Configuration server not in primary element");