espleaf/include/state.h

26 lines
667 B
C++

#pragma once
#include <Arduino.h>
#include <ArduinoJson.h>
#include "prototypes.h"
class State {
AnimationMode _mode = AM_NONE;
uint16_t _duration = 0;
int16_t _brightness = -1;
uint8_t _speedup = 0;
CRGB _color = CRGB::Black;
public:
void parse_json(char* str);
void set(String key, String value);
void commit();
static void publish_current_state();
void parse_state(String state);
void parse_mode(String mode);
void set_mode(AnimationMode mode);
void set_duration(uint16_t duration);
void set_brightness(uint8_t brightness);
void set_color(JsonObject rgb);
void set_speedup(uint8_t speedup);
};