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 MeshX generic client model for BLE mesh nodes. This file contains functions for registering, deregistering, and initializing the generic client model. More...
Go to the source code of this file.
Data Structures | |
struct | meshx_gen_cli_cb_reg |
Structure containing the model ID and callback function for generic client model registrations. More... | |
struct | meshx_gen_cli_resend_ctx |
Structure containing the model ID and parameter for generic client model message re-sending. More... | |
struct | meshx_gen_client_msg_ctx |
Structure containing the message context for generic client model messages. More... | |
struct | meshx_gen_cli_cb_reg_node |
Structure containing a node in the linked list of registered callbacks. More... | |
Macros | |
#define | MESHX_CLIENT_INIT_MAGIC_NO 0x1121 |
Typedefs | |
typedef struct meshx_gen_cli_cb_reg | meshx_gen_cli_cb_reg_t |
typedef struct meshx_gen_cli_resend_ctx | meshx_gen_cli_resend_ctx |
typedef struct meshx_gen_client_msg_ctx | meshx_gen_client_msg_ctx_t |
typedef struct meshx_gen_cli_cb_reg_node | meshx_gen_cli_cb_reg_node_t |
Functions | |
static meshx_err_t | meshx_gen_cli_cb_reg_add (meshx_gen_cli_cb_reg_t reg) |
Adds a new callback registration to the linked list of registered callbacks. | |
static meshx_err_t | meshx_is_gen_cli_get_opcode (uint16_t opcode) |
Checks if the given opcode corresponds to a GET request in the Generic Client group. | |
static meshx_err_t | meshx_is_gen_cli_model (uint32_t model_id) |
Checks if the given model ID corresponds to a Generic Client model. | |
static meshx_err_t | meshx_is_unack_opcode (uint32_t opcode) |
Checks if the given opcode corresponds to an unacknowledged (unack) message. | |
static meshx_err_t | meshx_gen_client_txcm_fn_model_send (meshx_gen_client_msg_ctx_t *msg_param, size_t msg_param_len) |
Transmit callback handler for sending Generic Client model messages. | |
static meshx_err_t | meshx_handle_txcm_msg (dev_struct_t *pdev, control_task_msg_evt_t evt, meshx_gen_cli_resend_ctx *param) |
Handles a control task message for a generic client model. | |
static meshx_err_t | meshx_gen_cli_handle_ack (uint16_t src_addr) |
Handles ack request for generic client messages. | |
static meshx_err_t | meshx_gen_cli_handle_resend (uint16_t model_id, const meshx_gen_cli_cb_param_t *param) |
Handles resend request for generic client messages. | |
static meshx_err_t | meshx_handle_gen_onoff_msg (dev_struct_t *pdev, control_task_msg_evt_t model_id, meshx_gen_cli_cb_param_t *param) |
Handle the Generic OnOff Client messages. | |
meshx_err_t | meshx_gen_client_init (void) |
Initialize the mesh fuction generic client. | |
meshx_err_t | meshx_gen_cli_send_msg (meshx_gen_client_send_params_t *params) |
Sends a Generic Client message over BLE Mesh. | |
meshx_err_t | meshx_gen_client_from_ble_reg_cb (uint32_t model_id, meshx_gen_client_cb_t cb) |
Registers a callback function for a specific generic server model. | |
Variables | ||
struct { | ||
uint16_t client_init | ||
meshx_gen_cli_cb_reg_node_t * cli_cb_reg_head | ||
} | g_meshx_client_control | |
Implementation of the MeshX generic client model for BLE mesh nodes. This file contains functions for registering, deregistering, and initializing the generic client model.
Copyright (c) 2024 - 2025 MeshX
The MeshX generic client model provides an interface for handling BLE mesh client operations, including callback registration and initialization.
Definition in file meshx_gen_client.c.
#define MESHX_CLIENT_INIT_MAGIC_NO 0x1121 |
Definition at line 20 of file meshx_gen_client.c.
typedef struct meshx_gen_cli_cb_reg_node meshx_gen_cli_cb_reg_node_t |
typedef struct meshx_gen_cli_cb_reg meshx_gen_cli_cb_reg_t |
typedef struct meshx_gen_cli_resend_ctx meshx_gen_cli_resend_ctx |
typedef struct meshx_gen_client_msg_ctx meshx_gen_client_msg_ctx_t |
|
static |
Adds a new callback registration to the linked list of registered callbacks.
This function allocates a new node in the linked list of registered callbacks and initializes it with the provided registration information.
[in] | reg | The structure containing the model ID and callback function to add to the linked list. |
Definition at line 91 of file meshx_gen_client.c.
|
static |
Handles ack request for generic client messages.
This function requests the TXCM module to clear the last message by sending a ACK signal with null parameters.
[in] | src_addr | The Source address of the message. |
Definition at line 293 of file meshx_gen_client.c.
|
static |
Handles resend request for generic client messages.
This function requests the TXCM module to resend the last message by sending a RESEND signal with null parameters.
Definition at line 308 of file meshx_gen_client.c.
meshx_err_t meshx_gen_cli_send_msg | ( | meshx_gen_client_send_params_t * | params | ) |
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] | params | Pointer to the structure containing the message parameters to set. |
Definition at line 426 of file meshx_gen_client.c.
meshx_err_t meshx_gen_client_from_ble_reg_cb | ( | uint32_t | model_id, |
meshx_gen_client_cb_t | cb ) |
Registers a callback function for a specific generic server model.
This function associates a callback with the given model ID, allowing the server to handle events or messages related to that model.
[in] | model_id | The unique identifier of the generic server model. |
[in] | cb | The callback function to be registered for the model. |
Definition at line 475 of file meshx_gen_client.c.
meshx_err_t meshx_gen_client_init | ( | void | ) |
Initialize the mesh fuction generic client.
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 404 of file meshx_gen_client.c.
|
static |
Transmit callback handler for sending Generic Client model messages.
This function processes the generic client message context and forwards it to the platform-specific BLE Mesh generic client send function for transmission. It validates the input parameters before invoking the core send function.
[in] | msg_param | Pointer to the message context structure (meshx_gen_client_msg_ctx_t). Must not be NULL. |
[in] | msg_param_len | Length of the message parameter data in bytes. Must equal sizeof(meshx_gen_client_msg_ctx_t). |
Definition at line 216 of file meshx_gen_client.c.
|
static |
Handle the Generic OnOff Client messages.
This function processes the incoming messages for the Generic OnOff Client and performs the necessary actions based on the message event and parameters.
[in] | pdev | Pointer to the device structure containing device-specific information. |
[in] | model_id | The model ID of the received message. |
[in] | param | Pointer to the Generic Client callback parameter structure. |
Definition at line 335 of file meshx_gen_client.c.
|
static |
Handles a control task message for a generic client model.
This function processes a control task message received from the control task module for a generic client model. It is responsible for handling messages such as Tx Control Module signals, and is called by the control task module when a control task message is received.
[in] | pdev | Pointer to the device structure associated with the BLE Mesh node. |
[in] | evt | Control task message event type, which represents the model ID of the generic client model associated with the message. |
[in] | param | Pointer to a structure containing the control task message parameters. Must not be NULL. |
Definition at line 250 of file meshx_gen_client.c.
|
static |
Checks if the given opcode corresponds to a GET request in the Generic Client group.
This function determines whether the provided opcode is part of the set of GET requests defined for the Generic Client group in the MeshX protocol.
[in] | opcode | The opcode to check. |
Definition at line 113 of file meshx_gen_client.c.
|
static |
Checks if the given model ID corresponds to a Generic Client model.
This function determines whether the specified model ID is associated with a Generic Client model in the MeshX framework.
[in] | model_id | The model ID to be checked. |
Definition at line 145 of file meshx_gen_client.c.
|
static |
Checks if the given opcode corresponds to an unacknowledged (unack) message.
This function determines whether the provided opcode represents a SET_UNACK operation for various Generic models in the BLE Mesh specification. It returns success if the opcode matches one of the defined unacknowledged set opcodes.
[in] | opcode | The mesh model opcode to check (uint32_t). |
Definition at line 180 of file meshx_gen_client.c.
meshx_gen_cli_cb_reg_node_t* cli_cb_reg_head |
Pointer to the head of the linked list of registered callbacks.
Definition at line 80 of file meshx_gen_client.c.
uint16_t client_init |
Flag indicating whether the mesh client has been initialized.
Definition at line 79 of file meshx_gen_client.c.
struct { ... } g_meshx_client_control |