MeshX 0.3
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.
|
Implementation of the Generic OnOff Server model for BLE Mesh. This file contains the initialization, state management, and message handling logic for the Generic OnOff Server model in the MeshX platform. More...
Go to the source code of this file.
Macros | |
#define | CONTROL_TASK_MSG_EVT_TO_BLE_GEN_SRV_MASK CONTROL_TASK_MSG_EVT_TO_BLE_SET_ON_OFF_SRV |
Functions | |
static meshx_err_t | meshx_plat_gen_srv_create (void *p_model, void **p_pub, void **p_srv) |
Creates and initializes the Generic Server model platform resources. | |
static void | esp_ble_mesh_generic_server_cb (MESHX_GEN_SRV_CB_EVT event, MESHX_GEN_SRV_CB_PARAM *param) |
Callback function for BLE Mesh Generic Server events. | |
meshx_err_t | meshx_plat_gen_srv_send_status (meshx_model_t *p_model, meshx_ctx_t *p_ctx, meshx_ptr_t p_data, uint32_t data_len) |
Send a status message from the Generic Server model. | |
meshx_err_t | meshx_plat_set_gen_srv_state (void *p_model, uint8_t on_off_state) |
Set the state of a generic server model. | |
meshx_err_t | meshx_plat_gen_srv_init (void) |
Initialize the meshxuction generic server. | |
meshx_err_t | meshx_plat_on_off_gen_srv_create (void *p_model, void **p_pub, void **p_onoff_srv) |
Creates a Generic OnOff Server model and its publication context. | |
meshx_err_t | meshx_plat_gen_srv_delete (void **p_pub, void **p_srv) |
Deletes the Generic OnOff Server model and its associated resources. | |
meshx_err_t | meshx_plat_gen_on_off_srv_restore (void *p_model, uint8_t state) |
Restores the state of the Generic OnOff Server model. | |
Variables | |
static const char * | server_state_str [] |
String representation of the server state change events. | |
Implementation of the Generic OnOff Server model for BLE Mesh. This file contains the initialization, state management, and message handling logic for the Generic OnOff Server model in the MeshX platform.
Copyright (c) 2024 - 2025 MeshX
The Generic OnOff Server model is responsible for managing the on/off state of a device in a BLE Mesh network. It handles incoming messages, updates the state, and publishes the state changes to the network.
Definition in file esp_gen_srv_model.c.
#define CONTROL_TASK_MSG_EVT_TO_BLE_GEN_SRV_MASK CONTROL_TASK_MSG_EVT_TO_BLE_SET_ON_OFF_SRV |
Definition at line 21 of file esp_gen_srv_model.c.
|
static |
Callback function for BLE Mesh Generic Server events.
This function is called whenever a BLE Mesh Generic Server event occurs.
[in] | event | The event type for the BLE Mesh Generic Server. |
[in] | param | Parameters associated with the event. |
Definition at line 80 of file esp_gen_srv_model.c.
meshx_err_t meshx_plat_gen_on_off_srv_restore | ( | void * | p_model, |
uint8_t | state ) |
Restores the state of the Generic OnOff Server model.
This function sets the user data of the specified model to the given state. It checks if the model pointer is valid before proceeding with the operation.
[in] | p_model | Pointer to the model structure. |
[in] | state | The state to be restored in the model. |
Definition at line 247 of file esp_gen_srv_model.c.
|
static |
Creates and initializes the Generic Server model platform resources.
This function sets up the necessary resources for a Generic Server model, including publication and OnOff server instances.
[in] | p_model | Pointer to the model instance to be initialized. |
[out] | p_pub | Pointer to the location where the publication context will be stored. |
[out] | p_srv | Pointer to the location where the OnOff server instance will be stored. |
Definition at line 36 of file esp_gen_srv_model.c.
meshx_err_t meshx_plat_gen_srv_delete | ( | void ** | p_pub, |
void ** | p_srv ) |
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.
[in,out] | p_pub | Pointer to the publication structure to be deleted. |
[in,out] | p_srv | Pointer to the Generic Server structure to be freed. |
Definition at line 236 of file esp_gen_srv_model.c.
meshx_err_t meshx_plat_gen_srv_init | ( | void | ) |
Initialize the meshxuction generic server.
Initialize the generic server model platform.
This function sets up the necessary configurations and initializes the meshxuction generic server for the BLE mesh node.
Definition at line 210 of file esp_gen_srv_model.c.
meshx_err_t meshx_plat_gen_srv_send_status | ( | meshx_model_t * | p_model, |
meshx_ctx_t * | p_ctx, | ||
meshx_ptr_t | p_data, | ||
uint32_t | data_len ) |
Send a status message from the Generic Server model.
This function sends a status message to the specified context with the provided data.
[in] | p_model | Pointer to the model instance. |
[in] | p_ctx | Pointer to the context structure containing destination address and other parameters. |
[in] | p_data | Pointer to the data to be sent. |
[in] | data_len | Length of the data to be sent. |
Definition at line 142 of file esp_gen_srv_model.c.
meshx_err_t meshx_plat_on_off_gen_srv_create | ( | void * | p_model, |
void ** | p_pub, | ||
void ** | p_onoff_srv ) |
Creates a Generic OnOff Server model and its publication context.
This function initializes the Generic OnOff Server model, its publication context, and allocates memory for the server instance. It checks for invalid arguments and handles memory allocation failures.
[out] | p_model | Pointer to the model structure to be created. |
[out] | p_pub | Pointer to the publication context to be created. |
[out] | p_onoff_srv | Pointer to the OnOff server instance to be allocated. |
Definition at line 224 of file esp_gen_srv_model.c.
meshx_err_t meshx_plat_set_gen_srv_state | ( | void * | p_model, |
uint8_t | on_off_state ) |
Set the state of a generic server model.
This function updates the on/off state of a specified generic server model.
[in] | p_model | Pointer to the model whose state is to be set. |
[in] | on_off_state | The desired on/off state to set for the model. |
Definition at line 187 of file esp_gen_srv_model.c.
|
static |
String representation of the server state change events.
Definition at line 65 of file esp_gen_srv_model.c.