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.
Loading...
Searching...
No Matches
meshx_prov_srv.h File Reference

Header file for provisioning related definitions and functions. More...

Go to the source code of this file.

Functions

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.

Detailed Description

Header file for provisioning related definitions and functions.

Copyright © 2024 - 2025 MeshX

This file contains the definitions and function declarations for provisioning in the BLE mesh node application.

Author
Pranjal Chanda

Function Documentation

◆ meshx_init_prov()

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.

Parameters
[in]p_devPointer to the device structure.
[in]prov_cfgPointer to the provisioning parameters structure containing the UUID.
Returns
  • MESHX_SUCCESS: Success
  • MESHX_FAIL: Failed to register provisioning callback
252{
253 if (!prov_cfg || memcmp(prov_cfg->uuid, MESHX_UUID_EMPTY, sizeof(meshx_uuid_addr_t)) == 0)
254 {
255 MESHX_LOGE(MODULE_ID_MODEL_SERVER, "Invalid server configuration");
256 return MESHX_INVALID_ARG;
257 }
258
260 if (err != MESHX_SUCCESS)
261 {
262 MESHX_LOGE(MODULE_ID_MODEL_SERVER, "Failed to register provisioning callback");
263 return err;
264 }
265
267 if (err != MESHX_SUCCESS)
268 {
269 MESHX_LOGE(MODULE_ID_MODEL_SERVER, "Failed to register provisioning callback");
270 return err;
271 }
272
273 err = meshx_init_freshboot_timer(p_dev, prov_cfg->freshboot_timeout_ms);
274 if (err != MESHX_SUCCESS)
275 {
276 MESHX_LOGE(MODULE_ID_MODEL_SERVER, "Failed to initialize boot timer");
277 return err;
278 }
279
280 return meshx_plat_init_prov(prov_cfg->uuid);
281}
uint8_t meshx_uuid_addr_t[16]
Definition meshx_ble_mesh_cmn_def.h:649
#define MESHX_UUID_EMPTY
Definition meshx_ble_mesh_cmn_def.h:651
meshx_err_t meshx_plat_init_prov(const uint8_t *uuid)
Initialize provisioning parameters.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43
@ MESHX_INVALID_ARG
Definition meshx_err.h:46
#define MESHX_LOGE(module_id, format,...)
Definition meshx_log.h:114
**This function is called by the parent element when a state change request *is received It validates the request and returns a result to the element not the model layer **return * MESHX_SUCCESS
Definition meshx_model_level.cpp:385
static meshx_err_t meshx_init_freshboot_timer(dev_struct_t *p_dev, uint16_t timeout_ms)
Definition meshx_prov_srv.cpp:214
meshx_err_t meshx_prov_srv_reg_from_ble_cb(void)
Definition meshx_prov_srv.cpp:241
meshx_err_t meshx_prov_srv_meshx_reg_cb(void)
Definition meshx_prov_srv.cpp:189
@ MODULE_ID_MODEL_SERVER
Definition module_id.h:34
uint8_t * uuid
Definition meshx_ble_mesh_cmn.h:60
uint16_t freshboot_timeout_ms
Definition meshx_ble_mesh_cmn.h:62

◆ meshx_prov_srv_reg_el_client_cb()

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.

Parameters
[in]cbThe callback function to register.
Returns
  • MESHX_SUCCESS: Success
  • MESHX_FAIL: Failed to register the callback
284{
289 );
290}
meshx_err_t(* control_task_msg_handle_t)(dev_struct_t *pdev, control_task_msg_evt_t evt, void *params)
Function pointer type for control task message handler.
Definition meshx_control_task.h:188
@ CONTROL_TASK_MSG_CODE_PROVISION
Definition meshx_control_task.h:70
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.
Definition meshx_control_task.c:142
#define MESHX_PROV_SRV_CLIENT_EVENT_BMAP
Definition meshx_prov_srv.cpp:29

◆ meshx_prov_srv_reg_el_server_cb()

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.

Parameters
[in]cbThe callback function to register.
Returns
  • MESHX_SUCCESS: Success
  • MESHX_FAIL: Failed to register the callback
293{
298 );
299}
#define MESHX_PROV_SRV_SERVER_EVENT_BMAP
Definition meshx_prov_srv.cpp:30