|
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.
|
A template class for creating Generic OnOff Server models. More...
#include <meshx_model_onoff.hpp>
Public Member Functions | |
| meshx_err_t | model_send (meshx_gen_onoff_send_params_t *params) override |
| Send a packet to the MeshX stack based on the given parameters. | |
| meshx_err_t | model_from_ble_cb (dev_struct_t *, control_task_msg_evt_t, meshx_ptr_t) override |
| This function is the callback for the Generic OnOff Server model. | |
| meshx_err_t | prepare_element_msg (meshx_ptr_t *msg_ptr, size_t *msg_size) override |
| Prepare the element message for notification. | |
| meshx_err_t | request_status (uint16_t dst_addr=0) |
| Request to send the Generic OnOff status to a specific address. | |
| meshx_err_t | element_state_change_handle (void) override |
| Handle state change request from element. | |
| meshXGenericOnOffServerModel (meshXElementIF *parent_element=nullptr, meshx_ptr_t parent_element_state=nullptr, uint16_t model_func_id=0) | |
| A template class for creating Generic OnOff Server models. | |
| ~meshXGenericOnOffServerModel () override=default | |
| Public Member Functions inherited from meshXServerModel< meshXBaseGenericServerModel, meshx_gen_onoff_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< meshXBaseGenericServerModel, meshx_gen_onoff_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. | |
| meshXBaseGenericServerModel * | 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 |
| 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. | |
Private Member Functions | |
| meshx_err_t | plat_model_create (MESHX_MODEL *p_plat_model_ptr=nullptr) override |
| Creates and initializes a server model instance. | |
| meshx_err_t | plat_model_delete (void) override |
| Deletes the Generic OnOff Server model and its associated resources. | |
Private Attributes | |
| meshx_gen_onoff_model_state_t | model_state |
| meshx_on_off_srv_el_msg_t | element_msg |
| bool | element_msg_prepared |
Additional Inherited Members | |
| Protected Member Functions inherited from meshXServerModel< meshXBaseGenericServerModel, meshx_gen_onoff_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. | |
A template class for creating Generic OnOff Server models.
This class is derived from meshXServerModel and provides a convenient interface for creating Generic OnOff Server models. It handles the Generic OnOff state change notifications from the MeshX stack and publishes the state change event to the element layer.
|
explicit |
A template class for creating Generic OnOff Server models.
This class is derived from meshXServerModel and provides a convenient interface for creating Generic OnOff Server models. It handles Generic OnOff state change notifications from the MeshX stack and publishes the state change event to the element layer.
| meshxBaseServerModel_t | The type of the meshXBaseServerModel class to be used. |
| meshx_send_packet_params_t | The type of the meshXSendPacketParams structure used for sending packets. |
| [in] | parent_element | A pointer to the parent element (meshXElementIF). |
| [in] | parent_element_state | Pointer to the parent element's state structure. |
| [in] | model_func_id | Functional ID for the model instance. |
|
overridedefault |
|
overridevirtual |
Handle state change request from element.
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. Note: The actual state is maintained in the element layer, not the model layer.
Implements meshXModelIF.
|
overridevirtual |
This function is the callback for the Generic OnOff Server model.
This function is triggered whenever a Generic OnOff message is received from the MeshX stack. It handles Generic OnOff state change notifications from the MeshX stack and publishes the state change event to the element layer.
| [in] | p_dev | A pointer to the device structure. |
| [in] | model_id | The unique identifier of the BLE mesh model. |
| [in] | params | A pointer to the callback parameter structure containing the details of the received message. |
Implements meshXModel< meshXBaseGenericServerModel, meshx_gen_onoff_send_params_t >.
|
overridevirtual |
Send a packet to the MeshX stack based on the given parameters.
This function takes a pointer to a meshx_gen_onoff_send_params_t structure as input and sends the corresponding packet to the MeshX stack for processing.
| [in] | params | Pointer to the meshx_gen_onoff_send_params_t structure containing the parameters |
Implements meshXModel< meshXBaseGenericServerModel, meshx_gen_onoff_send_params_t >.
|
overrideprivatevirtual |
Creates and initializes a server model instance.
This function handles the platform-specific model creation process for server models. It initializes server-specific features and cannot be overridden by derived classes.
Implements meshXModelIF.
|
overrideprivatevirtual |
Deletes the Generic OnOff Server model and its associated resources.
This function frees the memory allocated for the Generic OnOff Server and sets the pointer to NULL. It also deletes the model publication resources associated with the server.
Implements meshXModelIF.
|
overridevirtual |
Prepare the element message for notification.
This function prepares the element message for notification by setting the message pointer and size. It checks if the message was prepared for element notification and returns an error if not.
| [out] | msg_ptr | Pointer to store the message pointer. |
| [out] | msg_size | Pointer to store the message size. |
Implements meshXModelIF.
| meshx_err_t meshXGenericOnOffServerModel::request_status | ( | uint16_t | dst_addr = 0 | ) |
Request to send the Generic OnOff status to a specific address.
This function is used to request the Generic OnOff status to be sent to a specific address. It uses the parent element's context for the message.
| [in] | dst_addr | The destination address to send the status to. |
|
private |
|
private |
|
private |