|
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.
|
MeshX Tx Control Module This file contains the implementation of the MeshX Tx Control Module, which is responsible for managing transmission control in the MeshX BLE Mesh stack. More...
Data Structures | |
| struct | meshx_txcm_tx_q |
| Structure for queued transmission items in the Tx Control module. More... | |
| struct | meshx_tx_queue_t |
| Structure for the transmission queue in the Tx Control module. More... | |
Macros | |
| #define | MESHX_TXCM_INIT_MAGIC 0x4455 |
| Magic value used to check if the Tx Control module has been initialized. | |
| #define | MESHX_TXCM_TASK_STACK_SIZE 4096 |
| Stack size for the Tx Control task in bytes. | |
| #define | MESHX_TXCM_TASK_PRIO 5 |
| Priority level for the Tx Control task. | |
| #define | MESHX_TXCM_SIG_Q_LEN 10 |
| Maximum number of signals in the Tx Control signal queue. | |
| #define | MESHX_TXCM_SIG_Q_DEPTH sizeof(meshx_txcm_request_t) |
| Depth (size) of each signal queue entry. | |
Typedefs | |
| typedef meshx_err_t(* | meshx_txcm_sig_proc_t) (meshx_txcm_request_t *request) |
| Type definition for signal processing functions in the Tx Control module. | |
| typedef struct meshx_txcm_tx_q | meshx_txcm_tx_q_t |
| Structure for queued transmission items in the Tx Control module. | |
Functions | |
| static meshx_err_t | meshx_tx_queue_is_full (const meshx_tx_queue_t *q) |
| Checks if the transmission queue is full. | |
| static meshx_err_t | meshx_tx_queue_is_empty (const meshx_tx_queue_t *q) |
| Checks if the transmission queue is empty. | |
| static meshx_err_t | meshx_tx_queue_enqueue (meshx_tx_queue_t *q, const meshx_txcm_tx_q_t *item) |
| Adds an item to the transmission queue. | |
| static meshx_err_t | meshx_tx_queue_enqueue_front (meshx_tx_queue_t *q, const meshx_txcm_tx_q_t *item) |
| Adds an item to the front of the transmission queue. | |
| static void | meshx_txcm_task_handler (const dev_struct_t *args) |
| Handler function for the MeshX TXCM task. | |
| static meshx_err_t | meshx_txcm_sig_resend (meshx_txcm_request_t *request) |
| Handles the resend signal for the Tx Control module. | |
| static meshx_err_t | meshx_txcm_sig_enq_send (meshx_txcm_request_t *request) |
| Enqueues a send request to the Tx Control module. | |
| static meshx_err_t | meshx_txcm_sig_ack (const meshx_txcm_request_t *request) |
| Handles the flush signal for the Tx Control module. | |
| static meshx_err_t | meshx_txcm_sig_direct_send (meshx_txcm_request_t *request) |
| Enqueues a direct send request to the Tx Control module. | |
| static meshx_err_t | meshx_tx_queue_search (const meshx_tx_queue_t *q, const uint8_t *param, uint16_t param_len, uint16_t dest_addr) |
| Searches for a parameter in the transmission queue. | |
| static meshx_err_t | meshx_tx_queue_dequeue_at (meshx_tx_queue_t *q, int16_t index, meshx_txcm_tx_q_t *item) |
| Removes an item from the transmission queue. | |
| static meshx_err_t | meshx_txcm_msg_q_try_send (bool resend, uint16_t target_addr) |
| Attempts to send messages from the transmission queue. | |
| static meshx_err_t | meshx_txcm_msg_q_front_try_send (bool resend) |
| static meshx_err_t | meshx_txcm_proccess_request_msg (meshx_txcm_request_t *request, meshx_txcm_msg_type_t msg_type) |
| Processes a request message for the Tx Control module. | |
| 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. | |
Variables | |
| struct { | |
| uint16_t init_magic | |
| meshx_task_t txcm_task | |
| meshx_msg_q_t txcm_sig_queue | |
| meshx_tx_queue_t txcm_tx_queue | |
| } | g_txcm |
| Global structure for Tx Control module state and resources. | |
| static meshx_txcm_sig_proc_t | g_sig_proc_table [MESHX_TXCM_SIG_MAX] |
| Signal processing function table for the Tx Control module. | |
MeshX Tx Control Module This file contains the implementation of the MeshX Tx Control Module, which is responsible for managing transmission control in the MeshX BLE Mesh stack.
| #define MESHX_TXCM_INIT_MAGIC 0x4455 |
Magic value used to check if the Tx Control module has been initialized.
| #define MESHX_TXCM_SIG_Q_DEPTH sizeof(meshx_txcm_request_t) |
Depth (size) of each signal queue entry.
| #define MESHX_TXCM_SIG_Q_LEN 10 |
Maximum number of signals in the Tx Control signal queue.
| #define MESHX_TXCM_TASK_PRIO 5 |
Priority level for the Tx Control task.
| #define MESHX_TXCM_TASK_STACK_SIZE 4096 |
Stack size for the Tx Control task in bytes.
| typedef meshx_err_t(* meshx_txcm_sig_proc_t) (meshx_txcm_request_t *request) |
Type definition for signal processing functions in the Tx Control module.
A signal processing function takes a pointer to a transmission control request structure and processes the request accordingly.
| typedef struct meshx_txcm_tx_q meshx_txcm_tx_q_t |
Structure for queued transmission items in the Tx Control module.
This structure represents an item in the transmission queue, containing the send callback and message parameters ready for transmission.
|
static |
Removes an item from the transmission queue.
This function removes an item from the transmission queue. The item is a pointer to the meshx_txcm_tx_q_t structure to be removed.
| [in] | q | Pointer to the transmission queue structure to remove the item from. |
| [in] | index | Index of the item to dequeue. |
| [out] | item | Pointer to the meshx_txcm_tx_q_t structure to store the removed item. |
|
static |
Adds an item to the transmission queue.
This function adds an item to the transmission queue. The item is a pointer to the meshx_txcm_tx_q_t structure to be added.
| [in] | q | Pointer to the transmission queue structure to add the item to. |
| [in] | item | Pointer to the meshx_txcm_tx_q_t structure to be added. |
|
static |
Adds an item to the front of the transmission queue.
This function adds an item to the front of the transmission queue. The item is a pointer to the meshx_txcm_tx_q_t structure to be added.
| [in] | q | Pointer to the transmission queue structure to add the item to. |
| [in] | item | Pointer to the meshx_txcm_tx_q_t structure to be added. |
|
static |
Checks if the transmission queue is empty.
This function checks if the count of messages in the transmission queue has reached zero.
| [in] | q | Pointer to the transmission queue structure to be checked. |
|
static |
Checks if the transmission queue is full.
This function checks if the count of messages in the transmission queue has reached the maximum capacity.
| [in] | q | Pointer to the transmission queue structure to be checked. |
|
static |
Searches for a parameter in the transmission queue.
| [in] | q | Pointer to the transmission queue structure to search in. |
| [in] | param | Pointer to the uint8_t array to search for. |
| [in] | param_len | Length of the parameter array. |
| [in] | dest_addr | Destination address associated with the parameter. |
| 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. |
|
static |
|
static |
Attempts to send messages from the transmission queue.
| [in] | resend | True if this is a resend attempt. |
| [in] | target_addr | Target address for the message. |
|
static |
Processes a request message for the Tx Control module.
This function handles the processing of a request message for the Tx Control module. It checks if the request is valid, creates a new transmission entry with a sequence number, and then queues the message to the transmission queue. If the queued message is at the front of the queue, it immediately processes the send function.
| [in] | request | Pointer to the transmission control request structure containing the send msg |
| [in] | msg_type | Type of the message (ACKED or UNACKED) |
| 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 |
|
static |
Handles the flush signal for the Tx Control module.
This function clears all messages from the transmission queue of the Tx Control module. It removes only front message from the queue and returns the status of the operation.
| [in] | request | Pointer to the transmission control request structure containing the flush request |
|
static |
Enqueues a direct send request to the Tx Control module.
This function adds a direct send request to the transmission queue of the Tx Control module. It checks if the request is valid, creates a new transmission entry with a sequence number, and then queues the message to the transmission queue. If the queued message is at the front of the queue, it immediately processes the send function.
| [in] | request | Pointer to the transmission control request structure containing the send msg |
|
static |
Enqueues a send request to the Tx Control module.
This function adds a send request to the transmission queue of the Tx Control module. It checks if the request is valid, creates a new transmission entry with a sequence number, and then queues the message to the transmission queue. If the queued message is at the front of the queue, it immediately processes the send function.
| [in] | request | Pointer to the transmission control request structure containing the send msg |
|
static |
Handles the resend signal for the Tx Control module.
| [in] | request | Pointer to the transmission control request structure containing the send msg |
|
static |
Handler function for the MeshX TXCM task.
This static function processes transmission commands for the MeshX component. It is intended to be run as a task handler, typically within a FreeRTOS or similar multitasking environment.
| [in] | args | Pointer to a device structure (dev_struct_t) containing context or parameters required for the task operation. |
|
static |
Signal processing function table for the Tx Control module.
This table maps signal types to their corresponding processing functions. Each entry in the table is a function pointer that handles a specific type of signal. The table is indexed by the signal type (meshx_txcm_sig_t) and contains function pointers to the respective signal processing functions.
| struct { ... } g_txcm |
Global structure for Tx Control module state and resources.
This static structure manages the initialization state, task configuration, and queues for signals and transmissions in the Tx Control module.
| uint16_t init_magic |
| meshx_msg_q_t txcm_sig_queue |
| meshx_task_t txcm_task |
| meshx_tx_queue_t txcm_tx_queue |