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.h
Go to the documentation of this file.
1/**
2 * Copyright © 2024 - 2025 MeshX
3 *
4 * @file meshx.h
5 * @brief This file contains the headers for meshx.c
6 *
7 * @author Pranjal Chanda
8 */
9
10#ifndef __MESHX_H__
11#define __MESHX_H__
12
13#include <meshx_common.h>
14#include <meshx_nvs.h>
15#include <meshx_api.h>
16#include <meshx_err.h>
17#include <meshx_os_timer.h>
18#include <meshx_prov_srv.h>
19#include <meshx_config_server.h>
20#include "meshx_serial.h"
21#if CONFIG_TXCM_ENABLE
22#include <meshx_txcm.h>
23#endif /* CONFIG_TXCM_ENABLE */
25
26#include <meshx_builder_api.h>
27
28#if CONFIG_ENABLE_UNIT_TEST
29#include <unit_test.h>
30#endif /* CONFIG_ENABLE_UNIT_TEST */
31
32/**
33 * @brief Print and return error message if an error occurs.
34 *
35 * This macro prints an error message and returns the error code if an error occurs.
36 *
37 * @param _e_str Error string to print
38 * @param _err Error code to return
39 * @return Error code
40 */
41#define MESHX_ERR_PRINT_RET(_e_str, _err) \
42 if (_err != MESHX_SUCCESS) \
43 { \
44 MESHX_LOGE(MODULE_ID_COMMON, _e_str " (err 0x%x)", _err); \
45 return _err; \
46 }
47
48#define CID_ESP CONFIG_CID_ID
49
50/**
51 * @struct element_comp
52 * @brief Structure for element composition.
53 */
54typedef struct element_comp
55{
56 meshx_element_type_t type; /**< Element type */
57 uint16_t element_cnt; /**< Number of elements */
59
60/**
61 * @struct meshx_config
62 * @brief Structure for MeshX configuration.
63 */
64typedef struct meshx_config
65{
66 uint16_t cid; /**< Company ID */
67 uint16_t pid; /**< Product ID */
68 uint16_t vid; /**< Version ID */
69 char *product_name; /**< Product name */
70 uint32_t meshx_nvs_save_period; /**< NVS save period */
71 uint16_t element_comp_arr_len; /**< Length of the element composition array */
72 element_comp_t *element_comp_arr; /**< Element composition array */
73 meshx_app_data_cb_t app_element_cb; /**< Application element callback */
74 meshx_app_ctrl_cb_t app_ctrl_cb; /**< Application control callback */
75 unsigned meshx_log_level; /**< MeshX log level */
76 meshx_uuid_addr_t meshx_uuid_addr; /**< MeshX UUID address */
78
79/**
80 * @brief MeshX initialisation function
81 *
82 * This function initialises the MeshX stack with the given configuration.
83 *
84 * @param[in] config Pointer to the configuration structure
85 *
86 * @return MESHX_SUCCESS, Success
87 */
89
90#endif /* __MESHX_H__ */
struct element_comp element_comp_t
struct meshx_config meshx_config_t
meshx_err_t meshx_init(meshx_config_t const *config)
MeshX initialisation function.
Definition meshx.c:243
This file contains the API definitions for the MeshX application.
meshx_err_t(* meshx_app_data_cb_t)(const meshx_app_element_msg_header_t *msg_hdr, const meshx_data_payload_t *msg)
BLE Mesh application callback function.
Definition meshx_api.h:229
meshx_err_t(* meshx_app_ctrl_cb_t)(const meshx_ctrl_msg_header_t *msg_hdr, const meshx_ctrl_payload_t *msg)
BLE Mesh application control callback function.
Definition meshx_api.h:241
uint8_t meshx_uuid_addr_t[16]
Definition meshx_ble_mesh_cmn_def.h:649
C-compatible API for the MeshX Composition Builder.
Common application definitions and includes for BLE Mesh Node.
Header for Config Server (migrated for C++ architecture support).
MeshX Error Codes.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43
Header file for MeshX Non-Volatile Storage (NVS) operations.
Header file for OS timer utilities.
Platform abstraction layer for MeshX.
Header file for provisioning related definitions and functions.
MeshX Serial Protocol (MXSP) Definitions.
MeshX Tx Control Module This header file contains the definitions and function prototypes for the Mes...
Structure for element composition.
Definition meshx.h:55
uint16_t element_cnt
Definition meshx.h:57
meshx_element_type_t type
Definition meshx.h:56
Structure for MeshX configuration.
Definition meshx.h:65
uint16_t vid
Definition meshx.h:68
uint32_t meshx_nvs_save_period
Definition meshx.h:70
uint16_t cid
Definition meshx.h:66
unsigned meshx_log_level
Definition meshx.h:75
meshx_app_ctrl_cb_t app_ctrl_cb
Definition meshx.h:74
meshx_app_data_cb_t app_element_cb
Definition meshx.h:73
uint16_t pid
Definition meshx.h:67
uint16_t element_comp_arr_len
Definition meshx.h:71
element_comp_t * element_comp_arr
Definition meshx.h:72
meshx_uuid_addr_t meshx_uuid_addr
Definition meshx.h:76
char * product_name
Definition meshx.h:69
Header file for the production console unit test functionality.