fixed distribution event

This commit is contained in:
Jonas Zeunert
2018-09-27 14:18:51 +02:00
parent fc7cdb2a7a
commit e15e2d1152
4 changed files with 60 additions and 43 deletions

View File

@@ -16,17 +16,30 @@ class DistributingEvent : public Event
{
public:
DistributingEvent(char address, int priority, std::string name,
std::chrono::milliseconds deactivation_time, std::shared_ptr<IEventNotifier> event_notifier);
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 deactivation_time;
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;
};
}