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