13#ifndef BT_MESH_GEN_PROP_SRV_H__
14#define BT_MESH_GEN_PROP_SRV_H__
18#include <zephyr/sys/util.h>
39#define BT_MESH_PROP_SRV_INIT(_properties, _property_count, _get, _set) \
41 .get = _get, .set = _set, .properties = _properties, \
42 .property_count = _property_count, \
50#define BT_MESH_PROP_SRV_USER_INIT() {}
61#define BT_MESH_PROP_SRV_ADMIN_INIT(_properties, _get, _set) \
62 BT_MESH_PROP_SRV_INIT(_properties, ARRAY_SIZE(_properties), _get, _set)
72#define BT_MESH_PROP_SRV_MFR_INIT(_properties, _get) \
73 BT_MESH_PROP_SRV_INIT(_properties, ARRAY_SIZE(_properties), _get, NULL)
83#define BT_MESH_PROP_SRV_CLIENT_INIT(_properties) \
84 BT_MESH_PROP_SRV_INIT((struct bt_mesh_prop *)_properties, \
85 ARRAY_SIZE(_properties), NULL, NULL)
91#define BT_MESH_MODEL_PROP_SRV_USER(_srv) \
92 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_USER_PROP_SRV, \
93 _bt_mesh_prop_user_srv_op, &(_srv)->pub, \
94 BT_MESH_MODEL_USER_DATA(struct bt_mesh_prop_srv, \
96 &_bt_mesh_prop_srv_cb)
105#define BT_MESH_MODEL_PROP_SRV_ADMIN(_srv) \
106 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV, \
107 _bt_mesh_prop_admin_srv_op, &(_srv)->pub, \
108 BT_MESH_MODEL_USER_DATA(struct bt_mesh_prop_srv, \
110 &_bt_mesh_prop_srv_cb)
119#define BT_MESH_MODEL_PROP_SRV_MFR(_srv) \
120 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV, \
121 _bt_mesh_prop_mfr_srv_op, &(_srv)->pub, \
122 BT_MESH_MODEL_USER_DATA(struct bt_mesh_prop_srv, \
124 &_bt_mesh_prop_srv_cb)
133#define BT_MESH_MODEL_PROP_SRV_CLIENT(_srv) \
134 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV, \
135 _bt_mesh_prop_client_srv_op, &(_srv)->pub, \
136 BT_MESH_MODEL_USER_DATA(struct bt_mesh_prop_srv, \
138 &_bt_mesh_prop_srv_cb)
156 struct bt_mesh_model_pub
pub;
160 uint8_t
pub_data[BT_MESH_PROP_MSG_MAXLEN(CONFIG_BT_MESH_PROP_MAXCOUNT)];
196 struct bt_mesh_msg_ctx *ctx,
213 struct bt_mesh_msg_ctx *ctx,
230 struct bt_mesh_msg_ctx *ctx);
248 struct bt_mesh_msg_ctx *ctx,
252extern const struct bt_mesh_model_cb _bt_mesh_prop_srv_cb;
253extern const struct bt_mesh_model_op _bt_mesh_prop_user_srv_op[];
254extern const struct bt_mesh_model_op _bt_mesh_prop_admin_srv_op[];
255extern const struct bt_mesh_model_op _bt_mesh_prop_mfr_srv_op[];
256extern const struct bt_mesh_model_op _bt_mesh_prop_client_srv_op[];
bt_mesh_prop_srv_state
Definition gen_prop_srv.h:141
@ BT_MESH_PROP_SRV_STATE_LIST
Definition gen_prop_srv.h:143
@ BT_MESH_PROP_SRV_STATE_NONE
Definition gen_prop_srv.h:142
@ BT_MESH_PROP_SRV_STATE_PROP
Definition gen_prop_srv.h:144
int bt_mesh_prop_srv_pub_list(struct bt_mesh_prop_srv *srv, struct bt_mesh_msg_ctx *ctx)
Publish a list of all properties on the server.
int bt_mesh_prop_srv_pub(struct bt_mesh_prop_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_prop_val *val)
Publish a property value.
const uint32_t property_count
Definition gen_prop_srv.h:169
struct bt_mesh_prop *const properties
Definition gen_prop_srv.h:167
const struct bt_mesh_model * model
Definition gen_prop_srv.h:154
void(*const set)(struct bt_mesh_prop_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_prop_val *val)
Set a property value.
Definition gen_prop_srv.h:195
void(*const get)(struct bt_mesh_prop_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_prop_val *val)
Get a property value.
Definition gen_prop_srv.h:212
uint8_t pub_data[BT_MESH_PROP_MSG_MAXLEN(CONFIG_BT_MESH_PROP_MAXCOUNT)]
Definition gen_prop_srv.h:160
struct net_buf_simple pub_buf
Definition gen_prop_srv.h:158
uint16_t pub_id
Definition gen_prop_srv.h:162
enum bt_mesh_prop_srv_state pub_state
Definition gen_prop_srv.h:164
struct bt_mesh_model_pub pub
Definition gen_prop_srv.h:156
Definition gen_prop_srv.h:152