diff --git a/FlippR-Driver/.cproject b/FlippR-Driver/.cproject index b1c3aa6..1251af0 100644 --- a/FlippR-Driver/.cproject +++ b/FlippR-Driver/.cproject @@ -1,250 +1,11 @@ -<<<<<<< HEAD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -======= - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -268,67 +29,31 @@ - + - + - + - + - + - + - - - + - - - + - + - - - - - - - - - - - + - - - - - + - - - - - - @@ -340,63 +65,20 @@ + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->>>>>>> 1f0fd916cc2f3e7edd60b5dc45f16f825c6f06db diff --git a/FlippR-Driver/build/CMakeLists.txt b/FlippR-Driver/build/CMakeLists.txt index 7b16b4b..4603238 100644 --- a/FlippR-Driver/build/CMakeLists.txt +++ b/FlippR-Driver/build/CMakeLists.txt @@ -17,29 +17,28 @@ include_directories(${SOURCE_DIR}/output) include_directories(${SOURCE_DIR}/lib) include_directories(${SOURCE_DIR}/utilities) -file(GLOB SOURCES ${SOURCE_DIR}/*/*.cpp") -file(GLOB HEADER_SOURCES ${SOURCE_DIR}/*/*.hpp") +file(GLOB SOURCES ${SOURCE_DIR}/*/*.cpp) -add_library(flippr_driver STATIC ${SOURCES} ${HEADER_SOURCES}) +add_library(flippr_driver STATIC ${SOURCES}) target_link_libraries(flippr_driver ${CMAKE_SOURCE_DIR}/lib/libwiringPi.so.2.44) -enable_testing(TRUE) +#enable_testing(TRUE) # Prepare "Catch" library for other executables -set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../src/tests) -add_library(Catch INTERFACE) -target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}/*) +#set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../src/tests) +#add_library(Catch INTERFACE) +#target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}/*) # Make test executable -set(TEST_SOURCES ${SOURCE_DIR}/../tests/input) -include_directories(${TEST_SOURCES}) -include_directories(${TEST_SOURCES}/mocks) +#set(TEST_SOURCES ${SOURCE_DIR}/../tests/input) +#include_directories(${TEST_SOURCES}) +#include_directories(${TEST_SOURCES}/mocks) -file(GLOB SOURCES ${TEST_SOURCES}/*.cpp) -file(GLOB HEADER_SOURCES ${TEST_SOURCES}/*.hpp) +#file(GLOB SOURCES ${TEST_SOURCES}/*.cpp) +#file(GLOB HEADER_SOURCES ${TEST_SOURCES}/*.hpp) -add_executable(tests ${SOURCES} ${HEADER_SOURCES}) +#add_executable(tests ${SOURCES} ${HEADER_SOURCES}) -target_link_libraries(flippr_driver) -target_link_libraries(tests Catch) \ No newline at end of file +#target_link_libraries(flippr_driver) +#target_link_libraries(tests Catch) diff --git a/FlippR-Driver/src/input/Detector.h b/FlippR-Driver/src/input/Detector.h index 5e0febc..669eaa0 100644 --- a/FlippR-Driver/src/input/Detector.h +++ b/FlippR-Driver/src/input/Detector.h @@ -14,19 +14,12 @@ #ifndef DETECTOR_H_ #define DETECTOR_H_ -#include -#include - -#include "../utilities/InputGPIOInterface.h" -#include "Event.hpp" -#include "EventNotifier.h" - -#define SLEEP_DURATION_NANO 900 +#include "IDetector.h" namespace Input { -class Detector +class Detector : IDetector { public: diff --git a/FlippR-Driver/src/input/EventNotifier.cpp b/FlippR-Driver/src/input/EventNotifier.cpp index e0248a2..841b7f2 100644 --- a/FlippR-Driver/src/input/EventNotifier.cpp +++ b/FlippR-Driver/src/input/EventNotifier.cpp @@ -29,19 +29,19 @@ EventNotifier::~EventNotifier() notify_thread.join(); } -void EventNotifier::register_event_handler(EventHandler* handler) +void EventNotifier::register_event_handler(IEventHandler* handler) { std::lock_guard event_handler_guard(event_handler_mutex); event_handler.insert(handler); } -void EventNotifier::unregister_event_handler(EventHandler* handler) +void EventNotifier::unregister_event_handler(IEventHandler* handler) { std::lock_guard event_handler_guard(event_handler_mutex); event_handler.erase(handler); } -void EventNotifier::distribute_event(Event& event) +void EventNotifier::distribute_event(IEvent& event) { event_queue.push(event); } diff --git a/FlippR-Driver/src/input/EventNotifier.h b/FlippR-Driver/src/input/EventNotifier.h index 4b7d448..beed119 100644 --- a/FlippR-Driver/src/input/EventNotifier.h +++ b/FlippR-Driver/src/input/EventNotifier.h @@ -8,6 +8,8 @@ #ifndef SRC_INPUT_EVENTNOTIFIER_H_ #define SRC_INPUT_EVENTNOTIFIER_H_ +#include "IEventNotifier.h" + #include #include #include @@ -21,24 +23,24 @@ namespace Input { -class EventNotifier +class EventNotifier : IEventNotifier { public: EventNotifier(); ~EventNotifier(); - void register_event_handler(EventHandler* handler); - void unregister_event_handler(EventHandler* handler); + void register_event_handler(IEventHandler* handler); + void unregister_event_handler(IEventHandler* handler); - void distribute_event(Event& event); + void distribute_event(IEvent& event); private: void notify(); private: - BlockingQueue event_queue; - std::set event_handler; + BlockingQueue event_queue; + std::set event_handler; bool is_running; std::thread notify_thread;