Files
spore/include/NodeContext.h

27 lines
627 B
C++

#pragma once
#include <TaskSchedulerDeclarations.h>
#include <WiFiUdp.h>
#include <map>
#include "NodeInfo.h"
#include <functional>
#include <string>
#include "Config.h"
class NodeContext {
public:
NodeContext();
~NodeContext();
Scheduler* scheduler;
WiFiUDP* udp;
String hostname;
IPAddress localIP;
std::map<String, NodeInfo>* memberList;
Config config;
using EventCallback = std::function<void(void*)>;
std::map<std::string, std::vector<EventCallback>> eventRegistry;
void on(const std::string& event, EventCallback cb);
void fire(const std::string& event, void* data);
};