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
139#ifdef CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE
162#ifdef CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE
164 struct sensor_value initial_lux;
180 struct bt_mesh_model_pub
pub;
185 BT_MESH_LIGHT_CTRL_OP_LIGHT_ONOFF_STATUS, 3)];
188#if CONFIG_BT_MESH_LIGHT_CTRL_AMB_LIGHT_LEVEL_TIMEOUT
190 int64_t amb_light_level_timestamp;
198 BT_MESH_LIGHT_CTRL_OP_PROP_STATUS,
201#if CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG
296 struct bt_mesh_msg_ctx *ctx);
299extern const struct bt_mesh_model_cb _bt_mesh_light_ctrl_srv_cb;
300extern const struct bt_mesh_model_op _bt_mesh_light_ctrl_srv_op[];
301extern const struct bt_mesh_model_cb _bt_mesh_light_ctrl_setup_srv_cb;
302extern 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
struct bt_mesh_light_ctrl_srv::@151 fade
enum bt_mesh_light_ctrl_srv_state state
Definition: light_ctrl_srv.h:155
uint32_t duration
Definition: light_ctrl_srv.h:170
struct bt_mesh_onoff_srv onoff
Definition: light_ctrl_srv.h:210
uint16_t initial_light
Definition: light_ctrl_srv.h:161
const struct bt_mesh_model * model
Definition: light_ctrl_srv.h:214
struct k_work_delayable action_delay
Definition: light_ctrl_srv.h:176
struct bt_mesh_model_pub setup_pub
Definition: light_ctrl_srv.h:193
struct bt_mesh_tid_ctx tid
Definition: light_ctrl_srv.h:212
struct net_buf_simple setup_pub_buf
Definition: light_ctrl_srv.h:195
atomic_t flags
Definition: light_ctrl_srv.h:157
struct bt_mesh_lightness_srv * lightness
Definition: light_ctrl_srv.h:208
uint16_t resume
Definition: light_ctrl_srv.h:187
uint32_t initial_centilux
Definition: light_ctrl_srv.h:167
struct bt_mesh_model_pub pub
Definition: light_ctrl_srv.h:180
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:199
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_LIGHT_CTRL_OP_LIGHT_ONOFF_STATUS, 3)]
Definition: light_ctrl_srv.h:185
struct bt_mesh_light_ctrl_srv_cfg cfg
Definition: light_ctrl_srv.h:178
struct net_buf_simple pub_buf
Definition: light_ctrl_srv.h:182
struct k_work_delayable timer
Definition: light_ctrl_srv.h:173
const struct bt_mesh_model * setup_srv
Definition: light_ctrl_srv.h:216
Light Lightness Control Server instance.
Definition: light_ctrl_srv.h:153
Definition: lightness_srv.h:181
Definition: gen_onoff_srv.h:52
Definition: gen_onoff_srv.h:92
Definition: model_types.h:46