51 lines
846 B
C++
51 lines
846 B
C++
//
|
|
// Created by rhetenor on 21.09.18.
|
|
//
|
|
|
|
#ifndef flippR_driver_DISTRIBUTINGEVENT_H
|
|
#define flippR_driver_DISTRIBUTINGEVENT_H
|
|
|
|
#include "input/Event.h"
|
|
#include "input/EventNotifier.h"
|
|
|
|
namespace flippR_driver
|
|
{
|
|
namespace input
|
|
{
|
|
|
|
class DistributingEvent : public Event
|
|
{
|
|
public:
|
|
DistributingEvent(uint8_t address, int priority, std::string name,
|
|
std::chrono::milliseconds bounce_time, std::shared_ptr<EventNotifier> event_notifier);
|
|
|
|
void active();
|
|
void inactive();
|
|
|
|
private:
|
|
bool is_bouncing();
|
|
|
|
void distribute();
|
|
|
|
public:
|
|
const std::chrono::milliseconds bounce_time;
|
|
|
|
private:
|
|
enum ActivationState
|
|
{
|
|
NOT_ACTIVATED,
|
|
FIRST_ACTIVATED,
|
|
ACTIVATED
|
|
};
|
|
|
|
const std::shared_ptr<EventNotifier> event_notifier;
|
|
|
|
ActivationState activation_state;
|
|
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif //flippR_driver_DISTRIBUTINGEVENT_H
|