20#ifndef _MESHX_MODEL_CLASS_HPP_
21#define _MESHX_MODEL_CLASS_HPP_
meshXClientModel()=delete
Interface class for MeshX elements.
Definition meshx_fwd_decl.hpp:82
meshXElementIF * parent_element
Definition meshx_model_class.hpp:42
void set_parent_element(meshXElementIF *parent)
Set the parent element for this model.
Definition meshx_model_class.hpp:137
virtual void on_baked(void)
Called when the model's parent element is baked.
Definition meshx_model_class.hpp:92
MESHX_MODEL * p_plat_model
Definition meshx_model_class.hpp:39
meshx_ptr_t p_parent_element_state
Definition meshx_model_class.hpp:43
meshx_ptr_t get_pub_struct(void) const
Get the publication structures.
Definition meshx_model_class.hpp:113
virtual uint16_t get_model_id(void) const =0
Get the model identifier.
MESHX_MODEL * get_plat_model(void) const
Get the platform-specific model instance.
Definition meshx_model_class.hpp:107
meshXModelIF()
Definition meshx_model_class.hpp:34
meshXElementIF * get_parent_element(void) const
Get the parent element of this model.
Definition meshx_model_class.hpp:143
virtual meshx_err_t prepare_element_msg(meshx_ptr_t *msg_ptr, size_t *msg_size)=0
Prepare message for element notification.
meshXModelIF(MESHX_MODEL *p_plat_model)
Definition meshx_model_class.hpp:35
meshx_ptr_t p_plat_pub
Definition meshx_model_class.hpp:40
virtual bool is_initialized(void) const =0
Check if the model is successfully initialized.
virtual meshx_err_t plat_model_create(MESHX_MODEL *p_plat_model_ptr=nullptr)=0
Create logical model instance.
meshx_ptr_t p_plat_gen
Definition meshx_model_class.hpp:41
meshx_ptr_t get_parent_element_state(void) const
Get the parent element state pointer.
Definition meshx_model_class.hpp:154
virtual void set_plat_model(MESHX_MODEL *p_model)
Set the platform-specific model instance.
Definition meshx_model_class.hpp:101
void set_gen_struct(meshx_ptr_t gen)
Set the generic structures.
Definition meshx_model_class.hpp:131
void set_parent_element_state(meshx_ptr_t state)
Set the parent element state pointer.
Definition meshx_model_class.hpp:149
meshx_ptr_t get_gen_struct(void) const
Get the generic structures.
Definition meshx_model_class.hpp:119
virtual meshx_err_t plat_model_delete(void)=0
Delete logical model instance.
virtual ~meshXModelIF()=default
virtual meshx_err_t element_state_change_handle(void)=0
Handle state change request from element.
void set_pub_struct(meshx_ptr_t pub)
Set the publication structures.
Definition meshx_model_class.hpp:125
meshx_err_t status
Definition meshx_model_class.hpp:179
void set_model_id(uint16_t id)
Set the model identifier.
Definition meshx_model_class.hpp:304
virtual meshx_err_t model_from_ble_cb(dev_struct_t *dev, control_task_msg_evt_t evt, meshx_ptr_t data)=0
Handle upstream BLE Mesh events.
meshxBaseModel_t * get_base_model(void) const
Get the base model instance.
Definition meshx_model_class.hpp:315
meshx_err_t get_init_status(void) const
Get the model initialization status.
Definition meshx_model_class.hpp:309
virtual void update_element_state_change_header(meshx_err_t element_state_change, meshx_ptr_t msg_ptr)=0
Update element_state_change field in message header.
uint16_t model_func_id
Definition meshx_model_class.hpp:181
uint16_t model_id
Definition meshx_model_class.hpp:180
uint16_t get_model_id(void) const override
Get the model identifier.
Definition meshx_model_class.hpp:292
meshxBaseModel_t * base_model
Definition meshx_model_class.hpp:178
void set_model_func_id(uint16_t func_id)
Set the model function identifier.
Definition meshx_model_class.hpp:287
void on_baked(void) override
Called when the model's parent element is baked.
Definition meshx_model_class.hpp:246
bool is_initialized(void) const override
Check if the model is successfully initialized.
Definition meshx_model_class.hpp:298
uint16_t get_model_func_id(void) const
Get the model function identifier.
Definition meshx_model_class.hpp:281
virtual meshx_err_t model_send(meshx_send_packet_params_t *params)=0
Send message through the model.
meshXServerModel()=delete
Deleted default constructor.
meshx_err_t send_to_parent_element(meshx_ptr_t msg_ptr, size_t msg_size)
Send message to parent element.
Definition meshx_model_class.cpp:119
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)
Construct a new meshXClientModel.
Definition meshx_model_class.cpp:216
meshx_err_t plat_model_create(MESHX_MODEL *p_plat_model_ptr=nullptr) final
Create platform-specific client model instance.
Definition meshx_model_class.cpp:241
void update_element_state_change_header(meshx_err_t element_state_change, meshx_ptr_t msg_ptr) override
Update element_state_change field in client message header.
Definition meshx_model_class.cpp:313
meshx_err_t plat_model_delete(void) final
Delete platform-specific client model instance.
Definition meshx_model_class.cpp:292
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.
Definition meshx_model_class.cpp:160
void set_plat_model(MESHX_MODEL *p_model) override
Set the platform-specific model instance.
Definition meshx_model_class.cpp:92
virtual ~meshXModel()
Destructor for meshXModel.
Definition meshx_model_class.cpp:103
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.
Definition meshx_model_class.cpp:65
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.
Definition meshx_model_class.cpp:334
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.
Definition meshx_model_class.cpp:200
This file declares the meshXBaseModel class and its derived Client and Server classes.
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 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
#define MESHX_SERVER_MODEL_TEMPLATE_PROTO
Definition meshx_fwd_decl.hpp:31
#define MESHX_CLIENT_MODEL_TEMPLATE_PARAMS
Definition meshx_fwd_decl.hpp:34
#define MESHX_MODEL_TEMPLATE_PROTO
Definition meshx_fwd_decl.hpp:29
#define MESHX_SERVER_MODEL_TEMPLATE_PARAMS
Definition meshx_fwd_decl.hpp:32
#define MESHX_CLIENT_MODEL_TEMPLATE_PROTO
Definition meshx_fwd_decl.hpp:33
control_task_msg_evt_t evt_model_id_t
Definition meshx_model_class.hpp:29
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
**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
uint8_t state
Definition meshx_serial.c:39