34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
#pragma once
|
|
#include "spore/Service.h"
|
|
#include "spore/core/NodeContext.h"
|
|
#include "PixelStreamController.h"
|
|
#include <ArduinoJson.h>
|
|
#include <LittleFS.h>
|
|
#include "spore/util/Logging.h"
|
|
|
|
// PixelStreamConfig is defined in PixelStreamController.h
|
|
|
|
class PixelStreamService : public Service {
|
|
public:
|
|
PixelStreamService(NodeContext& ctx, ApiServer& apiServer, PixelStreamController* controller);
|
|
void registerEndpoints(ApiServer& api) override;
|
|
void registerTasks(TaskManager& taskManager) override;
|
|
const char* getName() const override { return "PixelStream"; }
|
|
|
|
// Config management
|
|
PixelStreamConfig loadConfig();
|
|
bool saveConfig(const PixelStreamConfig& config);
|
|
void setController(PixelStreamController* ctrl) { controller = ctrl; }
|
|
|
|
private:
|
|
NodeContext& ctx;
|
|
ApiServer& apiServer;
|
|
PixelStreamController* controller;
|
|
|
|
void handleConfigRequest(AsyncWebServerRequest* request);
|
|
void handleGetConfigRequest(AsyncWebServerRequest* request);
|
|
|
|
static const char* CONFIG_FILE() { return "/pixelstream.json"; }
|
|
};
|
|
|