feat: add src/reading.cpp

This commit is contained in:
2026-09-25 11:56:53 +08:00
parent bdb50a9175
commit 08cc51fa4f

10
src/reading.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include "reading.hpp"
#include <cmath>
ChannelAssessment assess_channel(const Reading& reading, std::int64_t now_ms) {
if (reading.timestamp_ms > now_ms || now_ms - reading.timestamp_ms > 5000)
return {reading, ChannelState::Stale};
if (!std::isfinite(reading.celsius) || reading.celsius < -40.0 || reading.celsius > 125.0)
return {reading, ChannelState::OutOfRange};
return {reading, ChannelState::Healthy};
}