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