Skip to content
Snippets Groups Projects
powerproc.hpp 849 B
Newer Older
#pragma once
#include <Arduino.h>

#define STAGESCOUNT 2

class PowerProcedure {
private:
    String currentStage;       // Stores the current stage name
    int currentChannel;        // Stores the current channel
    uint8_t stagesCount;       // Stores the quantity of power stages
    struct Stage {
        String name;           // Name of the stage (e.g., "ASICS")
        int* channels;         // Pointer to dynamically allocated channel array
        size_t size;           // Number of channels in the stage
    };
    Stage* stages;             // Array to hold stages
    const IPAddress ipAddr;    // Stores the IP address

    PowerProcedure(const IPAddress& ipAddr);
    ~PowerProcedure();

    bool powerOn(const String& stage);
    bool powerOff(const String& stage);
    String toJSON();
};

extern PowerProcedure pproc;