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 CW-WW (Cool White - Warm White) client model for BLE Mesh. More...
#include "meshx_common.h"
#include "meshx_control_task.h"
#include "meshx_nvs.h"
#include "meshx_api.h"
#include "meshx_light_cwww_client_element.h"
#include "meshx_config_server.h"
Go to the source code of this file.
Macros | |
#define | CONFIG_SERVER_CB_MASK |
Configuration server callback event mask for cwww server. | |
#define | MOD_LCC MODULE_ID_ELEMENT_LIGHT_CWWWW_CLIENT |
#define | CWWW_CLI_MESHX_ONOFF_ENABLE_CB true |
#define | CWWW_CLI_EL_STATE_CH_EVT_MASK CONTROL_TASK_MSG_EVT_EL_STATE_CH_SET_ON_OFF | CONTROL_TASK_MSG_EVT_EL_STATE_CH_SET_CTL |
#define | IS_EL_IN_RANGE(_element_id) |
#define | GET_RELATIVE_EL_IDX(_element_id) |
#define | CWWW_CLI_EL(_el_id) |
Functions | |
static meshx_err_t | meshx_element_struct_init (uint16_t n_max) |
Initializes the CW-WW client model. | |
static meshx_err_t | meshx_element_struct_deinit (uint16_t n_max) |
Deinitializes the CW-WW client model. | |
static meshx_err_t | meshx_dev_create_cwww_model_space (dev_struct_t const *pdev, uint16_t n_max) |
Creates a CW-WW model space for the given device. | |
static meshx_err_t | meshx_add_cwww_cli_model_to_element_list (dev_struct_t *pdev, uint16_t *start_idx, uint16_t n_max) |
This function adds the CW-WW client models to the element list of the specified device. It initializes the necessary structures and configurations for each model. | |
static meshx_err_t | meshx_cwww_cli_reg_app_req_cb () |
Registers a callback handler for CW-WW application requests. | |
static meshx_err_t | meshx_cwww_cli_el_state_change_reg_cb () |
meshx_err_t | meshx_cwww_el_get_state (uint16_t element_id, cwww_cli_sig_id_t model_id) |
Retrieves the current state of the CW/WW (Cool White/Warm White) light element for the specified element ID. | |
meshx_err_t | create_cwww_client_elements (dev_struct_t *pdev, uint16_t element_cnt) |
Create Dynamic CW-WW Model Elements. | |
REG_MESHX_ELEMENT_FN (cwww_cli_el, MESHX_ELEMENT_TYPE_LIGHT_CWWW_CLIENT, create_cwww_client_elements) | |
Variables | |
static meshx_cwww_client_elements_ctrl_t | cwww_client_element_init_ctrl |
Implementation of the CW-WW (Cool White - Warm White) client model for BLE Mesh.
Copyright © 2024 - 2025 MeshX
This file contains the implementation of the CW-WW client model, including initialization, configuration, and message handling functions. The CW-WW client model is used to control and manage CW-WW lighting devices in a BLE Mesh network.
The CW-WW client model supports the following features:
Definition in file meshx_light_cwww_client.c.
#define CONFIG_SERVER_CB_MASK |
Configuration server callback event mask for cwww server.
Definition at line 38 of file meshx_light_cwww_client.c.
#define CWWW_CLI_EL | ( | _el_id | ) |
Definition at line 59 of file meshx_light_cwww_client.c.
#define CWWW_CLI_EL_STATE_CH_EVT_MASK CONTROL_TASK_MSG_EVT_EL_STATE_CH_SET_ON_OFF | CONTROL_TASK_MSG_EVT_EL_STATE_CH_SET_CTL |
Definition at line 55 of file meshx_light_cwww_client.c.
#define CWWW_CLI_MESHX_ONOFF_ENABLE_CB true |
Definition at line 54 of file meshx_light_cwww_client.c.
#define GET_RELATIVE_EL_IDX | ( | _element_id | ) |
Definition at line 58 of file meshx_light_cwww_client.c.
#define IS_EL_IN_RANGE | ( | _element_id | ) |
Definition at line 57 of file meshx_light_cwww_client.c.
#define MOD_LCC MODULE_ID_ELEMENT_LIGHT_CWWWW_CLIENT |
Definition at line 53 of file meshx_light_cwww_client.c.
meshx_err_t create_cwww_client_elements | ( | dev_struct_t * | pdev, |
uint16_t | element_cnt ) |
Create Dynamic CW-WW Model Elements.
[in] | pdev | Pointer to device structure |
[in] | element_cnt | Maximum number of CW-WW models |
Definition at line 998 of file meshx_light_cwww_client.c.
|
static |
This function adds the CW-WW client models to the element list of the specified device. It initializes the necessary structures and configurations for each model.
[in] | pdev | Pointer to the device structure. |
[in] | start_idx | Pointer to the element index. |
[in] | n_max | Maximum number of elements that can be created in the model space. |
Definition at line 854 of file meshx_light_cwww_client.c.
|
static |
Definition at line 913 of file meshx_light_cwww_client.c.
|
static |
Registers a callback handler for CW-WW application requests.
This function subscribes the provided callback to control task messages related to BLE events. It ensures the callback is valid before subscribing.
Definition at line 904 of file meshx_light_cwww_client.c.
meshx_err_t meshx_cwww_el_get_state | ( | uint16_t | element_id, |
cwww_cli_sig_id_t | model_id ) |
Retrieves the current state of the CW/WW (Cool White/Warm White) light element for the specified element ID.
This function queries the state of a light element identified by the given element_id.
[in] | element_id | The unique identifier of the light element whose state is to be retrieved. |
[in] | model_id | The model ID to specify which model's state to retrieve. If set to CWWW_CLI_SIG_ID_MAX, it retrieves the state for all models. |
Definition at line 931 of file meshx_light_cwww_client.c.
|
static |
Creates a CW-WW model space for the given device.
This function initializes and allocates resources for a CW-WW (Cool White - Warm White) model space for the specified device. It sets up the necessary structures and configurations to manage the CW-WW model.
[in] | pdev | Pointer to the device structure. |
[in] | n_max | Maximum number of elements that can be created in the model space. |
Definition at line 825 of file meshx_light_cwww_client.c.
|
static |
Deinitializes the CW-WW client model.
This function deinitializes the CW-WW client model by freeing the memory allocated for the CW-WW client context, client list, publish list, and CW-WW client model list.
[in] | n_max | Maximum number of elements that can be created in the model space. |
Definition at line 782 of file meshx_light_cwww_client.c.
|
static |
Initializes the CW-WW client model.
This function initializes the CW-WW client model by allocating memory for the CW-WW client context, client list, publish list, and CW-WW client model list.
[in] | n_max | Maximum number of elements that can be created in the model space. |
Definition at line 724 of file meshx_light_cwww_client.c.
REG_MESHX_ELEMENT_FN | ( | cwww_cli_el | , |
MESHX_ELEMENT_TYPE_LIGHT_CWWW_CLIENT | , | ||
create_cwww_client_elements | ) |
|
static |
Definition at line 61 of file meshx_light_cwww_client.c.