#pragma once #include #include #include #include #include #include #include "spore/types/NodeInfo.h" #include "spore/types/Config.h" #include "spore/types/ApiTypes.h" #include "spore/core/Memberlist.h" class NodeContext { public: NodeContext(); NodeContext(std::initializer_list> initialLabels); ~NodeContext(); WiFiUDP* udp; String hostname; IPAddress localIP; NodeInfo self; std::unique_ptr memberList; ::Config config; std::map constructorLabels; // Labels passed to constructor (not persisted) using EventCallback = std::function; std::map> eventRegistry; using AnyEventCallback = std::function; std::vector anyEventSubscribers; void on(const std::string& event, EventCallback cb); void fire(const std::string& event, void* data); void onAny(AnyEventCallback cb); void rebuildLabels(); // Rebuild self.labels from constructorLabels + config.labels };