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.
|
This file contains the implementation of the provisioning process for the BLE mesh node. More...
#include "string.h"
#include "meshx_nvs.h"
#include "meshx_os_timer.h"
#include "meshx_control_task.h"
#include "meshx_prov_srv.h"
Go to the source code of this file.
Data Structures | |
struct | prov_cb_evt_ctrl_task_evt_table |
Structure to map provisioning callback events to control task events. More... | |
Macros | |
#define | CONTROL_TASK_PROV_EVT_MASK |
Mask for control task provisioning events. | |
#define | MESHX_PROV_SRV_CLIENT_EVENT_BMAP CONTROL_TASK_MSG_EVT_SYSTEM_FRESH_BOOT |
#define | MESHX_PROV_SRV_SERVER_EVENT_BMAP CONTROL_TASK_MSG_EVT_EN_NODE_PROV |
Typedefs | |
typedef struct prov_cb_evt_ctrl_task_evt_table | prov_cb_evt_ctrl_task_evt_table_t |
Structure to map provisioning callback events to control task events. | |
Functions | |
static meshx_err_t | meshx_prov_srv_control_task_handler (dev_struct_t *pdev, control_task_msg_evt_t evt, meshx_prov_srv_param_t *params) |
Control task handler for the provisioning server. | |
static void | meshx_handle_node_reset (dev_struct_t *pdev) |
Handle node reset event. | |
static meshx_err_t | meshx_prov_control_task_handler (dev_struct_t *pdev, control_task_msg_evt_t evt, void *params) |
Handles provisioning control task events. | |
static meshx_err_t | meshx_prov_srv_meshx_reg_cb (void) |
Register the BLE Mesh provisioning callback for MeshX Layer Internal. | |
static void | meshx_init_freshboot_timer_trigger_cb (const meshx_os_timer_t *p_timer) |
Callback function for the boot timer. | |
static meshx_err_t | meshx_init_freshboot_timer (dev_struct_t *p_dev, uint16_t timeout_ms) |
Initializes the fresh boot timer. | |
static meshx_err_t | meshx_prov_srv_reg_from_ble_cb (void) |
Register the BLE Mesh provisioning callback. | |
meshx_err_t | meshx_init_prov (dev_struct_t *p_dev, const meshx_prov_params_t *prov_cfg) |
Initialize provisioning parameters. | |
meshx_err_t | meshx_prov_srv_reg_el_client_cb (prov_srv_cb_t cb) |
Register a callback function for provisioning events. | |
meshx_err_t | meshx_prov_srv_reg_el_server_cb (prov_srv_cb_t cb) |
Register a callback function for provisioning events. | |
meshx_err_t | meshx_prov_srv_notify_plat_event (meshx_prov_srv_param_t *param) |
Notify the model event to the application. | |
Variables | |
static prov_cb_evt_ctrl_task_evt_table_t | prov_cb_evt_ctrl_task_evt_table [MESHX_PROV_EVT_MAX] |
Table mapping provisioning events to control task events. | |
static meshx_os_timer_t * | g_boot_timer |
This file contains the implementation of the provisioning process for the BLE mesh node.
Copyright © 2024 - 2025 MeshX
The provisioning process is responsible for setting up the BLE mesh node, including initializing necessary components and handling communication with other nodes.
Definition in file meshx_prov_srv.c.
#define CONTROL_TASK_PROV_EVT_MASK |
Mask for control task provisioning events.
This macro defines a mask that combines multiple control task message events related to provisioning.
Definition at line 27 of file meshx_prov_srv.c.
#define MESHX_PROV_SRV_CLIENT_EVENT_BMAP CONTROL_TASK_MSG_EVT_SYSTEM_FRESH_BOOT |
Definition at line 32 of file meshx_prov_srv.c.
#define MESHX_PROV_SRV_SERVER_EVENT_BMAP CONTROL_TASK_MSG_EVT_EN_NODE_PROV |
Definition at line 33 of file meshx_prov_srv.c.
typedef struct prov_cb_evt_ctrl_task_evt_table prov_cb_evt_ctrl_task_evt_table_t |
Structure to map provisioning callback events to control task events.
This structure contains a string representation of the provisioning event and the corresponding control task event.
|
static |
Handle node reset event.
This function handles the node reset event by removing all element contexts from NVS and resetting the MCU.
[in] | pdev | Pointer to the device structure. |
Definition at line 148 of file meshx_prov_srv.c.
|
static |
Initializes the fresh boot timer.
[in] | p_dev | Pointer to the device structure. |
[in] | timeout_ms | Timeout duration in milliseconds. |
Definition at line 254 of file meshx_prov_srv.c.
|
static |
Callback function for the boot timer.
This function is called when the boot timer expires.
[in] | p_timer | Pointer to the timer structure. |
Definition at line 230 of file meshx_prov_srv.c.
meshx_err_t meshx_init_prov | ( | dev_struct_t * | p_dev, |
const meshx_prov_params_t * | prov_cfg ) |
Initialize provisioning parameters.
This function initializes the provisioning parameters by copying the UUID from the provided server configuration and registering the provisioning callback.
[in] | p_dev | Pointer to the device structure. |
[in] | prov_cfg | Pointer to the provisioning parameters structure containing the UUID. |
Definition at line 313 of file meshx_prov_srv.c.
|
static |
Handles provisioning control task events.
This function processes various provisioning-related events and updates the device structure accordingly. It handles events such as provisioning completion and identification start.
[in] | pdev | Pointer to the device structure. |
[in] | evt | The control task message event type. |
[in] | params | Pointer to the event parameters. |
Definition at line 181 of file meshx_prov_srv.c.
|
static |
Control task handler for the provisioning server.
[in] | pdev | Pointer to the device structure. |
[in] | evt | Event type. |
[in] | params | Pointer to the provisioning server parameters. |
Definition at line 95 of file meshx_prov_srv.c.
|
static |
Register the BLE Mesh provisioning callback for MeshX Layer Internal.
This function registers the BLE Mesh provisioning callback to handle provisioning events.
Definition at line 215 of file meshx_prov_srv.c.
meshx_err_t meshx_prov_srv_notify_plat_event | ( | meshx_prov_srv_param_t * | param | ) |
Notify the model event to the application.
This function notifies the application of a model event by invoking the registered provisioning callback with the provided event parameters.
[in] | param | Pointer to the event parameters structure. |
Definition at line 402 of file meshx_prov_srv.c.
meshx_err_t meshx_prov_srv_reg_el_client_cb | ( | prov_srv_cb_t | cb | ) |
Register a callback function for provisioning events.
This function registers a callback function that will be called when certain provisioning events occur.
[in] | cb | The callback function to register. |
Definition at line 357 of file meshx_prov_srv.c.
meshx_err_t meshx_prov_srv_reg_el_server_cb | ( | prov_srv_cb_t | cb | ) |
Register a callback function for provisioning events.
This function registers a callback function that will be called when certain provisioning events occur.
[in] | cb | The callback function to register. |
Definition at line 378 of file meshx_prov_srv.c.
|
static |
Register the BLE Mesh provisioning callback.
This function registers the BLE Mesh provisioning callback to handle provisioning events.
Definition at line 291 of file meshx_prov_srv.c.
|
static |
Definition at line 84 of file meshx_prov_srv.c.
|
static |
Table mapping provisioning events to control task events.
This table is indexed by provisioning event types and contains the string representation of the event and the corresponding control task event.
Definition at line 73 of file meshx_prov_srv.c.