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 Light CTL Server model for BLE Mesh Node. More...
#include <meshx_light_ctl_srv.h>
Go to the source code of this file.
Data Structures | |
struct | meshx_light_ctl_setup_server |
Structure representing the MeshX Light CTL Setup Server. More... | |
Macros | |
#define | MESHX_SERVER_INIT_MAGIC_NO 0x2483 |
Typedefs | |
typedef struct meshx_light_ctl_setup_server | meshx_light_ctl_setup_server_t |
Structure representing the MeshX Light CTL Setup Server. | |
Functions | |
static meshx_err_t | meshx_state_change_notify (meshx_lighting_server_cb_param_t *param) |
Perform hardware change for the light control server model. | |
static meshx_err_t | meshx_handle_light_ctl_msg (const dev_struct_t *pdev, const control_task_msg_evt_t evt, meshx_lighting_server_cb_param_t *param) |
Handle Light CTL messages for the lighting server model. | |
static meshx_err_t | meshx_light_ctl_setup_server_delete (void) |
Deletes or deinitializes the Light CTL (Color Temperature Lightness) Setup Server instance. | |
static meshx_err_t | meshx_light_ctl_setup_server_create (void) |
Creates and initializes the Light CTL (Color Temperature Lightness) Setup Server. | |
meshx_err_t | meshx_get_ctl_setup_srv_model (meshx_ptr_t p_model) |
Retrieves the CTL (Color Temperature Lightness) Setup Server model instance. | |
meshx_err_t | meshx_light_ctl_server_init (void) |
Initialize the Light CTL Server model. | |
meshx_err_t | meshx_light_ctl_server_create (meshx_ctl_server_model_t **p_model, meshx_ptr_t p_sig_model) |
Create and initialize a new CTL server model instance. | |
meshx_err_t | meshx_light_ctl_server_delete (meshx_ctl_server_model_t **p_model) |
Delete the CTL server model instance. | |
meshx_err_t | meshx_light_ctl_srv_state_restore (meshx_ctl_server_model_t *p_model, meshx_light_ctl_srv_state_t ctl_state) |
Restore the CTL state for the generic server model. | |
meshx_err_t | meshx_light_ctl_srv_status_send (meshx_model_t *p_model, meshx_ctx_t *ctx, int16_t delta_uv, uint16_t lightness, uint16_t temperature) |
Send the Light CTL status message. | |
meshx_err_t | meshx_light_ctl_srv_send_pack_create (meshx_ptr_t p_model, uint16_t element_id, uint16_t net_idx, uint16_t app_idx, uint16_t pub_addr, meshx_light_ctl_srv_state_t ctl_state, meshx_lighting_server_cb_param_t *light_srv_send) |
Create a Light CTL Server send message packet. | |
Variables | ||
struct { | ||
uint16_t ctl_lighting_server_init | ||
uint16_t ctl_lighting_server_created | ||
meshx_light_ctl_setup_server_t ctl_setup_server | ||
} | g_meshx_light_ctl_srv | |
Structure to maintain the initialization and creation state of the MeshX Light CTL Server. | ||
Implementation of the Light CTL Server model for BLE Mesh Node.
Copyright © 2024 - 2025 MeshX
This file contains the implementation of the Light CTL (Color Temperature Light) Server model for the BLE Mesh Node. The Light CTL Server model is responsible for controlling the color temperature and lightness of a light.
Definition in file meshx_light_ctl_srv.c.
#define MESHX_SERVER_INIT_MAGIC_NO 0x2483 |
Definition at line 16 of file meshx_light_ctl_srv.c.
typedef struct meshx_light_ctl_setup_server meshx_light_ctl_setup_server_t |
Structure representing the MeshX Light CTL Setup Server.
This structure holds the initialization state, model information, and a pointer to the server model for the Light CTL (Color Temperature Lightness) Setup Server.
meshx_err_t meshx_get_ctl_setup_srv_model | ( | meshx_ptr_t | p_model | ) |
Retrieves the CTL (Color Temperature Lightness) Setup Server model instance.
This function is used to obtain a reference or handle to the CTL Setup Server model, which is responsible for managing color temperature and lightness control in a mesh network.
[in] | p_model | Pointer to the model structure or context. |
Definition at line 289 of file meshx_light_ctl_srv.c.
|
static |
Handle Light CTL messages for the lighting server model.
This function processes incoming Light CTL messages and performs the necessary actions based on the message parameters.
pdev | Pointer to the device structure. |
evt | Event type of the control task message. |
param | Pointer to the BLE Mesh lighting server callback parameter structure. |
< Light CTL Message Opcode
< Light CTL Setup Message Opcode
Definition at line 117 of file meshx_light_ctl_srv.c.
meshx_err_t meshx_light_ctl_server_create | ( | meshx_ctl_server_model_t ** | p_model, |
meshx_ptr_t | p_sig_model ) |
Create and initialize a new CTL server model instance.
This function allocates memory for a new CTL server model and initializes it using the platform-specific creation function. It ensures that the model is properly set up for handling Generic OnOff messages in a BLE Mesh network.
[in,out] | p_model | Pointer to a pointer where the newly created CTL server model instance will be stored. |
[in,out] | p_sig_model | Pointer to a pointer where the offset of the model will be stored. |
Definition at line 357 of file meshx_light_ctl_srv.c.
meshx_err_t meshx_light_ctl_server_delete | ( | meshx_ctl_server_model_t ** | p_model | ) |
Delete the CTL server model instance.
This function deletes an instance of the CTL server model, freeing associated resources and setting the model pointer to NULL.
[in,out] | p_model | Double pointer to the CTL server model instance to be deleted. |
Definition at line 420 of file meshx_light_ctl_srv.c.
meshx_err_t meshx_light_ctl_server_init | ( | void | ) |
Initialize the Light CTL Server model.
Initialize the CTL server model.
This function initializes the Light CTL (Color Temperature Light) Server model for the BLE Mesh Node. It sets up the necessary configurations and state for the Light CTL Server to operate correctly.
Definition at line 311 of file meshx_light_ctl_srv.c.
|
static |
Creates and initializes the Light CTL (Color Temperature Lightness) Setup Server.
This function sets up the Light CTL Setup Server model, allocating necessary resources and initializing internal state. It should be called during the provisioning or initialization phase of the mesh node.
Definition at line 246 of file meshx_light_ctl_srv.c.
|
static |
Deletes or deinitializes the Light CTL (Color Temperature Lightness) Setup Server instance.
This function is responsible for cleaning up resources and performing any necessary teardown for the Light CTL Setup Server in the MeshX framework.
Definition at line 218 of file meshx_light_ctl_srv.c.
meshx_err_t meshx_light_ctl_srv_send_pack_create | ( | meshx_ptr_t | p_model, |
uint16_t | element_id, | ||
uint16_t | net_idx, | ||
uint16_t | app_idx, | ||
uint16_t | pub_addr, | ||
meshx_light_ctl_srv_state_t | ctl_state, | ||
meshx_lighting_server_cb_param_t * | light_srv_send ) |
Create a Light CTL Server send message packet.
This function creates a Light CTL Server send message packet with the provided parameters.
[in] | p_model | Pointer to the MeshX model structure. |
[in] | element_id | Element ID associated with the model. |
[in] | net_idx | Network Index for the message. |
[in] | app_idx | Application Index for the message. |
[in] | pub_addr | Publication address for the message. |
[in] | ctl_state | Current state of the Light CTL Server. |
[out] | light_srv_send | Pointer to the structure where the created message packet will be stored. |
Definition at line 536 of file meshx_light_ctl_srv.c.
meshx_err_t meshx_light_ctl_srv_state_restore | ( | meshx_ctl_server_model_t * | p_model, |
meshx_light_ctl_srv_state_t | ctl_state ) |
Restore the CTL state for the generic server model.
This function restores the CTL state of the specified server model using the provided state value. It checks for a valid model pointer before proceeding with the restoration.
p_model | Pointer to the CTL server model structure. |
ctl_state | The CTL state to be restored. |
Definition at line 459 of file meshx_light_ctl_srv.c.
meshx_err_t meshx_light_ctl_srv_status_send | ( | meshx_model_t * | p_model, |
meshx_ctx_t * | ctx, | ||
int16_t | delta_uv, | ||
uint16_t | lightness, | ||
uint16_t | temperature ) |
Send the Light CTL status message.
This function sends the Light CTL status message to the specified context.
[in] | p_model | Pointer to the MeshX model structure. |
[in] | ctx | Context structure containing the necessary parameters for sending the message. |
[in] | delta_uv | The Delta UV value to be included in the status message. |
[in] | lightness | The Lightness value to be included in the status message. |
[in] | temperature | The Temperature value to be included in the status message. |
Definition at line 486 of file meshx_light_ctl_srv.c.
|
static |
Perform hardware change for the light control server model.
This function is responsible for performing the necessary hardware changes based on the parameters provided by the BLE Mesh lighting server callback.
param | Pointer to the BLE Mesh lighting server callback parameters. |
Definition at line 65 of file meshx_light_ctl_srv.c.
uint16_t ctl_lighting_server_created |
Definition at line 42 of file meshx_light_ctl_srv.c.
uint16_t ctl_lighting_server_init |
Definition at line 41 of file meshx_light_ctl_srv.c.
meshx_light_ctl_setup_server_t ctl_setup_server |
Definition at line 43 of file meshx_light_ctl_srv.c.
struct { ... } g_meshx_light_ctl_srv |
Structure to maintain the initialization and creation state of the MeshX Light CTL Server.
This static structure holds flags indicating whether the CTL Setup Server and CTL Lighting Server have been initialized, as well as whether the CTL Lighting Server has been created.