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
meshXLightCTLSetupServerModel Class Reference

A class for creating Light CTL Setup Server models. More...

#include <meshx_model_ctl.hpp>

Inheritance diagram for meshXLightCTLSetupServerModel:
meshXServerModel< meshXBaseLightServerModel, meshx_light_ctl_send_params_t > meshXModel< meshXBaseLightServerModel, meshx_light_ctl_send_params_t > meshXModelIF

Public Member Functions

meshx_err_t model_send (meshx_light_ctl_send_params_t *params) override
 Send message through the model.
meshx_err_t model_from_ble_cb (dev_struct_t *, control_task_msg_evt_t, meshx_ptr_t) override
 Handle upstream BLE Mesh events.
meshx_err_t prepare_element_msg (meshx_ptr_t *msg_ptr, size_t *msg_size) override
 Prepare message for element notification.
meshx_err_t element_state_change_handle (void) override
 Handle state change request from element.
 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.
Public Member Functions inherited from meshXServerModel< meshXBaseLightServerModel, meshx_light_ctl_send_params_t >
 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)
 Construct a new Server Model.
Public Member Functions inherited from meshXModel< meshXBaseLightServerModel, meshx_light_ctl_send_params_t >
void set_plat_model (MESHX_MODEL *p_model) override
 Set the platform-specific model instance.
meshx_err_t model_handle_from_ble_cb (dev_struct_t *p_dev, evt_model_id_t evt_model_id, meshx_ptr_t params)
 Handle upstream BLE Mesh events.
void on_baked (void) override
 Called when the model's parent element is baked.
virtual ~meshXModel ()
 Destructor for meshXModel.
meshx_err_t send_to_parent_element (meshx_ptr_t msg_ptr, size_t msg_size)
 Send message to parent element.
uint16_t get_model_func_id (void) const
 Get the model function identifier.
void set_model_func_id (uint16_t func_id)
 Set the model function identifier.
uint16_t get_model_id (void) const override
 Get the model identifier.
bool is_initialized (void) const override
 Check if the model is successfully initialized.
void set_model_id (uint16_t id)
 Set the model identifier.
meshx_err_t get_init_status (void) const
 Get the model initialization status.
meshXBaseLightServerModelget_base_model (void) const
 Get the base model instance.
 meshXModel (MESHX_MODEL *p_plat_model, uint32_t model_id, meshXElementIF *parent_element=nullptr, uint16_t model_func_id=0)
 Constructs a new meshXModel instance.
Public Member Functions inherited from meshXModelIF
 meshXModelIF ()
 meshXModelIF (MESHX_MODEL *p_plat_model)
virtual ~meshXModelIF ()=default
MESHX_MODEL * get_plat_model (void) const
 Get the platform-specific model instance.
meshx_ptr_t get_pub_struct (void) const
 Get the publication structures.
meshx_ptr_t get_gen_struct (void) const
 Get the generic structures.
void set_pub_struct (meshx_ptr_t pub)
 Set the publication structures.
void set_gen_struct (meshx_ptr_t gen)
 Set the generic structures.
void set_parent_element (meshXElementIF *parent)
 Set the parent element for this model.
meshXElementIFget_parent_element (void) const
 Get the parent element of this model.
void set_parent_element_state (meshx_ptr_t state)
 Set the parent element state pointer.
meshx_ptr_t get_parent_element_state (void) const
 Get the parent element state pointer.

Private Member Functions

meshx_err_t plat_model_create (MESHX_MODEL *p_plat_model_ptr=nullptr) override
 Create logical model instance.
meshx_err_t plat_model_delete (void) override
 Delete logical model instance.

Additional Inherited Members

Protected Member Functions inherited from meshXServerModel< meshXBaseLightServerModel, meshx_light_ctl_send_params_t >
void update_element_state_change_header (meshx_err_t element_state_change, meshx_ptr_t msg_ptr) override
 Update element_state_change field in server message header.

Detailed Description

A class for creating Light CTL Setup Server models.

Constructor & Destructor Documentation

◆ meshXLightCTLSetupServerModel()

meshXLightCTLSetupServerModel::meshXLightCTLSetupServerModel ( meshXElementIF * parent_element = nullptr,
meshx_ptr_t parent_element_state = nullptr,
uint16_t model_func_id = 0 )
explicit

Constructor for Light CTL Setup Server Model.

Parameters
[in]parent_elementPointer to the parent element (meshXElementIF)
[in]parent_element_statePointer to the parent element state
[in]model_func_idFunctional ID for the model instance.
680{
681}
meshXElementIF * parent_element
Definition meshx_model_class.hpp:42
uint16_t model_func_id
Definition meshx_model_class.hpp:181
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
#define MESHX_MODEL_ID_LIGHT_CTL_SETUP_SRV
Definition meshx_ble_mesh_cmn_def.h:108

Member Function Documentation

◆ element_state_change_handle()

