25 lines
687 B
C++
25 lines
687 B
C++
#pragma once
|
|
#include "Globals.h"
|
|
#include <IPAddress.h>
|
|
#include <vector>
|
|
#include <tuple>
|
|
|
|
struct NodeInfo {
|
|
String hostname;
|
|
IPAddress ip;
|
|
unsigned long lastSeen;
|
|
enum Status { ACTIVE, INACTIVE, DEAD } status;
|
|
struct Resources {
|
|
uint32_t freeHeap = 0;
|
|
uint32_t chipId = 0;
|
|
String sdkVersion;
|
|
uint32_t cpuFreqMHz = 0;
|
|
uint32_t flashChipSize = 0;
|
|
} resources;
|
|
unsigned long latency = 0; // ms since lastSeen
|
|
std::vector<std::tuple<String, int>> apiEndpoints; // List of registered endpoints
|
|
};
|
|
|
|
const char* statusToStr(NodeInfo::Status status);
|
|
void updateNodeStatus(NodeInfo &node, unsigned long now = millis());
|