MeshX 0.4
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_rgb_element.hpp
Go to the documentation of this file.
1/**
2 * @file meshx_rgb_element.hpp
3 * @brief MeshX RGB (HSL) Element class definition
4 * This file contains the meshXRGBServerElement class which represents an RGB (HSL) element
5 * in the MeshX BLE mesh network.
6 *
7 * @author Pranjal Chanda
8 * @date 2024-2025
9 * @copyright Copyright 2024 - 2025 MeshX
10 */
11
12#ifndef __MESHX_RGB_ELEMENT_HPP__
13#define __MESHX_RGB_ELEMENT_HPP__
14
18#include <mutex>
19#include <array>
20
21#define MESHX_RGB_SERVER_ELEMENT_TEMPLATE_PROTO
22#define MESHX_RGB_SERVER_ELEMENT_TEMPLATE_PARAMS
23
24/**
25 * @brief RGB server element context structure
26 * @details This structure contains the state context for the RGB server element,
27 * including the OnOff and HSL states and publication/app binding information.
28 */
30{
31 uint16_t app_id; /**< Application key ID for publication */
32 uint16_t pub_addr; /**< Publication address */
35};
36
38
39/*********************************************************************************
40 * meshXRGBServerElement
41 *********************************************************************************/
42
49
52{
53private:
55
56 uint8_t list_sig_models (void) override;
57 uint8_t list_ven_models (void) override;
58 const char* get_element_name(void) const override;
59
60 /**
61 * @brief Notify element of state change from child model.
62 */
63 meshx_err_t element_state_change_notify(meshx_ptr_t param, size_t param_size) override;
64
65 /**
66 * @brief Synchronize element state (Status broadcast)
67 */
68 void sync(control_task_msg_evt_t evt) override;
69
70 /**
71 * @brief Handle configuration server events
72 */
74
76 const dev_struct_t *pdev,
78 const void *params);
79
80public:
81 /**
82 * @brief Constructs a new meshXRGBServerElement instance.
83 * @param element_idx The index of the element within the node.
84 */
85 explicit meshXRGBServerElement (uint16_t element_idx);
86
87 meshXRGBServerElement (void) = delete;
88};
89
90#endif /* __MESHX_RGB_ELEMENT_HPP__ */
uint16_t element_idx
Definition meshx_fwd_decl.hpp:84
meshXElementServer()=default
meshx_rgb_srv_el_ctx_t element_ctx
Definition meshx_rgb_element.hpp:54
meshXRGBServerElement(uint16_t element_idx)
Constructs a new meshXRGBServerElement instance.
Definition meshx_rgb_element.cpp:28
meshXRGBServerElement(void)=delete
meshx_err_t element_state_change_notify(meshx_ptr_t param, size_t param_size) override
Notify element of state change from child model.
Definition meshx_rgb_element.cpp:83
uint8_t list_ven_models(void) override
Lists and creates all required Vendor models for the element.
Definition meshx_rgb_element.cpp:73
uint8_t list_sig_models(void) override
Lists and creates all required SIG models for the element.
Definition meshx_rgb_element.cpp:68
void sync(control_task_msg_evt_t evt) override
Synchronize element state (Status broadcast).
Definition meshx_rgb_element.cpp:202
const char * get_element_name(void) const override
Get the name of the element.
Definition meshx_rgb_element.cpp:78
static meshx_err_t s_to_ble_cb(const dev_struct_t *pdev, control_task_msg_evt_t evt, const void *params)
Definition meshx_rgb_element.cpp:137
void handle_config(control_task_msg_evt_t evt, const meshx_config_srv_cb_param_t *params) override
Handle configuration server events.
Definition meshx_rgb_element.cpp:231
void * meshx_ptr_t
Definition meshx_ble_mesh_cmn_def.h:636
struct meshx_config_srv_cb_param meshx_config_srv_cb_param_t
struct dev_struct dev_struct_t
Structure representing the device composition and elements.
uint32_t control_task_msg_evt_t
Type definition for control task message event.
Definition meshx_control_task.h:81
MeshX Element class and interface declaration This file contains the meshXElement class and its inter...
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43
Header file for MeshX Light HSL Models This file contains the declarations and definitions for the Me...
struct meshx_light_hsl_model_state meshx_light_hsl_model_state_t
Definition meshx_model_hsl.hpp:48
Implementation of Generic OnOff Client Model for MeshX.
struct meshx_gen_onoff_model_state meshx_gen_onoff_model_state_t
Definition meshx_model_onoff.hpp:38
#define MESHX_RGB_SERVER_ELEMENT_TEMPLATE_PROTO
Definition meshx_rgb_element.hpp:21
meshxRGBServerElementComposition
Definition meshx_rgb_element.hpp:44
@ MESHX_RGB_SERVER_ELEMENT_COMP_MAX
Definition meshx_rgb_element.hpp:47
@ MESHX_RGB_SERVER_ELEMENT_COMP_GENERIC_ONOFF_SERVER
Definition meshx_rgb_element.hpp:45
@ MESHX_RGB_SERVER_ELEMENT_COMP_LIGHT_HSL_SERVER
Definition meshx_rgb_element.hpp:46
#define MESHX_RGB_SERVER_ELEMENT_TEMPLATE_PARAMS
Definition meshx_rgb_element.hpp:22
RGB server element context structure.
Definition meshx_rgb_element.hpp:30
meshx_light_hsl_model_state_t light_hsl_state
Definition meshx_rgb_element.hpp:34
meshx_gen_onoff_model_state_t gen_on_off_state
Definition meshx_rgb_element.hpp:33
uint16_t app_id
Definition meshx_rgb_element.hpp:31
uint16_t pub_addr
Definition meshx_rgb_element.hpp:32