1 // Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 /** @file
16  *  @brief Bluetooth Mesh Light Client Model APIs.
17  */
18 
19 #ifndef _ESP_BLE_MESH_LIGHTING_MODEL_API_H_
20 #define _ESP_BLE_MESH_LIGHTING_MODEL_API_H_
21 
22 #include "esp_ble_mesh_defs.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /** @def    ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_CLI
29  *
30  *  @brief  Define a new Light Lightness Client Model.
31  *
32  *  @note   This API needs to be called for each element on which
33  *          the application needs to have a Light Lightness Client Model.
34  *
35  *  @param  cli_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
36  *  @param  cli_data Pointer to the unique struct esp_ble_mesh_client_t.
37  *
38  *  @return New Light Lightness Client Model instance.
39  */
40 #define ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_CLI(cli_pub, cli_data)           \
41         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI,   \
42                     NULL, cli_pub, cli_data)
43 
44 /** @def    ESP_BLE_MESH_MODEL_LIGHT_CTL_CLI
45  *
46  *  @brief  Define a new Light CTL Client Model.
47  *
48  *  @note   This API needs to be called for each element on which
49  *          the application needs to have a Light CTL Client Model.
50  *
51  *  @param  cli_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
52  *  @param  cli_data Pointer to the unique struct esp_ble_mesh_client_t.
53  *
54  *  @return New Light CTL Client Model instance.
55  */
56 #define ESP_BLE_MESH_MODEL_LIGHT_CTL_CLI(cli_pub, cli_data)             \
57         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_CLI,     \
58                     NULL, cli_pub, cli_data)
59 
60 /** @def    ESP_BLE_MESH_MODEL_LIGHT_HSL_CLI
61  *
62  *  @brief  Define a new Light HSL Client Model.
63  *
64  *  @note   This API needs to be called for each element on which
65  *          the application needs to have a Light HSL Client Model.
66  *
67  *  @param  cli_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
68  *  @param  cli_data Pointer to the unique struct esp_ble_mesh_client_t.
69  *
70  *  @return New Light HSL Client Model instance.
71  */
72 #define ESP_BLE_MESH_MODEL_LIGHT_HSL_CLI(cli_pub, cli_data)             \
73         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_CLI,     \
74                     NULL, cli_pub, cli_data)
75 
76 /** @def    ESP_BLE_MESH_MODEL_LIGHT_XYL_CLI
77  *
78  *  @brief  Define a new Light xyL Client Model.
79  *
80  *  @note   This API needs to be called for each element on which
81  *          the application needs to have a Light xyL Client Model.
82  *
83  *  @param  cli_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
84  *  @param  cli_data Pointer to the unique struct esp_ble_mesh_client_t.
85  *
86  *  @return New Light xyL Client Model instance.
87  */
88 #define ESP_BLE_MESH_MODEL_LIGHT_XYL_CLI(cli_pub, cli_data)             \
89         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_CLI,     \
90                     NULL, cli_pub, cli_data)
91 
92 /** @def    ESP_BLE_MESH_MODEL_LIGHT_LC_CLI
93  *
94  *  @brief  Define a new Light LC Client Model.
95  *
96  *  @note   This API needs to be called for each element on which
97  *          the application needs to have a Light LC Client Model.
98  *
99  *  @param  cli_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
100  *  @param  cli_data Pointer to the unique struct esp_ble_mesh_client_t.
101  *
102  *  @return New Light LC Client Model instance.
103  */
104 #define ESP_BLE_MESH_MODEL_LIGHT_LC_CLI(cli_pub, cli_data)             \
105         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LC_CLI,     \
106                     NULL, cli_pub, cli_data)
107 
108 /**
109  *  @brief Bluetooth Mesh Light Lightness Client Model Get and Set parameters structure.
110  */
111 
112 /** Parameters of Light Lightness Set */
113 typedef struct {
114     bool     op_en;        /*!< Indicate if optional parameters are included */
115     uint16_t lightness;    /*!< Target value of light lightness actual state */
116     uint8_t  tid;          /*!< Transaction ID */
117     uint8_t  trans_time;   /*!< Time to complete state transition (optional) */
118     uint8_t  delay;        /*!< Indicate message execution delay (C.1) */
119 } esp_ble_mesh_light_lightness_set_t;
120 
121 /** Parameters of Light Lightness Linear Set */
122 typedef struct {
123     bool     op_en;        /*!< Indicate if optional parameters are included */
124     uint16_t lightness;    /*!< Target value of light lightness linear state */
125     uint8_t  tid;          /*!< Transaction ID */
126     uint8_t  trans_time;   /*!< Time to complete state transition (optional) */
127     uint8_t  delay;        /*!< Indicate message execution delay (C.1) */
128 } esp_ble_mesh_light_lightness_linear_set_t;
129 
130 /** Parameter of Light Lightness Default Set */
131 typedef struct {
132     uint16_t lightness;    /*!< The value of the Light Lightness Default state */
133 } esp_ble_mesh_light_lightness_default_set_t;
134 
135 /** Parameters of Light Lightness Range Set */
136 typedef struct {
137     uint16_t range_min;    /*!< Value of range min field of light lightness range state */
138     uint16_t range_max;    /*!< Value of range max field of light lightness range state */
139 } esp_ble_mesh_light_lightness_range_set_t;
140 
141 /** Parameters of Light CTL Set */
142 typedef struct {
143     bool     op_en;            /*!< Indicate if optional parameters are included */
144     uint16_t ctl_lightness;    /*!< Target value of light ctl lightness state */
145     uint16_t ctl_temperatrue;  /*!< Target value of light ctl temperature state */
146     int16_t  ctl_delta_uv;     /*!< Target value of light ctl delta UV state */
147     uint8_t  tid;              /*!< Transaction ID */
148     uint8_t  trans_time;       /*!< Time to complete state transition (optional) */
149     uint8_t  delay;            /*!< Indicate message execution delay (C.1) */
150 } esp_ble_mesh_light_ctl_set_t;
151 
152 /** Parameters of Light CTL Temperature Set */
153 typedef struct {
154     bool     op_en;            /*!< Indicate if optional parameters are included */
155     uint16_t ctl_temperatrue;  /*!< Target value of light ctl temperature state */
156     int16_t  ctl_delta_uv;     /*!< Target value of light ctl delta UV state */
157     uint8_t  tid;              /*!< Transaction ID */
158     uint8_t  trans_time;       /*!< Time to complete state transition (optional) */
159     uint8_t  delay;            /*!< Indicate message execution delay (C.1) */
160 } esp_ble_mesh_light_ctl_temperature_set_t;
161 
162 /** Parameters of Light CTL Temperature Range Set */
163 typedef struct {
164     uint16_t range_min;        /*!< Value of temperature range min field of light ctl temperature range state */
165     uint16_t range_max;        /*!< Value of temperature range max field of light ctl temperature range state */
166 } esp_ble_mesh_light_ctl_temperature_range_set_t;
167 
168 /** Parameters of Light CTL Default Set */
169 typedef struct {
170     uint16_t lightness;        /*!< Value of light lightness default state */
171     uint16_t temperature;      /*!< Value of light temperature default state */
172     int16_t  delta_uv;         /*!< Value of light delta UV default state */
173 } esp_ble_mesh_light_ctl_default_set_t;
174 
175 /** Parameters of Light HSL Set */
176 typedef struct {
177     bool     op_en;            /*!< Indicate if optional parameters are included */
178     uint16_t hsl_lightness;    /*!< Target value of light hsl lightness state */
179     uint16_t hsl_hue;          /*!< Target value of light hsl hue state */
180     uint16_t hsl_saturation;   /*!< Target value of light hsl saturation state */
181     uint8_t  tid;              /*!< Transaction ID */
182     uint8_t  trans_time;       /*!< Time to complete state transition (optional) */
183     uint8_t  delay;            /*!< Indicate message execution delay (C.1) */
184 } esp_ble_mesh_light_hsl_set_t;
185 
186 /** Parameters of Light HSL Hue Set */
187 typedef struct {
188     bool     op_en;            /*!< Indicate if optional parameters are included */
189     uint16_t hue;              /*!< Target value of light hsl hue state */
190     uint8_t  tid;              /*!< Transaction ID */
191     uint8_t  trans_time;       /*!< Time to complete state transition (optional) */
192     uint8_t  delay;            /*!< Indicate message execution delay (C.1) */
193 } esp_ble_mesh_light_hsl_hue_set_t;
194 
195 /** Parameters of Light HSL Saturation Set */
196 typedef struct {
197     bool     op_en;            /*!< Indicate if optional parameters are included */
198     uint16_t saturation;       /*!< Target value of light hsl hue state */
199     uint8_t  tid;              /*!< Transaction ID */
200     uint8_t  trans_time;       /*!< Time to complete state transition (optional) */
201     uint8_t  delay;            /*!< Indicate message execution delay (C.1) */
202 } esp_ble_mesh_light_hsl_saturation_set_t;
203 
204 /** Parameters of Light HSL Default Set */
205 typedef struct {
206     uint16_t lightness;        /*!< Value of light lightness default state */
207     uint16_t hue;              /*!< Value of light hue default state */
208     uint16_t saturation;       /*!< Value of light saturation default state */
209 } esp_ble_mesh_light_hsl_default_set_t;
210 
211 /** Parameters of Light HSL Range Set */
212 typedef struct {
213     uint16_t hue_range_min;        /*!< Value of hue range min field of light hsl hue range state */
214     uint16_t hue_range_max;        /*!< Value of hue range max field of light hsl hue range state */
215     uint16_t saturation_range_min; /*!< Value of saturation range min field of light hsl saturation range state */
216     uint16_t saturation_range_max; /*!< Value of saturation range max field of light hsl saturation range state */
217 } esp_ble_mesh_light_hsl_range_set_t;
218 
219 /** Parameters of Light xyL Set */
220 typedef struct {
221     bool     op_en;            /*!< Indicate whether optional parameters included */
222     uint16_t xyl_lightness;    /*!< The target value of the Light xyL Lightness state */
223     uint16_t xyl_x;            /*!< The target value of the Light xyL x state */
224     uint16_t xyl_y;            /*!< The target value of the Light xyL y state */
225     uint8_t  tid;              /*!< Transaction Identifier */
226     uint8_t  trans_time;       /*!< Time to complete state transition (optional) */
227     uint8_t  delay;            /*!< Indicate message execution delay (C.1) */
228 } esp_ble_mesh_light_xyl_set_t;
229 
230 /** Parameters of Light xyL Default Set */
231 typedef struct {
232     uint16_t lightness;        /*!< The value of the Light Lightness Default state */
233     uint16_t xyl_x;            /*!< The value of the Light xyL x Default state */
234     uint16_t xyl_y;            /*!< The value of the Light xyL y Default state */
235 } esp_ble_mesh_light_xyl_default_set_t;
236 
237 /** Parameters of Light xyL Range Set */
238 typedef struct {
239     uint16_t xyl_x_range_min;  /*!< The value of the xyL x Range Min field of the Light xyL x Range state */
240     uint16_t xyl_x_range_max;  /*!< The value of the xyL x Range Max field of the Light xyL x Range state */
241     uint16_t xyl_y_range_min;  /*!< The value of the xyL y Range Min field of the Light xyL y Range state */
242     uint16_t xyl_y_range_max;  /*!< The value of the xyL y Range Max field of the Light xyL y Range state */
243 } esp_ble_mesh_light_xyl_range_set_t;
244 
245 /** Parameter of Light LC Mode Set */
246 typedef struct {
247     uint8_t mode;              /*!< The target value of the Light LC Mode state */
248 } esp_ble_mesh_light_lc_mode_set_t;
249 
250 /** Parameter of Light LC OM Set */
251 typedef struct {
252     uint8_t mode;              /*!< The target value of the Light LC Occupancy Mode state */
253 } esp_ble_mesh_light_lc_om_set_t;
254 
255 /** Parameters of Light LC Light OnOff Set */
256 typedef struct {
257     bool    op_en;             /*!< Indicate whether optional parameters included */
258     uint8_t light_onoff;       /*!< The target value of the Light LC Light OnOff state */
259     uint8_t tid;               /*!< Transaction Identifier */
260     uint8_t trans_time;        /*!< Time to complete state transition (optional) */
261     uint8_t delay;             /*!< Indicate message execution delay (C.1) */
262 } esp_ble_mesh_light_lc_light_onoff_set_t;
263 
264 /** Parameter of Light LC Property Get */
265 typedef struct {
266     uint16_t property_id;      /*!< Property ID identifying a Light LC Property */
267 } esp_ble_mesh_light_lc_property_get_t;
268 
269 /** Parameters of Light LC Property Set */
270 typedef struct {
271     uint16_t property_id;      /*!< Property ID identifying a Light LC Property */
272     struct net_buf_simple *property_value;  /*!< Raw value for the Light LC Property */
273 } esp_ble_mesh_light_lc_property_set_t;
274 
275 /**
276  * @brief Lighting Client Model get message union
277  */
278 typedef union {
279     esp_ble_mesh_light_lc_property_get_t           lc_property_get;             /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_GET */
280 } esp_ble_mesh_light_client_get_state_t;
281 
282 /**
283  * @brief Lighting Client Model set message union
284  */
285 typedef union {
286     esp_ble_mesh_light_lightness_set_t             lightness_set;               /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK */
287     esp_ble_mesh_light_lightness_linear_set_t      lightness_linear_set;        /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET_UNACK */
288     esp_ble_mesh_light_lightness_default_set_t     lightness_default_set;       /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET_UNACK */
289     esp_ble_mesh_light_lightness_range_set_t       lightness_range_set;         /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET_UNACK */
290     esp_ble_mesh_light_ctl_set_t                   ctl_set;                     /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK */
291     esp_ble_mesh_light_ctl_temperature_set_t       ctl_temperature_set;         /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET_UNACK */
292     esp_ble_mesh_light_ctl_temperature_range_set_t ctl_temperature_range_set;   /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET_UNACK */
293     esp_ble_mesh_light_ctl_default_set_t           ctl_default_set;             /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET_UNACK */
294     esp_ble_mesh_light_hsl_set_t                   hsl_set;                     /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK */
295     esp_ble_mesh_light_hsl_hue_set_t               hsl_hue_set;                 /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET_UNACK */
296     esp_ble_mesh_light_hsl_saturation_set_t        hsl_saturation_set;          /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET_UNACK */
297     esp_ble_mesh_light_hsl_default_set_t           hsl_default_set;             /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET_UNACK */
298     esp_ble_mesh_light_hsl_range_set_t             hsl_range_set;               /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET_UNACK */
299     esp_ble_mesh_light_xyl_set_t                   xyl_set;                     /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET_UNACK */
300     esp_ble_mesh_light_xyl_default_set_t           xyl_default_set;             /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET_UNACK */
301     esp_ble_mesh_light_xyl_range_set_t             xyl_range_set;               /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET_UNACK */
302     esp_ble_mesh_light_lc_mode_set_t               lc_mode_set;                 /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET_UNACK */
303     esp_ble_mesh_light_lc_om_set_t                 lc_om_set;                   /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET_UNACK */
304     esp_ble_mesh_light_lc_light_onoff_set_t        lc_light_onoff_set;          /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET_UNACK */
305     esp_ble_mesh_light_lc_property_set_t           lc_property_set;             /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET_UNACK */
306 } esp_ble_mesh_light_client_set_state_t;
307 
308 /**
309  *  @brief Bluetooth Mesh Light Lightness Client Model Get and Set callback parameters structure.
310  */
311 
312 /** Parameters of Light Lightness Status */
313 typedef struct {
314     bool     op_en;                /*!< Indicate if optional parameters are included */
315     uint16_t present_lightness;    /*!< Current value of light lightness actual state */
316     uint16_t target_lightness;     /*!< Target value of light lightness actual state (optional) */
317     uint8_t  remain_time;          /*!< Time to complete state transition (C.1) */
318 } esp_ble_mesh_light_lightness_status_cb_t;
319 
320 /** Parameters of Light Lightness Linear Status */
321 typedef struct {
322     bool     op_en;                /*!< Indicate if optional parameters are included */
323     uint16_t present_lightness;    /*!< Current value of light lightness linear state */
324     uint16_t target_lightness;     /*!< Target value of light lightness linear state (optional) */
325     uint8_t  remain_time;          /*!< Time to complete state transition (C.1) */
326 } esp_ble_mesh_light_lightness_linear_status_cb_t;
327 
328 /** Parameter of Light Lightness Last Status */
329 typedef struct {
330     uint16_t lightness;            /*!< The value of the Light Lightness Last state */
331 } esp_ble_mesh_light_lightness_last_status_cb_t;
332 
333 /** Parameter of Light Lightness Default Status */
334 typedef struct {
335     uint16_t lightness;            /*!< The value of the Light Lightness default State */
336 } esp_ble_mesh_light_lightness_default_status_cb_t;
337 
338 /** Parameters of Light Lightness Range Status */
339 typedef struct {
340     uint8_t  status_code;          /*!< Status Code for the request message */
341     uint16_t range_min;            /*!< Value of range min field of light lightness range state */
342     uint16_t range_max;            /*!< Value of range max field of light lightness range state */
343 } esp_ble_mesh_light_lightness_range_status_cb_t;
344 
345 /** Parameters of Light CTL Status */
346 typedef struct {
347     bool     op_en;                    /*!< Indicate if optional parameters are included */
348     uint16_t present_ctl_lightness;    /*!< Current value of light ctl lightness state */
349     uint16_t present_ctl_temperature;  /*!< Current value of light ctl temperature state */
350     uint16_t target_ctl_lightness;     /*!< Target value of light ctl lightness state (optional) */
351     uint16_t target_ctl_temperature;   /*!< Target value of light ctl temperature state (C.1) */
352     uint8_t  remain_time;              /*!< Time to complete state transition (C.1) */
353 } esp_ble_mesh_light_ctl_status_cb_t;
354 
355 /** Parameters of Light CTL Temperature Status */
356 typedef struct {
357     bool     op_en;                    /*!< Indicate if optional parameters are included */
358     uint16_t present_ctl_temperature;  /*!< Current value of light ctl temperature state */
359     uint16_t present_ctl_delta_uv;     /*!< Current value of light ctl delta UV state */
360     uint16_t target_ctl_temperature;   /*!< Target value of light ctl temperature state (optional) */
361     uint16_t target_ctl_delta_uv;      /*!< Target value of light ctl delta UV state (C.1) */
362     uint8_t  remain_time;              /*!< Time to complete state transition (C.1) */
363 } esp_ble_mesh_light_ctl_temperature_status_cb_t;
364 
365 /** Parameters of Light CTL Temperature Range Status */
366 typedef struct {
367     uint8_t  status_code;      /*!< Status code for the request message */
368     uint16_t range_min;        /*!< Value of temperature range min field of light ctl temperature range state */
369     uint16_t range_max;        /*!< Value of temperature range max field of light ctl temperature range state */
370 } esp_ble_mesh_light_ctl_temperature_range_status_cb_t;
371 
372 /** Parameters of Light CTL Default Status */
373 typedef struct {
374     uint16_t lightness;        /*!< Value of light lightness default state */
375     uint16_t temperature;      /*!< Value of light temperature default state */
376     int16_t  delta_uv;         /*!< Value of light delta UV default state */
377 } esp_ble_mesh_light_ctl_default_status_cb_t;
378 
379 /** Parameters of Light HSL Status */
380 typedef struct {
381     bool     op_en;            /*!< Indicate if optional parameters are included */
382     uint16_t hsl_lightness;    /*!< Current value of light hsl lightness state */
383     uint16_t hsl_hue;          /*!< Current value of light hsl hue state */
384     uint16_t hsl_saturation;   /*!< Current value of light hsl saturation state */
385     uint8_t  remain_time;      /*!< Time to complete state transition (optional) */
386 } esp_ble_mesh_light_hsl_status_cb_t;
387 
388 /** Parameters of Light HSL Target Status */
389 typedef struct {
390     bool  op_en;                    /*!< Indicate if optional parameters are included */
391     uint16_t hsl_lightness_target;     /*!< Target value of light hsl lightness state */
392     uint16_t hsl_hue_target;           /*!< Target value of light hsl hue state */
393     uint16_t hsl_saturation_target;    /*!< Target value of light hsl saturation state */
394     uint8_t  remain_time;              /*!< Time to complete state transition (optional) */
395 } esp_ble_mesh_light_hsl_target_status_cb_t;
396 
397 /** Parameters of Light HSL Hue Status */
398 typedef struct {
399     bool     op_en;        /*!< Indicate if optional parameters are included */
400     uint16_t present_hue;  /*!< Current value of light hsl hue state */
401     uint16_t target_hue;   /*!< Target value of light hsl hue state (optional) */
402     uint8_t  remain_time;  /*!< Time to complete state transition (C.1) */
403 } esp_ble_mesh_light_hsl_hue_status_cb_t;
404 
405 /** Parameters of Light HSL Saturation Status */
406 typedef struct {
407     bool     op_en;                /*!< Indicate if optional parameters are included */
408     uint16_t present_saturation;   /*!< Current value of light hsl saturation state */
409     uint16_t target_saturation;    /*!< Target value of light hsl saturation state (optional) */
410     uint8_t  remain_time;          /*!< Time to complete state transition (C.1) */
411 } esp_ble_mesh_light_hsl_saturation_status_cb_t;
412 
413 /** Parameters of Light HSL Default Status */
414 typedef struct {
415     uint16_t lightness;    /*!< Value of light lightness default state */
416     uint16_t hue;          /*!< Value of light hue default state */
417     uint16_t saturation;   /*!< Value of light saturation default state */
418 } esp_ble_mesh_light_hsl_default_status_cb_t;
419 
420 /** Parameters of Light HSL Range Status */
421 typedef struct {
422     uint8_t  status_code;          /*!< Status code for the request message */
423     uint16_t hue_range_min;        /*!< Value of hue range min field of light hsl hue range state */
424     uint16_t hue_range_max;        /*!< Value of hue range max field of light hsl hue range state */
425     uint16_t saturation_range_min; /*!< Value of saturation range min field of light hsl saturation range state */
426     uint16_t saturation_range_max; /*!< Value of saturation range max field of light hsl saturation range state */
427 } esp_ble_mesh_light_hsl_range_status_cb_t;
428 
429 /** Parameters of Light xyL Status */
430 typedef struct {
431     bool     op_en;                /*!< Indicate whether optional parameters included */
432     uint16_t xyl_lightness;        /*!< The present value of the Light xyL Lightness state */
433     uint16_t xyl_x;                /*!< The present value of the Light xyL x state */
434     uint16_t xyl_y;                /*!< The present value of the Light xyL y state */
435     uint8_t  remain_time;          /*!< Time to complete state transition (optional) */
436 } esp_ble_mesh_light_xyl_status_cb_t;
437 
438 /** Parameters of Light xyL Target Status */
439 typedef struct {
440     bool     op_en;                /*!< Indicate whether optional parameters included */
441     uint16_t target_xyl_lightness; /*!< The target value of the Light xyL Lightness state */
442     uint16_t target_xyl_x;         /*!< The target value of the Light xyL x state */
443     uint16_t target_xyl_y;         /*!< The target value of the Light xyL y state */
444     uint8_t  remain_time;          /*!< Time to complete state transition (optional) */
445 } esp_ble_mesh_light_xyl_target_status_cb_t;
446 
447 /** Parameters of Light xyL Default Status */
448 typedef struct {
449     uint16_t lightness;        /*!< The value of the Light Lightness Default state */
450     uint16_t xyl_x;            /*!< The value of the Light xyL x Default state */
451     uint16_t xyl_y;            /*!< The value of the Light xyL y Default state */
452 } esp_ble_mesh_light_xyl_default_status_cb_t;
453 
454 /** Parameters of Light xyL Range Status */
455 typedef struct {
456     uint8_t  status_code;      /*!< Status Code for the requesting message */
457     uint16_t xyl_x_range_min;  /*!< The value of the xyL x Range Min field of the Light xyL x Range state */
458     uint16_t xyl_x_range_max;  /*!< The value of the xyL x Range Max field of the Light xyL x Range state */
459     uint16_t xyl_y_range_min;  /*!< The value of the xyL y Range Min field of the Light xyL y Range state */
460     uint16_t xyl_y_range_max;  /*!< The value of the xyL y Range Max field of the Light xyL y Range state */
461 } esp_ble_mesh_light_xyl_range_status_cb_t;
462 
463 /** Parameter of Light LC Mode Status */
464 typedef struct {
465     uint8_t mode;              /*!< The present value of the Light LC Mode state */
466 } esp_ble_mesh_light_lc_mode_status_cb_t;
467 
468 /** Parameter of Light LC OM Status */
469 typedef struct {
470     uint8_t mode;              /*!< The present value of the Light LC Occupancy Mode state */
471 } esp_ble_mesh_light_lc_om_status_cb_t;
472 
473 /** Parameters of Light LC Light OnOff Status */
474 typedef struct {
475     bool    op_en;                 /*!< Indicate whether optional parameters included */
476     uint8_t present_light_onoff;   /*!< The present value of the Light LC Light OnOff state */
477     uint8_t target_light_onoff;    /*!< The target value of the Light LC Light OnOff state (Optional) */
478     uint8_t remain_time;           /*!< Time to complete state transition (C.1) */
479 } esp_ble_mesh_light_lc_light_onoff_status_cb_t;
480 
481 /** Parameters of Light LC Property Status */
482 typedef struct {
483     uint16_t property_id;      /*!< Property ID identifying a Light LC Property */
484     struct net_buf_simple *property_value;  /*!< Raw value for the Light LC Property */
485 } esp_ble_mesh_light_lc_property_status_cb_t;
486 
487 /**
488  * @brief Lighting Client Model received message union
489  */
490 typedef union {
491     esp_ble_mesh_light_lightness_status_cb_t             lightness_status;             /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS */
492     esp_ble_mesh_light_lightness_linear_status_cb_t      lightness_linear_status;      /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_STATUS */
493     esp_ble_mesh_light_lightness_last_status_cb_t        lightness_last_status;        /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_STATUS */
494     esp_ble_mesh_light_lightness_default_status_cb_t     lightness_default_status;     /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_STATUS */
495     esp_ble_mesh_light_lightness_range_status_cb_t       lightness_range_status;       /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_STATUS */
496     esp_ble_mesh_light_ctl_status_cb_t                   ctl_status;                   /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_STATUS */
497     esp_ble_mesh_light_ctl_temperature_status_cb_t       ctl_temperature_status;       /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_STATUS */
498     esp_ble_mesh_light_ctl_temperature_range_status_cb_t ctl_temperature_range_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_STATUS */
499     esp_ble_mesh_light_ctl_default_status_cb_t           ctl_default_status;           /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_STATUS */
500     esp_ble_mesh_light_hsl_status_cb_t                   hsl_status;                   /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_STATUS */
501     esp_ble_mesh_light_hsl_target_status_cb_t            hsl_target_status;            /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_STATUS */
502     esp_ble_mesh_light_hsl_hue_status_cb_t               hsl_hue_status;               /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_STATUS */
503     esp_ble_mesh_light_hsl_saturation_status_cb_t        hsl_saturation_status;        /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_STATUS */
504     esp_ble_mesh_light_hsl_default_status_cb_t           hsl_default_status;           /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_STATUS */
505     esp_ble_mesh_light_hsl_range_status_cb_t             hsl_range_status;             /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_STATUS */
506     esp_ble_mesh_light_xyl_status_cb_t                   xyl_status;                   /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_STATUS */
507     esp_ble_mesh_light_xyl_target_status_cb_t            xyl_target_status;            /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_STATUS */
508     esp_ble_mesh_light_xyl_default_status_cb_t           xyl_default_status;           /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_STATUS */
509     esp_ble_mesh_light_xyl_range_status_cb_t             xyl_range_status;             /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_STATUS */
510     esp_ble_mesh_light_lc_mode_status_cb_t               lc_mode_status;               /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_STATUS */
511     esp_ble_mesh_light_lc_om_status_cb_t                 lc_om_status;                 /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_STATUS */
512     esp_ble_mesh_light_lc_light_onoff_status_cb_t        lc_light_onoff_status;        /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_STATUS */
513     esp_ble_mesh_light_lc_property_status_cb_t           lc_property_status;           /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_STATUS */
514 } esp_ble_mesh_light_client_status_cb_t;
515 
516 /** Lighting Client Model callback parameters */
517 typedef struct {
518     int error_code;                                     /*!< Appropriate error code */
519     esp_ble_mesh_client_common_param_t   *params;       /*!< The client common parameters. */
520     esp_ble_mesh_light_client_status_cb_t status_cb;    /*!< The light status message callback values */
521 } esp_ble_mesh_light_client_cb_param_t;
522 
523 /** This enum value is the event of Lighting Client Model */
524 typedef enum {
525     ESP_BLE_MESH_LIGHT_CLIENT_GET_STATE_EVT,
526     ESP_BLE_MESH_LIGHT_CLIENT_SET_STATE_EVT,
527     ESP_BLE_MESH_LIGHT_CLIENT_PUBLISH_EVT,
528     ESP_BLE_MESH_LIGHT_CLIENT_TIMEOUT_EVT,
529     ESP_BLE_MESH_LIGHT_CLIENT_EVT_MAX,
530 } esp_ble_mesh_light_client_cb_event_t;
531 
532 /**
533  *  @brief Bluetooth Mesh Light Client Model function.
534  */
535 
536 /**
537  * @brief   Lighting Client Model callback function type
538  * @param   event: Event type
539  * @param   param: Pointer to callback parameter
540  */
541 typedef void (* esp_ble_mesh_light_client_cb_t)(esp_ble_mesh_light_client_cb_event_t event,
542                                                 esp_ble_mesh_light_client_cb_param_t *param);
543 
544 /**
545  * @brief       Register BLE Mesh Light Client Model callback.
546  *
547  * @param[in]   callback: pointer to the callback function.
548  *
549  * @return      ESP_OK on success or error code otherwise.
550  *
551  */
552 esp_err_t esp_ble_mesh_register_light_client_callback(esp_ble_mesh_light_client_cb_t callback);
553 
554 /**
555  * @brief       Get the value of Light Server Model states using the Light Client Model get messages.
556  *
557  * @note        If you want to know the opcodes and corresponding meanings accepted by this API,
558  *              please refer to esp_ble_mesh_light_message_opcode_t in esp_ble_mesh_defs.h
559  *
560  * @param[in]   params:    Pointer to BLE Mesh common client parameters.
561  * @param[in]   get_state: Pointer of light get message value.
562  *                         Shall not be set to NULL.
563  *
564  * @return      ESP_OK on success or error code otherwise.
565  *
566  */
567 esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t *params,
568                                               esp_ble_mesh_light_client_get_state_t *get_state);
569 
570 /**
571  * @brief       Set the value of Light Server Model states using the Light Client Model set messages.
572  *
573  * @note        If you want to know the opcodes and corresponding meanings accepted by this API,
574  *              please refer to esp_ble_mesh_light_message_opcode_t in esp_ble_mesh_defs.h
575  *
576  * @param[in]   params:    Pointer to BLE Mesh common client parameters.
577  * @param[in]   set_state: Pointer of light set message value.
578  *                         Shall not be set to NULL.
579  *
580  * @return      ESP_OK on success or error code otherwise.
581  *
582  */
583 esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t *params,
584                                               esp_ble_mesh_light_client_set_state_t *set_state);
585 
586 /**
587  * @brief Lighting Server Models related context.
588  */
589 
590 /** @def    ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SRV
591  *
592  *  @brief  Define a new Light Lightness Server Model.
593  *
594  *  @note   1. The Light Lightness Server model extends the Generic Power OnOff
595  *             Server model and the Generic Level Server model. When this model
596  *             is present on an Element, the corresponding Light Lightness Setup
597  *             Server model shall also be present.
598  *          2. This model shall support model publication and model subscription.
599  *
600  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
601  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_lightness_srv_t.
602  *
603  *  @return New Light Lightness Server Model instance.
604  */
605 #define ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SRV(srv_pub, srv_data)             \
606         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV,     \
607                     NULL, srv_pub, srv_data)
608 
609 /** @def    ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SETUP_SRV
610  *
611  *  @brief  Define a new Light Lightness Setup Server Model.
612  *
613  *  @note   1. The Light Lightness Setup Server model extends the Light Lightness
614  *             Server model and the Generic Power OnOff Setup Server model.
615  *          2. This model shall support model subscription.
616  *
617  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
618  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_lightness_setup_srv_t.
619  *
620  *  @return New Light Lightness Setup Server Model instance.
621  */
622 #define ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SETUP_SRV(srv_pub, srv_data)             \
623         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV,     \
624                     NULL, srv_pub, srv_data)
625 
626 /** @def    ESP_BLE_MESH_MODEL_LIGHT_CTL_SRV
627  *
628  *  @brief  Define a new Light CTL Server Model.
629  *
630  *  @note   1. The Light CTL Server model extends the Light Lightness Server model.
631  *             When this model is present on an Element, the corresponding Light
632  *             CTL Temperature Server model and the corresponding Light CTL Setup
633  *             Server model shall also be present.
634  *          2. This model shall support model publication and model subscription.
635  *          3. The model requires two elements: the main element and the Temperature
636  *             element. The Temperature element contains the corresponding Light CTL
637  *             Temperature Server model and an instance of a Generic Level state
638  *             bound to the Light CTL Temperature state on the Temperature element.
639  *             The Light CTL Temperature state on the Temperature element is bound to
640  *             the Light CTL state on the main element.
641  *
642  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
643  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_ctl_srv_t.
644  *
645  *  @return New Light CTL Server Model instance.
646  */
647 #define ESP_BLE_MESH_MODEL_LIGHT_CTL_SRV(srv_pub, srv_data)             \
648         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SRV,     \
649                     NULL, srv_pub, srv_data)
650 
651 /** @def    ESP_BLE_MESH_MODEL_LIGHT_CTL_SETUP_SRV
652  *
653  *  @brief  Define a new Light CTL Setup Server Model.
654  *
655  *  @note   1. The Light CTL Setup Server model extends the Light CTL Server and
656  *             the Light Lightness Setup Server.
657  *          2. This model shall support model subscription.
658  *
659  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
660  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_ctl_setup_srv_t.
661  *
662  *  @return New Light CTL Setup Server Model instance.
663  */
664 #define ESP_BLE_MESH_MODEL_LIGHT_CTL_SETUP_SRV(srv_pub, srv_data)             \
665         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV,     \
666                     NULL, srv_pub, srv_data)
667 
668 /** @def    ESP_BLE_MESH_MODEL_LIGHT_CTL_TEMP_SRV
669  *
670  *  @brief  Define a new Light CTL Temperature Server Model.
671  *
672  *  @note   1. The Light CTL Temperature Server model extends the Generic Level
673  *             Server model.
674  *          2. This model shall support model publication and model subscription.
675  *
676  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
677  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_ctl_temp_srv_t.
678  *
679  *  @return New Light CTL Temperature Server Model instance.
680  */
681 #define ESP_BLE_MESH_MODEL_LIGHT_CTL_TEMP_SRV(srv_pub, srv_data)             \
682         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV,     \
683                     NULL, srv_pub, srv_data)
684 
685 /** @def    ESP_BLE_MESH_MODEL_LIGHT_HSL_SRV
686  *
687  *  @brief  Define a new Light HSL Server Model.
688  *
689  *  @note   1. The Light HSL Server model extends the Light Lightness Server model. When
690  *             this model is present on an Element, the corresponding Light HSL Hue
691  *             Server model and the corresponding Light HSL Saturation Server model and
692  *             the corresponding Light HSL Setup Server model shall also be present.
693  *          2. This model shall support model publication and model subscription.
694  *          3. The model requires three elements: the main element and the Hue element
695  *             and the Saturation element. The Hue element contains the corresponding
696  *             Light HSL Hue Server model and an instance of a Generic Level state bound
697  *             to the Light HSL Hue state on the Hue element. The Saturation element
698  *             contains the corresponding Light HSL Saturation Server model and an
699  *             instance of a Generic Level state bound to the Light HSL Saturation state
700  *             on the Saturation element. The Light HSL Hue state on the Hue element is
701  *             bound to the Light HSL state on the main element and the Light HSL
702  *             Saturation state on the Saturation element is bound to the Light HSL state
703  *             on the main element.
704  *
705  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
706  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_hsl_srv_t.
707  *
708  *  @return New Light HSL Server Model instance.
709  */
710 #define ESP_BLE_MESH_MODEL_LIGHT_HSL_SRV(srv_pub, srv_data)             \
711         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SRV,     \
712                     NULL, srv_pub, srv_data)
713 
714 /** @def    ESP_BLE_MESH_MODEL_LIGHT_HSL_SETUP_SRV
715  *
716  *  @brief  Define a new Light HSL Setup Server Model.
717  *
718  *  @note   1. The Light HSL Setup Server model extends the Light HSL Server and
719  *             the Light Lightness Setup Server.
720  *          2. This model shall support model subscription.
721  *
722  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
723  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_hsl_setup_srv_t.
724  *
725  *  @return New Light HSL Setup Server Model instance.
726  */
727 #define ESP_BLE_MESH_MODEL_LIGHT_HSL_SETUP_SRV(srv_pub, srv_data)           \
728         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV,   \
729                     NULL, srv_pub, srv_data)
730 
731 /** @def    ESP_BLE_MESH_MODEL_LIGHT_HSL_HUE_SRV
732  *
733  *  @brief  Define a new Light HSL Hue Server Model.
734  *
735  *  @note   1. The Light HSL Hue Server model extends the Generic Level Server model.
736  *             This model is associated with the Light HSL Server model.
737  *          2. This model shall support model publication and model subscription.
738  *
739  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
740  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_hsl_hue_srv_t.
741  *
742  *  @return New Light HSL Hue Server Model instance.
743  */
744 #define ESP_BLE_MESH_MODEL_LIGHT_HSL_HUE_SRV(srv_pub, srv_data)             \
745         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV,     \
746                     NULL, srv_pub, srv_data)
747 
748 /** @def    ESP_BLE_MESH_MODEL_LIGHT_HSL_SAT_SRV
749  *
750  *  @brief  Define a new Light HSL Saturation Server Model.
751  *
752  *  @note   1. The Light HSL Saturation Server model extends the Generic Level Server
753  *             model. This model is associated with the Light HSL Server model.
754  *          2. This model shall support model publication and model subscription.
755  *
756  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
757  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_hsl_sat_srv_t.
758  *
759  *  @return New Light HSL Saturation Server Model instance.
760  */
761 #define ESP_BLE_MESH_MODEL_LIGHT_HSL_SAT_SRV(srv_pub, srv_data)             \
762         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV,     \
763                     NULL, srv_pub, srv_data)
764 
765 /** @def    ESP_BLE_MESH_MODEL_LIGHT_XYL_SRV
766  *
767  *  @brief  Define a new Light xyL Server Model.
768  *
769  *  @note   1. The Light xyL Server model extends the Light Lightness Server model.
770  *             When this model is present on an Element, the corresponding Light xyL
771  *             Setup Server model shall also be present.
772  *          2. This model shall support model publication and model subscription.
773  *
774  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
775  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_xyl_srv_t.
776  *
777  *  @return New Light xyL Server Model instance.
778  */
779 #define ESP_BLE_MESH_MODEL_LIGHT_XYL_SRV(srv_pub, srv_data)             \
780         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SRV,     \
781                     NULL, srv_pub, srv_data)
782 
783 /** @def    ESP_BLE_MESH_MODEL_LIGHT_XYL_SETUP_SRV
784  *
785  *  @brief  Define a new Light xyL Setup Server Model.
786  *
787  *  @note   1. The Light xyL Setup Server model extends the Light xyL Server and
788  *             the Light Lightness Setup Server.
789  *          2. This model shall support model subscription.
790  *
791  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
792  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_xyl_setup_srv_t.
793  *
794  *  @return New Light xyL Setup Server Model instance.
795  */
796 #define ESP_BLE_MESH_MODEL_LIGHT_XYL_SETUP_SRV(srv_pub, srv_data)           \
797         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV,   \
798                     NULL, srv_pub, srv_data)
799 
800 /** @def    ESP_BLE_MESH_MODEL_LIGHT_LC_SRV
801  *
802  *  @brief  Define a new Light LC Server Model.
803  *
804  *  @note   1. The Light LC (Lightness Control) Server model extends the Light
805  *             Lightness Server model and the Generic OnOff Server model. When
806  *             this model is present on an Element, the corresponding Light LC
807  *             Setup Server model shall also be present.
808  *          2. This model shall support model publication and model subscription.
809  *          3. This model may be used to represent an element that is a client to
810  *             a Sensor Server model and controls the Light Lightness Actual state
811  *             via defined state bindings.
812  *
813  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
814  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_lc_srv_t.
815  *
816  *  @return New Light LC Server Model instance.
817  */
818 #define ESP_BLE_MESH_MODEL_LIGHT_LC_SRV(srv_pub, srv_data)           \
819         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SRV,   \
820                     NULL, srv_pub, srv_data)
821 
822 /** @def    ESP_BLE_MESH_MODEL_LIGHT_LC_SETUP_SRV
823  *
824  *  @brief  Define a new Light LC Setup Server Model.
825  *
826  *  @note   1. The Light LC (Lightness Control) Setup model extends the Light LC
827  *             Server model.
828  *          2. This model shall support model publication and model subscription.
829  *          3. This model may be used to configure setup parameters for the Light
830  *             LC Server model.
831  *
832  *  @param  srv_pub  Pointer to the unique struct esp_ble_mesh_model_pub_t.
833  *  @param  srv_data Pointer to the unique struct esp_ble_mesh_light_lc_setup_srv_t.
834  *
835  *  @return New Light LC Setup Server Model instance.
836  */
837 #define ESP_BLE_MESH_MODEL_LIGHT_LC_SETUP_SRV(srv_pub, srv_data)           \
838         ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SETUP_SRV,   \
839                     NULL, srv_pub, srv_data)
840 
841 /** Parameters of Light Lightness state */
842 typedef struct {
843     uint16_t lightness_linear;          /*!< The present value of Light Lightness Linear state */
844     uint16_t target_lightness_linear;   /*!< The target value of Light Lightness Linear state */
845 
846     uint16_t lightness_actual;          /*!< The present value of Light Lightness Actual state */
847     uint16_t target_lightness_actual;   /*!< The target value of Light Lightness Actual state */
848 
849     uint16_t lightness_last;            /*!< The value of Light Lightness Last state */
850     uint16_t lightness_default;         /*!< The value of Light Lightness Default state */
851 
852     uint8_t  status_code;               /*!< The status code of setting Light Lightness Range state */
853     uint16_t lightness_range_min;       /*!< The minimum value of Light Lightness Range state */
854     uint16_t lightness_range_max;       /*!< The maximum value of Light Lightness Range state */
855 } esp_ble_mesh_light_lightness_state_t;
856 
857 /** User data of Light Lightness Server Model */
858 typedef struct {
859     esp_ble_mesh_model_t *model;                    /*!< Pointer to the Lighting Lightness Server Model. Initialized internally. */
860     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;        /*!< Response control of the server model received messages */
861     esp_ble_mesh_light_lightness_state_t *state;    /*!< Parameters of the Light Lightness state */
862     esp_ble_mesh_last_msg_info_t last;              /*!< Parameters of the last received set message */
863     esp_ble_mesh_state_transition_t actual_transition;  /*!< Parameters of state transition */
864     esp_ble_mesh_state_transition_t linear_transition;  /*!< Parameters of state transition */
865     int32_t tt_delta_lightness_actual;      /*!< Delta change value of lightness actual state transition */
866     int32_t tt_delta_lightness_linear;      /*!< Delta change value of lightness linear state transition */
867 } esp_ble_mesh_light_lightness_srv_t;
868 
869 /** User data of Light Lightness Setup Server Model */
870 typedef struct {
871     esp_ble_mesh_model_t *model;                    /*!< Pointer to the Lighting Lightness Setup Server Model. Initialized internally. */
872     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;        /*!< Response control of the server model received messages */
873     esp_ble_mesh_light_lightness_state_t *state;    /*!< Parameters of the Light Lightness state */
874 } esp_ble_mesh_light_lightness_setup_srv_t;
875 
876 /** Parameters of Light CTL state */
877 typedef struct {
878     uint16_t lightness;             /*!< The present value of Light CTL Lightness state */
879     uint16_t target_lightness;      /*!< The target value of Light CTL Lightness state */
880 
881     uint16_t temperature;           /*!< The present value of Light CTL Temperature state */
882     uint16_t target_temperature;    /*!< The target value of Light CTL Temperature state */
883 
884     int16_t  delta_uv;              /*!< The present value of Light CTL Delta UV state */
885     int16_t  target_delta_uv;       /*!< The target value of Light CTL Delta UV state */
886 
887     uint8_t  status_code;           /*!< The statue code of setting Light CTL Temperature Range state */
888     uint16_t temperature_range_min; /*!< The minimum value of Light CTL Temperature Range state */
889     uint16_t temperature_range_max; /*!< The maximum value of Light CTL Temperature Range state */
890 
891     uint16_t lightness_default;     /*!< The value of Light Lightness Default state */
892     uint16_t temperature_default;   /*!< The value of Light CTL Temperature Default state */
893     int16_t  delta_uv_default;      /*!< The value of Light CTL Delta UV Default state */
894 } esp_ble_mesh_light_ctl_state_t;
895 
896 /** User data of Light CTL Server Model */
897 typedef struct {
898     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting CTL Server Model. Initialized internally. */
899     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
900     esp_ble_mesh_light_ctl_state_t *state;      /*!< Parameters of the Light CTL state */
901     esp_ble_mesh_last_msg_info_t last;          /*!< Parameters of the last received set message */
902     esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
903     int32_t tt_delta_lightness;     /*!< Delta change value of lightness state transition */
904     int32_t tt_delta_temperature;   /*!< Delta change value of temperature state transition */
905     int32_t tt_delta_delta_uv;      /*!< Delta change value of delta uv state transition */
906 } esp_ble_mesh_light_ctl_srv_t;
907 
908 /** User data of Light CTL Setup Server Model */
909 typedef struct {
910     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting CTL Setup Server Model. Initialized internally. */
911     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
912     esp_ble_mesh_light_ctl_state_t *state;      /*!< Parameters of the Light CTL state */
913 } esp_ble_mesh_light_ctl_setup_srv_t;
914 
915 /** User data of Light CTL Temperature Server Model */
916 typedef struct {
917     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting CTL Temperature Server Model. Initialized internally. */
918     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
919     esp_ble_mesh_light_ctl_state_t *state;      /*!< Parameters of the Light CTL state */
920     esp_ble_mesh_last_msg_info_t last;          /*!< Parameters of the last received set message */
921     esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
922     int32_t tt_delta_temperature;   /*!< Delta change value of temperature state transition */
923     int32_t tt_delta_delta_uv;      /*!< Delta change value of delta uv state transition */
924 } esp_ble_mesh_light_ctl_temp_srv_t;
925 
926 /** Parameters of Light HSL state */
927 typedef struct {
928     uint16_t lightness;             /*!< The present value of Light HSL Lightness state */
929     uint16_t target_lightness;      /*!< The target value of Light HSL Lightness state */
930 
931     uint16_t hue;                   /*!< The present value of Light HSL Hue state */
932     uint16_t target_hue;            /*!< The target value of Light HSL Hue state */
933 
934     uint16_t saturation;            /*!< The present value of Light HSL Saturation state */
935     uint16_t target_saturation;     /*!< The target value of Light HSL Saturation state */
936 
937     uint16_t lightness_default;     /*!< The value of Light Lightness Default state */
938     uint16_t hue_default;           /*!< The value of Light HSL Hue Default state */
939     uint16_t saturation_default;    /*!< The value of Light HSL Saturation Default state */
940 
941     uint8_t  status_code;           /*!< The status code of setting Light HSL Hue & Saturation Range state */
942     uint16_t hue_range_min;         /*!< The minimum value of Light HSL Hue Range state */
943     uint16_t hue_range_max;         /*!< The maximum value of Light HSL Hue Range state */
944     uint16_t saturation_range_min;  /*!< The minimum value of Light HSL Saturation state */
945     uint16_t saturation_range_max;  /*!< The maximum value of Light HSL Saturation state */
946 } esp_ble_mesh_light_hsl_state_t;
947 
948 /** User data of Light HSL Server Model */
949 typedef struct {
950     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting HSL Server Model. Initialized internally. */
951     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
952     esp_ble_mesh_light_hsl_state_t *state;      /*!< Parameters of the Light HSL state */
953     esp_ble_mesh_last_msg_info_t last;          /*!< Parameters of the last received set message */
954     esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
955     int32_t tt_delta_lightness;     /*!< Delta change value of lightness state transition */
956     int32_t tt_delta_hue;           /*!< Delta change value of hue state transition */
957     int32_t tt_delta_saturation;    /*!< Delta change value of saturation state transition */
958 } esp_ble_mesh_light_hsl_srv_t;
959 
960 /** User data of Light HSL Setup Server Model */
961 typedef struct {
962     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting HSL Setup Server Model. Initialized internally. */
963     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
964     esp_ble_mesh_light_hsl_state_t *state;      /*!< Parameters of the Light HSL state */
965 } esp_ble_mesh_light_hsl_setup_srv_t;
966 
967 /** User data of Light HSL Hue Server Model */
968 typedef struct {
969     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting HSL Hue Server Model. Initialized internally. */
970     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
971     esp_ble_mesh_light_hsl_state_t *state;      /*!< Parameters of the Light HSL state */
972     esp_ble_mesh_last_msg_info_t last;          /*!< Parameters of the last received set message */
973     esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
974     int32_t tt_delta_hue;   /*!< Delta change value of hue state transition */
975 } esp_ble_mesh_light_hsl_hue_srv_t;
976 
977 /** User data of Light HSL Saturation Server Model */
978 typedef struct {
979     esp_ble_mesh_model_t *model;    /*!< Pointer to the Lighting HSL Saturation Server Model. Initialized internally. */
980     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
981     esp_ble_mesh_light_hsl_state_t *state;      /*!< Parameters of the Light HSL state */
982     esp_ble_mesh_last_msg_info_t last;          /*!< Parameters of the last received set message */
983     esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
984     int32_t tt_delta_saturation;    /*!< Delta change value of saturation state transition */
985 } esp_ble_mesh_light_hsl_sat_srv_t;
986 
987 /** Parameters of Light xyL state */
988 typedef struct {
989     uint16_t lightness;         /*!< The present value of Light xyL Lightness state */
990     uint16_t target_lightness;  /*!< The target value of Light xyL Lightness state */
991 
992     uint16_t x;                 /*!< The present value of Light xyL x state */
993     uint16_t target_x;          /*!< The target value of Light xyL x state */
994 
995     uint16_t y;                 /*!< The present value of Light xyL y state */
996     uint16_t target_y;          /*!< The target value of Light xyL y state */
997 
998     uint16_t lightness_default; /*!< The value of Light Lightness Default state */
999     uint16_t x_default;         /*!< The value of Light xyL x Default state */
1000     uint16_t y_default;         /*!< The value of Light xyL y Default state */
1001 
1002     uint8_t  status_code;       /*!< The status code of setting Light xyL x & y Range state */
1003     uint16_t x_range_min;       /*!< The minimum value of Light xyL x Range state */
1004     uint16_t x_range_max;       /*!< The maximum value of Light xyL x Range state */
1005     uint16_t y_range_min;       /*!< The minimum value of Light xyL y Range state */
1006     uint16_t y_range_max;       /*!< The maximum value of Light xyL y Range state */
1007 } esp_ble_mesh_light_xyl_state_t;
1008 
1009 /** User data of Light xyL Server Model */
1010 typedef struct {
1011     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting xyL Server Model. Initialized internally. */
1012     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
1013     esp_ble_mesh_light_xyl_state_t *state;      /*!< Parameters of the Light xyL state */
1014     esp_ble_mesh_last_msg_info_t last;          /*!< Parameters of the last received set message */
1015     esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
1016     int32_t tt_delta_lightness; /*!< Delta change value of lightness state transition */
1017     int32_t tt_delta_x;         /*!< Delta change value of x state transition */
1018     int32_t tt_delta_y;         /*!< Delta change value of y state transition */
1019 } esp_ble_mesh_light_xyl_srv_t;
1020 
1021 /** User data of Light xyL Setup Server Model */
1022 typedef struct {
1023     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting xyL Setup Server Model. Initialized internally. */
1024     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
1025     esp_ble_mesh_light_xyl_state_t *state;      /*!< Parameters of the Light xyL state */
1026 } esp_ble_mesh_light_xyl_setup_srv_t;
1027 
1028 /** Parameters of Light LC states */
1029 typedef struct {
1030     /**
1031      * 0b0 The controller is turned off.
1032      * - The binding with the Light Lightness state is disabled.
1033      * 0b1 The controller is turned on.
1034      * - The binding with the Light Lightness state is enabled.
1035      */
1036     uint32_t mode : 1,                  /*!< The value of Light LC Mode state */
1037              occupancy_mode : 1,        /*!< The value of Light LC Occupancy Mode state */
1038              light_onoff : 1,           /*!< The present value of Light LC Light OnOff state */
1039              target_light_onoff : 1,    /*!< The target value of Light LC Light OnOff state */
1040              occupancy : 1,             /*!< The value of Light LC Occupancy state */
1041              ambient_luxlevel : 24;     /*!< The value of Light LC Ambient LuxLevel state */
1042 
1043     /**
1044      * 1. Light LC Linear Output = max((Lightness Out)^2/65535, Regulator Output)
1045      * 2. If the Light LC Mode state is set to 0b1, the binding is enabled and upon
1046      *    a change of the Light LC Linear Output state, the following operation
1047      *    shall be performed:
1048      *    Light Lightness Linear = Light LC Linear Output
1049      * 3. If the Light LC Mode state is set to 0b0, the binding is disabled (i.e.,
1050      *    upon a change of the Light LC Linear Output state, no operation on the
1051      *    Light Lightness Linear state is performed).
1052      */
1053     uint16_t linear_output;     /*!< The value of Light LC Linear Output state */
1054 } esp_ble_mesh_light_lc_state_t;
1055 
1056 /**
1057  * Parameters of Light Property states.
1058  * The Light LC Property states are read / write states that determine the
1059  * configuration of a Light Lightness Controller. Each state is represented
1060  * by a device property and is controlled by Light LC Property messages.
1061  */
1062 typedef struct {
1063     /**
1064      * A timing state that determines the delay for changing the Light LC
1065      * Occupancy state upon receiving a Sensor Status message from an
1066      * occupancy sensor.
1067      */
1068     uint32_t time_occupancy_delay;  /*!< The value of Light LC Time Occupancy Delay state */
1069     /**
1070      * A timing state that determines the time the controlled lights fade
1071      * to the level determined by the Light LC Lightness On state.
1072      */
1073     uint32_t time_fade_on;      /*!< The value of Light LC Time Fade On state */
1074     /**
1075      * A timing state that determines the time the controlled lights stay
1076      * at the level determined by the Light LC Lightness On state.
1077      */
1078     uint32_t time_run_on;       /*!< The value of Light LC Time Run On state */
1079     /**
1080      * A timing state that determines the time the controlled lights fade
1081      * from the level determined by the Light LC Lightness On state to the
1082      * level determined by the Light Lightness Prolong state.
1083      */
1084     uint32_t time_fade;         /*!< The value of Light LC Time Fade state */
1085     /**
1086      * A timing state that determines the time the controlled lights stay at
1087      * the level determined by the Light LC Lightness Prolong state.
1088      */
1089     uint32_t time_prolong;      /*!< The value of Light LC Time Prolong state */
1090     /**
1091      * A timing state that determines the time the controlled lights fade from
1092      * the level determined by the Light LC Lightness Prolong state to the level
1093      * determined by the Light LC Lightness Standby state when the transition is
1094      * automatic.
1095      */
1096     uint32_t time_fade_standby_auto;    /*!< The value of Light LC Time Fade Standby Auto state */
1097     /**
1098      * A timing state that determines the time the controlled lights fade from
1099      * the level determined by the Light LC Lightness Prolong state to the level
1100      * determined by the Light LC Lightness Standby state when the transition is
1101      * triggered by a change in the Light LC Light OnOff state.
1102      */
1103     uint32_t time_fade_standby_manual;  /*!< The value of Light LC Time Fade Standby Manual state */
1104 
1105     /**
1106      * A lightness state that determines the perceptive light lightness at the
1107      * Occupancy and Run internal controller states.
1108      */
1109     uint16_t lightness_on;          /*!< The value of Light LC Lightness On state */
1110     /**
1111      * A lightness state that determines the light lightness at the Prolong
1112      * internal controller state.
1113      */
1114     uint16_t lightness_prolong;     /*!< The value of Light LC Lightness Prolong state */
1115     /**
1116      * A lightness state that determines the light lightness at the Standby
1117      * internal controller state.
1118      */
1119     uint16_t lightness_standby;     /*!< The value of Light LC Lightness Standby state */
1120 
1121     /**
1122      * A uint16 state representing the Ambient LuxLevel level that determines
1123      * if the controller transitions from the Light Control Standby state.
1124      */
1125     uint16_t ambient_luxlevel_on;       /*!< The value of Light LC Ambient LuxLevel On state */
1126     /**
1127      * A uint16 state representing the required Ambient LuxLevel level in the
1128      * Prolong state.
1129      */
1130     uint16_t ambient_luxlevel_prolong;  /*!< The value of Light LC Ambient LuxLevel Prolong state */
1131     /**
1132      * A uint16 state representing the required Ambient LuxLevel level in the
1133      * Standby state.
1134      */
1135     uint16_t ambient_luxlevel_standby;  /*!< The value of Light LC Ambient LuxLevel Standby state */
1136 
1137     /**
1138      * A float32 state representing the integral coefficient that determines the
1139      * integral part of the equation defining the output of the Light LC PI
1140      * Feedback Regulator, when Light LC Ambient LuxLevel is less than LuxLevel
1141      * Out. Valid range: 0.0 ~ 1000.0. The default value is 250.0.
1142      */
1143     float regulator_kiu;    /*!< The value of Light LC Regulator Kiu state */
1144     /**
1145      * A float32 state representing the integral coefficient that determines the
1146      * integral part of the equation defining the output of the Light LC PI
1147      * Feedback Regulator, when Light LC Ambient LuxLevel is greater than or equal
1148      * to the value of the LuxLevel Out state. Valid range: 0.0 ~ 1000.0. The
1149      * default value is 25.0.
1150      */
1151     float regulator_kid;    /*!< The value of Light LC Regulator Kid state */
1152     /**
1153      * A float32 state representing the proportional coefficient that determines
1154      * the proportional part of the equation defining the output of the Light LC
1155      * PI Feedback Regulator, when Light LC Ambient LuxLevel is less than the value
1156      * of the LuxLevel Out state. Valid range: 0.0 ~ 1000.0. The default value is 80.0.
1157      */
1158     float regulator_kpu;    /*!< The value of Light LC Regulator Kpu state */
1159     /**
1160      * A float32 state representing the proportional coefficient that determines
1161      * the proportional part of the equation defining the output of the Light LC PI
1162      * Feedback Regulator, when Light LC Ambient LuxLevel is greater than or equal
1163      * to the value of the LuxLevel Out state. Valid range: 0.0 ~ 1000.0. The default
1164      * value is 80.0.
1165      */
1166     float regulator_kpd;    /*!< The value of Light LC Regulator Kpd state */
1167     /**
1168      * A int8 state representing the percentage accuracy of the Light LC PI Feedback
1169      * Regulator. Valid range: 0.0 ~ 100.0. The default value is 2.0.
1170      */
1171     int8_t regulator_accuracy;  /*!< The value of Light LC Regulator Accuracy state */
1172 
1173     /**
1174      * If the message Raw field contains a Raw Value for the Time Since Motion
1175      * Sensed device property, which represents a value less than or equal to
1176      * the value of the Light LC Occupancy Delay state, it shall delay setting
1177      * the Light LC Occupancy state to 0b1 by the difference between the value
1178      * of the Light LC Occupancy Delay state and the received Time Since Motion
1179      * value.
1180      */
1181     uint32_t set_occupancy_to_1_delay;  /*!< The value of the difference between value of the
1182                                             Light LC Occupancy Delay state and the received
1183                                             Time Since Motion value */
1184 } esp_ble_mesh_light_lc_property_state_t;
1185 
1186 /** This enum value is the Light LC State Machine states */
1187 typedef enum {
1188     ESP_BLE_MESH_LC_OFF,
1189     ESP_BLE_MESH_LC_STANDBY,
1190     ESP_BLE_MESH_LC_FADE_ON,
1191     ESP_BLE_MESH_LC_RUN,
1192     ESP_BLE_MESH_LC_FADE,
1193     ESP_BLE_MESH_LC_PROLONG,
1194     ESP_BLE_MESH_LC_FADE_STANDBY_AUTO,
1195     ESP_BLE_MESH_LC_FADE_STANDBY_MANUAL,
1196 } esp_ble_mesh_lc_state_t;
1197 
1198 /** Parameters of Light LC state machine */
1199 typedef struct {
1200     /**
1201      * The Fade On, Fade, Fade Standby Auto, and Fade Standby Manual states are
1202      * transition states that define the transition of the Lightness Out and
1203      * LuxLevel Out states. This transition can be started as a result of the
1204      * Light LC State Machine change or as a result of receiving the Light LC
1205      * Light OnOff Set or Light LC Light Set Unacknowledged message.
1206      */
1207     struct {
1208         uint8_t fade_on;                /*!< The value of transition time of Light LC Time Fade On */
1209         uint8_t fade;                   /*!< The value of transition time of Light LC Time Fade */
1210         uint8_t fade_standby_auto;      /*!< The value of transition time of Light LC Time Fade Standby Auto */
1211         uint8_t fade_standby_manual;    /*!< The value of transition time of Light LC Time Fade Standby Manual */
1212     } trans_time;                       /*!< The value of transition time */
1213     esp_ble_mesh_lc_state_t state;      /*!< The value of Light LC state machine state */
1214     struct k_delayed_work timer;        /*!< Timer of Light LC state machine */
1215 } esp_ble_mesh_light_lc_state_machine_t;
1216 
1217 /** Parameters of Light Lightness controller */
1218 typedef struct {
1219     esp_ble_mesh_light_lc_state_t          state;           /*!< Parameters of Light LC state */
1220     esp_ble_mesh_light_lc_property_state_t prop_state;      /*!< Parameters of Light LC Property state */
1221     esp_ble_mesh_light_lc_state_machine_t  state_machine;   /*!< Parameters of Light LC state machine */
1222 } esp_ble_mesh_light_control_t;
1223 
1224 /** User data of Light LC Server Model */
1225 typedef struct {
1226     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting LC Server Model. Initialized internally. */
1227     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
1228     esp_ble_mesh_light_control_t *lc;           /*!< Parameters of the Light controller */
1229     esp_ble_mesh_last_msg_info_t last;          /*!< Parameters of the last received set message */
1230     esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
1231 } esp_ble_mesh_light_lc_srv_t;
1232 
1233 /** User data of Light LC Setup Server Model */
1234 typedef struct {
1235     esp_ble_mesh_model_t *model;                /*!< Pointer to the Lighting LC Setup Server Model. Initialized internally. */
1236     esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl;    /*!< Response control of the server model received messages */
1237     esp_ble_mesh_light_control_t *lc;           /*!< Parameters of the Light controller */
1238 } esp_ble_mesh_light_lc_setup_srv_t;
1239 
1240 /** Parameter of Light Lightness Actual state change event */
1241 typedef struct {
1242     uint16_t lightness;     /*!< The value of Light Lightness Actual state */
1243 } esp_ble_mesh_state_change_light_lightness_set_t;
1244 
1245 /** Parameter of Light Lightness Linear state change event */
1246 typedef struct {
1247     uint16_t lightness;     /*!< The value of Light Lightness Linear state */
1248 } esp_ble_mesh_state_change_light_lightness_linear_set_t;
1249 
1250 /** Parameter of Light Lightness Default state change event */
1251 typedef struct {
1252     uint16_t lightness;     /*!< The value of Light Lightness Default state */
1253 } esp_ble_mesh_state_change_light_lightness_default_set_t;
1254 
1255 /** Parameters of Light Lightness Range state change event */
1256 typedef struct {
1257     uint16_t range_min;     /*!< The minimum value of Light Lightness Range state */
1258     uint16_t range_max;     /*!< The maximum value of Light Lightness Range state */
1259 } esp_ble_mesh_state_change_light_lightness_range_set_t;
1260 
1261 /** Parameters of Light CTL state change event */
1262 typedef struct {
1263     uint16_t lightness;     /*!< The value of Light CTL Lightness state */
1264     uint16_t temperature;   /*!< The value of Light CTL Temperature state */
1265     int16_t  delta_uv;      /*!< The value of Light CTL Delta UV state */
1266 } esp_ble_mesh_state_change_light_ctl_set_t;
1267 
1268 /** Parameters of Light CTL Temperature state change event */
1269 typedef struct {
1270     uint16_t temperature;   /*!< The value of Light CTL Temperature state */
1271     int16_t  delta_uv;      /*!< The value of Light CTL Delta UV state */
1272 } esp_ble_mesh_state_change_light_ctl_temperature_set_t;
1273 
1274 /** Parameters of Light CTL Temperature Range state change event */
1275 typedef struct {
1276     uint16_t range_min;     /*!< The minimum value of Light CTL Temperature Range state */
1277     uint16_t range_max;     /*!< The maximum value of Light CTL Temperature Range state */
1278 } esp_ble_mesh_state_change_light_ctl_temperature_range_set_t;
1279 
1280 /** Parameters of Light CTL Default state change event */
1281 typedef struct {
1282     uint16_t lightness;     /*!< The value of Light Lightness Default state */
1283     uint16_t temperature;   /*!< The value of Light CTL Temperature Default state */
1284     int16_t  delta_uv;      /*!< The value of Light CTL Delta UV Default state */
1285 } esp_ble_mesh_state_change_light_ctl_default_set_t;
1286 
1287 /** Parameters of Light HSL state change event */
1288 typedef struct {
1289     uint16_t lightness;     /*!< The value of Light HSL Lightness state */
1290     uint16_t hue;           /*!< The value of Light HSL Hue state */
1291     uint16_t saturation;    /*!< The value of Light HSL Saturation state */
1292 } esp_ble_mesh_state_change_light_hsl_set_t;
1293 
1294 /** Parameter of Light HSL Hue state change event */
1295 typedef struct {
1296     uint16_t hue;           /*!< The value of Light HSL Hue state */
1297 } esp_ble_mesh_state_change_light_hsl_hue_set_t;
1298 
1299 /** Parameter of Light HSL Saturation state change event */
1300 typedef struct {
1301     uint16_t saturation;    /*!< The value of Light HSL Saturation state */
1302 } esp_ble_mesh_state_change_light_hsl_saturation_set_t;
1303 
1304 /** Parameters of Light HSL Default state change event */
1305 typedef struct {
1306     uint16_t lightness;     /*!< The value of Light HSL Lightness Default state */
1307     uint16_t hue;           /*!< The value of Light HSL Hue Default state */
1308     uint16_t saturation;    /*!< The value of Light HSL Saturation Default state */
1309 } esp_ble_mesh_state_change_light_hsl_default_set_t;
1310 
1311 /** Parameters of Light HSL Range state change event */
1312 typedef struct {
1313     uint16_t hue_range_min;         /*!< The minimum hue value of Light HSL Range state */
1314     uint16_t hue_range_max;         /*!< The maximum hue value of Light HSL Range state */
1315     uint16_t saturation_range_min;  /*!< The minimum saturation value of Light HSL Range state */
1316     uint16_t saturation_range_max;  /*!< The maximum saturation value of Light HSL Range state */
1317 } esp_ble_mesh_state_change_light_hsl_range_set_t;
1318 
1319 /** Parameters of Light xyL state change event */
1320 typedef struct {
1321     uint16_t lightness;     /*!< The value of Light xyL Lightness state */
1322     uint16_t x;             /*!< The value of Light xyL x state */
1323     uint16_t y;             /*!< The value of Light xyL y state */
1324 } esp_ble_mesh_state_change_light_xyl_set_t;
1325 
1326 /** Parameters of Light xyL Default state change event */
1327 typedef struct {
1328     uint16_t lightness;     /*!< The value of Light Lightness Default state */
1329     uint16_t x;             /*!< The value of Light xyL x Default state */
1330     uint16_t y;             /*!< The value of Light xyL y Default state */
1331 } esp_ble_mesh_state_change_light_xyl_default_set_t;
1332 
1333 /** Parameters of Light xyL Range state change event */
1334 typedef struct {
1335     uint16_t x_range_min;   /*!< The minimum value of Light xyL x Range state */
1336     uint16_t x_range_max;   /*!< The maximum value of Light xyL x Range state */
1337     uint16_t y_range_min;   /*!< The minimum value of Light xyL y Range state */
1338     uint16_t y_range_max;   /*!< The maximum value of Light xyL y Range state */
1339 } esp_ble_mesh_state_change_light_xyl_range_set_t;
1340 
1341 /** Parameter of Light LC Mode state change event */
1342 typedef struct {
1343     uint8_t mode;       /*!< The value of Light LC Mode state */
1344 } esp_ble_mesh_state_change_light_lc_mode_set_t;
1345 
1346 /** Parameter of Light LC Occupancy Mode state change event */
1347 typedef struct {
1348     uint8_t mode;       /*!< The value of Light LC Occupancy Mode state */
1349 } esp_ble_mesh_state_change_light_lc_om_set_t;
1350 
1351 /** Parameter of Light LC Light OnOff state change event */
1352 typedef struct {
1353     uint8_t onoff;      /*!< The value of Light LC Light OnOff state */
1354 } esp_ble_mesh_state_change_light_lc_light_onoff_set_t;
1355 
1356 /** Parameters of Light LC Property state change event */
1357 typedef struct {
1358     uint16_t property_id;   /*!< The property id of Light LC Property state */
1359     struct net_buf_simple *property_value;  /*!< The property value of Light LC Property state */
1360 } esp_ble_mesh_state_change_light_lc_property_set_t;
1361 
1362 /** Parameters of Sensor Status state change event */
1363 typedef struct {
1364     uint16_t property_id;       /*!< The value of Sensor Property ID */
1365     /** Parameters of Sensor Status related state */
1366     union {
1367         uint8_t  occupancy;                 /*!< The value of Light LC Occupancy state */
1368         uint32_t set_occupancy_to_1_delay;  /*!< The value of Light LC Set Occupancy to 1 Delay state */
1369         uint32_t ambient_luxlevel;          /*!< The value of Light LC Ambient Luxlevel state */
1370     } state;
1371 } esp_ble_mesh_state_change_sensor_status_t;
1372 
1373 /**
1374  * @brief Lighting Server Model state change value union
1375  */
1376 typedef union {
1377     /**
1378      * The recv_op in ctx can be used to decide which state is changed.
1379      */
1380     esp_ble_mesh_state_change_light_lightness_set_t             lightness_set;          /*!< Light Lightness Set */
1381     esp_ble_mesh_state_change_light_lightness_linear_set_t      lightness_linear_set;   /*!< Light Lightness Linear Set */
1382     esp_ble_mesh_state_change_light_lightness_default_set_t     lightness_default_set;  /*!< Light Lightness Default Set */
1383     esp_ble_mesh_state_change_light_lightness_range_set_t       lightness_range_set;    /*!< Light Lightness Range Set */
1384     esp_ble_mesh_state_change_light_ctl_set_t                   ctl_set;                /*!< Light CTL Set */
1385     esp_ble_mesh_state_change_light_ctl_temperature_set_t       ctl_temp_set;           /*!< Light CTL Temperature Set */
1386     esp_ble_mesh_state_change_light_ctl_temperature_range_set_t ctl_temp_range_set;     /*!< Light CTL Temperature Range Set */
1387     esp_ble_mesh_state_change_light_ctl_default_set_t           ctl_default_set;        /*!< Light CTL Default Set */
1388     esp_ble_mesh_state_change_light_hsl_set_t                   hsl_set;                /*!< Light HSL Set */
1389     esp_ble_mesh_state_change_light_hsl_hue_set_t               hsl_hue_set;            /*!< Light HSL Hue Set */
1390     esp_ble_mesh_state_change_light_hsl_saturation_set_t        hsl_saturation_set;     /*!< Light HSL Saturation Set */
1391     esp_ble_mesh_state_change_light_hsl_default_set_t           hsl_default_set;        /*!< Light HSL Default Set */
1392     esp_ble_mesh_state_change_light_hsl_range_set_t             hsl_range_set;          /*!< Light HSL Range Set */
1393     esp_ble_mesh_state_change_light_xyl_set_t                   xyl_set;                /*!< Light xyL Set */
1394     esp_ble_mesh_state_change_light_xyl_default_set_t           xyl_default_set;        /*!< Light xyL Default Set */
1395     esp_ble_mesh_state_change_light_xyl_range_set_t             xyl_range_set;          /*!< Light xyL Range Set */
1396     esp_ble_mesh_state_change_light_lc_mode_set_t               lc_mode_set;            /*!< Light LC Mode Set */
1397     esp_ble_mesh_state_change_light_lc_om_set_t                 lc_om_set;              /*!< Light LC Occupancy Mode Set */
1398     esp_ble_mesh_state_change_light_lc_light_onoff_set_t        lc_light_onoff_set;     /*!< Light LC Light OnOff Set */
1399     esp_ble_mesh_state_change_light_lc_property_set_t           lc_property_set;        /*!< Light LC Property Set */
1400     esp_ble_mesh_state_change_sensor_status_t                   sensor_status;          /*!< Sensor Status */
1401 } esp_ble_mesh_lighting_server_state_change_t;
1402 
1403 /** Context of the received Light LC Property Get message */
1404 typedef struct {
1405     uint16_t property_id;   /*!< Property ID identifying a Light LC Property */
1406 } esp_ble_mesh_server_recv_light_lc_property_get_t;
1407 
1408 /**
1409  * @brief Lighting Server Model received get message union
1410  */
1411 typedef union {
1412     esp_ble_mesh_server_recv_light_lc_property_get_t lc_property;   /*!< Light LC Property Get */
1413 } esp_ble_mesh_lighting_server_recv_get_msg_t;
1414 
1415 /** Context of the received Light Lightness Set message */
1416 typedef struct {
1417     bool     op_en;         /*!< Indicate if optional parameters are included */
1418     uint16_t lightness;     /*!< Target value of light lightness actual state */
1419     uint8_t  tid;           /*!< Transaction ID */
1420     uint8_t  trans_time;    /*!< Time to complete state transition (optional) */
1421     uint8_t  delay;         /*!< Indicate message execution delay (C.1) */
1422 } esp_ble_mesh_server_recv_light_lightness_set_t;
1423 
1424 /** Context of the received Light Lightness Linear Set message */
1425 typedef struct {
1426     bool     op_en;         /*!< Indicate if optional parameters are included */
1427     uint16_t lightness;     /*!< Target value of light lightness linear state */
1428     uint8_t  tid;           /*!< Transaction ID */
1429     uint8_t  trans_time;    /*!< Time to complete state transition (optional) */
1430     uint8_t  delay;         /*!< Indicate message execution delay (C.1) */
1431 } esp_ble_mesh_server_recv_light_lightness_linear_set_t;
1432 
1433 /** Context of the received Light Lightness Default Set message */
1434 typedef struct {
1435     uint16_t lightness;     /*!< The value of the Light Lightness Default state */
1436 } esp_ble_mesh_server_recv_light_lightness_default_set_t;
1437 
1438 /** Context of the received Light Lightness Range Set message */
1439 typedef struct {
1440     uint16_t range_min;     /*!< Value of range min field of light lightness range state */
1441     uint16_t range_max;     /*!< Value of range max field of light lightness range state */
1442 } esp_ble_mesh_server_recv_light_lightness_range_set_t;
1443 
1444 /** Context of the received Light CTL Set message */
1445 typedef struct {
1446     bool     op_en;         /*!< Indicate if optional parameters are included */
1447     uint16_t lightness;     /*!< Target value of light ctl lightness state */
1448     uint16_t temperature;   /*!< Target value of light ctl temperature state */
1449     int16_t  delta_uv;      /*!< Target value of light ctl delta UV state */
1450     uint8_t  tid;           /*!< Transaction ID */
1451     uint8_t  trans_time;    /*!< Time to complete state transition (optional) */
1452     uint8_t  delay;         /*!< Indicate message execution delay (C.1) */
1453 } esp_ble_mesh_server_recv_light_ctl_set_t;
1454 
1455 /** Context of the received Light CTL Temperature Set message */
1456 typedef struct {
1457     bool     op_en;         /*!< Indicate if optional parameters are included */
1458     uint16_t temperature;   /*!< Target value of light ctl temperature state */
1459     int16_t  delta_uv;      /*!< Target value of light ctl delta UV state */
1460     uint8_t  tid;           /*!< Transaction ID */
1461     uint8_t  trans_time;    /*!< Time to complete state transition (optional) */
1462     uint8_t  delay;         /*!< Indicate message execution delay (C.1) */
1463 } esp_ble_mesh_server_recv_light_ctl_temperature_set_t;
1464 
1465 /** Context of the received Light CTL Temperature Range Set message */
1466 typedef struct {
1467     uint16_t range_min;     /*!< Value of temperature range min field of light ctl temperature range state */
1468     uint16_t range_max;     /*!< Value of temperature range max field of light ctl temperature range state */
1469 } esp_ble_mesh_server_recv_light_ctl_temperature_range_set_t;
1470 
1471 /** Context of the received Light CTL Default Set message */
1472 typedef struct {
1473     uint16_t lightness;     /*!< Value of light lightness default state */
1474     uint16_t temperature;   /*!< Value of light temperature default state */
1475     int16_t  delta_uv;      /*!< Value of light delta UV default state */
1476 } esp_ble_mesh_server_recv_light_ctl_default_set_t;
1477 
1478 /** Context of the received Light HSL Set message */
1479 typedef struct {
1480     bool     op_en;         /*!< Indicate if optional parameters are included */
1481     uint16_t lightness;     /*!< Target value of light hsl lightness state */
1482     uint16_t hue;           /*!< Target value of light hsl hue state */
1483     uint16_t saturation;    /*!< Target value of light hsl saturation state */
1484     uint8_t  tid;           /*!< Transaction ID */
1485     uint8_t  trans_time;    /*!< Time to complete state transition (optional) */
1486     uint8_t  delay;         /*!< Indicate message execution delay (C.1) */
1487 } esp_ble_mesh_server_recv_light_hsl_set_t;
1488 
1489 /** Context of the received Light HSL Hue Set message */
1490 typedef struct {
1491     bool     op_en;         /*!< Indicate if optional parameters are included */
1492     uint16_t hue;           /*!< Target value of light hsl hue state */
1493     uint8_t  tid;           /*!< Transaction ID */
1494     uint8_t  trans_time;    /*!< Time to complete state transition (optional) */
1495     uint8_t  delay;         /*!< Indicate message execution delay (C.1) */
1496 } esp_ble_mesh_server_recv_light_hsl_hue_set_t;
1497 
1498 /** Context of the received Light HSL Saturation Set message */
1499 typedef struct {
1500     bool     op_en;         /*!< Indicate if optional parameters are included */
1501     uint16_t saturation;    /*!< Target value of light hsl hue state */
1502     uint8_t  tid;           /*!< Transaction ID */
1503     uint8_t  trans_time;    /*!< Time to complete state transition (optional) */
1504     uint8_t  delay;         /*!< Indicate message execution delay (C.1) */
1505 } esp_ble_mesh_server_recv_light_hsl_saturation_set_t;
1506 
1507 /** Context of the received Light HSL Default Set message */
1508 typedef struct {
1509     uint16_t lightness;     /*!< Value of light lightness default state */
1510     uint16_t hue;           /*!< Value of light hue default state */
1511     uint16_t saturation;    /*!< Value of light saturation default state */
1512 } esp_ble_mesh_server_recv_light_hsl_default_set_t;
1513 
1514 /** Context of the received Light HSL Range Set message */
1515 typedef struct {
1516     uint16_t hue_range_min;         /*!< Value of hue range min field of light hsl hue range state */
1517     uint16_t hue_range_max;         /*!< Value of hue range max field of light hsl hue range state */
1518     uint16_t saturation_range_min;  /*!< Value of saturation range min field of light hsl saturation range state */
1519     uint16_t saturation_range_max;  /*!< Value of saturation range max field of light hsl saturation range state */
1520 } esp_ble_mesh_server_recv_light_hsl_range_set_t;
1521 
1522 /** Context of the received Light xyL Set message */
1523 typedef struct {
1524     bool     op_en;         /*!< Indicate whether optional parameters included */
1525     uint16_t lightness;     /*!< The target value of the Light xyL Lightness state */
1526     uint16_t x;             /*!< The target value of the Light xyL x state */
1527     uint16_t y;             /*!< The target value of the Light xyL y state */
1528     uint8_t  tid;           /*!< Transaction Identifier */
1529     uint8_t  trans_time;    /*!< Time to complete state transition (optional) */
1530     uint8_t  delay;         /*!< Indicate message execution delay (C.1) */
1531 } esp_ble_mesh_server_recv_light_xyl_set_t;
1532 
1533 /** Context of the received Light xyL Default Set message */
1534 typedef struct {
1535     uint16_t lightness;     /*!< The value of the Light Lightness Default state */
1536     uint16_t x;             /*!< The value of the Light xyL x Default state */
1537     uint16_t y;             /*!< The value of the Light xyL y Default state */
1538 } esp_ble_mesh_server_recv_light_xyl_default_set_t;
1539 
1540 /** Context of the received Light xyl Range Set message */
1541 typedef struct {
1542     uint16_t x_range_min;   /*!< The value of the xyL x Range Min field of the Light xyL x Range state */
1543     uint16_t x_range_max;   /*!< The value of the xyL x Range Max field of the Light xyL x Range state */
1544     uint16_t y_range_min;   /*!< The value of the xyL y Range Min field of the Light xyL y Range state */
1545     uint16_t y_range_max;   /*!< The value of the xyL y Range Max field of the Light xyL y Range state */
1546 } esp_ble_mesh_server_recv_light_xyl_range_set_t;
1547 
1548 /** Context of the received Light LC Mode Set message */
1549 typedef struct {
1550     uint8_t mode;   /*!< The target value of the Light LC Mode state */
1551 } esp_ble_mesh_server_recv_light_lc_mode_set_t;
1552 
1553 /** Context of the received Light OM Set message */
1554 typedef struct {
1555     uint8_t mode;   /*!< The target value of the Light LC Occupancy Mode state */
1556 } esp_ble_mesh_server_recv_light_lc_om_set_t;
1557 
1558 /** Context of the received Light LC Light OnOff Set message */
1559 typedef struct {
1560     bool    op_en;          /*!< Indicate whether optional parameters included */
1561     uint8_t light_onoff;    /*!< The target value of the Light LC Light OnOff state */
1562     uint8_t tid;            /*!< Transaction Identifier */
1563     uint8_t trans_time;     /*!< Time to complete state transition (optional) */
1564     uint8_t delay;          /*!< Indicate message execution delay (C.1) */
1565 } esp_ble_mesh_server_recv_light_lc_light_onoff_set_t;
1566 
1567 /** Context of the received Light LC Property Set message */
1568 typedef struct {
1569     uint16_t property_id;   /*!< Property ID identifying a Light LC Property */
1570     struct net_buf_simple *property_value;  /*!< Raw value for the Light LC Property */
1571 } esp_ble_mesh_server_recv_light_lc_property_set_t;
1572 
1573 /**
1574  * @brief Lighting Server Model received set message union
1575  */
1576 typedef union {
1577     esp_ble_mesh_server_recv_light_lightness_set_t             lightness;           /*!< Light Lightness Set/Light Lightness Set Unack */
1578     esp_ble_mesh_server_recv_light_lightness_linear_set_t      lightness_linear;    /*!< Light Lightness Linear Set/Light Lightness Linear Set Unack */
1579     esp_ble_mesh_server_recv_light_lightness_default_set_t     lightness_default;   /*!< Light Lightness Default Set/Light Lightness Default Set Unack */
1580     esp_ble_mesh_server_recv_light_lightness_range_set_t       lightness_range;     /*!< Light Lightness Range Set/Light Lightness Range Set Unack */
1581     esp_ble_mesh_server_recv_light_ctl_set_t                   ctl;                 /*!< Light CTL Set/Light CTL Set Unack */
1582     esp_ble_mesh_server_recv_light_ctl_temperature_set_t       ctl_temp;            /*!< Light CTL Temperature Set/Light CTL Temperature Set Unack */
1583     esp_ble_mesh_server_recv_light_ctl_temperature_range_set_t ctl_temp_range;      /*!< Light CTL Temperature Range Set/Light CTL Temperature Range Set Unack */
1584     esp_ble_mesh_server_recv_light_ctl_default_set_t           ctl_default;         /*!< Light CTL Default Set/Light CTL Default Set Unack */
1585     esp_ble_mesh_server_recv_light_hsl_set_t                   hsl;                 /*!< Light HSL Set/Light HSL Set Unack */
1586     esp_ble_mesh_server_recv_light_hsl_hue_set_t               hsl_hue;             /*!< Light HSL Hue Set/Light HSL Hue Set Unack */
1587     esp_ble_mesh_server_recv_light_hsl_saturation_set_t        hsl_saturation;      /*!< Light HSL Saturation Set/Light HSL Saturation Set Unack */
1588     esp_ble_mesh_server_recv_light_hsl_default_set_t           hsl_default;         /*!< Light HSL Default Set/Light HSL Default Set Unack */
1589     esp_ble_mesh_server_recv_light_hsl_range_set_t             hsl_range;           /*!< Light HSL Range Set/Light HSL Range Set Unack */
1590     esp_ble_mesh_server_recv_light_xyl_set_t                   xyl;                 /*!< Light xyL Set/Light xyL Set Unack */
1591     esp_ble_mesh_server_recv_light_xyl_default_set_t           xyl_default;         /*!< Light xyL Default Set/Light xyL Default Set Unack */
1592     esp_ble_mesh_server_recv_light_xyl_range_set_t             xyl_range;           /*!< Light xyL Range Set/Light xyL Range Set Unack */
1593     esp_ble_mesh_server_recv_light_lc_mode_set_t               lc_mode;             /*!< Light LC Mode Set/Light LC Mode Set Unack */
1594     esp_ble_mesh_server_recv_light_lc_om_set_t                 lc_om;               /*!< Light LC OM Set/Light LC OM Set Unack */
1595     esp_ble_mesh_server_recv_light_lc_light_onoff_set_t        lc_light_onoff;      /*!< Light LC Light OnOff Set/Light LC Light OnOff Set Unack */
1596     esp_ble_mesh_server_recv_light_lc_property_set_t           lc_property;         /*!< Light LC Property Set/Light LC Property Set Unack */
1597 } esp_ble_mesh_lighting_server_recv_set_msg_t;
1598 
1599 /** Context of the received Sensor Status message */
1600 typedef struct {
1601     struct net_buf_simple *data;    /*!< Value of sensor data state (optional) */
1602 } esp_ble_mesh_server_recv_sensor_status_t;
1603 
1604 /**
1605  * @brief Lighting Server Model received status message union
1606  */
1607 typedef union {
1608     esp_ble_mesh_server_recv_sensor_status_t sensor_status;     /*!< Sensor Status */
1609 } esp_ble_mesh_lighting_server_recv_status_msg_t;
1610 
1611 /**
1612  * @brief Lighting Server Model callback value union
1613  */
1614 typedef union {
1615     esp_ble_mesh_lighting_server_state_change_t state_change;   /*!< ESP_BLE_MESH_LIGHTING_SERVER_STATE_CHANGE_EVT */
1616     esp_ble_mesh_lighting_server_recv_get_msg_t get;            /*!< ESP_BLE_MESH_LIGHTING_SERVER_RECV_GET_MSG_EVT */
1617     esp_ble_mesh_lighting_server_recv_set_msg_t set;            /*!< ESP_BLE_MESH_LIGHTING_SERVER_RECV_SET_MSG_EVT */
1618     esp_ble_mesh_lighting_server_recv_status_msg_t status;      /*!< ESP_BLE_MESH_LIGHTING_SERVER_RECV_STATUS_MSG_EVT */
1619 } esp_ble_mesh_lighting_server_cb_value_t;
1620 
1621 /** Lighting Server Model callback parameters */
1622 typedef struct {
1623     esp_ble_mesh_model_t  *model;   /*!< Pointer to Lighting Server Models */
1624     esp_ble_mesh_msg_ctx_t ctx;     /*!< Context of the received messages */
1625     esp_ble_mesh_lighting_server_cb_value_t value;  /*!< Value of the received Lighting Messages */
1626 } esp_ble_mesh_lighting_server_cb_param_t;
1627 
1628 /** This enum value is the event of Lighting Server Model */
1629 typedef enum {
1630     /**
1631      * 1. When get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, no event will be
1632      *    callback to the application layer when Lighting Get messages are received.
1633      * 2. When set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, this event will
1634      *    be callback to the application layer when Lighting Set/Set Unack messages
1635      *    are received.
1636      */
1637     ESP_BLE_MESH_LIGHTING_SERVER_STATE_CHANGE_EVT,
1638     /**
1639      * When get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
1640      * callback to the application layer when Lighting Get messages are received.
1641      */
1642     ESP_BLE_MESH_LIGHTING_SERVER_RECV_GET_MSG_EVT,
1643     /**
1644      * When set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
1645      * callback to the application layer when Lighting Set/Set Unack messages are received.
1646      */
1647     ESP_BLE_MESH_LIGHTING_SERVER_RECV_SET_MSG_EVT,
1648     /**
1649      * When status_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will
1650      * be callback to the application layer when Sensor Status message is received.
1651      */
1652     ESP_BLE_MESH_LIGHTING_SERVER_RECV_STATUS_MSG_EVT,
1653     ESP_BLE_MESH_LIGHTING_SERVER_EVT_MAX,
1654 } esp_ble_mesh_lighting_server_cb_event_t;
1655 
1656 /**
1657  *  @brief Bluetooth Mesh Lighting Server Model function.
1658  */
1659 
1660 /**
1661  * @brief   Lighting Server Model callback function type
1662  * @param   event: Event type
1663  * @param   param: Pointer to callback parameter
1664  */
1665 typedef void (* esp_ble_mesh_lighting_server_cb_t)(esp_ble_mesh_lighting_server_cb_event_t event,
1666                                                    esp_ble_mesh_lighting_server_cb_param_t *param);
1667 
1668 /**
1669  * @brief       Register BLE Mesh Lighting Server Model callback.
1670  *
1671  * @param[in]   callback: Pointer to the callback function.
1672  *
1673  * @return      ESP_OK on success or error code otherwise.
1674  *
1675  */
1676 esp_err_t esp_ble_mesh_register_lighting_server_callback(esp_ble_mesh_lighting_server_cb_t callback);
1677 
1678 #ifdef __cplusplus
1679 }
1680 #endif
1681 
1682 #endif /* _ESP_BLE_MESH_LIGHTING_MODEL_API_H_ */
1683