- Restructure include/ and src/ directories with logical grouping - Move core components to spore/core/ (NodeContext, NetworkManager, TaskManager, ClusterManager, ApiServer) - Move services to spore/services/ (NodeService, NetworkService, ClusterService, TaskService) - Move types to spore/types/ (NodeInfo, ApiTypes, Config) - Move internal components to spore/internal/ (Globals) - Update all #include statements to use new namespace paths - Update platformio.ini build filters for all environments - Update all example files to use new include paths - Maintain backward compatibility for public API - Improve code organization, maintainability, and scalability This reorganization follows modern C++ project structure patterns and provides clear separation between public API, internal implementation, and utilities. All examples compile successfully with the new structure.
27 lines
907 B
C++
27 lines
907 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
// Cluster protocol and API constants
|
|
namespace ClusterProtocol {
|
|
constexpr const char* DISCOVERY_MSG = "CLUSTER_DISCOVERY";
|
|
constexpr const char* RESPONSE_MSG = "CLUSTER_RESPONSE";
|
|
constexpr uint16_t UDP_PORT = 4210;
|
|
constexpr size_t UDP_BUF_SIZE = 64;
|
|
constexpr const char* API_NODE_STATUS = "/api/node/status";
|
|
}
|
|
|
|
namespace TaskIntervals {
|
|
constexpr unsigned long SEND_DISCOVERY = 1000;
|
|
constexpr unsigned long LISTEN_FOR_DISCOVERY = 100;
|
|
constexpr unsigned long UPDATE_STATUS = 1000;
|
|
constexpr unsigned long PRINT_MEMBER_LIST = 5000;
|
|
constexpr unsigned long HEARTBEAT = 2000;
|
|
constexpr unsigned long UPDATE_ALL_MEMBERS_INFO = 10000;
|
|
}
|
|
|
|
constexpr unsigned long NODE_ACTIVE_THRESHOLD = 10000;
|
|
constexpr unsigned long NODE_INACTIVE_THRESHOLD = 60000;
|
|
constexpr unsigned long NODE_DEAD_THRESHOLD = 120000;
|
|
|