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)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
PROJECT(hyperion)
|
||||||
|
|
||||||
IF ( POLICY CMP0026 )
|
IF ( POLICY CMP0026 )
|
||||||
CMAKE_POLICY( SET CMP0026 OLD )
|
CMAKE_POLICY( SET CMP0026 OLD )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@ -23,8 +21,7 @@ SET ( DEFAULT_DISPMANX OFF )
|
|||||||
SET ( DEFAULT_OSX OFF )
|
SET ( DEFAULT_OSX OFF )
|
||||||
SET ( DEFAULT_X11 OFF )
|
SET ( DEFAULT_X11 OFF )
|
||||||
SET ( DEFAULT_WS281XPWM OFF )
|
SET ( DEFAULT_WS281XPWM OFF )
|
||||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF )
|
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
||||||
SET ( DEFAULT_USE_AVAHI_LIBS ON )
|
|
||||||
SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF )
|
SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF )
|
||||||
SET ( DEFAULT_TESTS 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" )
|
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/qt5" CACHE STRING "path to your QT5 files" )
|
||||||
include_directories("/opt/X11/include/")
|
include_directories("/opt/X11/include/")
|
||||||
SET ( DEFAULT_OSX ON )
|
SET ( DEFAULT_OSX ON )
|
||||||
SET ( DEFAULT_USE_AVAHI_LIBS OFF )
|
|
||||||
elseif ( "${PLATFORM}" STREQUAL "rpi" )
|
elseif ( "${PLATFORM}" STREQUAL "rpi" )
|
||||||
SET ( DEFAULT_DISPMANX ON )
|
SET ( DEFAULT_DISPMANX ON )
|
||||||
SET ( DEFAULT_WS281XPWM ON )
|
SET ( DEFAULT_WS281XPWM ON )
|
||||||
@ -81,11 +77,8 @@ elseif ( "${PLATFORM}" STREQUAL "amlogic" )
|
|||||||
SET ( DEFAULT_AMLOGIC ON )
|
SET ( DEFAULT_AMLOGIC ON )
|
||||||
elseif ( "${PLATFORM}" STREQUAL "amlogic64" )
|
elseif ( "${PLATFORM}" STREQUAL "amlogic64" )
|
||||||
SET ( DEFAULT_AMLOGIC ON )
|
SET ( DEFAULT_AMLOGIC ON )
|
||||||
SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS ON )
|
|
||||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
|
||||||
elseif ( "${PLATFORM}" MATCHES "x86" )
|
elseif ( "${PLATFORM}" MATCHES "x86" )
|
||||||
SET ( DEFAULT_X11 ON )
|
SET ( DEFAULT_X11 ON )
|
||||||
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
|
||||||
if ( "${PLATFORM}" STREQUAL "x86-dev" )
|
if ( "${PLATFORM}" STREQUAL "x86-dev" )
|
||||||
SET ( DEFAULT_AMLOGIC ON)
|
SET ( DEFAULT_AMLOGIC ON)
|
||||||
SET ( DEFAULT_WS281XPWM ON )
|
SET ( DEFAULT_WS281XPWM ON )
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
#include <utils/Components.h>
|
#include <utils/Components.h>
|
||||||
@ -15,7 +17,7 @@ class GrabberWrapper : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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();
|
virtual ~GrabberWrapper();
|
||||||
|
|
||||||
@ -29,6 +31,8 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
|
|
||||||
|
static QStringList availableGrabbers();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void componentStateChanged(const hyperion::Components component, bool enable);
|
void componentStateChanged(const hyperion::Components component, bool enable);
|
||||||
|
|
||||||
@ -49,7 +53,7 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
void setColors(const std::vector<ColorRgb> &ledColors, const int timeout_ms);
|
void setColors(const std::vector<ColorRgb> &ledColors, const int timeout_ms);
|
||||||
std::string _grabberName;
|
QString _grabberName;
|
||||||
|
|
||||||
/// Pointer to Hyperion for writing led values
|
/// Pointer to Hyperion for writing led values
|
||||||
Hyperion * _hyperion;
|
Hyperion * _hyperion;
|
||||||
|
@ -37,20 +37,21 @@ target_link_libraries(bonjour
|
|||||||
hyperion-utils
|
hyperion-utils
|
||||||
${QT_LIBRARIES})
|
${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)
|
if (USE_SHARED_AVAHI_LIBS)
|
||||||
target_link_libraries(bonjour
|
target_link_libraries(bonjour
|
||||||
dns_sd
|
dns_sd
|
||||||
avahi-client
|
avahi-client
|
||||||
avahi-common
|
avahi-common
|
||||||
avahi-core
|
avahi-core)
|
||||||
dbus-1)
|
else()
|
||||||
elseif (DEFAULT_USE_AVAHI_LIBS)
|
target_link_libraries(bonjour
|
||||||
target_link_libraries(bonjour
|
libdns_sd.a
|
||||||
libdns_sd.a
|
libavahi-client.a
|
||||||
libavahi-client.a
|
libavahi-common.a
|
||||||
libavahi-common.a
|
libavahi-core.a)
|
||||||
libavahi-core.a
|
endif()
|
||||||
dbus-1)
|
target_link_libraries(bonjour dbus-1)
|
||||||
endif()
|
ENDIF()
|
||||||
|
@ -16,7 +16,7 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device,
|
|||||||
double greenSignalThreshold,
|
double greenSignalThreshold,
|
||||||
double blueSignalThreshold,
|
double blueSignalThreshold,
|
||||||
const int priority)
|
const int priority)
|
||||||
: GrabberWrapper("V4L2:"+device, priority, hyperion::COMP_V4L)
|
: GrabberWrapper("V4L2:"+QString::fromStdString(device), priority, hyperion::COMP_V4L)
|
||||||
, _timeout_ms(1000)
|
, _timeout_ms(1000)
|
||||||
, _grabber(device,
|
, _grabber(device,
|
||||||
input,
|
input,
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
#include <hyperion/ImageProcessorFactory.h>
|
#include <hyperion/ImageProcessorFactory.h>
|
||||||
#include <hyperion/ImageProcessor.h>
|
#include <hyperion/ImageProcessor.h>
|
||||||
#include <hyperion/GrabberWrapper.h>
|
#include <hyperion/GrabberWrapper.h>
|
||||||
|
#include <HyperionConfig.h>
|
||||||
|
|
||||||
|
#define QSTRING_CSTR(str) str.toLocal8Bit().constData()
|
||||||
GrabberWrapper::GrabberWrapper(std::string grabberName, const int priority, hyperion::Components grabberComponentId)
|
GrabberWrapper::GrabberWrapper(QString grabberName, const int priority, hyperion::Components grabberComponentId)
|
||||||
: _grabberName(grabberName)
|
: _grabberName(grabberName)
|
||||||
, _hyperion(Hyperion::getInstance())
|
, _hyperion(Hyperion::getInstance())
|
||||||
, _priority(priority)
|
, _priority(priority)
|
||||||
, _timer()
|
, _timer()
|
||||||
, _log(Logger::getInstance(grabberName.c_str()))
|
, _log(Logger::getInstance(grabberName))
|
||||||
, _forward(true)
|
, _forward(true)
|
||||||
, _processor(ImageProcessorFactory::getInstance().newImageProcessor())
|
, _processor(ImageProcessorFactory::getInstance().newImageProcessor())
|
||||||
, _grabberComponentId(grabberComponentId)
|
, _grabberComponentId(grabberComponentId)
|
||||||
@ -28,7 +29,7 @@ GrabberWrapper::GrabberWrapper(std::string grabberName, const int priority, hype
|
|||||||
GrabberWrapper::~GrabberWrapper()
|
GrabberWrapper::~GrabberWrapper()
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
Debug(_log,"Close grabber: %s", _grabberName.c_str());
|
Debug(_log,"Close grabber: %s", QSTRING_CSTR(_grabberName));
|
||||||
delete _processor;
|
delete _processor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ bool GrabberWrapper::start()
|
|||||||
{
|
{
|
||||||
// Start the timer with the pre configured interval
|
// Start the timer with the pre configured interval
|
||||||
_timer.start();
|
_timer.start();
|
||||||
_hyperion->registerPriority(_grabberName,_priority);
|
_hyperion->registerPriority(_grabberName.toStdString(), _priority);
|
||||||
return _timer.isActive();
|
return _timer.isActive();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -45,7 +46,7 @@ void GrabberWrapper::stop()
|
|||||||
{
|
{
|
||||||
// Stop the timer, effectivly stopping the process
|
// Stop the timer, effectivly stopping the process
|
||||||
_timer.stop();
|
_timer.stop();
|
||||||
_hyperion->unRegisterPriority(_grabberName);
|
_hyperion->unRegisterPriority(_grabberName.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrabberWrapper::componentStateChanged(const hyperion::Components component, bool enable)
|
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);
|
_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/ColorSys.h>
|
||||||
#include <utils/ColorRgb.h>
|
#include <utils/ColorRgb.h>
|
||||||
#include <leddevice/LedDevice.h>
|
#include <leddevice/LedDevice.h>
|
||||||
|
#include <hyperion/GrabberWrapper.h>
|
||||||
#include <HyperionConfig.h>
|
#include <HyperionConfig.h>
|
||||||
#include <utils/jsonschema/QJsonFactory.h>
|
#include <utils/jsonschema/QJsonFactory.h>
|
||||||
#include <utils/Process.h>
|
#include <utils/Process.h>
|
||||||
@ -761,15 +762,27 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
|
|||||||
// get available led devices
|
// get available led devices
|
||||||
QJsonObject ledDevices;
|
QJsonObject ledDevices;
|
||||||
ledDevices["active"] = QString::fromStdString(LedDevice::activeDevice());
|
ledDevices["active"] = QString::fromStdString(LedDevice::activeDevice());
|
||||||
QJsonArray available;
|
QJsonArray availableLedDevices;
|
||||||
for (auto dev: LedDevice::getDeviceMap())
|
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;
|
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
|
// get available components
|
||||||
QJsonArray component;
|
QJsonArray component;
|
||||||
std::map<hyperion::Components, bool> components = _hyperion->getComponentRegister().getRegister();
|
std::map<hyperion::Components, bool> components = _hyperion->getComponentRegister().getRegister();
|
||||||
|
Loading…
Reference in New Issue
Block a user