mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
avhai cleanup + grabber list (#402)
* - cleanup shared_avahi stuff - add a list of avilable grabbers to json server info * fix compile
This commit is contained in:
parent
195226ec69
commit
26154befa4
@ -1,9 +1,7 @@
|
||||
# Define the main-project name
|
||||
project(hyperion)
|
||||
|
||||
# define the minimum cmake version (as required by cmake)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
PROJECT(hyperion)
|
||||
|
||||
IF ( POLICY CMP0026 )
|
||||
CMAKE_POLICY( SET CMP0026 OLD )
|
||||
ENDIF()
|
||||
@ -23,8 +21,7 @@ SET ( DEFAULT_DISPMANX OFF )
|
||||
SET ( DEFAULT_OSX OFF )
|
||||
SET ( DEFAULT_X11 OFF )
|
||||
SET ( DEFAULT_WS281XPWM OFF )
|
||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF )
|
||||
SET ( DEFAULT_USE_AVAHI_LIBS ON )
|
||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
||||
SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF )
|
||||
SET ( DEFAULT_TESTS OFF )
|
||||
|
||||
@ -73,7 +70,6 @@ if ( "${PLATFORM}" MATCHES "osx" )
|
||||
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/qt5" CACHE STRING "path to your QT5 files" )
|
||||
include_directories("/opt/X11/include/")
|
||||
SET ( DEFAULT_OSX ON )
|
||||
SET ( DEFAULT_USE_AVAHI_LIBS OFF )
|
||||
elseif ( "${PLATFORM}" STREQUAL "rpi" )
|
||||
SET ( DEFAULT_DISPMANX ON )
|
||||
SET ( DEFAULT_WS281XPWM ON )
|
||||
@ -81,11 +77,8 @@ elseif ( "${PLATFORM}" STREQUAL "amlogic" )
|
||||
SET ( DEFAULT_AMLOGIC ON )
|
||||
elseif ( "${PLATFORM}" STREQUAL "amlogic64" )
|
||||
SET ( DEFAULT_AMLOGIC ON )
|
||||
SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS ON )
|
||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
||||
elseif ( "${PLATFORM}" MATCHES "x86" )
|
||||
SET ( DEFAULT_X11 ON )
|
||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
||||
if ( "${PLATFORM}" STREQUAL "x86-dev" )
|
||||
SET ( DEFAULT_AMLOGIC ON)
|
||||
SET ( DEFAULT_WS281XPWM ON )
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <string>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
@ -15,7 +17,7 @@ class GrabberWrapper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GrabberWrapper(std::string grabberName, const int priority, hyperion::Components grabberComponentId=hyperion::COMP_GRABBER);
|
||||
GrabberWrapper(QString grabberName, const int priority, hyperion::Components grabberComponentId=hyperion::COMP_GRABBER);
|
||||
|
||||
virtual ~GrabberWrapper();
|
||||
|
||||
@ -29,6 +31,8 @@ public:
|
||||
///
|
||||
virtual void stop();
|
||||
|
||||
static QStringList availableGrabbers();
|
||||
|
||||
public slots:
|
||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||
|
||||
@ -49,7 +53,7 @@ signals:
|
||||
protected:
|
||||
|
||||
void setColors(const std::vector<ColorRgb> &ledColors, const int timeout_ms);
|
||||
std::string _grabberName;
|
||||
QString _grabberName;
|
||||
|
||||
/// Pointer to Hyperion for writing led values
|
||||
Hyperion * _hyperion;
|
||||
|
@ -37,20 +37,21 @@ target_link_libraries(bonjour
|
||||
hyperion-utils
|
||||
${QT_LIBRARIES})
|
||||
|
||||
set(USE_SHARED_AVAHI_LIBS ${DEFAULT_USE_SHARED_AVAHI_LIBS} CACHE BOOL "use avahi libraries from system")
|
||||
IF (NOT APPLE)
|
||||
set(USE_SHARED_AVAHI_LIBS ${DEFAULT_USE_SHARED_AVAHI_LIBS} CACHE BOOL "use avahi libraries from system")
|
||||
|
||||
if (USE_SHARED_AVAHI_LIBS)
|
||||
target_link_libraries(bonjour
|
||||
dns_sd
|
||||
avahi-client
|
||||
avahi-common
|
||||
avahi-core
|
||||
dbus-1)
|
||||
elseif (DEFAULT_USE_AVAHI_LIBS)
|
||||
target_link_libraries(bonjour
|
||||
libdns_sd.a
|
||||
libavahi-client.a
|
||||
libavahi-common.a
|
||||
libavahi-core.a
|
||||
dbus-1)
|
||||
endif()
|
||||
if (USE_SHARED_AVAHI_LIBS)
|
||||
target_link_libraries(bonjour
|
||||
dns_sd
|
||||
avahi-client
|
||||
avahi-common
|
||||
avahi-core)
|
||||
else()
|
||||
target_link_libraries(bonjour
|
||||
libdns_sd.a
|
||||
libavahi-client.a
|
||||
libavahi-common.a
|
||||
libavahi-core.a)
|
||||
endif()
|
||||
target_link_libraries(bonjour dbus-1)
|
||||
ENDIF()
|
||||
|
@ -16,7 +16,7 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device,
|
||||
double greenSignalThreshold,
|
||||
double blueSignalThreshold,
|
||||
const int priority)
|
||||
: GrabberWrapper("V4L2:"+device, priority, hyperion::COMP_V4L)
|
||||
: GrabberWrapper("V4L2:"+QString::fromStdString(device), priority, hyperion::COMP_V4L)
|
||||
, _timeout_ms(1000)
|
||||
, _grabber(device,
|
||||
input,
|
||||
|
@ -2,14 +2,15 @@
|
||||
#include <hyperion/ImageProcessorFactory.h>
|
||||
#include <hyperion/ImageProcessor.h>
|
||||
#include <hyperion/GrabberWrapper.h>
|
||||
#include <HyperionConfig.h>
|
||||
|
||||
|
||||
GrabberWrapper::GrabberWrapper(std::string grabberName, const int priority, hyperion::Components grabberComponentId)
|
||||
#define QSTRING_CSTR(str) str.toLocal8Bit().constData()
|
||||
GrabberWrapper::GrabberWrapper(QString grabberName, const int priority, hyperion::Components grabberComponentId)
|
||||
: _grabberName(grabberName)
|
||||
, _hyperion(Hyperion::getInstance())
|
||||
, _priority(priority)
|
||||
, _timer()
|
||||
, _log(Logger::getInstance(grabberName.c_str()))
|
||||
, _log(Logger::getInstance(grabberName))
|
||||
, _forward(true)
|
||||
, _processor(ImageProcessorFactory::getInstance().newImageProcessor())
|
||||
, _grabberComponentId(grabberComponentId)
|
||||
@ -28,7 +29,7 @@ GrabberWrapper::GrabberWrapper(std::string grabberName, const int priority, hype
|
||||
GrabberWrapper::~GrabberWrapper()
|
||||
{
|
||||
stop();
|
||||
Debug(_log,"Close grabber: %s", _grabberName.c_str());
|
||||
Debug(_log,"Close grabber: %s", QSTRING_CSTR(_grabberName));
|
||||
delete _processor;
|
||||
}
|
||||
|
||||
@ -36,7 +37,7 @@ bool GrabberWrapper::start()
|
||||
{
|
||||
// Start the timer with the pre configured interval
|
||||
_timer.start();
|
||||
_hyperion->registerPriority(_grabberName,_priority);
|
||||
_hyperion->registerPriority(_grabberName.toStdString(), _priority);
|
||||
return _timer.isActive();
|
||||
|
||||
}
|
||||
@ -45,7 +46,7 @@ void GrabberWrapper::stop()
|
||||
{
|
||||
// Stop the timer, effectivly stopping the process
|
||||
_timer.stop();
|
||||
_hyperion->unRegisterPriority(_grabberName);
|
||||
_hyperion->unRegisterPriority(_grabberName.toStdString());
|
||||
}
|
||||
|
||||
void GrabberWrapper::componentStateChanged(const hyperion::Components component, bool enable)
|
||||
@ -105,3 +106,34 @@ void GrabberWrapper::setColors(const std::vector<ColorRgb> &ledColors, const int
|
||||
{
|
||||
_hyperion->setColors(_priority, ledColors, timeout_ms, true, _grabberComponentId);
|
||||
}
|
||||
|
||||
QStringList GrabberWrapper::availableGrabbers()
|
||||
{
|
||||
QStringList grabbers;
|
||||
|
||||
#ifdef ENABLE_DISPMANX
|
||||
grabbers << "dispmanx";
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_V4L2
|
||||
grabbers << "v4l2";
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FB
|
||||
grabbers << "framebuffer";
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AMLOGIC
|
||||
grabbers << "amlogic";
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_OSX
|
||||
grabbers << "osx";
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_X11
|
||||
grabbers << "x11";
|
||||
#endif
|
||||
|
||||
return grabbers;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <utils/ColorSys.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <leddevice/LedDevice.h>
|
||||
#include <hyperion/GrabberWrapper.h>
|
||||
#include <HyperionConfig.h>
|
||||
#include <utils/jsonschema/QJsonFactory.h>
|
||||
#include <utils/Process.h>
|
||||
@ -761,15 +762,27 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
|
||||
// get available led devices
|
||||
QJsonObject ledDevices;
|
||||
ledDevices["active"] = QString::fromStdString(LedDevice::activeDevice());
|
||||
QJsonArray available;
|
||||
QJsonArray availableLedDevices;
|
||||
for (auto dev: LedDevice::getDeviceMap())
|
||||
{
|
||||
available.append(QString::fromStdString(dev.first));
|
||||
availableLedDevices.append(QString::fromStdString(dev.first));
|
||||
}
|
||||
|
||||
ledDevices["available"] = available;
|
||||
ledDevices["available"] = availableLedDevices;
|
||||
info["ledDevices"] = ledDevices;
|
||||
|
||||
// get available grabbers
|
||||
QJsonObject grabbers;
|
||||
//grabbers["active"] = ????;
|
||||
QJsonArray availableGrabbers;
|
||||
for (auto grabber: GrabberWrapper::availableGrabbers())
|
||||
{
|
||||
availableGrabbers.append(grabber);
|
||||
}
|
||||
|
||||
grabbers["available"] = availableGrabbers;
|
||||
info["grabbers"] = grabbers;
|
||||
|
||||
// get available components
|
||||
QJsonArray component;
|
||||
std::map<hyperion::Components, bool> components = _hyperion->getComponentRegister().getRegister();
|
||||
|
Loading…
Reference in New Issue
Block a user