meshx_err_t meshXLightCTLSetupServerModel::element_state_change_handle ( void )
inlineoverridevirtual

Handle state change request from element.

Pure virtual function that derived classes must implement to handle state change requests from the parent element. The model validates the request, updates its internal state, and returns the result.

Returns
MESHX_SUCCESS on success, error code otherwise

Implements meshXModelIF.

179{ return MESHX_SUCCESS; }
**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

◆ model_from_ble_cb()

meshx_err_t meshXLightCTLSetupServerModel::model_from_ble_cb ( dev_struct_t * dev,
control_task_msg_evt_t evt,
meshx_ptr_t data )
overridevirtual

Handle upstream BLE Mesh events.

Pure virtual function that derived classes must implement to process messages and events coming from the BLE Mesh network. The implementation will be automatically registered with base_model->base_client_model_cb_list.

Parameters
[in]devDevice structure containing sender information
[in]evtEvent type indicating the nature of the message
[in]dataEvent-specific data payload
Returns
MESHX_SUCCESS if event handled successfully, error code otherwise

Implements meshXModel< meshXBaseLightServerModel, meshx_light_ctl_send_params_t >.

662{
664 // Implementation for setup callbacks...
665 return MESHX_SUCCESS;
666}

◆ model_send()

meshx_err_t meshXLightCTLSetupServerModel::model_send ( meshx_light_ctl_send_params_t * params)
inlineoverridevirtual

Send message through the model.

Pure virtual function that derived classes must implement to send messages through the model to the BLE Mesh network.

Parameters
[in]paramsMessage parameters including destination, opcode, and data
Returns
MESHX_SUCCESS if message sent successfully, error code otherwise

Implements meshXModel< meshXBaseLightServerModel, meshx_light_ctl_send_params_t >.

176{ return MESHX_NOT_SUPPORTED; }
@ MESHX_NOT_SUPPORTED
Definition meshx_err.h:51

◆ plat_model_create()

meshx_err_t meshXLightCTLSetupServerModel::plat_model_create ( MESHX_MODEL * p_plat_model_ptr = nullptr)
overrideprivatevirtual

Create logical model instance.

Pure virtual function that derived classes must implement to create a logical model instance on the platform. This is called during model initialization to set up the model's runtime state.

Returns
MESHX_SUCCESS if model created successfully, error code otherwise

Implements meshXModelIF.

635{
636 if (p_plat_model_ptr) {
637 this->set_plat_model(p_plat_model_ptr);
638 }
639
640 meshx_ptr_t p_pub = nullptr;
641 meshx_ptr_t p_gen = nullptr;
642
643 meshx_err_t err = meshx_plat_light_ctl_setup_srv_create(p_plat_model_ptr, &p_pub, &p_gen);
644 if (err != MESHX_SUCCESS) {
645 MESHX_LOGE(MODULE_ID_MODEL_SERVER, "Failed to create CTL Setup Server (Plat)");
646 return err;
647 }
648
649 this->set_pub_struct(p_pub);
650 this->set_gen_struct(p_gen);
651
652 return MESHX_SUCCESS;
653}
void set_gen_struct(meshx_ptr_t gen)
Set the generic structures.
Definition meshx_model_class.hpp:131
void set_pub_struct(meshx_ptr_t pub)
Set the publication structures.
Definition meshx_model_class.hpp:125
void set_plat_model(MESHX_MODEL *p_model) override
Definition meshx_model_class.cpp:92
void * meshx_ptr_t
Definition meshx_ble_mesh_cmn_def.h:636
meshx_err_t meshx_plat_light_ctl_setup_srv_create(meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_ctl_srv)
Creates and initializes a Light CTL (Color Temperature Lightness) Setup Server model instance.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43
#define MESHX_LOGE(module_id, format,...)
Definition meshx_log.h:114
@ MODULE_ID_MODEL_SERVER
Definition module_id.h:34

◆ plat_model_delete()

meshx_err_t meshXLightCTLSetupServerModel::plat_model_delete ( void )
overrideprivatevirtual

Delete logical model instance.

Pure virtual function that derived classes must implement to delete the logical model instance from the platform. This is called during model cleanup to release resources associated with the model.

Implements meshXModelIF.

656{
657 // C-layer cleanup if necessary
658 return MESHX_SUCCESS;
659}

◆ prepare_element_msg()

meshx_err_t meshXLightCTLSetupServerModel::prepare_element_msg ( meshx_ptr_t * msg_ptr,
size_t * msg_size )
inlineoverridevirtual

Prepare message for element notification.

Pure virtual function that derived classes must implement to prepare a message structure that will be sent to the parent element. The message must persist after this function returns.

Parameters
[out]msg_ptrPointer to message structure (output parameter)
[out]msg_sizeSize of the message structure (output parameter)
Returns
MESHX_SUCCESS if message prepared successfully, error code otherwise

Implements meshXModelIF.

178{ return MESHX_NOT_SUPPORTED; }

The documentation for this class was generated from the following files: