#ifndef STATE_h #define STATE_h #include "json/single_include/nlohmann/json.hpp" #include #include using json = nlohmann::json; using namespace std; enum Action { NONE, LOAD, DISPLAY, STOP }; enum Mode { RGB, BW, INVERT, BW_INVERT, RGB_CHANNELS, INVERT_CHANNELS }; class State { private: Action action = STOP; Mode mode = RGB; string image; vector exposure = {}; uint64_t x; uint64_t y; uint64_t width; uint64_t height; bool ERROR = false; void error(); bool imageExists(string& image); void setAction(json& msgData); void setImage(json& msgData); void setMode(json& msgData); void setExposure(json& msgData); void setPosition(json& msgData); public : State(); void receiveMessage(string msgString); string createMessage(bool success); Action getAction () { return action; } Mode getMode() { return mode; } string getImage () { return image; } vector getExposure() { return exposure; } vector getPosition() { return { x, y, width, height }; } bool isError () { return ERROR; } }; #endif