19#ifndef _MESHX_MODEL_CTL_HPP_
20#define _MESHX_MODEL_CTL_HPP_
25#define MESHX_LIGHT_CTL_CLIENT_MODEL_TEMPLATE_PROTO
26#define MESHX_LIGHT_CTL_CLIENT_MODEL_TEMPLATE_PARAMS
28#define MESHX_LIGHT_CTL_SERVER_MODEL_TEMPLATE_PROTO
29#define MESHX_LIGHT_CTL_SERVER_MODEL_TEMPLATE_PARAMS
57#if CONFIG_ENABLE_LIGHT_CTL_CLIENT
81 :
public meshXClientModel<meshXBaseLightClientModel, meshx_light_ctl_send_params_t>
112#if CONFIG_ENABLE_LIGHT_CTL_SERVER
136 :
public meshXServerModel<meshXBaseLightServerModel, meshx_light_ctl_send_params_t>
169 :
public meshXServerModel<meshXBaseLightServerModel, meshx_light_ctl_send_params_t>
Interface class for MeshX elements.
Definition meshx_fwd_decl.hpp:82
meshXLightCTLClientModel(meshXElementIF *parent_element=nullptr, meshx_ptr_t parent_element_state=nullptr, uint16_t model_func_id=0)
A template class for creating Light CTL Client models.
Definition meshx_model_ctl.cpp:290
meshx_err_t meshx_state_change_notify(const meshx_gen_light_cli_cb_param_t *param, uint8_t status)
Handle Light CTL state change notifications from MeshX stack.
Definition meshx_model_ctl.cpp:39
meshx_err_t element_state_change_handle(void) override
Handle state change request from element.
Definition meshx_model_ctl.cpp:83
meshx_err_t model_from_ble_cb(dev_struct_t *, control_task_msg_evt_t, meshx_ptr_t) override
Creates a meshXLightCTLClientModel instance based on a BLE device.
Definition meshx_model_ctl.cpp:117
meshx_err_t prepare_element_msg(meshx_ptr_t *msg_ptr, size_t *msg_size) override
Prepare message for element notification.
Definition meshx_model_ctl.cpp:149
meshx_err_t request_ctl(uint16_t lightness, uint16_t temperature, int16_t delta_uv, uint8_t tid=0)
Definition meshx_model_ctl.cpp:228
meshx_light_ctl_model_state_t model_state
Definition meshx_model_ctl.hpp:84
meshx_light_ctl_cli_el_msg_t element_msg
Definition meshx_model_ctl.hpp:87
meshx_err_t model_send(meshx_light_ctl_send_params_t *params) override
Send a packet to the MeshX stack based on the given parameters.
Definition meshx_model_ctl.cpp:173
meshXLightCTLServerModel(meshXElementIF *parent_element=nullptr, meshx_ptr_t parent_element_state=nullptr, uint16_t model_func_id=0)
Constructor for Light CTL Server Model.
Definition meshx_model_ctl.cpp:583
meshx_err_t request_status(uint16_t dst_addr=0)
Definition meshx_model_ctl.cpp:691
meshx_light_ctl_model_state_t model_state
Definition meshx_model_ctl.hpp:139
meshx_err_t plat_model_create(MESHX_MODEL *p_plat_model_ptr=nullptr) override
Creates and initializes a server model instance.
Definition meshx_model_ctl.cpp:321
meshx_err_t model_from_ble_cb(dev_struct_t *, control_task_msg_evt_t, meshx_ptr_t) override
This function is the callback for the Light CTL Server model.
Definition meshx_model_ctl.cpp:443
meshx_err_t element_state_change_handle(void) override
Handle state change request from element.
Definition meshx_model_ctl.cpp:609
meshx_light_ctl_srv_el_msg_t element_msg
Definition meshx_model_ctl.hpp:142
bool element_msg_prepared
Definition meshx_model_ctl.hpp:145
meshx_err_t plat_model_delete(void) override
Deletes the Light CTL Server model and its associated resources.
Definition meshx_model_ctl.cpp:371
meshx_err_t prepare_element_msg(meshx_ptr_t *msg_ptr, size_t *msg_size) override
Prepare message for element notification.
Definition meshx_model_ctl.cpp:555
meshx_err_t model_send(meshx_light_ctl_send_params_t *params) override
Send a packet to the MeshX stack based on the given parameters.
Definition meshx_model_ctl.cpp:402
meshx_err_t model_send(meshx_light_ctl_send_params_t *params) override
Send message through the model.
Definition meshx_model_ctl.hpp:176
meshx_err_t plat_model_create(MESHX_MODEL *p_plat_model_ptr=nullptr) override
Create logical model instance.
Definition meshx_model_ctl.cpp:634
meshXLightCTLSetupServerModel(meshXElementIF *parent_element=nullptr, meshx_ptr_t parent_element_state=nullptr, uint16_t model_func_id=0)
Constructor for Light CTL Setup Server Model.
Definition meshx_model_ctl.cpp:675
meshx_err_t element_state_change_handle(void) override
Handle state change request from element.
Definition meshx_model_ctl.hpp:179
meshx_err_t prepare_element_msg(meshx_ptr_t *msg_ptr, size_t *msg_size) override
Prepare message for element notification.
Definition meshx_model_ctl.hpp:178
meshx_err_t plat_model_delete(void) override
Delete logical model instance.
Definition meshx_model_ctl.cpp:655
meshx_err_t model_from_ble_cb(dev_struct_t *, control_task_msg_evt_t, meshx_ptr_t) override
Handle upstream BLE Mesh events.
Definition meshx_model_ctl.cpp:661
meshXElementIF * parent_element
Definition meshx_model_class.hpp:42
meshx_err_t status
Definition meshx_model_class.hpp:179
uint16_t model_func_id
Definition meshx_model_class.hpp:181
meshXClientModel(MESHX_MODEL *p_plat_model, uint32_t model_id, meshXElementIF *parent_element=nullptr, meshx_ptr_t parent_element_state=nullptr, uint16_t model_func_id=0)
Definition meshx_model_class.cpp:216
meshXServerModel(MESHX_MODEL *p_plat_model, uint32_t model_id, meshXElementIF *parent_element=nullptr, meshx_ptr_t parent_element_state=nullptr, uint16_t model_func_id=0)
Definition meshx_model_class.cpp:200
Header file for MeshX Light Client model declarations.
struct meshx_model meshx_model_t
struct meshx_ctx meshx_ctx_t
Structure to hold context information for BLE Mesh operations.
void * meshx_ptr_t
Definition meshx_ble_mesh_cmn_def.h:636
struct meshx_gen_light_cli_cb_param meshx_gen_light_cli_cb_param_t
Callback parameters for Generic Light Client Model events. This structure is used to pass information...
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_err_t
MeshX Error Codes.
Definition meshx_err.h:43
@ MESHX_NOT_SUPPORTED
Definition meshx_err.h:51
Template declarations for MeshX model wrapper classes.
struct meshx_cli_model_send_param_header meshx_cli_model_send_param_header_t
Definition meshx_model_class.hpp:417
struct meshx_srv_model_send_param_header meshx_srv_model_send_param_header_t
Definition meshx_model_class.hpp:354
struct meshx_light_ctl_model_state meshx_light_ctl_model_state_t
Definition meshx_model_ctl.hpp:42
#define MESHX_LIGHT_CTL_CLIENT_MODEL_TEMPLATE_PARAMS
Definition meshx_model_ctl.hpp:26
struct meshx_light_ctl_cli_el_msg meshx_light_ctl_cli_el_msg_t
Definition meshx_model_ctl.hpp:68
#define MESHX_LIGHT_CTL_CLIENT_MODEL_TEMPLATE_PROTO
Definition meshx_model_ctl.hpp:25
#define MESHX_LIGHT_CTL_SERVER_MODEL_TEMPLATE_PROTO
Definition meshx_model_ctl.hpp:28
struct meshx_light_ctl_send_params meshx_light_ctl_send_params_t
Definition meshx_model_ctl.hpp:55
#define MESHX_LIGHT_CTL_SERVER_MODEL_TEMPLATE_PARAMS
Definition meshx_model_ctl.hpp:29
struct meshx_light_ctl_srv_el_msg meshx_light_ctl_srv_el_msg_t
Definition meshx_model_ctl.hpp:123
**This function is called by the parent element when a state change request *is received It validates the request and returns a result to the element not the model layer **return * MESHX_SUCCESS
Definition meshx_model_level.cpp:385
Structure to hold the Light CTL Client to element message.
Definition meshx_model_ctl.hpp:63
meshx_light_ctl_model_state_t state
Definition meshx_model_ctl.hpp:65
meshx_cli_model_send_param_header_t header
Definition meshx_model_ctl.hpp:64
Structure to hold the Light CTL model state.
Definition meshx_model_ctl.hpp:35
uint16_t temp_range_min
Definition meshx_model_ctl.hpp:39
uint16_t temp_range_max
Definition meshx_model_ctl.hpp:40
int16_t delta_uv
Definition meshx_model_ctl.hpp:38
uint16_t temperature
Definition meshx_model_ctl.hpp:37
uint16_t lightness
Definition meshx_model_ctl.hpp:36
Structure to hold the parameters for sending a Light CTL message.
Definition meshx_model_ctl.hpp:48
uint8_t tid
Definition meshx_model_ctl.hpp:51
meshx_light_ctl_model_state_t state
Definition meshx_model_ctl.hpp:52
meshx_ctx_t * ctx
Definition meshx_model_ctl.hpp:50
meshx_model_t * model
Definition meshx_model_ctl.hpp:49
Structure to hold the Light CTL Server to element message.
Definition meshx_model_ctl.hpp:118
meshx_srv_model_send_param_header_t header
Definition meshx_model_ctl.hpp:119
meshx_light_ctl_model_state_t state
Definition meshx_model_ctl.hpp:120