Skip to content

Interface IEnvironmentMonitor

Namespace: Belay.Core.Examples
Assembly: Belay.Core.dll

Interface demonstrating comprehensive attribute-driven device programming. This environmental monitoring device showcases the complete lifecycle using [Setup], [Task], [Thread], and [Teardown] attributes with method interception.

csharp
public interface IEnvironmentMonitor

Remarks

This interface shows how to build complex device behavior using only attributes and Python code embedding, eliminating the need for manual ExecuteAsync calls. The method interception system automatically handles Python code execution.

Methods

CalibrateSensorsAsync(float, float)

Perform sensor calibration routine. This should be done in known environmental conditions.

CleanupHardwareAsync()

Clean up hardware resources and put sensors in safe state. This runs last during disconnection.

GetCurrentReadingAsync()

Read current environmental conditions from all sensors.

GetDiagnosticsAsync()

Get device diagnostics and sensor health information.

InitializeHardwareAsync()

Initialize hardware pins and basic sensor configuration. This runs first during device connection.

InitializeMonitoringStateAsync()

Initialize global monitoring state and data structures. This runs last in the setup sequence.

LoadCalibrationAsync()

Load calibration data and configure sensor parameters. This runs after hardware initialization.

SaveDataAsync()

Save current data buffer and statistics to persistent storage. This runs after stopping threads but before hardware cleanup.

StartContinuousMonitoringAsync(int)

Start continuous environmental monitoring in a background thread. Data is collected at the specified interval and can trigger alerts.

StartHealthWatchdogAsync()

Start a watchdog thread that monitors system health.

StopBackgroundThreadsAsync()

Stop all background monitoring threads. This runs first during disconnection.

StopMonitoringAsync()

Stop continuous monitoring thread.

Released under the Apache License 2.0.