MeshX 0.3
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
|
Implementation of the BLE Mesh Light CTL Server Model for ESP32. This file contains the initialization, message handling, and state management for the Light CTL Server Model, including support for Lightness, Temperature, and Delta UV operations. More...
#include "meshx_platform_ble_mesh.h"
#include "interface/ble_mesh/server/meshx_ble_mesh_light_srv.h"
#include "interface/ble_mesh/server/meshx_ble_mesh_gen_srv.h"
Go to the source code of this file.
Data Structures | |
union | meshx_plat_ctl_status |
Light CTL status packet. More... | |
Typedefs | |
typedef union meshx_plat_ctl_status | meshx_plat_ctl_status_t |
Light CTL status packet. | |
Functions | |
static void | meshx_ble_lightness_server_cb (MESHX_LIGHT_SRV_CB_EVT event, MESHX_LIGHT_SRV_CB_PARAM *param) |
Callback function for BLE Mesh Lightness Server events. | |
meshx_err_t | meshx_plat_gen_light_srv_send_status (const meshx_model_t *p_model, const meshx_ctx_t *p_ctx, const meshx_lighting_server_state_change_t *state_change) |
Send a status message from the Light Server. This function constructs and sends a status message containing the current state of the Light Server. | |
meshx_err_t | meshx_plat_light_srv_init (void) |
Initialize the platform-specific Light Server. | |
meshx_err_t | meshx_plat_light_srv_delete (meshx_ptr_t *p_pub, meshx_ptr_t *p_ctl_srv) |
Delete a Light CTL Server instance. | |
meshx_err_t | meshx_plat_light_ctl_setup_srv_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_ctl_srv) |
Creates and initializes a Light CTL (Color Temperature Lightness) Setup Server model instance. | |
meshx_err_t | meshx_plat_light_ctl_srv_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_ctl_srv) |
Create a Light CTL Server instance. | |
meshx_err_t | meshx_plat_set_light_ctl_srv_state (meshx_ptr_t p_model, uint16_t delta_uv, uint16_t lightness, uint16_t temperature, uint16_t temp_range_max, uint16_t temp_range_min) |
Set the state of the Light CTL Server. | |
meshx_err_t | meshx_plat_light_ctl_srv_restore (meshx_ptr_t p_model, uint16_t delta_uv, uint16_t lightness, uint16_t temperature, uint16_t temp_range_max, uint16_t temp_range_min) |
Restore the state of the Light CTL Server. | |
Variables | |
static const MESHX_MODEL | light_ctl_setup_sig_template |
Template for CTL Setup Srv SIG model initialization. | |
static const MESHX_MODEL | light_ctl_sig_template |
Template for CTL Setup Srv SIG model initialization. | |
Implementation of the BLE Mesh Light CTL Server Model for ESP32. This file contains the initialization, message handling, and state management for the Light CTL Server Model, including support for Lightness, Temperature, and Delta UV operations.
Copyright (c) 2024 - 2025 MeshX
The implementation includes:
Definition in file esp_light_srv_model.c.
typedef union meshx_plat_ctl_status meshx_plat_ctl_status_t |
Light CTL status packet.
|
static |
Callback function for BLE Mesh Lightness Server events.
This function is called whenever a BLE Mesh Lightness Server event occurs.
[in] | event | The event type for the BLE Mesh Lightness Server. |
[in] | param | Parameters associated with the event. |
< Light CTL Message Opcode
< Light CTL Setup Message Opcode
Definition at line 72 of file esp_light_srv_model.c.
meshx_err_t meshx_plat_gen_light_srv_send_status | ( | const meshx_model_t * | p_model, |
const meshx_ctx_t * | p_ctx, | ||
const meshx_lighting_server_state_change_t * | state_change ) |
Send a status message from the Light Server. This function constructs and sends a status message containing the current state of the Light Server.
[in] | p_model | Pointer to the Light Server model. |
[in] | p_ctx | Pointer to the context containing message information. |
[in] | state_change | The state change data to be sent in the status message. |
Definition at line 194 of file esp_light_srv_model.c.
meshx_err_t meshx_plat_light_ctl_setup_srv_create | ( | meshx_ptr_t | p_model, |
meshx_ptr_t * | p_pub, | ||
meshx_ptr_t * | p_ctl_srv ) |
Creates and initializes a Light CTL (Color Temperature Lightness) Setup Server model instance.
This function sets up the Light CTL Setup Server for a given model, configuring publication and server context pointers.
[in] | p_model | Pointer to the parent model instance. |
[out] | p_pub | Pointer to the publication context to be initialized. |
[out] | p_ctl_srv | Pointer to the Light CTL Setup Server context to be initialized. |
Definition at line 293 of file esp_light_srv_model.c.
meshx_err_t meshx_plat_light_ctl_srv_create | ( | meshx_ptr_t | p_model, |
meshx_ptr_t * | p_pub, | ||
meshx_ptr_t * | p_ctl_srv ) |
Create a Light CTL Server instance.
This function initializes and allocates resources for a Light CTL Server model.
[in] | p_model | Pointer to the model instance. |
[out] | p_pub | Pointer to the publication context. |
[out] | p_ctl_srv | Pointer to the Light CTL Server instance. |
Definition at line 333 of file esp_light_srv_model.c.
meshx_err_t meshx_plat_light_ctl_srv_restore | ( | meshx_ptr_t | p_model, |
uint16_t | delta_uv, | ||
uint16_t | lightness, | ||
uint16_t | temperature, | ||
uint16_t | temp_range_max, | ||
uint16_t | temp_range_min ) |
Restore the state of the Light CTL Server.
This function restores the state of the Light CTL Server with the provided parameters.
[in] | p_model | Pointer to the model instance. |
[in] | delta_uv | Delta UV value. |
[in] | lightness | Lightness value. |
[in] | temperature | Temperature value. |
[in] | temp_range_max | Maximum temperature range. |
[in] | temp_range_min | Minimum temperature range. |
Definition at line 398 of file esp_light_srv_model.c.
meshx_err_t meshx_plat_light_srv_delete | ( | meshx_ptr_t * | p_pub, |
meshx_ptr_t * | p_ctl_srv ) |
Delete a Light CTL Server instance.
This function releases resources associated with a Light CTL Server model.
[in,out] | p_pub | Pointer to the publication context to be deleted. |
[in,out] | p_ctl_srv | Pointer to the Light CTL Server instance to be deleted. |
Definition at line 277 of file esp_light_srv_model.c.
meshx_err_t meshx_plat_light_srv_init | ( | void | ) |
Initialize the platform-specific Light Server.
This function sets up the necessary resources for the Light Server.
Definition at line 263 of file esp_light_srv_model.c.
meshx_err_t meshx_plat_set_light_ctl_srv_state | ( | meshx_ptr_t | p_model, |
uint16_t | delta_uv, | ||
uint16_t | lightness, | ||
uint16_t | temperature, | ||
uint16_t | temp_range_max, | ||
uint16_t | temp_range_min ) |
Set the state of the Light CTL Server.
This function updates the state of the Light CTL Server with the provided parameters.
[in] | p_model | Pointer to the model instance. |
[in] | delta_uv | Delta UV value. |
[in] | lightness | Lightness value. |
[in] | temperature | Temperature value. |
[in] | temp_range_max | Maximum temperature range. |
[in] | temp_range_min | Minimum temperature range. |
Definition at line 377 of file esp_light_srv_model.c.
|
static |
Template for CTL Setup Srv SIG model initialization.
Definition at line 55 of file esp_light_srv_model.c.
|
static |
Template for CTL Setup Srv SIG model initialization.
Definition at line 61 of file esp_light_srv_model.c.