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.
Loading...
Searching...
No Matches
meshx_cwww_server_element.h File Reference

Header file for CWWW Server Model. More...

#include <string.h>
#include <meshx_common.h>
#include <meshx_onoff_server.h>
#include <meshx_light_ctl_srv.h>
Include dependency graph for meshx_cwww_server_element.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cwww_srv_ctx
 Structure to hold the context of the cwww client. More...
 
struct  meshx_cwww_element
 Structure to manage CWWW element initialization. More...
 
struct  meshx_cwww_elements_ctrl
 Structure representing a CW-WW element in the BLE mesh network. More...
 

Macros

#define CWWW_SRV_MODEL_SIG_CNT   CWWW_SIG_ID_MAX
 
#define CWWW_SRV_MODEL_VEN_CNT   0
 

Typedefs

typedef struct cwww_srv_ctx meshx_cwww_server_ctx_t
 Structure to hold the context of the cwww client.
 
typedef struct meshx_cwww_element meshx_cwww_element_t
 Structure to manage CWWW element initialization.
 
typedef struct meshx_cwww_elements_ctrl meshx_cwww_elements_ctrl_t
 Structure representing a CW-WW element in the BLE mesh network.
 

Enumerations

enum  cwww_sig_id_t {
  CWWW_SIG_ONOFF_MODEL_ID ,
  CWWW_SIG_L_CTL_MODEL_ID ,
  CWWW_SIG_ID_MAX
}
 Enumeration of CW-WW SIG model IDs. More...
 

Functions

meshx_err_t meshx_create_cwww_elements (dev_struct_t *pdev, uint16_t element_cnt)
 Create Dynamic CWWW Server Model Elements.
 

Detailed Description

Header file for CWWW Server Model.

Copyright © 2024 - 2025 MeshX

This file contains the definitions and function prototypes for the CWWW Server Model. It includes the necessary includes, macros, and data structures required for the model.

Author
Pranjal Chanda

Definition in file meshx_cwww_server_element.h.

Macro Definition Documentation

◆ CWWW_SRV_MODEL_SIG_CNT

#define CWWW_SRV_MODEL_SIG_CNT   CWWW_SIG_ID_MAX

Definition at line 23 of file meshx_cwww_server_element.h.

◆ CWWW_SRV_MODEL_VEN_CNT

#define CWWW_SRV_MODEL_VEN_CNT   0

Definition at line 24 of file meshx_cwww_server_element.h.

Typedef Documentation

◆ meshx_cwww_element_t

Structure to manage CWWW element initialization.

◆ meshx_cwww_elements_ctrl_t

Structure representing a CW-WW element in the BLE mesh network.

This structure contains all the necessary context and configuration for controlling a CW-WW (Cool White - Warm White) light element in a BLE mesh network.

◆ meshx_cwww_server_ctx_t

Structure to hold the context of the cwww client.

Enumeration Type Documentation

◆ cwww_sig_id_t

Enumeration of CW-WW SIG model IDs.

Enumerator
CWWW_SIG_ONOFF_MODEL_ID 

On/Off model ID

CWWW_SIG_L_CTL_MODEL_ID 

Light CTL model ID

CWWW_SIG_ID_MAX 

Maximum number of model IDs

Definition at line 29 of file meshx_cwww_server_element.h.

