TinyMeasurement HEADER FILE¶
Info
This is the main header file of the TinyMeasurement library. It includes all necessary header files and provides a unified interface to use the functions of the library. After completing the porting of this library in the project, you can insert this header file where you want to use the relevant functions to use all functions in the library. The documentation update speed is slow and may not be consistent with the actual code, please refer to the actual code.
OVERVIEW¶
The tiny_measurement.h header file serves as the unified entry point for all measurement functionality in the TinyMeasurement middleware. By including this single header file, you gain access to:
- Online Sensing: Real-time continuous sensor data acquisition with configurable sampling rates, supporting MQTT transmission, serial output, and optional LCD display
- Offline Sensing: High-frequency batch data collection for detailed analysis, with support for memory buffer and SD card storage
- Command Handler: MQTT-based remote control interface for managing sensing operations
MODULE STRUCTURE¶
The header file organizes functionality into three main modules, each with its own sub-header file that is automatically included when you include tiny_measurement.h.
The following diagram illustrates the module hierarchy and dependencies:
tiny_measurement_config.h
(Configuration & Macros)
|
+------------------+------------------+
| | |
v v v
online_sensing.h offline_sensing.h sensing_command.h
(Online Sensing) (Offline Sensing) (Command Handler)
| | |
+------------------+------------------+
|
v
tiny_measurement.h
(Unified Entry Point)
Structure Explanation:
-
tiny_measurement_config.h: The foundation configuration file that defines all default settings and macros. It is included by all sub-modules.
-
Sub-modules: Three independent modules that depend on the configuration:
online_sensing.h: Real-time continuous data acquisitionoffline_sensing.h: High-frequency batch data collection-
sensing_command.h: MQTT command handling interface -
tiny_measurement.h: The main header file that includes the configuration and all three sub-modules, providing a unified interface for the entire measurement system.
CODE¶
/**
* @file tiny_measurement.h
* @author SHUAIWEN CUI (SHUAIWEN001@e.ntu.edu.sg)
* @brief tiny_measurement | Main header file - Unified entry point for all measurement functionality
* @version 1.0
* @date 2025-12-17
* @copyright Copyright (c) 2025
*
* @details
* This header file provides a unified interface to all measurement functionality
* in the tiny_measurement middleware. It includes:
*
* - Online Sensing: Continuous sensor data acquisition and transmission
* - Offline Sensing: Batch data collection and processing
*
* Usage:
* Simply include this header to access all measurement functions:
* @code
* #include "tiny_measurement.h"
* @endcode
*/
#pragma once
/* ============================================================================
* DEPENDENCIES
* ============================================================================ */
// Core configuration
#include "tiny_measurement_config.h"
/* ============================================================================
* ONLINE SENSING MODULES
* ============================================================================ */
/**
* @name Online Sensing
* @brief Continuous sensor data acquisition and transmission
* @details
* - Configurable sampling frequency
* - MQTT transmission support
* - Serial output support
* - Online data streaming
*/
#include "online_sensing.h"
/* ============================================================================
* OFFLINE SENSING MODULES
* ============================================================================ */
/**
* @name Offline Sensing
* @brief High-frequency batch sensor data acquisition and storage
* @details
* - High-frequency sampling (default: 100 Hz)
* - Configurable sampling duration
* - Memory buffer storage
* - SD card storage
* - MQTT report after sampling
*/
#include "offline_sensing.h"
/* ============================================================================
* COMMAND HANDLER MODULE
* ============================================================================ */
/**
* @name Sensing Command Handler
* @brief MQTT remote control command handler for sensing modules
* @details
* - Parse and execute MQTT commands
* - Control online and offline sensing
* - Support for scheduled and delayed sensing
*/
#include "sensing_command.h"
/* ============================================================================
* C++ COMPATIBILITY
* ============================================================================ */
#ifdef __cplusplus
extern "C"
{
#endif
// All measurement functions are C-compatible and can be called from C++
#ifdef __cplusplus
}
#endif