14#ifndef BT_MESH_GEN_PLVL_SRV_H__
15#define BT_MESH_GEN_PLVL_SRV_H__
17#include <zephyr/bluetooth/mesh.h>
23#if IS_ENABLED(CONFIG_EMDS) && IS_ENABLED(CONFIG_BT_SETTINGS)
39#define BT_MESH_PLVL_SRV_INIT(_handlers) \
41 .lvl = BT_MESH_LVL_SRV_INIT(&bt_mesh_plvl_srv_lvl_handlers), \
42 .ponoff = BT_MESH_PONOFF_SRV_INIT( \
43 &bt_mesh_plvl_srv_onoff_handlers, NULL, NULL), \
44 .handlers = _handlers, \
53#define BT_MESH_MODEL_PLVL_SRV(_srv) \
54 BT_MESH_MODEL_LVL_SRV(&(_srv)->lvl), \
55 BT_MESH_MODEL_PONOFF_SRV(&(_srv)->ponoff), \
56 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV, \
57 _bt_mesh_plvl_srv_op, &(_srv)->pub, \
58 BT_MESH_MODEL_USER_DATA( \
59 struct bt_mesh_plvl_srv, _srv), \
60 &_bt_mesh_plvl_srv_cb), \
61 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV, \
62 _bt_mesh_plvl_setup_srv_op, NULL, \
63 BT_MESH_MODEL_USER_DATA( \
64 struct bt_mesh_plvl_srv, _srv), \
65 &_bt_mesh_plvl_setup_srv_cb)
86 struct bt_mesh_msg_ctx *ctx,
100 struct bt_mesh_msg_ctx *ctx,
115 struct bt_mesh_msg_ctx *ctx,
116 uint16_t old_default, uint16_t new_default);
134 struct bt_mesh_msg_ctx *ctx,
154 struct bt_mesh_model_pub
pub;
159 BT_MESH_PLVL_OP_LEVEL_STATUS,
160 BT_MESH_PLVL_MSG_MAXLEN_LEVEL_STATUS)];
177#if IS_ENABLED(CONFIG_EMDS) && IS_ENABLED(CONFIG_BT_SETTINGS)
202 struct bt_mesh_msg_ctx *ctx,
206extern const struct bt_mesh_model_cb _bt_mesh_plvl_srv_cb;
207extern const struct bt_mesh_model_cb _bt_mesh_plvl_setup_srv_cb;
208extern const struct bt_mesh_model_op _bt_mesh_plvl_srv_op[];
209extern const struct bt_mesh_model_op _bt_mesh_plvl_setup_srv_op[];
int bt_mesh_plvl_srv_pub(struct bt_mesh_plvl_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_plvl_status *status)
Publish the current Power state.
Definition: gen_lvl_srv.h:52
Definition: gen_lvl_srv.h:143
Definition: gen_onoff_srv.h:52
Definition: gen_plvl.h:53
Definition: gen_plvl.h:25
void(*const default_update)(struct bt_mesh_plvl_srv *srv, struct bt_mesh_msg_ctx *ctx, uint16_t old_default, uint16_t new_default)
The Default Power state has changed.
Definition: gen_plvl_srv.h:114
void(*const power_set)(struct bt_mesh_plvl_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_plvl_set *set, struct bt_mesh_plvl_status *rsp)
Set the Power state.
Definition: gen_plvl_srv.h:85
void(*const power_get)(struct bt_mesh_plvl_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_plvl_status *rsp)
Get the current Power state.
Definition: gen_plvl_srv.h:99
void(*const range_update)(struct bt_mesh_plvl_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_plvl_range *old_range, const struct bt_mesh_plvl_range *new_range)
The Power Range state has changed.
Definition: gen_plvl_srv.h:133
Definition: gen_plvl_srv.h:68
struct bt_mesh_model_pub pub
Definition: gen_plvl_srv.h:154
struct net_buf_simple pub_buf
Definition: gen_plvl_srv.h:156
uint16_t last
Definition: gen_plvl_srv.h:172
struct bt_mesh_plvl_range range
Definition: gen_plvl_srv.h:167
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_PLVL_OP_LEVEL_STATUS, BT_MESH_PLVL_MSG_MAXLEN_LEVEL_STATUS)]
Definition: gen_plvl_srv.h:160
const struct bt_mesh_model * plvl_model
Definition: gen_plvl_srv.h:150
struct bt_mesh_tid_ctx tid
Definition: gen_plvl_srv.h:162
struct bt_mesh_ponoff_srv ponoff
Definition: gen_plvl_srv.h:148
const struct bt_mesh_plvl_srv_handlers *const handlers
Definition: gen_plvl_srv.h:164
struct bt_mesh_plvl_srv::@150 transient
uint16_t default_power
Definition: gen_plvl_srv.h:169
const struct bt_mesh_model * plvl_setup_model
Definition: gen_plvl_srv.h:152
bool is_on
Definition: gen_plvl_srv.h:174
struct bt_mesh_lvl_srv lvl
Definition: gen_plvl_srv.h:146
Definition: gen_plvl_srv.h:144
Definition: gen_plvl.h:39
Definition: gen_ponoff_srv.h:74
Definition: model_types.h:46