42 lines
755 B
C++
42 lines
755 B
C++
/*
|
|
* Event.cpp
|
|
*
|
|
* Created on: Jun 15, 2018
|
|
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
|
*/
|
|
#include "input/Event.h"
|
|
|
|
#include "json/json.hpp"
|
|
|
|
#include "utility/config.h"
|
|
|
|
namespace flippR_driver
|
|
{
|
|
namespace input
|
|
{
|
|
|
|
Event::Event(uint8_t address, int priority, std::string name) :
|
|
address(address), priority(priority), name(name)
|
|
{
|
|
CLOG_IF(VLOG_IS_ON(0), INFO, INPUT_LOGGER) << "Created event: " << name << ", address: " << address;
|
|
}
|
|
|
|
std::string Event::getJsonString()
|
|
{
|
|
nlohmann::json json;
|
|
|
|
json["name"] = this->name;
|
|
json["address"] = this->address;
|
|
json["priority"] = this->priority;
|
|
|
|
return json.dump();
|
|
}
|
|
|
|
bool operator==(const Event& left, const Event& right)
|
|
{
|
|
return left.name == right.name;
|
|
}
|
|
|
|
}
|
|
}
|