refactor with logging
This commit is contained in:
1
FlippR-Driver/Matrix_Config.json
Normal file
1
FlippR-Driver/Matrix_Config.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -5,6 +5,10 @@
|
|||||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
|
#include "../utilities/config.h"
|
||||||
|
|
||||||
#include "EventNotifier.h"
|
#include "EventNotifier.h"
|
||||||
|
|
||||||
namespace Input
|
namespace Input
|
||||||
@@ -50,8 +54,13 @@ void EventNotifier::notify()
|
|||||||
std::lock_guard<std::mutex> event_handler_guard(event_handler_mutex);
|
std::lock_guard<std::mutex> event_handler_guard(event_handler_mutex);
|
||||||
for(auto handler : event_handler)
|
for(auto handler : event_handler)
|
||||||
{
|
{
|
||||||
// todo timeout!
|
boost::thread handler_caller(handler, &EventHandler::handle, event);
|
||||||
handler->handle(event);
|
|
||||||
|
if(!handler_caller.timed_join(boost::posix_time::milliseconds(HANDLER_TIMEOUT)))
|
||||||
|
{
|
||||||
|
CLOG(WARNING, INPUT_LOGGER) << "Handler " << typeid(handler).name() << " didn't finish in "
|
||||||
|
<< HANDLER_TIMEOUT << " milliseconds. Aborting Execution!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include "Event.hpp"
|
#include "Event.hpp"
|
||||||
#include "EventHandler.hpp"
|
#include "EventHandler.hpp"
|
||||||
|
|
||||||
|
#define HANDLER_TIMEOUT 2000
|
||||||
|
|
||||||
namespace Input
|
namespace Input
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
#define MATRIX_SIZE 8
|
#define INPUT_MATRIX_SIZE 8
|
||||||
|
|
||||||
class InputGPIOInterface : GPIOInterface
|
class InputGPIOInterface : GPIOInterface
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,4 +5,8 @@
|
|||||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../lib/easylogging/easylogging++.h"
|
||||||
|
|
||||||
#define INPUT_LOGGER "input_logger"
|
#define INPUT_LOGGER "input_logger"
|
||||||
|
|
||||||
|
#define INPUT_MATRIX_SIZE 8
|
||||||
|
|||||||
Reference in New Issue
Block a user