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 control task for event handling and messaging. More...
#include <meshx_control_task.h>
Go to the source code of this file.
Functions | |
static void | control_task_handler (void *args) |
Task handler function for processing control task messages. | |
meshx_err_t | create_control_task (dev_struct_t *pdev) |
Create the control task. | |
meshx_err_t | control_task_msg_publish (control_task_msg_code_t msg_code, control_task_msg_evt_t msg_evt, const void *msg_evt_params, size_t sizeof_msg_evt_params) |
Publish a control task message. | |
meshx_err_t | control_task_msg_subscribe (control_task_msg_code_t msg_code, control_task_msg_evt_t evt_bmap, control_task_msg_handle_t callback) |
Subscribe to a control task message. | |
meshx_err_t | control_task_msg_unsubscribe (control_task_msg_code_t msg_code, control_task_msg_evt_t evt_bmap, control_task_msg_handle_t callback) |
Deregister a callback for a specific message code and event bitmap. | |
static meshx_err_t | control_task_msg_dispatch (dev_struct_t *pdev, control_task_msg_code_t msg_code, control_task_msg_evt_t evt, void *params) |
Dispatch a message to the registered callbacks. | |
static meshx_err_t | create_control_task_msg_q (void) |
Create the control task message queue. | |
Variables | |
static meshx_msg_q_t | control_task_queue |
Queue handle for control task messages. | |
static control_task_evt_cb_reg_t * | control_task_msg_code_list_heads [CONTROL_TASK_MSG_CODE_MAX] |
Linked list heads for registered callbacks per message code. | |
Implementation of control task for event handling and messaging.
Copyright © 2024 - 2025 MeshX
This file contains the implementation of a control task, including functions for creating the task, sending messages, registering message handlers, and handling events. The control task uses FreeRTOS for inter-task communication and event-driven architecture.
Definition in file meshx_control_task.c.
|
static |
Task handler function for processing control task messages.
This function runs in a loop, receiving messages from the queue and dispatching them to registered handlers. Allocated memory for message parameters is freed after processing.
[in] | args | Pointer to the device structure (dev_struct_t) passed during task creation. |
Definition at line 247 of file meshx_control_task.c.
|
static |
Dispatch a message to the registered callbacks.
This function dispatches a message to the registered handlers based on the message code and event type.
[in] | pdev | Pointer to the device structure (dev_struct_t). |
[in] | msg_code | The message code of the received message. |
[in] | evt | The event type of the received message. |
[in] | params | Pointer to the message parameters. |
Definition at line 192 of file meshx_control_task.c.
meshx_err_t control_task_msg_publish | ( | control_task_msg_code_t | msg_code, |
control_task_msg_evt_t | msg_evt, | ||
const void * | msg_evt_params, | ||
size_t | sizeof_msg_evt_params ) |
Publish a control task message.
This function allows you to publish a control task message with the given message code, event, and event parameters. The message will be sent to the control task for processing.
[in] | msg_code | The message code to publish. |
[in] | msg_evt | The event associated with the message. |
[in] | msg_evt_params | Pointer to the event parameters. |
[in] | sizeof_msg_evt_params | Size of the event parameters. |
Definition at line 66 of file meshx_control_task.c.
meshx_err_t control_task_msg_subscribe | ( | control_task_msg_code_t | msg_code, |
control_task_msg_evt_t | evt_bmap, | ||
control_task_msg_handle_t | callback ) |
Subscribe to a control task message.
This function allows you to subscribe to a specific control task message identified by the given message code. When the message is received, the specified callback function will be invoked.
[in] | msg_code | The message code to subscribe to. |
[in] | evt_bmap | The event bitmap associated with the message. |
[in] | callback | The callback function to be called when the message is received. |
Definition at line 122 of file meshx_control_task.c.
meshx_err_t control_task_msg_unsubscribe | ( | control_task_msg_code_t | msg_code, |
control_task_msg_evt_t | evt_bmap, | ||
control_task_msg_handle_t | callback ) |
Deregister a callback for a specific message code and event bitmap.
This function allows deregistering a callback handler for a specific message code and event type.
[in] | msg_code | The message code to deregister the handler for. |
[in] | evt_bmap | Bitmap of events to deregister for. |
[in] | callback | Callback function to deregister. |
Definition at line 152 of file meshx_control_task.c.
meshx_err_t create_control_task | ( | dev_struct_t * | pdev | ) |
Create the control task.
This function creates a FreeRTOS task to handle control events.
[in] | pdev | Pointer to the device structure (dev_struct_t). |
Definition at line 40 of file meshx_control_task.c.
|
static |
Create the control task message queue.
This function initializes the FreeRTOS queue for handling control task messages.
Definition at line 234 of file meshx_control_task.c.
|
static |
Linked list heads for registered callbacks per message code.
Definition at line 30 of file meshx_control_task.c.
|
static |
Queue handle for control task messages.
Definition at line 21 of file meshx_control_task.c.