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 Client model for BLE Mesh. This file contains the initialization, resource management, and message handling logic for the Generic OnOff Client model in the MeshX platform. More...
Go to the source code of this file.
Macros | |
#define | MESHX_CLIENT_INIT_MAGIC_NO 0x8709 |
Functions | |
static void | esp_ble_mesh_generic_client_cb (MESHX_GEN_CLI_CB_EVT event, MESHX_GEN_CLI_CB_PARAM *param) |
Callback function for handling BLE Mesh Generic Client events. | |
meshx_err_t | meshx_plat_gen_cli_init (void) |
Initialize the meshxuction generic client. | |
meshx_err_t | meshx_plat_on_off_gen_cli_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_onoff_cli) |
Creates a Generic OnOff client model and its publication context. | |
meshx_err_t | meshx_plat_gen_cli_delete (meshx_ptr_t *p_pub, meshx_ptr_t *p_cli) |
Deletes the Generic OnOff Client model and its associated resources. | |
meshx_err_t | meshx_plat_gen_cli_send_msg (meshx_ptr_t p_model, meshx_gen_cli_set_t *p_set, uint16_t opcode, uint16_t addr, uint16_t net_idx, uint16_t app_idx, bool is_get_opcode) |
Sends a Generic Client message over BLE Mesh. | |
Variables | |
static uint16_t | meshx_client_init = 0 |
static const char * | client_state_str [] |
Mapping of BLE Mesh client state events to string representations. | |
Implementation of the Generic OnOff Client model for BLE Mesh. This file contains the initialization, resource management, and message handling logic for the Generic OnOff Client model in the MeshX platform.
Copyright (c) 2024 - 2025 MeshX
The Generic OnOff Client model is responsible for sending requests and receiving responses related to the on/off state of devices in a BLE Mesh network. It manages the client instance, publication context, and interacts with the MeshX BLE Mesh stack.
Definition in file esp_gen_cli_model.c.
#define MESHX_CLIENT_INIT_MAGIC_NO 0x8709 |
Definition at line 27 of file esp_gen_cli_model.c.
|
static |
Callback function for handling BLE Mesh Generic Client events.
This function is invoked when a BLE Mesh Generic Client event occurs. It logs the event details, prepares a parameter structure for the MeshX layer, copies relevant status data, and publishes the event to the control task message queue.
[in] | event | The type of Generic Client callback event (MESHX_GEN_CLI_CB_EVT). |
[in] | param | Pointer to the callback parameter structure containing event-specific data (MESHX_GEN_CLI_CB_PARAM). |
The function performs the following steps:
Definition at line 71 of file esp_gen_cli_model.c.
meshx_err_t meshx_plat_gen_cli_delete | ( | meshx_ptr_t * | p_pub, |
meshx_ptr_t * | p_cli ) |
Deletes the Generic OnOff Client model and its associated resources.
This function frees the memory allocated for the Generic OnOff Client and sets the pointer to NULL. It also deletes the model publication resources associated with the client.
[in,out] | p_pub | Pointer to the publication structure to be deleted. |
[in,out] | p_cli | Pointer to the OnOff Client structure to be freed. |
Definition at line 187 of file esp_gen_cli_model.c.
meshx_err_t meshx_plat_gen_cli_init | ( | void | ) |
Initialize the meshxuction generic client.
This function sets up the necessary configurations and initializes the meshxuction generic client for the BLE mesh node.
Definition at line 125 of file esp_gen_cli_model.c.
meshx_err_t meshx_plat_gen_cli_send_msg | ( | meshx_ptr_t | p_model, |
meshx_gen_cli_set_t * | p_set, | ||
uint16_t | opcode, | ||
uint16_t | addr, | ||
uint16_t | net_idx, | ||
uint16_t | app_idx, | ||
bool | is_get_opcode ) |
Sends a Generic Client message over BLE Mesh.
This function sends a message from a Generic Client model to a specified address within the BLE Mesh network, using the provided opcode and parameters.
[in] | p_model | Pointer to the Generic Client model instance. |
[in] | p_set | Pointer to the structure containing the message parameters to set. |
[in] | opcode | Operation code specifying the type of message to send. |
[in] | addr | Destination address within the BLE Mesh network. |
[in] | net_idx | Network index identifying the subnet to use. |
[in] | app_idx | Application key index to encrypt the message. |
[in] | is_get_opcode | Flag indicating if the opcode is a GET request. |
Definition at line 214 of file esp_gen_cli_model.c.
meshx_err_t meshx_plat_on_off_gen_cli_create | ( | meshx_ptr_t | p_model, |
meshx_ptr_t * | p_pub, | ||
meshx_ptr_t * | p_onoff_cli ) |
Creates a Generic OnOff client model and its publication context.
This function initializes the Generic OnOff client model, its publication context, and allocates memory for the client 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_cli | Pointer to the OnOff client instance to be allocated. |
Definition at line 160 of file esp_gen_cli_model.c.
|
static |
Mapping of BLE Mesh client state events to string representations.
Definition at line 37 of file esp_gen_cli_model.c.
|
static |
Definition at line 32 of file esp_gen_cli_model.c.