basic functionality

This commit is contained in:
2025-08-21 15:54:05 +02:00
commit fc015e8958
25 changed files with 1138 additions and 0 deletions

21
src/NodeInfo.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "NodeInfo.h"
const char* statusToStr(NodeInfo::Status status) {
switch (status) {
case NodeInfo::ACTIVE: return "active";
case NodeInfo::INACTIVE: return "inactive";
case NodeInfo::DEAD: return "dead";
default: return "unknown";
}
}
void updateNodeStatus(NodeInfo &node, unsigned long now) {
unsigned long diff = now - node.lastSeen;
if (diff < NODE_INACTIVE_THRESHOLD) {
node.status = NodeInfo::ACTIVE;
} else if (diff < NODE_INACTIVE_THRESHOLD) {
node.status = NodeInfo::INACTIVE;
} else {
node.status = NodeInfo::DEAD;
}
}