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
meshXElementIF Class Referenceabstract

Interface class for MeshX elements. More...

#include <meshx_fwd_decl.hpp>

Inheritance diagram for meshXElementIF:
meshXElement< meshx_cli_model_send_param_header_t > meshXElement< meshx_srv_model_send_param_header_t > meshXElement< meshx_model_send_param_header_t > meshXElementClient meshXElementServer meshXCWWWClientElement meshXRelayClientElement meshXCWWWServerElement meshXRGBServerElement meshXRelayServerElement meshXRootElement meshXSensorElement

Public Member Functions

virtual meshx_err_t on_model_cb (meshx_ptr_t param, size_t param_size)=0
 Handle model callback from child models.
void set_element_idx (uint16_t idx)
uint16_t get_element_idx (void) const
virtual void on_baked (uint16_t index)=0
 Called when the composition is baked to update the element's index.
virtual meshxElementType_t get_element_type (void) const =0
 Get the element type.
virtual meshx_element_type_t get_element_variant (void) const =0
 Get the element variant.
virtual uint8_t get_no_of_sig_models (void) const =0
 Get the number of SIG models supported by the element.
virtual uint8_t get_no_of_ven_models (void) const =0
 Get the number of Vendor models supported by the element.
virtual uint8_t list_sig_models (void)=0
 Lists and creates all required SIG models for the element.
virtual uint8_t list_ven_models (void)=0
 Lists and creates all required Vendor models for the element.
virtual std::vector< std::unique_ptr< meshXModelIF > > & get_sig_models (void)=0
 Get the SIG models vector.
virtual std::vector< std::unique_ptr< meshXModelIF > > & get_ven_models (void)=0
 Get the Vendor models vector.
virtual meshx_err_t initialize (void)=0
 Initialize the element.
virtual meshx_err_t reset (void)=0
 Reset the element.
virtual bool is_initialized (void) const =0
 Check if the element is initialized.
virtual meshx_err_t restore_nvs_context (void)=0
 Restore the element's context from NVS.
virtual bool has_model (uint16_t model_id) const =0
 Check if the element contains a specific model by ID.
virtual meshx_ptr_t get_element_ctx (void) const =0
 Get the element context structure.
virtual size_t get_element_ctx_size (void) const =0
 Get the size of the element context structure.
virtual void sync (control_task_msg_evt_t evt)=0
 Synchronize element state (Status broadcast or GET request).
virtual const char * get_element_name (void) const =0
 Get the name of the element.
virtual void handle_config (control_task_msg_evt_t evt, const meshx_config_srv_cb_param_t *params)=0
 Handle configuration server events (AppKey bind, Publication, etc.).
 meshXElementIF ()=delete
 meshXElementIF (uint16_t element_idx)
virtual ~meshXElementIF ()=default

Private Attributes

uint16_t element_idx

Detailed Description

Interface class for MeshX elements.

This is an interface class defining the base functionality for mesh elements.

Constructor & Destructor Documentation

◆ meshXElementIF() [1/2]

meshXElementIF::meshXElementIF ( )
delete

◆ meshXElementIF() [2/2]

meshXElementIF::meshXElementIF ( uint16_t element_idx)
inlineexplicit
uint16_t element_idx
Definition meshx_fwd_decl.hpp:84

◆ ~meshXElementIF()

virtual meshXElementIF::~meshXElementIF ( )
virtualdefault

Member Function Documentation

◆ get_element_ctx()

virtual meshx_ptr_t meshXElementIF::get_element_ctx ( void ) const
pure virtual

Get the element context structure.

Returns
Pointer to the element context structure

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ get_element_ctx_size()

virtual size_t meshXElementIF::get_element_ctx_size ( void ) const
pure virtual

Get the size of the element context structure.

Returns
Size of the element context structure

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ get_element_idx()

uint16_t meshXElementIF::get_element_idx ( void ) const
inline
99{ return element_idx; }

◆ get_element_name()

virtual const char * meshXElementIF::get_element_name ( void ) const
pure virtual

◆ get_element_type()

virtual meshxElementType_t meshXElementIF::get_element_type ( void ) const
pure virtual

◆ get_element_variant()

virtual meshx_element_type_t meshXElementIF::get_element_variant ( void ) const
pure virtual

◆ get_no_of_sig_models()

virtual uint8_t meshXElementIF::get_no_of_sig_models ( void ) const
pure virtual

Get the number of SIG models supported by the element.

Returns
Number of SIG models

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ get_no_of_ven_models()

virtual uint8_t meshXElementIF::get_no_of_ven_models ( void ) const
pure virtual

Get the number of Vendor models supported by the element.

Returns
Number of Vendor models

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ get_sig_models()

virtual std::vector< std::unique_ptr< meshXModelIF > > & meshXElementIF::get_sig_models ( void )
pure virtual

◆ get_ven_models()

virtual std::vector< std::unique_ptr< meshXModelIF > > & meshXElementIF::get_ven_models ( void )
pure virtual

Get the Vendor models vector.

Returns
Reference to the Vendor models vector

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ handle_config()

virtual void meshXElementIF::handle_config ( control_task_msg_evt_t evt,
const meshx_config_srv_cb_param_t * params )
pure virtual

Handle configuration server events (AppKey bind, Publication, etc.).

Parameters
evtThe configuration event code
paramsPointer to the configuration parameters

Implemented in meshXCWWWClientElement, meshXCWWWServerElement, meshXRelayClientElement, meshXRelayServerElement, meshXRGBServerElement, meshXRootElement, and meshXSensorElement.

◆ has_model()

virtual bool meshXElementIF::has_model ( uint16_t model_id) const
pure virtual

Check if the element contains a specific model by ID.

Parameters
model_idThe model ID to check for
Returns
true if the model exists in this element, false otherwise

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ initialize()

virtual meshx_err_t meshXElementIF::initialize ( void )
pure virtual

Initialize the element.

Returns
MESHX_SUCCESS on success, error code otherwise

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ is_initialized()

virtual bool meshXElementIF::is_initialized ( void ) const
pure virtual

Check if the element is initialized.

Returns
true if initialized, false otherwise

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ list_sig_models()

◆ list_ven_models()

◆ on_baked()

virtual void meshXElementIF::on_baked ( uint16_t index)
pure virtual

Called when the composition is baked to update the element's index.

Parameters
indexThe final platform index of this element.

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ on_model_cb()

virtual meshx_err_t meshXElementIF::on_model_cb ( meshx_ptr_t param,
size_t param_size )
pure virtual

Handle model callback from child models.

This is a pure virtual function that must be implemented by derived classes. It is called when a model event occurs, allowing the element to handle the event.

Parameters
[in]paramPointer to the model event parameters.
[in]param_sizeSize of the parameter structure.
Returns
MESHX_SUCCESS on success, error code otherwise.

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ reset()

virtual meshx_err_t meshXElementIF::reset ( void )
pure virtual

◆ restore_nvs_context()

virtual meshx_err_t meshXElementIF::restore_nvs_context ( void )
pure virtual

Restore the element's context from NVS.

Returns
MESHX_SUCCESS on success, error code otherwise.

Implemented in meshXElement< meshx_model_send_param_header_t >, meshXElement< meshx_cli_model_send_param_header_t >, and meshXElement< meshx_srv_model_send_param_header_t >.

◆ set_element_idx()

void meshXElementIF::set_element_idx ( uint16_t idx)
inline
98{ element_idx = idx; }

◆ sync()

virtual void meshXElementIF::sync ( control_task_msg_evt_t evt)
pure virtual

Synchronize element state (Status broadcast or GET request).

Parameters
evtThe event trigger (STACK_READY or FRESH_BOOT)

Implemented in meshXCWWWClientElement, meshXCWWWServerElement, meshXRelayClientElement, meshXRelayServerElement, meshXRGBServerElement, meshXRootElement, and meshXSensorElement.

Field Documentation

◆ element_idx

uint16_t meshXElementIF::element_idx
private

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