diff --git a/CMakeLists.txt b/CMakeLists.txt index db0b2303..eaf2690b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,20 @@ +project(hyperion) # define the minimum cmake version (as required by cmake) cmake_minimum_required(VERSION 2.8) #set(CMAKE_TOOLCHAIN_FILE /opt/raspberrypi/Toolchain-RaspberryPi.cmake) +# set the build options +option (ENABLE_DISPMANX "Enable the RPi dispmanx grabber" ON) +message(STATUS "ENABLE_DISPMANX = " ${ENABLE_DISPMANX}) + +# Createt the configuration file +# configure a header file to pass some of the CMake settings +# to the source code +configure_file ("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h") +include_directories("${PROJECT_BINARY_DIR}") + # Define the main-project name project(Hyperion) @@ -37,8 +48,9 @@ find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET) # add protocol buffers find_package(Protobuf REQUIRED) -#add libusb +#add libusb and pthreads find_package(libusb-1.0 REQUIRED) +find_package(Threads REQUIRED) #SET(QT_DONT_USE_QTGUI TRUE) #SET(QT_USE_QTCONSOLE TRUE) diff --git a/HyperionConfig.h.in b/HyperionConfig.h.in new file mode 100644 index 00000000..875e1193 --- /dev/null +++ b/HyperionConfig.h.in @@ -0,0 +1,4 @@ +// Generated config file + +// Define to enable the dispmanx grabber +#cmakedefine ENABLE_DISPMANX diff --git a/deploy/HyperCon.jar.REMOVED.git-id b/deploy/HyperCon.jar.REMOVED.git-id index 78191e82..66954acf 100644 --- a/deploy/HyperCon.jar.REMOVED.git-id +++ b/deploy/HyperCon.jar.REMOVED.git-id @@ -1 +1 @@ -2361db3581db887d5f2de0077d0ef6a16a5bb582 \ No newline at end of file +97f01ae47416100223417becca5c3a50a773fbfa \ No newline at end of file diff --git a/deploy/hyperion-remote b/deploy/hyperion-remote index 8d8588d2..e1720d47 100755 Binary files a/deploy/hyperion-remote and b/deploy/hyperion-remote differ diff --git a/deploy/hyperiond.REMOVED.git-id b/deploy/hyperiond.REMOVED.git-id index f603c0d1..1eec85ee 100644 --- a/deploy/hyperiond.REMOVED.git-id +++ b/deploy/hyperiond.REMOVED.git-id @@ -1 +1 @@ -d59ae219a9dad5cd6138c23122df5e3313e473cb \ No newline at end of file +5031f4b1d3a2682b6df94ba6671bcc97f9b5a4d1 \ No newline at end of file diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index a6874d3a..d97e6368 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -4,10 +4,13 @@ SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc) add_subdirectory(bootsequence) -add_subdirectory(dispmanx-grabber) add_subdirectory(hyperion) add_subdirectory(jsonserver) add_subdirectory(protoserver) add_subdirectory(boblightserver) add_subdirectory(utils) add_subdirectory(xbmcvideochecker) + +if (ENABLE_DISPMANX) + add_subdirectory(dispmanx-grabber) +endif (ENABLE_DISPMANX) diff --git a/libsrc/bootsequence/BootSequenceFactory.cpp b/libsrc/bootsequence/BootSequenceFactory.cpp index c7674657..7ad5ae6b 100644 --- a/libsrc/bootsequence/BootSequenceFactory.cpp +++ b/libsrc/bootsequence/BootSequenceFactory.cpp @@ -24,7 +24,7 @@ BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, cons const unsigned duration_ms = jsonConfig["duration_ms"].asUInt(); return new RainbowBootSequence(hyperion, duration_ms); } - else if (type == "knightrider" || type == "knight rider") + else if (type == "knightrider" || type == "knight rider" || "knight_rider") { std::cout << "SELECTED BOOT SEQUENCE: " << "KITT" << std::endl; const unsigned duration_ms = jsonConfig["duration_ms"].asUInt(); @@ -34,5 +34,3 @@ BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, cons std::cerr << "Unknown boot-sequence selected; boot-sequence disabled." << std::endl; return nullptr; } - - diff --git a/libsrc/hyperion/CMakeLists.txt b/libsrc/hyperion/CMakeLists.txt index 4ad8df23..03d9df24 100644 --- a/libsrc/hyperion/CMakeLists.txt +++ b/libsrc/hyperion/CMakeLists.txt @@ -82,4 +82,5 @@ target_link_libraries(hyperion hyperion-utils serialport ${QT_LIBRARIES} - ${LIBUSB_1_LIBRARIES}) + ${LIBUSB_1_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT}) diff --git a/libsrc/jsonserver/JsonClientConnection.cpp b/libsrc/jsonserver/JsonClientConnection.cpp index 4af1b4dd..1c99b13d 100644 --- a/libsrc/jsonserver/JsonClientConnection.cpp +++ b/libsrc/jsonserver/JsonClientConnection.cpp @@ -168,7 +168,7 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &message) item["priority"] = priority; if (priorityInfo.timeoutTime_ms != -1) { - item["duration_ms"] = priorityInfo.timeoutTime_ms - now; + item["duration_ms"] = Json::Value::UInt(priorityInfo.timeoutTime_ms - now); } } diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/BootSequence.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/BootSequence.java index 138638b4..7109dee3 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/BootSequence.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/BootSequence.java @@ -7,7 +7,7 @@ public enum BootSequence { /** The rainbow boot sequence */ rainbow, /** The Knight Rider (or KITT) boot sequence */ - knight_rider; + knightrider; /** * Returns a string representation of the BootSequence @@ -19,7 +19,7 @@ public enum BootSequence { switch(this) { case rainbow: return "Rainbow"; - case knight_rider: + case knightrider: return "Kinght Rider"; } return "None"; diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java index f8fd108a..118cd8a3 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java @@ -62,7 +62,7 @@ public class MiscConfig { StringBuffer strBuf = new StringBuffer(); strBuf.append("\t/// The boot-sequence configuration, contains the following items: \n"); - strBuf.append("\t/// * type : The type of the boot-sequence ('rainbow', 'knight_rider', 'none') \n"); + strBuf.append("\t/// * type : The type of the boot-sequence ('rainbow', 'knightrider', 'none') \n"); strBuf.append("\t/// * duration_ms : The length of the boot-sequence [ms]\n"); String bootPreamble = mBootsequenceEnabled? "\t" : "//\t"; diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index 2f75e10b..646a8575 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -5,8 +5,11 @@ add_executable(hyperiond target_link_libraries(hyperiond bootsequence hyperion - dispmanx-grabber xbmcvideochecker jsonserver protoserver boblightserver) + +if (ENABLE_DISPMANX) + target_link_libraries(hyperiond dispmanx-grabber) +endif (ENABLE_DISPMANX) diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index 4f62ada8..bc789691 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -6,6 +6,9 @@ #include #include +// config includes +#include "HyperionConfig.h" + // Json-Schema includes #include @@ -15,8 +18,10 @@ // Bootsequence includes #include +#ifdef ENABLE_DISPMANX // Dispmanx grabber includes #include +#endif // XBMC Video checker includes #include @@ -118,6 +123,7 @@ int main(int argc, char** argv) std::cout << "XBMC video checker created and started" << std::endl; } +#ifdef ENABLE_DISPMANX // Construct and start the frame-grabber if the configuration is present DispmanxWrapper * dispmanx = nullptr; if (config.isMember("framegrabber")) @@ -137,6 +143,12 @@ int main(int argc, char** argv) dispmanx->start(); std::cout << "Frame grabber created and started" << std::endl; } +#else + if (config.isMember("framegrabber")) + { + std::cerr << "The dispmanx framegrabber can not be instantiated, becuse it has been left out from the build" << std::endl; + } +#endif // Create Json server if configuration is present JsonServer * jsonServer = nullptr; @@ -171,7 +183,9 @@ int main(int argc, char** argv) // Delete all component delete bootSequence; +#ifdef ENABLE_DISPMANX delete dispmanx; +#endif delete xbmcVideoChecker; delete jsonServer; delete protoServer; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 35f7a65b..5e2844e3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,7 +27,9 @@ add_executable(test_image2ledsmap target_link_libraries(test_image2ledsmap hyperion) -add_subdirectory(dispmanx2png) +if (ENABLE_DISPMANX) + add_subdirectory(dispmanx2png) +endif (ENABLE_DISPMANX) add_executable(test_blackborderdetector TestBlackBorderDetector.cpp)