30{
cwww_sig_id_t
Enumeration of CW-WW SIG model IDs.
@ CWWW_SIG_ONOFF_MODEL_ID
@ CWWW_SIG_L_CTL_MODEL_ID

Function Documentation

◆ meshx_create_cwww_elements()

meshx_err_t meshx_create_cwww_elements ( dev_struct_t * pdev,
uint16_t element_cnt )

Create Dynamic CWWW Server Model Elements.

This function creates dynamic CWWW server model elements for the given device structure.

Parameters
[in]pdevPointer to device structure
[in]element_cntMaximum number of CWWW server models
Returns
meshx_err_t Returns MESHX_SUCCESS on success or an error code on failure

Definition at line 613 of file meshx_cwww_server.c.

614{
615 meshx_err_t err;
616 err = meshx_dev_create_cwww_model_space(element_cnt);
617 if (err)
618 {
619 MESHX_LOGE(MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER, "CWWW Model create failed: (%d)", err);
620 return err;
621 }
622 err = meshx_add_cwww_srv_model_to_element_list(pdev, (uint16_t *)&pdev->element_idx, element_cnt);
623 if (err)
624 {
625 MESHX_LOGE(MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER, "CWWW Model create failed: (%d)", err);
626 return err;
627 }
628#if CONFIG_ENABLE_CONFIG_SERVER
631 if (err)
632 {
633 MESHX_LOGE(MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER, "Relay Model configserver callback reg failed: (%d)", err);
634 return err;
635 }
636#endif /* CONFIG_ENABLE_CONFIG_SERVER */
641 if (err)
642 {
643 MESHX_LOGE(MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER, "Failed to register control task callback: (%d)", err);
644 return err;
645 }
646
648 if (err)
649 {
650 MESHX_LOGE(MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER, "Failed to register control task callback: (%d)", err);
651 return err;
652 }
657 if (err)
658 {
659 MESHX_LOGE(MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER, "Failed to register control task callback: (%d)", err);
660 return err;
661 }
662 err = meshx_on_off_server_init();
663 if (err)
664 {
665 MESHX_LOGE(MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER, "meshx_on_off_server_init failed: (%d)", err);
666 return err;
667 }
669 if (err)
670 {
671 MESHX_LOGE(MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER, "meshx_light_ctl_server_init failed: (%d)", err);
672 return err;
673 }
674 return MESHX_SUCCESS;
675}
control_task_msg_handle_t config_srv_cb_t
control_task_msg_handle_t prov_srv_cb_t
meshx_err_t meshx_config_server_cb_reg(config_srv_cb_t cb, uint32_t config_evt_bmap)
Registers a configuration server callback for specific events.
meshx_err_t(* control_task_msg_handle_t)(dev_struct_t *pdev, control_task_msg_evt_t evt, void *params)
Function pointer type for control task message handler.
@ CONTROL_TASK_MSG_CODE_EL_STATE_CH
@ CONTROL_TASK_MSG_CODE_TO_BLE
meshx_err_t control_task_msg_subscribe(control_task_msg_code_t msg_code, control_task_msg_evt_t evt_bmap, control_task_msg_handle_t callback)
Subscribe to a control task message.
static meshx_err_t meshx_cwww_srv_msg_send_handler(const dev_struct_t *pdev, control_task_msg_evt_to_ble_t evt, void *params)
Handler for sending messages from the CW-WW server model to BLE.
#define CONTROL_TASK_EVT_MASK
#define CONTROL_TASK_MSG_EVT_TO_BLE_GEN_SRV_MASK
static meshx_err_t meshx_dev_create_cwww_model_space(uint16_t n_max)
Create space for CW-WW models.
static meshx_err_t meshx_api_control_task_handler(const dev_struct_t *pdev, const control_task_msg_evt_t evt, const void *params)
CW-WW server model event handler.
static meshx_err_t cwww_server_config_srv_cb(const dev_struct_t *pdev, control_task_msg_evt_t evt, const meshx_config_srv_cb_param_t *params)
Callback function for configuration server events.
static meshx_err_t meshx_add_cwww_srv_model_to_element_list(dev_struct_t *pdev, uint16_t *start_idx, uint16_t n_max)
Add CW-WW server models to the element list.
static meshx_err_t cwww_prov_control_task_handler(dev_struct_t const *pdev, control_task_msg_evt_t evt, void const *params)
Callback function for relay server model events for Provisioning events.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:39
@ MESHX_SUCCESS
Definition meshx_err.h:40
meshx_err_t meshx_light_ctl_server_init(void)
Initialize the CTL server model.
#define CONFIG_SERVER_CB_MASK
Configuration server callback event mask for cwww server.
#define MESHX_LOGE(module_id, format,...)
Definition meshx_log.h:73
meshx_err_t meshx_prov_srv_reg_el_server_cb(prov_srv_cb_t cb)
Register a callback function for provisioning events.
@ MODULE_ID_ELEMENT_SWITCH_RELAY_SERVER
Definition module_id.h:28
size_t element_idx
Here is the call graph for this function:
Here is the caller graph for this function: