|
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.
|
Derived class for the root element. More...
#include <meshx_root_element.hpp>
Public Member Functions | |
| meshXRootElement () | |
| Constructs a new meshXRootElement instance. | |
| Public Member Functions inherited from meshXElementServer | |
| meshXElementServer ()=default | |
| meshXElementServer (uint16_t element_idx, uint8_t no_of_sig_models=0, uint8_t no_of_ven_models=0) | |
| Public Member Functions inherited from meshXElement< meshx_srv_model_send_param_header_t > | |
| void | set_element_type (meshxElementType_t type) |
| meshxElementType_t | get_element_type (void) const final |
| Get the element type. | |
| void | set_element_variant (meshx_element_type_t variant) |
| meshx_element_type_t | get_element_variant (void) const final |
| Get the element variant. | |
| void | set_no_of_sig_models (uint8_t cnt) |
| uint8_t | get_no_of_sig_models (void) const final |
| Get the number of SIG models supported by the element. | |
| void | set_no_of_ven_models (uint8_t cnt) |
| uint8_t | get_no_of_ven_models (void) const final |
| Get the number of Vendor models supported by the element. | |
| std::vector< std::unique_ptr< meshXModelIF > > & | get_sig_models (void) final |
| Get the SIG models vector. | |
| std::vector< std::unique_ptr< meshXModelIF > > & | get_ven_models (void) final |
| Get the Vendor models vector. | |
| void | register_element_ctx (meshx_ptr_t ctx, size_t ctx_size) |
| Register element context structure. | |
| meshx_ptr_t | get_element_ctx (void) const override |
| Get the element context structure. | |
| size_t | get_element_ctx_size (void) const override |
| Get the size of the element context structure. | |
| meshx_err_t | sig_plat_model_array_allocate (void) |
| Allocate memory for SIG model platform array. | |
| meshx_err_t | ven_plat_model_array_allocate (void) |
| Allocate memory for Vendor model platform array. | |
| std::vector< uint8_t > & | get_sig_model_array (void) |
| Get the SIG model array. | |
| std::vector< uint8_t > & | get_ven_model_array (void) |
| Get the Vendor model array. | |
| meshx_err_t | add_sig_model (ConstructorsArgs &&... args) |
| Add a SIG model to the element. | |
| meshx_err_t | add_ven_model (ConstructorsArgs &&... args) |
| Add a Vendor model to the element. | |
| uint8_t | get_sig_model_count (void) const |
| Get the number of SIG models currently added to the element. | |
| uint8_t | get_ven_model_count (void) const |
| Get the number of Vendor models currently added to the element. | |
| meshx_err_t | add_sig_models (void) |
| Add multiple SIG models to the element. | |
| meshx_err_t | add_ven_models (void) |
| Add multiple Vendor models to the element. | |
| meshx_err_t | add_models (void) |
| Add both SIG and Vendor models to the element. | |
| MESHX_MODEL * | get_sig_plat_model_array (void) |
| Get the platform model array for SIG models. | |
| MESHX_MODEL * | get_ven_plat_model_array (void) |
| Get the platform model array for Vendor models. | |
| meshXElement (void) | |
| Default constructor for meshXElement. | |
| meshx_err_t | initialize (void) override |
| Initialize the element. | |
| meshx_err_t | reset (void) override |
| Reset the element. | |
| bool | is_initialized (void) const override |
| Check if the element is initialized. | |
| meshx_err_t | restore_nvs_context (void) override |
| Restore the element's context from NVS. | |
| bool | has_model (uint16_t model_id) const override |
| Check if the element contains a specific model by ID. | |
| void | on_baked (uint16_t index) override |
| Called when the composition is baked to update the element's index. | |
| ~meshXElement () override | |
| Public Member Functions inherited from meshXElementIF | |
| void | set_element_idx (uint16_t idx) |
| uint16_t | get_element_idx (void) const |
| meshXElementIF ()=delete | |
| meshXElementIF (uint16_t element_idx) | |
| virtual | ~meshXElementIF ()=default |
Private Member Functions | |
| uint8_t | list_sig_models () override |
| Lists and initializes SIG models for Root Element. | |
| uint8_t | list_ven_models () override |
| Lists and creates all required Vendor models for the element. | |
| const char * | get_element_name (void) const override |
| Get the name of the element. | |
| meshx_err_t | element_state_change_notify (meshx_ptr_t param, size_t param_size) override |
| Handle model callback from child models. | |
| void | sync (control_task_msg_evt_t evt) override |
| Synchronize element state (Status broadcast or GET request). | |
| void | handle_config (control_task_msg_evt_t evt, const meshx_config_srv_cb_param_t *params) override |
| Handle configuration server events (AppKey bind, Publication, etc.). | |
| template<typename ModelT> | |
| void | add_sig_model_if_present (uint16_t trigger_model_id, const char *log_name) |
Additional Inherited Members | |
| Static Public Member Functions inherited from meshXElement< meshx_srv_model_send_param_header_t > | |
| static meshx_err_t | static_prov_srv_cb (const dev_struct_t *pdev, control_task_msg_evt_t evt, const void *params) |
| Global static provisioning callback for Server elements. | |
| static meshx_err_t | static_prov_cli_cb (const dev_struct_t *pdev, control_task_msg_evt_t evt, const void *params) |
| Global static provisioning callback for Client elements. | |
| static meshx_err_t | static_config_cb (const dev_struct_t *pdev, control_task_msg_evt_t evt, const meshx_config_srv_cb_param_t *params) |
| Global static configuration callback. | |
| static void | register_global_callbacks (void) |
| Register the global callbacks with the provisioning server. | |
Derived class for the root element.
| meshXRootElement::meshXRootElement | ( | ) |
Constructs a new meshXRootElement instance.
Constructor for Root Element.
The meshXRootElement represents the primary element in the MeshX BLE mesh network. It automatically initializes and configures all required SIG models for the root element, including the Configuration Server model and other essential models.
The constructor follows these steps:
This constructor initializes a Root Element with the predefined element index. All required SIG models are added in list_sig_models() method. Auto initialization is taken care by meshXElement constructor.
|
private |
|
overrideprivatevirtual |
Handle model callback from child models.
This function is called by child models when a state change occurs. It handles the state change by logging the event. The root element only has a Configuration Server model.
| [in] | param | Pointer to the model callback parameter |
| [in] | param_size | Size of the parameter structure |
Reimplemented from meshXElement< meshx_srv_model_send_param_header_t >.
|
overrideprivatevirtual |
Get the name of the element.
Reimplemented from meshXElement< meshx_srv_model_send_param_header_t >.
|
overrideprivatevirtual |
Handle configuration server events (AppKey bind, Publication, etc.).
| evt | The configuration event code |
| params | Pointer to the configuration parameters |
Implements meshXElementIF.
|
overrideprivatevirtual |
Lists and initializes SIG models for Root Element.
This function creates and adds the Configuration Server model to the element's SIG models list. The Configuration Server model is always required for root elements in the BLE mesh network.
Reimplemented from meshXElement< meshx_srv_model_send_param_header_t >.
|
overrideprivatevirtual |
Lists and creates all required Vendor models for the element.
This function is responsible for creating and populating the ven_models vector with all essential Vendor models that the element must have.
The function can be extended to include additional models based on configuration flags or specific requirements.
Reimplemented from meshXElement< meshx_srv_model_send_param_header_t >.
|
overrideprivatevirtual |
Synchronize element state (Status broadcast or GET request).
| evt | The event trigger (STACK_READY or FRESH_BOOT) |
Implements meshXElementIF.