working on big refactor
This commit is contained in:
@@ -4,20 +4,26 @@
|
||||
|
||||
#include "DistributingEvent.h"
|
||||
|
||||
flippR_driver::input::DistributingEvent::DistributingEvent(char address, int priority, std::string name,
|
||||
std::chrono::milliseconds bounce_time, std::shared_ptr<IEventNotifier> event_notifier):
|
||||
Event(address, priority, std::move(name)),
|
||||
bounce_time(bounce_time),
|
||||
event_notifier(std::move(event_notifier)),
|
||||
activation_state(NOT_ACTIVATED)
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace input
|
||||
{
|
||||
|
||||
DistributingEvent::DistributingEvent(char address, int priority, std::string name,
|
||||
std::chrono::milliseconds bounce_time, std::shared_ptr<EventNotifier> event_notifier)
|
||||
:
|
||||
Event(address, priority, std::move(name)),
|
||||
bounce_time(bounce_time),
|
||||
event_notifier(std::move(event_notifier)),
|
||||
activation_state(NOT_ACTIVATED)
|
||||
{}
|
||||
|
||||
void flippR_driver::input::DistributingEvent::distribute()
|
||||
void DistributingEvent::distribute()
|
||||
{
|
||||
event_notifier->distribute_event(*this);
|
||||
}
|
||||
|
||||
void flippR_driver::input::DistributingEvent::active()
|
||||
void DistributingEvent::active()
|
||||
{
|
||||
if(!is_bouncing())
|
||||
{
|
||||
@@ -35,7 +41,7 @@ void flippR_driver::input::DistributingEvent::active()
|
||||
}
|
||||
}
|
||||
|
||||
bool flippR_driver::input::DistributingEvent::is_bouncing()
|
||||
bool DistributingEvent::is_bouncing()
|
||||
{
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> now = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::milliseconds elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(now - last_activation);
|
||||
@@ -43,7 +49,7 @@ bool flippR_driver::input::DistributingEvent::is_bouncing()
|
||||
return elapsed_time < bounce_time;
|
||||
}
|
||||
|
||||
void flippR_driver::input::DistributingEvent::inactive()
|
||||
void DistributingEvent::inactive()
|
||||
{
|
||||
if(activation_state == ACTIVATED)
|
||||
{
|
||||
@@ -52,3 +58,5 @@ void flippR_driver::input::DistributingEvent::inactive()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user