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_builder_api.h
Go to the documentation of this file.
1/**
2 * @file meshx_builder_api.h
3 * @brief C-compatible API for the MeshX Composition Builder.
4 *
5 * This header provides a bridge for C code (like main.c and meshx.c) to
6 * interact with the C++ fluent builder pattern.
7 *
8 * @author Pranjal Chanda
9 * @date 2024-2025
10 */
11
12#ifndef __MESHX_BUILDER_API_H__
13#define __MESHX_BUILDER_API_H__
14
15#include <meshx_common.h>
16#include <stdbool.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/**
23 * @brief Checks if a dynamic composition has been built.
24 * @return true if elements have been added via the builder, false otherwise.
25 */
27
28/**
29 * @brief Bakes the dynamic composition into the device structure.
30 * @param pdev Pointer to the device structure.
31 * @param cid Company ID.
32 * @param pid Product ID.
33 * @param vid Version ID.
34 * @return MESHX_SUCCESS on success, or error code.
35 */
36meshx_err_t meshx_builder_bake(dev_struct_t *pdev, uint16_t cid, uint16_t pid, uint16_t vid);
37
38/**
39 * @brief Adds elements of a specific type to the composition.
40 * @param type The type of element to add.
41 * @param count The number of elements of this type to add.
42 */
43void meshx_builder_add_element(meshx_element_type_t type, uint16_t count);
44
45/**
46 * @brief C-friendly builder lifecycle functions
47 */
48void meshx_builder_begin(void);
49void meshx_builder_commit(void);
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif /* __MESHX_BUILDER_API_H__ */
bool meshx_builder_is_active(void)
Checks if a dynamic composition has been built.
Definition meshx_composition_builder.cpp:98
void meshx_builder_add_element(meshx_element_type_t type, uint16_t count)
Adds elements of a specific type to the composition.
Definition meshx_composition_builder.cpp:118
void meshx_builder_commit(void)
Definition meshx_composition_builder.cpp:166
meshx_err_t meshx_builder_bake(dev_struct_t *pdev, uint16_t cid, uint16_t pid, uint16_t vid)
Bakes the dynamic composition into the device structure.
Definition meshx_composition_builder.cpp:102
void meshx_builder_begin(void)
C-friendly builder lifecycle functions.
Definition meshx_composition_builder.cpp:161
Common application definitions and includes for BLE Mesh Node.
struct dev_struct dev_struct_t
Structure representing the device composition and elements.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43