|
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.
|
meshXModel class More...
#include <meshx_model_class.hpp>
Public Member Functions | |
| 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. | |
| 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. | |
| virtual meshx_err_t | model_send (meshx_send_packet_params_t *params)=0 |
| Send message through the model. | |
| 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. | |
| meshxBaseModel_t * | get_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 |
| virtual meshx_err_t | plat_model_create (MESHX_MODEL *p_plat_model_ptr=nullptr)=0 |
| Create logical model instance. | |
| virtual meshx_err_t | plat_model_delete (void)=0 |
| Delete logical model instance. | |
| virtual meshx_err_t | element_state_change_handle (void)=0 |
| Handle state change request from element. | |
| virtual meshx_err_t | prepare_element_msg (meshx_ptr_t *msg_ptr, size_t *msg_size)=0 |
| Prepare message for element notification. | |
| 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. | |
| meshXElementIF * | get_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. | |
Protected Member Functions | |
| 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. | |
Private Attributes | |
| meshxBaseModel_t * | base_model = nullptr |
| meshx_err_t | status |
| uint16_t | model_id |
| uint16_t | model_func_id |
meshXModel class
This is a base class for both client and server models.
|
inline |
Get the base model instance.
|
inline |
Get the model initialization status.
|
inline |
Get the model function identifier.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Check if the model is successfully initialized.
Implements meshXModelIF.
|
pure virtual |
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.
| [in] | dev | Device structure containing sender information |
| [in] | evt | Event type indicating the nature of the message |
| [in] | data | Event-specific data payload |
Implemented in meshXConfigModel, meshXGenericAdminPropertyServerModel, meshXGenericBatteryClientModel, meshXGenericBatteryServerModel, meshXGenericClientPropertyServerModel, meshXGenericDefTransTimeClientModel, meshXGenericDefTransTimeServerModel, meshXGenericLevelClientModel, meshXGenericLevelServerModel, meshXGenericLocationClientModel, meshXGenericLocationServerModel, meshXGenericLocationSetupServerModel, meshXGenericManufacturerPropertyServerModel, meshXGenericOnOffClientModel, meshXGenericOnOffServerModel, meshXGenericPowerLevelClientModel, meshXGenericPowerLevelServerModel, meshXGenericPowerLevelSetupServerModel, meshXGenericPowerOnOffClientModel, meshXGenericPowerOnOffServerModel, meshXGenericPowerOnOffSetupServerModel, meshXGenericPropertyClientModel, meshXGenericUserPropertyServerModel, meshXLightCTLClientModel, meshXLightCTLServerModel, meshXLightCTLSetupServerModel, meshXLightHSLServerModel, and meshXSensorServerModel.
|
pure virtual |
Send message through the model.
Pure virtual function that derived classes must implement to send messages through the model to the BLE Mesh network.
| [in] | params | Message parameters including destination, opcode, and data |
Implemented in meshXConfigModel, meshXGenericAdminPropertyServerModel, meshXGenericBatteryClientModel, meshXGenericBatteryServerModel, meshXGenericClientPropertyServerModel, meshXGenericDefTransTimeClientModel, meshXGenericDefTransTimeServerModel, meshXGenericLevelClientModel, meshXGenericLevelServerModel, meshXGenericLocationClientModel, meshXGenericLocationServerModel, meshXGenericLocationSetupServerModel, meshXGenericManufacturerPropertyServerModel, meshXGenericOnOffClientModel, meshXGenericOnOffServerModel, meshXGenericPowerLevelClientModel, meshXGenericPowerLevelServerModel, meshXGenericPowerLevelSetupServerModel, meshXGenericPowerOnOffClientModel, meshXGenericPowerOnOffServerModel, meshXGenericPowerOnOffSetupServerModel, meshXGenericPropertyClientModel, meshXGenericUserPropertyServerModel, meshXLightCTLClientModel, meshXLightCTLServerModel, meshXLightCTLSetupServerModel, meshXLightHSLServerModel, and meshXSensorServerModel.
|
inlineoverridevirtual |
Called when the model's parent element is baked.
Overridden to perform deferred registration of callbacks.
Reimplemented from meshXModelIF.
|
inline |
Set the model function identifier.
| [in] | func_id | Model function ID to set |
|
inline |
|
protectedpure virtual |
Update element_state_change field in message header.
Protected virtual method that derived classes (meshXClientModel, meshXServerModel) must implement to handle type-specific header casting. This method is called by send_to_parent_element to update the element_state_change field.
| [in] | element_state_change | Result from element_state_change_handle() |
| [in] | msg_ptr | Pointer to the message structure |
Implemented in meshXClientModel< meshxBaseClientModel_t, meshx_send_packet_params_t >, meshXClientModel< meshXBaseGenericClientModel, meshx_gen_battery_send_params_t >, meshXClientModel< meshXBaseGenericClientModel, meshx_gen_def_trans_time_send_params_t >, meshXClientModel< meshXBaseGenericClientModel, meshx_gen_level_send_params_t >, meshXClientModel< meshXBaseGenericClientModel, meshx_gen_location_send_params_t >, meshXClientModel< meshXBaseGenericClientModel, meshx_gen_onoff_send_params_t >, meshXClientModel< meshXBaseGenericClientModel, meshx_gen_power_level_send_params_t >, meshXClientModel< meshXBaseGenericClientModel, meshx_gen_power_onoff_send_params_t >, meshXClientModel< meshXBaseGenericClientModel, meshx_gen_property_send_params_t >, meshXClientModel< meshXBaseLightClientModel, meshx_light_ctl_send_params_t >, meshXServerModel< meshxBaseServerModel_t, meshx_send_packet_params_t >, meshXServerModel< meshXBaseConfigServerModel, meshx_config_send_params_t >, meshXServerModel< meshXBaseGenericServerModel, meshx_gen_battery_send_params_t >, meshXServerModel< meshXBaseGenericServerModel, meshx_gen_def_trans_time_send_params_t >, meshXServerModel< meshXBaseGenericServerModel, meshx_gen_level_send_params_t >, meshXServerModel< meshXBaseGenericServerModel, meshx_gen_location_send_params_t >, meshXServerModel< meshXBaseGenericServerModel, meshx_gen_onoff_send_params_t >, meshXServerModel< meshXBaseGenericServerModel, meshx_gen_power_level_send_params_t >, meshXServerModel< meshXBaseGenericServerModel, meshx_gen_power_onoff_send_params_t >, meshXServerModel< meshXBaseGenericServerModel, meshx_gen_property_send_params_t >, meshXServerModel< meshXBaseLightServerModel, meshx_light_ctl_send_params_t >, meshXServerModel< meshXBaseLightServerModel, meshx_light_hsl_send_params_t >, and meshXServerModel< meshXBaseSensorServerModel, meshx_sensor_server_send_params_t >.
|
private |
|
private |
|
private |
|
private |