From 08cc51fa4fa42d777dee08ba1148afff57be96c0 Mon Sep 17 00:00:00 2001 From: xingchen <1098756313@qq.com> Date: Fri, 25 Sep 2026 11:56:53 +0800 Subject: [PATCH] feat: add src/reading.cpp --- src/reading.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/reading.cpp diff --git a/src/reading.cpp b/src/reading.cpp new file mode 100644 index 0000000..f664bf3 --- /dev/null +++ b/src/reading.cpp @@ -0,0 +1,10 @@ +#include "reading.hpp" +#include + +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}; +}