nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
light_ctrl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
13#ifndef BT_MESH_LIGHT_CTRL_H__
14#define BT_MESH_LIGHT_CTRL_H__
15
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
33
42
51
60
69
78
87
96
105
114
123
132
141
150};
151
161
169
177
185};
186
193static inline const struct bt_mesh_sensor_format *
195{
196 switch (id) {
220 default:
221 return NULL;
222 }
223}
224
226#define BT_MESH_LIGHT_CTRL_OP_MODE_GET BT_MESH_MODEL_OP_2(0x82, 0x91)
227#define BT_MESH_LIGHT_CTRL_OP_MODE_SET BT_MESH_MODEL_OP_2(0x82, 0x92)
228#define BT_MESH_LIGHT_CTRL_OP_MODE_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x93)
229#define BT_MESH_LIGHT_CTRL_OP_MODE_STATUS BT_MESH_MODEL_OP_2(0x82, 0x94)
230#define BT_MESH_LIGHT_CTRL_OP_OM_GET BT_MESH_MODEL_OP_2(0x82, 0x95)
231#define BT_MESH_LIGHT_CTRL_OP_OM_SET BT_MESH_MODEL_OP_2(0x82, 0x96)
232#define BT_MESH_LIGHT_CTRL_OP_OM_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x97)
233#define BT_MESH_LIGHT_CTRL_OP_OM_STATUS BT_MESH_MODEL_OP_2(0x82, 0x98)
234#define BT_MESH_LIGHT_CTRL_OP_LIGHT_ONOFF_GET BT_MESH_MODEL_OP_2(0x82, 0x99)
235#define BT_MESH_LIGHT_CTRL_OP_LIGHT_ONOFF_SET BT_MESH_MODEL_OP_2(0x82, 0x9A)
236#define BT_MESH_LIGHT_CTRL_OP_LIGHT_ONOFF_SET_UNACK \
237 BT_MESH_MODEL_OP_2(0x82, 0x9B)
238#define BT_MESH_LIGHT_CTRL_OP_LIGHT_ONOFF_STATUS BT_MESH_MODEL_OP_2(0x82, 0x9C)
239#define BT_MESH_LIGHT_CTRL_OP_PROP_GET BT_MESH_MODEL_OP_2(0x82, 0x9D)
240#define BT_MESH_LIGHT_CTRL_OP_PROP_SET BT_MESH_MODEL_OP_1(0x62)
241#define BT_MESH_LIGHT_CTRL_OP_PROP_SET_UNACK BT_MESH_MODEL_OP_1(0x63)
242#define BT_MESH_LIGHT_CTRL_OP_PROP_STATUS BT_MESH_MODEL_OP_1(0x64)
243
244#define BT_MESH_LIGHT_CTRL_MSG_LEN_MODE_GET 0
245#define BT_MESH_LIGHT_CTRL_MSG_LEN_MODE_SET 1
246#define BT_MESH_LIGHT_CTRL_MSG_LEN_MODE_STATUS 1
247#define BT_MESH_LIGHT_CTRL_MSG_LEN_OM_GET 0
248#define BT_MESH_LIGHT_CTRL_MSG_LEN_OM_SET 1
249#define BT_MESH_LIGHT_CTRL_MSG_LEN_OM_STATUS 1
250#define BT_MESH_LIGHT_CTRL_MSG_LEN_LIGHT_ONOFF_GET 0
251#define BT_MESH_LIGHT_CTRL_MSG_MINLEN_LIGHT_ONOFF_SET 2
252#define BT_MESH_LIGHT_CTRL_MSG_MINLEN_LIGHT_ONOFF_STATUS 1
253#define BT_MESH_LIGHT_CTRL_MSG_LEN_PROP_GET 2
254#define BT_MESH_LIGHT_CTRL_MSG_MINLEN_PROP_SET 2
255#define BT_MESH_LIGHT_CTRL_MSG_MINLEN_PROP_STATUS 2
256
257#if CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG
258#define BT_MESH_LIGHT_CTRL_SRV_REG_CFG_INIT \
259 { \
260 .ki.up = CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_KIU, \
261 .ki.down = CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_KID, \
262 .kp.up = CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_KPU, \
263 .kp.down = CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_KPD, \
264 .accuracy = CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_ACCURACY, \
265 }
266
267#ifdef CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE
268#define BT_MESH_LIGHT_CTRL_SRV_LUX_INIT \
269 .lux = { \
270 { CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_STANDBY }, \
271 { CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_ON }, \
272 { CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_PROLONG } \
273 }
274#else
275#define BT_MESH_LIGHT_CTRL_SRV_LUX_INIT \
276 .centilux = { \
277 CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_STANDBY * 100, \
278 CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_ON * 100, \
279 CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_PROLONG * 100 \
280 }
281#endif
282#else
283#define BT_MESH_LIGHT_CTRL_SRV_LUX_INIT
284#endif
285
286#define BT_MESH_LIGHT_CTRL_SRV_CFG_INIT \
287 { \
288 .occupancy_delay = \
289 CONFIG_BT_MESH_LIGHT_CTRL_SRV_OCCUPANCY_DELAY, \
290 .fade_on = \
291 CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_FADE_ON, \
292 .on = (MSEC_PER_SEC * CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_ON), \
293 .fade_prolong = \
294 CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_FADE_PROLONG, \
295 .prolong = (MSEC_PER_SEC * \
296 CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_PROLONG), \
297 .fade_standby_auto = \
298 CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_FADE_STANDBY_AUTO, \
299 .fade_standby_manual = \
300 CONFIG_BT_MESH_LIGHT_CTRL_SRV_TIME_FADE_STANDBY_MANUAL,\
301 .light = { \
302 CONFIG_BT_MESH_LIGHT_CTRL_SRV_LVL_STANDBY, \
303 CONFIG_BT_MESH_LIGHT_CTRL_SRV_LVL_ON, \
304 CONFIG_BT_MESH_LIGHT_CTRL_SRV_LVL_PROLONG, \
305 }, \
306 BT_MESH_LIGHT_CTRL_SRV_LUX_INIT \
307 }
310#ifdef __cplusplus
311}
312#endif
313
314#endif /* BT_MESH_LIGHT_CTRL_H__ */
315
bt_mesh_light_ctrl_prop
Definition: light_ctrl.h:24
@ BT_MESH_LIGHT_CTRL_PROP_ILLUMINANCE_STANDBY
Definition: light_ctrl.h:49
@ BT_MESH_LIGHT_CTRL_PROP_LIGHTNESS_STANDBY
Definition: light_ctrl.h:76
@ BT_MESH_LIGHT_CTRL_PROP_TIME_FADE_ON
Definition: light_ctrl.h:103
@ BT_MESH_LIGHT_CTRL_PROP_LIGHTNESS_PROLONG
Definition: light_ctrl.h:67
@ BT_MESH_LIGHT_CTRL_PROP_TIME_FADE_PROLONG
Definition: light_ctrl.h:94
@ BT_MESH_LIGHT_CTRL_PROP_REG_ACCURACY
Definition: light_ctrl.h:85
@ BT_MESH_LIGHT_CTRL_PROP_ILLUMINANCE_ON
Definition: light_ctrl.h:31
@ BT_MESH_LIGHT_CTRL_PROP_TIME_FADE_STANDBY_MANUAL
Definition: light_ctrl.h:121
@ BT_MESH_LIGHT_CTRL_PROP_LIGHTNESS_ON
Definition: light_ctrl.h:58
@ BT_MESH_LIGHT_CTRL_PROP_TIME_OCCUPANCY_DELAY
Definition: light_ctrl.h:130
@ BT_MESH_LIGHT_CTRL_PROP_ILLUMINANCE_PROLONG
Definition: light_ctrl.h:40
@ BT_MESH_LIGHT_CTRL_PROP_TIME_PROLONG
Definition: light_ctrl.h:139
@ BT_MESH_LIGHT_CTRL_PROP_TIME_ON
Definition: light_ctrl.h:148
@ BT_MESH_LIGHT_CTRL_PROP_TIME_FADE_STANDBY_AUTO
Definition: light_ctrl.h:112
static const struct bt_mesh_sensor_format * bt_mesh_lc_prop_format_get(uint16_t id)
Get the sensor format for the given Light Lightness Control property ID.
Definition: light_ctrl.h:194
bt_mesh_light_ctrl_coeff
Definition: light_ctrl.h:153
@ BT_MESH_LIGHT_CTRL_COEFF_KPD
Definition: light_ctrl.h:176
@ BT_MESH_LIGHT_CTRL_COEFF_KIU
Definition: light_ctrl.h:168
@ BT_MESH_LIGHT_CTRL_COEFF_KID
Definition: light_ctrl.h:160
@ BT_MESH_LIGHT_CTRL_COEFF_KPU
Definition: light_ctrl.h:184
#define BT_MESH_PROP_ID_LIGHT_CTRL_AMB_LUXLEVEL_STANDBY
Definition: properties.h:115
#define BT_MESH_PROP_ID_LIGHT_CTRL_REG_KPU
Definition: properties.h:131
#define BT_MESH_PROP_ID_LIGHT_CTRL_REG_KIU
Definition: properties.h:127
#define BT_MESH_PROP_ID_LIGHT_CTRL_TIME_FADE_STANDBY_AUTO
Definition: properties.h:137
#define BT_MESH_PROP_ID_LIGHT_CTRL_TIME_RUN_ON
Definition: properties.h:145
#define BT_MESH_PROP_ID_LIGHT_CTRL_LIGHTNESS_ON
Definition: properties.h:117
#define BT_MESH_PROP_ID_LIGHT_CTRL_AMB_LUXLEVEL_ON
Definition: properties.h:111
#define BT_MESH_PROP_ID_LIGHT_CTRL_TIME_FADE_STANDBY_MANUAL
Definition: properties.h:139
#define BT_MESH_PROP_ID_LIGHT_CTRL_REG_ACCURACY
Definition: properties.h:123
#define BT_MESH_PROP_ID_LIGHT_CTRL_TIME_PROLONG
Definition: properties.h:143
#define BT_MESH_PROP_ID_LIGHT_CTRL_TIME_FADE_ON
Definition: properties.h:135
#define BT_MESH_PROP_ID_LIGHT_CTRL_REG_KID
Definition: properties.h:125
#define BT_MESH_PROP_ID_LIGHT_CTRL_LIGHTNESS_PROLONG
Definition: properties.h:119
#define BT_MESH_PROP_ID_LIGHT_CTRL_TIME_OCCUPANCY_DELAY
Definition: properties.h:141
#define BT_MESH_PROP_ID_LIGHT_CTRL_LIGHTNESS_STANDBY
Definition: properties.h:121
#define BT_MESH_PROP_ID_LIGHT_CTRL_TIME_FADE
Definition: properties.h:133
#define BT_MESH_PROP_ID_LIGHT_CTRL_AMB_LUXLEVEL_PROLONG
Definition: properties.h:113
#define BT_MESH_PROP_ID_LIGHT_CTRL_REG_KPD
Definition: properties.h:129
const struct bt_mesh_sensor_format bt_mesh_sensor_format_perceived_lightness
const struct bt_mesh_sensor_format bt_mesh_sensor_format_illuminance
const struct bt_mesh_sensor_format bt_mesh_sensor_format_coefficient
const struct bt_mesh_sensor_format bt_mesh_sensor_format_percentage_8
const struct bt_mesh_sensor_format bt_mesh_sensor_format_time_millisecond_24
Definition: sensor.h:454