finished Detector tests
This commit is contained in:
@@ -12,14 +12,15 @@
|
||||
|
||||
#include "../utilities/config.h"
|
||||
|
||||
using namespace Input;
|
||||
namespace Input
|
||||
{
|
||||
|
||||
Detector::Detector(IInputGPIOInterface* input_gpio_interface, std::map<char, Event> events, IEventNotifier* event_notifier) :
|
||||
input_gpio_interface(input_gpio_interface), events(events), is_running(true), event_notifier(event_notifier)
|
||||
{
|
||||
this->detect_thread = std::thread(&Detector::detect, this);
|
||||
|
||||
CLOG(WARNING, INPUT_LOGGER) << "Created Detector";
|
||||
CLOG(INFO, INPUT_LOGGER) << "Created Detector";
|
||||
}
|
||||
|
||||
Detector::~Detector()
|
||||
@@ -68,3 +69,7 @@ bool Detector::check_inputs(char& address)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
*/
|
||||
#include "Event.h"
|
||||
|
||||
using namespace Input;
|
||||
namespace Input
|
||||
{
|
||||
|
||||
Event::Event(char address, int priority, std::string name) :
|
||||
address(address), priority(priority), name(name)
|
||||
@@ -14,7 +15,9 @@ Event::Event(char address, int priority, std::string name) :
|
||||
CLOG_IF(VLOG_IS_ON(HIGH_VERBOSITY), INFO, INPUT_LOGGER) << "Created event: " << name << ", address: " << address;
|
||||
}
|
||||
|
||||
bool Event::operator==(const Event& other)
|
||||
bool operator==(const Event& left, const Event& right)
|
||||
{
|
||||
return this->name == other.name;
|
||||
return left.name == right.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ class Event
|
||||
{
|
||||
public:
|
||||
Event(char address, int priority, std::string name);
|
||||
bool operator==(const Event& other);
|
||||
|
||||
friend bool operator==(const Event& left, const Event& right);
|
||||
friend bool operator<(const Event& left, const Event& right)
|
||||
{
|
||||
return left.priority < right.priority;
|
||||
@@ -32,10 +33,10 @@ private:
|
||||
public:
|
||||
int priority;
|
||||
std::string name;
|
||||
|
||||
|
||||
};
|
||||
|
||||
bool operator==(const Event& left, const Event& right);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user