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.
|
MeshX Tx Control Module This header file contains the definitions and function prototypes for the MeshX Tx Control Module, which is responsible for managing transmission control in the MeshX BLE Mesh stack. More...
#include <stdint.h>
#include <stddef.h>
#include "meshx_err.h"
#include "meshx_common.h"
#include "meshx_control_task.h"
#include "interface/ble_mesh/meshx_ble_mesh_cmn_def.h"
Go to the source code of this file.
Data Structures | |
struct | meshx_txcm_request |
Structure for Tx Control module requests. More... | |
Macros | |
#define | MESHX_TXCM_MSG_RETRY_MAX 3 |
Maximum number of retries for a message. | |
#define | MESHX_TXCM_MSG_PARAM_MAX_LEN 64 |
Maximum length of the message parameters in bytes. | |
#define | MESHX_TXCM_TX_Q_LEN 10 |
Maximum number of transmission items in the Tx queue. | |
#define | MESHX_TXCM_TX_Q_DEPTH sizeof(meshx_txcm_tx_q_t) |
Depth (size) of each transmission queue entry. | |
Typedefs | |
typedef control_task_msg_handle_t | meshx_txcm_cb_t |
typedef meshx_err_t(* | meshx_txcm_fn_model_send_t) (meshx_cptr_t msg_param, size_t msg_param_len) |
Function pointer the Model client layer needs to provide for the msg to be sent for both MESHX_TXCM_SIG_ENQ_SEND and MESHX_TXCM_SIG_DIRECT_SEND. | |
typedef struct meshx_txcm_request | meshx_txcm_request_t |
Structure for Tx Control module requests. | |
Enumerations | |
enum | meshx_txcm_sig_t { MESHX_TXCM_SIG_ENQ_SEND = 0 , MESHX_TXCM_SIG_DIRECT_SEND = 1 , MESHX_TXCM_SIG_RESEND = 2 , MESHX_TXCM_SIG_ACK = 3 , MESHX_TXCM_SIG_MAX } |
Enumeration of signal types for the Tx Control Module. More... | |
enum | meshx_txcm_msg_state_t { MESHX_TXCM_MSG_STATE_NONE = 0 , MESHX_TXCM_MSG_STATE_NEW = 1 , MESHX_TXCM_MSG_STATE_SENDING = 2 , MESHX_TXCM_MSG_STATE_WAITING_ACK = 3 , MESHX_TXCM_MSG_STATE_ACK = 4 , MESHX_TXCM_MSG_STATE_NACK = 5 , MESHX_TXCM_MSG_STATE_MAX } |
Enumeration of message states for the Tx Control Module. More... | |
enum | meshx_txcm_msg_type_t { MESHX_TXCM_MSG_TYPE_ACKED , MESHX_TXCM_MSG_TYPE_UNACKED , MESHX_TXCM_MSG_TYPE_MAX } |
Functions | |
meshx_err_t | meshx_txcm_init (dev_struct_t *pdev) |
Initializes the MeshX Tx Control Module. | |
meshx_err_t | meshx_txcm_request_send (meshx_txcm_sig_t request_type, uint16_t dest_addr, meshx_cptr_t msg_param, uint16_t msg_param_len, meshx_txcm_fn_model_send_t send_fn) |
Sends a request to the Tx Control module. | |
meshx_err_t | meshx_txcm_event_cb_reg (meshx_txcm_cb_t event_cb) |
Registers a callback function for handling Tx Control module events. | |
MeshX Tx Control Module This header file contains the definitions and function prototypes for the MeshX Tx Control Module, which is responsible for managing transmission control in the MeshX BLE Mesh stack.
Definition in file meshx_txcm.h.
#define MESHX_TXCM_MSG_PARAM_MAX_LEN 64 |
Maximum length of the message parameters in bytes.
Definition at line 34 of file meshx_txcm.h.
#define MESHX_TXCM_MSG_RETRY_MAX 3 |
Maximum number of retries for a message.
Definition at line 27 of file meshx_txcm.h.
#define MESHX_TXCM_TX_Q_DEPTH sizeof(meshx_txcm_tx_q_t) |
Depth (size) of each transmission queue entry.
Definition at line 47 of file meshx_txcm.h.
#define MESHX_TXCM_TX_Q_LEN 10 |
Maximum number of transmission items in the Tx queue.
Definition at line 41 of file meshx_txcm.h.
Definition at line 49 of file meshx_txcm.h.
typedef meshx_err_t(* meshx_txcm_fn_model_send_t) (meshx_cptr_t msg_param, size_t msg_param_len) |
Function pointer the Model client layer needs to provide for the msg to be sent for both MESHX_TXCM_SIG_ENQ_SEND and MESHX_TXCM_SIG_DIRECT_SEND.
[in] | msg_param | Pointer to the model specific parameter structure |
[in] | msg_param_len | Length of the msg_param |
Definition at line 94 of file meshx_txcm.h.
typedef struct meshx_txcm_request meshx_txcm_request_t |
Structure for Tx Control module requests.
This structure holds the details of a transmission request, including the type of signal, the send function callback, and parameters for the message to be transmitted.
Enumeration of message states for the Tx Control Module.
This enumeration defines the different states a message can be in during transmission, including new messages, waiting for acknowledgment, acknowledged messages, and the maximum state value.
Definition at line 71 of file meshx_txcm.h.
Enumerator | |
---|---|
MESHX_TXCM_MSG_TYPE_ACKED | |
MESHX_TXCM_MSG_TYPE_UNACKED | |
MESHX_TXCM_MSG_TYPE_MAX |
Definition at line 82 of file meshx_txcm.h.
enum meshx_txcm_sig_t |
Enumeration of signal types for the Tx Control Module.
This enumeration defines the different types of signals that can be sent to the Tx Control Module, each representing a different type of transmission command.
Definition at line 56 of file meshx_txcm.h.
meshx_err_t meshx_txcm_event_cb_reg | ( | meshx_txcm_cb_t | event_cb | ) |
Registers a callback function for handling Tx Control module events.
This function registers a callback function to handle specific events from the Tx Control module. The callback will be invoked when the specified event occurs.
[in] | event_cb | Pointer to the callback function to be registered for event handling. |
meshx_err_t meshx_txcm_init | ( | dev_struct_t * | pdev | ) |
Initializes the MeshX Tx Control Module.
This function sets up the transmission control module for MeshX. It checks if the module has already been initialized using an initialization magic value. If not initialized, it sets the magic value, assigns the provided device structure to the task argument, and creates the Tx Control task.
[in] | pdev | Pointer to the device structure to be used by the Tx Control Module. |
meshx_err_t meshx_txcm_request_send | ( | meshx_txcm_sig_t | request_type, |
uint16_t | dest_addr, | ||
meshx_cptr_t | msg_param, | ||
uint16_t | msg_param_len, | ||
meshx_txcm_fn_model_send_t | send_fn ) |
Sends a request to the Tx Control module.
This function sends a request to the Tx Control module with the specified parameters. It creates a new request structure, copies the message parameters, and sends the request to the signal queue of the Tx Control module.
[in] | request_type | Type of the request (ACK, RESEND, ENQ_SEND, DIRECT_SEND) |
[in] | dest_addr | Destination address of the message |
[in] | msg_param | Pointer to the message parameters |
[in] | msg_param_len | Length of the message parameters |
[in] | send_fn | Function pointer to the send function to be used for the request |