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_device.hpp
Go to the documentation of this file.
1/**
2 * @file meshx_device.hpp
3 * @brief C++ Wrapper for dev_struct_t to provide high-level management and visualization.
4 *
5 * @author Pranjal Chanda
6 * @date 2024-2025
7 */
8
9#ifndef __MESHX_DEVICE_HPP__
10#define __MESHX_DEVICE_HPP__
11
12#include <meshx_fwd_decl.hpp>
13
14/**
15 * @class meshXDevice
16 * @brief Singleton wrapper for the raw C dev_struct_t.
17 * @details This class provides a bridge between the C-centric device structure
18 * and the rich C++ element/model system.
19 */
21public:
22 /**
23 * @brief Get the singleton instance
24 */
25 static meshXDevice& get_instance();
26
27 /**
28 * @brief Initialize the device wrapper with a raw C struct
29 * @param pdev Pointer to the dev_struct_t
30 */
32 this->pdev = pdev;
33 }
34
35 /**
36 * @brief Get the underlying C structure
37 */
39
40 /**
41 * @brief Check if initialized
42 */
43 bool is_initialized() const { return pdev != nullptr; }
44
45 /**
46 * @brief Visualize the current composition and element status
47 */
48 void visualize_status();
49
50private:
51 meshXDevice() : pdev(nullptr) {}
52 ~meshXDevice() = default;
53
55};
56
57#endif /* __MESHX_DEVICE_HPP__ */
dev_struct_t * pdev
Definition meshx_device.hpp:54
void init(dev_struct_t *pdev)
Initialize the device wrapper with a raw C struct.
Definition meshx_device.hpp:31
~meshXDevice()=default
static meshXDevice & get_instance()
Get the singleton instance.
Definition meshx_device.cpp:14
void visualize_status()
Visualize the current composition and element status.
Definition meshx_device.cpp:19
dev_struct_t * get_raw_struct()
Get the underlying C structure.
Definition meshx_device.hpp:38
bool is_initialized() const
Check if initialized.
Definition meshx_device.hpp:43
meshXDevice()
Definition meshx_device.hpp:51
struct dev_struct dev_struct_t
Structure representing the device composition and elements.
Forward declaration of MeshX classes.