/**
 * Anatole SCHRAMM-HENRY
 * 27/04/2020 à 19:45
 * Tested, working
 */
#ifndef EVENTHANDLER_H
#define EVENTHANDLER_H
#include "definition.h"
#include "Queue.h"

class EventHandler
{
  public:
    enum Event {NO_EVENT = -1,FLASH_BUTTON_PRESS, FLASH_BUTTON_LONG_PRESS};
    EventHandler(uint8_t queueSize = 10);
    void run();
    Event getEvent();
  protected:
  private:
    void addEventCheckSizeLimit(Event e);
    
    Queue<Event> _eventQueue;
    uint8_t _maxQueueSize;
    unsigned long _flashBtnTs = 0, _flashBtnDebounceTs = 0;
    boolean _flashBtnPushed = false, _flashBtnLongPressFired = false;
};

#endif //EVENTHANDLER_H
