|
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 Battery Client models. More...
#include <meshx_model_battery.hpp>
Public Member Functions | |
| meshx_err_t | model_send (meshx_gen_battery_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 |
| Creates a meshXGenericBatteryClientModel instance based on a BLE device. | |
| meshx_err_t | prepare_element_msg (meshx_ptr_t *msg_ptr, size_t *msg_size) override |
| Prepare message for element notification. | |
| meshXGenericBatteryClientModel (meshXElementIF *parent_element=nullptr, meshx_ptr_t parent_element_state=nullptr, uint16_t model_func_id=0) | |
| A template class for creating Generic Battery Client models. | |
| ~meshXGenericBatteryClientModel ()=default | |
| Public Member Functions inherited from meshXClientModel< meshXBaseGenericClientModel, meshx_gen_battery_send_params_t > | |
| 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. | |
| Public Member Functions inherited from meshXModel< meshXBaseGenericClientModel, meshx_gen_battery_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. | |
| meshXBaseGenericClientModel * | 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 | meshx_state_change_notify (const meshx_gen_cli_cb_param_t *param, uint8_t status) |
| Handle Generic Battery state change notifications from the MeshX stack. | |
| meshx_err_t | element_state_change_handle (void) override |
| Handle state change request from element. | |
Private Attributes | |
| meshx_gen_battery_model_state_t | model_state |
| meshx_battery_cli_el_msg_t | element_msg |
Additional Inherited Members | |
| Protected Member Functions inherited from meshXClientModel< meshXBaseGenericClientModel, meshx_gen_battery_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 client message header. | |
A template class for creating Generic Battery Client models.
This class is derived from meshXClientModel and provides a convenient interface for creating Generic Battery Client models. It handles the Generic Battery state change notifications from the MeshX stack and publishes the state change event to the element layer.
| meshXGenericBatteryClientModel::meshXGenericBatteryClientModel | ( | meshXElementIF * | parent_element = nullptr, |
| meshx_ptr_t | parent_element_state = nullptr, | ||
| uint16_t | model_func_id = 0 ) |
A template class for creating Generic Battery Client models.
This class is derived from meshXClientModel and provides a convenient interface for creating Generic Battery Client models. It handles the Generic Battery state change notifications from the MeshX stack and publishes the state change event to the element layer.
| meshxBaseClientModel_t | The type of the meshXBaseClientModel 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. |
|
default |
|
overrideprivatevirtual |
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.
|
private |
Handle Generic Battery state change notifications from the MeshX stack.
This function is responsible for handling Generic Battery state change notifications from the MeshX stack. It is called when the MeshX stack receives a state change event from the Generic Battery server model. The function publishes the state change event to the control task framework, which in turn notifies the application about the state change.
| [in] | param | Pointer to the Generic Battery client callback parameter structure. |
| [in] | status | Status of the state change event (success or timeout). |
|
overridevirtual |
Creates a meshXGenericBatteryClientModel instance based on a BLE device.
This function is used to create a meshXGenericBatteryClientModel instance based on a BLE device. It takes the device structure, model ID, and parameters as input and returns a pointer to the created instance.
| [in] | p_dev | Pointer to the device structure |
| [in] | model_id | Model ID associated with the device |
| [in] | params | Pointer to the parameters associated with the device |
Implements meshXModel< meshXBaseGenericClientModel, meshx_gen_battery_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_battery_send_params_t structure as input and sends the corresponding packet to the MeshX stack for processing.
| [in] | params | Pointer to the meshx_gen_battery_send_params_t structure containing the parameters |
Implements meshXModel< meshXBaseGenericClientModel, meshx_gen_battery_send_params_t >.
|
overridevirtual |
Prepare message for element notification.
Returns pointer to the stored element message
| [out] | msg_ptr | Pointer to message structure (output parameter) |
| [out] | msg_size | Size of the message structure (output parameter) |
Implements meshXModelIF.
|
private |
|
private |