14#ifndef BT_MESH_LIGHT_CTRL_SRV_H__
15#define BT_MESH_LIGHT_CTRL_SRV_H__
17#include <zephyr/bluetooth/mesh.h>
32#if defined(CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG)
43#define BT_MESH_LIGHT_CTRL_SRV_INIT_WITH_REG(_lightness_srv, _reg) \
45 .cfg = BT_MESH_LIGHT_CTRL_SRV_CFG_INIT, \
46 .onoff = BT_MESH_ONOFF_SRV_INIT( \
47 &_bt_mesh_light_ctrl_srv_onoff), \
48 .lightness = _lightness_srv, \
64#if CONFIG_BT_MESH_LIGHT_CTRL_REG_SPEC && CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG
65#define BT_MESH_LIGHT_CTRL_SRV_INIT(_lightness_srv) \
66 BT_MESH_LIGHT_CTRL_SRV_INIT_WITH_REG( \
68 &(&((struct bt_mesh_light_ctrl_reg_spec) \
69 BT_MESH_LIGHT_CTRL_REG_SPEC_INIT))->reg)
71#define BT_MESH_LIGHT_CTRL_SRV_INIT(_lightness_srv) \
73 .cfg = BT_MESH_LIGHT_CTRL_SRV_CFG_INIT, \
74 .onoff = BT_MESH_ONOFF_SRV_INIT( \
75 &_bt_mesh_light_ctrl_srv_onoff), \
76 .lightness = _lightness_srv \
86#define BT_MESH_MODEL_LIGHT_CTRL_SRV(_srv) \
87 BT_MESH_MODEL_ONOFF_SRV(&(_srv)->onoff), \
88 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_LIGHT_LC_SRV, \
89 _bt_mesh_light_ctrl_srv_op, &(_srv)->pub, \
90 BT_MESH_MODEL_USER_DATA( \
91 struct bt_mesh_light_ctrl_srv, _srv), \
92 &_bt_mesh_light_ctrl_srv_cb), \
93 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV, \
94 _bt_mesh_light_ctrl_setup_srv_op, \
96 BT_MESH_MODEL_USER_DATA( \
97 struct bt_mesh_light_ctrl_srv, _srv), \
98 &_bt_mesh_light_ctrl_setup_srv_cb)
138#if CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG
170 struct bt_mesh_model_pub
pub;
175 BT_MESH_LIGHT_CTRL_OP_LIGHT_ONOFF_STATUS, 3)];
178#if CONFIG_BT_MESH_LIGHT_CTRL_AMB_LIGHT_LEVEL_TIMEOUT
180 int64_t amb_light_level_timestamp;
188 BT_MESH_LIGHT_CTRL_OP_PROP_STATUS,
191#if CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG
286 struct bt_mesh_msg_ctx *ctx);
289extern const struct bt_mesh_model_cb _bt_mesh_light_ctrl_srv_cb;
290extern const struct bt_mesh_model_op _bt_mesh_light_ctrl_srv_op[];
291extern const struct bt_mesh_model_cb _bt_mesh_light_ctrl_setup_srv_cb;
292extern const struct bt_mesh_model_op _bt_mesh_light_ctrl_setup_srv_op[];
int bt_mesh_light_ctrl_srv_on(struct bt_mesh_light_ctrl_srv *srv)
Turn the light on.
int bt_mesh_light_ctrl_srv_off(struct bt_mesh_light_ctrl_srv *srv)
Manually turn the light off.
bt_mesh_light_ctrl_srv_state
Definition light_ctrl_srv.h:101
@ LIGHT_CTRL_STATE_COUNT
Definition light_ctrl_srv.h:117
@ LIGHT_CTRL_STATE_PROLONG
Definition light_ctrl_srv.h:114
@ LIGHT_CTRL_STATE_ON
Definition light_ctrl_srv.h:110
@ LIGHT_CTRL_STATE_STANDBY
Definition light_ctrl_srv.h:106
int bt_mesh_light_ctrl_srv_disable(struct bt_mesh_light_ctrl_srv *srv)
Disable the Light Lightness Control Server.
int bt_mesh_light_ctrl_srv_enable(struct bt_mesh_light_ctrl_srv *srv)
Enable the Light Lightness Control Server.
int bt_mesh_light_ctrl_srv_pub(struct bt_mesh_light_ctrl_srv *srv, struct bt_mesh_msg_ctx *ctx)
Publish the current OnOff state.
bool bt_mesh_light_ctrl_srv_is_on(struct bt_mesh_light_ctrl_srv *srv)
Check if the Light Lightness Control Server has turned the light on.
#define CONFIG_BT_MESH_SENSOR_CHANNEL_ENCODED_SIZE_MAX
Definition sensor.h:26
Definition light_ctrl_reg.h:41
uint32_t fade_standby_auto
Definition light_ctrl_srv.h:133
uint32_t fade_prolong
Definition light_ctrl_srv.h:129
uint32_t prolong
Definition light_ctrl_srv.h:131
uint32_t fade_on
Definition light_ctrl_srv.h:125
uint32_t fade_standby_manual
Definition light_ctrl_srv.h:135
uint32_t occupancy_delay
Definition light_ctrl_srv.h:123
uint32_t on
Definition light_ctrl_srv.h:127
uint16_t light[LIGHT_CTRL_STATE_COUNT]
Definition light_ctrl_srv.h:137
Definition light_ctrl_srv.h:121
enum bt_mesh_light_ctrl_srv_state state
Definition light_ctrl_srv.h:150
uint32_t duration
Definition light_ctrl_srv.h:160
struct bt_mesh_onoff_srv onoff
Definition light_ctrl_srv.h:200
uint16_t initial_light
Definition light_ctrl_srv.h:156
const struct bt_mesh_model * model
Definition light_ctrl_srv.h:204
struct k_work_delayable action_delay
Definition light_ctrl_srv.h:166
struct bt_mesh_model_pub setup_pub
Definition light_ctrl_srv.h:183
struct bt_mesh_tid_ctx tid
Definition light_ctrl_srv.h:202
struct net_buf_simple setup_pub_buf
Definition light_ctrl_srv.h:185
atomic_t flags
Definition light_ctrl_srv.h:152
struct bt_mesh_lightness_srv * lightness
Definition light_ctrl_srv.h:198
uint16_t resume
Definition light_ctrl_srv.h:177
uint32_t initial_centilux
Definition light_ctrl_srv.h:158
struct bt_mesh_model_pub pub
Definition light_ctrl_srv.h:170
uint8_t setup_pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_LIGHT_CTRL_OP_PROP_STATUS, 2+CONFIG_BT_MESH_SENSOR_CHANNEL_ENCODED_SIZE_MAX)]
Definition light_ctrl_srv.h:189
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_LIGHT_CTRL_OP_LIGHT_ONOFF_STATUS, 3)]
Definition light_ctrl_srv.h:175
struct bt_mesh_light_ctrl_srv::@154 fade
struct bt_mesh_light_ctrl_srv_cfg cfg
Definition light_ctrl_srv.h:168
struct net_buf_simple pub_buf
Definition light_ctrl_srv.h:172
struct k_work_delayable timer
Definition light_ctrl_srv.h:163
const struct bt_mesh_model * setup_srv
Definition light_ctrl_srv.h:206
Light Lightness Control Server instance.
Definition light_ctrl_srv.h:148
Definition lightness_srv.h:181
Definition gen_onoff_srv.h:52
Definition gen_onoff_srv.h:92
Definition model_types.h:46