remove protobuf (part 2)

This commit is contained in:
Paulchen-Panther
2018-12-30 22:07:53 +01:00
parent 559311e18c
commit 38950edf35
54 changed files with 1441 additions and 377 deletions

View File

@@ -4,8 +4,8 @@ project(hyperion-aml)
find_package(Qt5Widgets REQUIRED)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
${PROTOBUF_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
${FLATBUFFERS_INCLUDE_DIRS}
)
set(Hyperion_AML_HEADERS
@@ -27,9 +27,11 @@ target_link_libraries(${PROJECT_NAME}
commandline
blackborder
hyperion-utils
protoclient
flatbufserver
flatbuffers
amlogic-grabber
framebuffer-grabber
ssdp
Qt5::Core
Qt5::Gui
Qt5::Network

View File

@@ -4,12 +4,15 @@
#include <QCoreApplication>
#include <QImage>
#include <protoserver/ProtoConnectionWrapper.h>
#include <flatbufserver/FlatBufferConnection.h>
#include "AmlogicWrapper.h"
#include "HyperionConfig.h"
#include <commandline/Parser.h>
// ssdp discover
#include <ssdp/SSDPDiscover.h>
using namespace commandline;
// save the image as screenshot
@@ -32,7 +35,7 @@ int main(int argc, char ** argv)
try
{
// create the option parser and initialize all parser
Parser parser("AmLogic capture application for Hyperion");
Parser parser("AmLogic capture application for Hyperion. Will automatically search a Hyperion server if -a option isn't used. Please note that if you have more than one server running it's more or less random which one will be used.");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10");
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096);
@@ -62,11 +65,26 @@ int main(int argc, char ** argv)
}
else
{
// Create the Proto-connection with hyperiond
ProtoConnectionWrapper protoWrapper(argAddress.value(parser), argPriority.getInt(parser), 1000, parser.isSet(argSkipReply));
// server searching by ssdp
QString address;
if(parser.isSet(argAddress))
{
address = argAddress.value(parser);
}
else
{
SSDPDiscover discover;
address = discover.getFirstService(STY_FLATBUFSERVER);
if(address.isEmpty())
{
address = argAddress.value(parser);
}
}
// Create the Flabuf-connection
FlatBufferConnection flatbuf("AML Standalone", address, argPriority.getInt(parser), parser.isSet(argSkipReply));
// Connect the screen capturing to the proto processing
QObject::connect(&amlWrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>)));
// Connect the screen capturing to flatbuf connection processing
QObject::connect(&amlWrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
// Start the capturing
amlWrapper.start();

View File

@@ -10,9 +10,9 @@ ELSE()
ENDIF()
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
${BCM_INCLUDE_DIRS}
${PROTOBUF_INCLUDE_DIRS}
${FLATBUFFERS_INCLUDE_DIRS}
)
set(Hyperion_Dispmanx_HEADERS
@@ -34,9 +34,11 @@ target_link_libraries( ${PROJECT_NAME}
commandline
blackborder
hyperion-utils
protoclient
flatbufserver
flatbuffers
dispmanx-grabber
${Dispmanx_LIBRARIES}
ssdp
Qt5::Core
Qt5::Gui
Qt5::Network

View File

@@ -3,12 +3,15 @@
#include <QCoreApplication>
#include <QImage>
#include <protoserver/ProtoConnectionWrapper.h>
#include <flatbufserver/FlatBufferConnection.h>
#include "DispmanxWrapper.h"
#include "HyperionConfig.h"
#include <commandline/Parser.h>
// ssdp discover
#include <ssdp/SSDPDiscover.h>
using namespace commandline;
// save the image as screenshot
@@ -31,7 +34,7 @@ int main(int argc, char ** argv)
try
{
// create the option parser and initialize all parameters
Parser parser("Dispmanx capture application for Hyperion");
Parser parser("Dispmanx capture application for Hyperion. Will automatically search a Hyperion server if -a option isn't used. Please note that if you have more than one server running it's more or less random which one will be used.");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10");
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "64", 32, 4096);
@@ -90,11 +93,26 @@ int main(int argc, char ** argv)
}
else
{
// Create the Proto-connection with hyperiond
ProtoConnectionWrapper protoWrapper(argAddress.value(parser), argPriority.getInt(parser), 1000, parser.isSet(argSkipReply));
// server searching by ssdp
QString address;
if(parser.isSet(argAddress))
{
address = argAddress.value(parser);
}
else
{
SSDPDiscover discover;
address = discover.getFirstService(STY_FLATBUFSERVER);
if(address.isEmpty())
{
address = argAddress.value(parser);
}
}
// Create the Flabuf-connection
FlatBufferConnection flatbuf("Dispmanx Standalone", address, argPriority.getInt(parser), parser.isSet(argSkipReply));
// Connect the screen capturing to the proto processing
QObject::connect(&dispmanxWrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>)));
// Connect the screen capturing to flatbuf connection processing
QObject::connect(&dispmanxWrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
// Start the capturing
dispmanxWrapper.start();

View File

@@ -4,8 +4,8 @@ project(hyperion-framebuffer)
find_package(Qt5Widgets REQUIRED)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
${PROTOBUF_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
${FLATBUFFERS_INCLUDE_DIRS}
)
set(Hyperion_FB_HEADERS
@@ -27,8 +27,10 @@ target_link_libraries( ${PROJECT_NAME}
commandline
blackborder
hyperion-utils
protoclient
flatbufserver
flatbuffers
framebuffer-grabber
ssdp
Qt5::Core
Qt5::Gui
Qt5::Network

View File

@@ -4,10 +4,13 @@
#include <QCoreApplication>
#include <QImage>
#include <protoserver/ProtoConnectionWrapper.h>
#include <flatbufserver/FlatBufferConnection.h>
#include "FramebufferWrapper.h"
#include <commandline/Parser.h>
// ssdp discover
#include <ssdp/SSDPDiscover.h>
using namespace commandline;
// save the image as screenshot
@@ -25,7 +28,7 @@ int main(int argc, char ** argv)
try
{
// create the option parser and initialize all parameters
Parser parser("FrameBuffer capture application for Hyperion");
Parser parser("FrameBuffer capture application for Hyperion. Will automatically search a Hyperion server if -a option isn't used. Please note that if you have more than one server running it's more or less random which one will be used.");
Option & argDevice = parser.add<Option> ('d', "device", "Set the video device [default: %1]", "/dev/video0");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10");
@@ -56,11 +59,26 @@ int main(int argc, char ** argv)
}
else
{
// Create the Proto-connection with hyperiond
ProtoConnectionWrapper protoWrapper(argAddress.value(parser), argPriority.getInt(parser), 1000, parser.isSet(argSkipReply));
// server searching by ssdp
QString address;
if(parser.isSet(argAddress))
{
address = argAddress.value(parser);
}
else
{
SSDPDiscover discover;
address = discover.getFirstService(STY_FLATBUFSERVER);
if(address.isEmpty())
{
address = argAddress.value(parser);
}
}
// Create the Flabuf-connection
FlatBufferConnection flatbuf("Framebuffer Standalone", address, argPriority.getInt(parser), parser.isSet(argSkipReply));
// Connect the screen capturing to the proto processing
QObject::connect(&fbWrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>)));
// Connect the screen capturing to flatbuf connection processing
QObject::connect(&fbWrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
// Start the capturing
fbWrapper.start();

View File

@@ -4,8 +4,8 @@ project(hyperion-osx)
find_package(Qt5Widgets REQUIRED)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
${PROTOBUF_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
${FLATBUFFERS_INCLUDE_DIRS}
)
set(Hyperion_OSX_HEADERS
@@ -27,8 +27,10 @@ target_link_libraries( ${PROJECT_NAME}
commandline
blackborder
hyperion-utils
protoclient
flatbufserver
flatbuffers
osx-grabber
ssdp
Qt5::Core
Qt5::Gui
Qt5::Network

View File

@@ -4,10 +4,13 @@
#include <QCoreApplication>
#include <QImage>
#include <protoserver/ProtoConnectionWrapper.h>
#include <flatbufserver/FlatBufferConnection.h>
#include "OsxWrapper.h"
#include <commandline/Parser.h>
// ssdp discover
#include <ssdp/SSDPDiscover.h>
using namespace commandline;
// save the image as screenshot
@@ -25,7 +28,7 @@ int main(int argc, char ** argv)
try
{
// create the option parser and initialize all parameters
Parser parser("OSX capture application for Hyperion");
Parser parser("OSX capture application for Hyperion. Will automatically search a Hyperion server if -a option isn't used. Please note that if you have more than one server running it's more or less random which one will be used.");
Option & argDisplay = parser.add<Option> ('d', "display", "Set the display to capture [default: %1]");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10", 1, 600);
@@ -46,37 +49,50 @@ int main(int argc, char ** argv)
parser.showHelp(0);
}
OsxWrapper osxWrapper
(parser.isSet(argDisplay), argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser));
OsxWrapper osxWrapper
(parser.isSet(argDisplay), argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser));
if (parser.isSet(argScreenshot)) {
// Capture a single screenshot and finish
const Image<ColorRgb> &screenshot = osxWrapper.getScreenshot();
saveScreenshot("screenshot.png", screenshot);
}
else {
// Create the Proto-connection with hyperiond
ProtoConnectionWrapper protoWrapper
(argAddress.value(parser), argPriority.getInt(parser), 1000, parser.isSet(argSkipReply));
if (parser.isSet(argScreenshot))
{
// Capture a single screenshot and finish
const Image<ColorRgb> &screenshot = osxWrapper.getScreenshot();
saveScreenshot("screenshot.png", screenshot);
}
else
{
// server searching by ssdp
QString address;
if(parser.isSet(argAddress))
{
address = argAddress.value(parser);
}
else
{
SSDPDiscover discover;
address = discover.getFirstService(STY_FLATBUFSERVER);
if(address.isEmpty())
{
address = argAddress.value(parser);
}
}
// Connect the screen capturing to the proto processing
QObject::connect(&osxWrapper,
SIGNAL(sig_screenshot(
const Image<ColorRgb> &)),
&protoWrapper,
SLOT(receiveImage(Image<ColorRgb>)));
// Create the Flabuf-connection
FlatBufferConnection flatbuf("OSX Standalone", address, argPriority.getInt(parser), parser.isSet(argSkipReply));
// Start the capturing
osxWrapper.start();
// Connect the screen capturing to flatbuf connection processing
QObject::connect(&osxWrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
// Start the application
app.exec();
// Start the capturing
osxWrapper.start();
// Start the application
app.exec();
}
}
catch (const std::runtime_error & e)
{
// An error occured. Display error and quit
Error(Logger::getInstance("OSXGRABBER"), "%s", e.what());
Error(Logger::getInstance("OSXGRABBER"), "%s", e.what());
return -1;
}
return 0;

View File

@@ -4,8 +4,8 @@ project(hyperion-v4l2)
find_package(Qt5Widgets REQUIRED)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
${PROTOBUF_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
${FLATBUFFERS_INCLUDE_DIRS}
)
set(Hyperion_V4L2_HEADERS
@@ -28,7 +28,9 @@ target_link_libraries(${PROJECT_NAME}
commandline
blackborder
hyperion-utils
protoclient
flatbufserver
flatbuffers
ssdp
Qt5::Core
Qt5::Gui
Qt5::Network

View File

@@ -12,9 +12,8 @@
// grabber includes
#include "grabber/V4L2Grabber.h"
// proto includes
#include "protoserver/ProtoConnection.h"
#include "protoserver/ProtoConnectionWrapper.h"
// flatbuf includes
#include <flatbufserver/FlatBufferConnection.h>
// hyperion-v4l2 includes
#include "ScreenshotHandler.h"
@@ -22,6 +21,9 @@
#include "HyperionConfig.h"
#include <commandline/Parser.h>
// ssdp discover
#include <ssdp/SSDPDiscover.h>
using namespace commandline;
// save the image as screenshot
@@ -54,7 +56,7 @@ int main(int argc, char** argv)
try
{
// create the option parser and initialize all parameters
Parser parser("V4L capture application for Hyperion");
Parser parser("V4L capture application for Hyperion. Will automatically search a Hyperion server if -a option isn't used. Please note that if you have more than one server running it's more or less random which one will be used.");
Option & argDevice = parser.add<Option> ('d', "device", "The device to use, can be /dev/video0 [default: %1 (auto detected)]", "auto");
SwitchOption<VideoStandard> & argVideoStandard= parser.add<SwitchOption<VideoStandard>>('v', "video-standard", "The used video standard. Valid values are PAL, NTSC, SECAM or no-change. [default: %1]", "no-change");
@@ -188,8 +190,28 @@ int main(int argc, char** argv)
}
else
{
ProtoConnectionWrapper protoWrapper(argAddress.value(parser), argPriority.getInt(parser), 1000, parser.isSet(argSkipReply));
QObject::connect(&grabber, SIGNAL(newFrame(Image<ColorRgb>)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>)));
// server searching by ssdp
QString address;
if(parser.isSet(argAddress))
{
address = argAddress.value(parser);
}
else
{
SSDPDiscover discover;
address = discover.getFirstService(STY_FLATBUFSERVER);
if(address.isEmpty())
{
address = argAddress.value(parser);
}
}
// Create the Flatbuf-connection
FlatBufferConnection flatbuf("V4L2 Standalone", address, argPriority.getInt(parser), parser.isSet(argSkipReply));
// Connect the screen capturing to flatbuf connection processing
QObject::connect(&grabber, SIGNAL(newFrame(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
if (grabber.start())
QCoreApplication::exec();
grabber.stop();

View File

@@ -5,9 +5,9 @@ find_package(Qt5Widgets REQUIRED)
find_package(X11 REQUIRED)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
${X11_INCLUDES}
${PROTOBUF_INCLUDE_DIRS}
${FLATBUFFERS_INCLUDE_DIRS}
)
set(Hyperion_X11_HEADERS
@@ -29,8 +29,10 @@ target_link_libraries(${PROJECT_NAME}
blackborder
commandline
hyperion-utils
protoclient
flatbufserver
flatbuffers
x11-grabber
ssdp
${X11_LIBRARIES}
${X11_Xrender_LIB}
Qt5::Core

View File

@@ -4,10 +4,13 @@
#include <QImage>
#include <commandline/Parser.h>
#include "protoserver/ProtoConnectionWrapper.h"
#include <flatbufserver/FlatBufferConnection.h>
#include "X11Wrapper.h"
#include "HyperionConfig.h"
// ssdp discover
#include <ssdp/SSDPDiscover.h>
using namespace commandline;
// save the image as screenshot
@@ -30,7 +33,7 @@ int main(int argc, char ** argv)
try
{
// create the option parser and initialize all parameters
Parser parser("X11 capture application for Hyperion");
Parser parser("X11 capture application for Hyperion. Will automatically search a Hyperion server if -a option isn't used. Please note that if you have more than one server running it's more or less random which one will be used.");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10");
IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0");
@@ -62,7 +65,7 @@ int main(int argc, char ** argv)
parser.isSet(argCropRight) ? argCropRight.getInt(parser) : argCropWidth.getInt(parser),
parser.isSet(argCropTop) ? argCropTop.getInt(parser) : argCropHeight.getInt(parser),
parser.isSet(argCropBottom) ? argCropBottom.getInt(parser) : argCropHeight.getInt(parser),
argSizeDecimation.getInt(parser)); // pixel decimation
argSizeDecimation.getInt(parser)); // decimation
if (!x11Wrapper.displayInit())
return -1;
@@ -75,14 +78,26 @@ int main(int argc, char ** argv)
}
else
{
// Create the Proto-connection with hyperiond
ProtoConnectionWrapper protoWrapper(argAddress.value(parser), argPriority.getInt(parser), 1000, parser.isSet(argSkipReply));
// server searching by ssdp
QString address;
if(parser.isSet(argAddress))
{
address = argAddress.value(parser);
}
else
{
SSDPDiscover discover;
address = discover.getFirstService(STY_FLATBUFSERVER);
if(address.isEmpty())
{
address = argAddress.value(parser);
}
}
// Create the Flatbuf-connection
FlatBufferConnection flatbuf("X11 Standalone", address, argPriority.getInt(parser), parser.isSet(argSkipReply));
// Connect the screen capturing to the proto processing
QObject::connect(&x11Wrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>)));
// Connect the vodeMode to the proto processing
QObject::connect(&protoWrapper, SIGNAL(setVideoMode(VideoMode)), &x11Wrapper, SLOT(setVideoMode(VideoMode)));
// Connect the screen capturing to flatbuf connection processing
QObject::connect(&x11Wrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
// Start the capturing
x11Wrapper.start();

View File

@@ -16,10 +16,10 @@ target_link_libraries(hyperiond
effectengine
jsonserver
udplistener
protoserver
flatbufserver
webserver
bonjour
ssdp
python
${PYTHON_LIBRARIES}
)

View File

@@ -21,7 +21,6 @@
#include <hyperion/Hyperion.h>
#include <jsonserver/JsonServer.h>
#include <protoserver/ProtoServer.h>
#include <udplistener/UDPListener.h>
#include <webserver/WebServer.h>
#include <utils/Stats.h>
@@ -34,6 +33,9 @@
// bonjour browser
#include <bonjour/bonjourbrowserwrapper.h>
// ssdp
#include <ssdp/SSDPHandler.h>
// settings
#include <hyperion/SettingsManager.h>
@@ -49,7 +51,6 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
, _pyInit(new PythonInit())
, _webserver(nullptr)
, _jsonServer(nullptr)
, _protoServer(nullptr)
, _udpListener(nullptr)
, _v4l2Grabbers()
, _dispmanx(nullptr)
@@ -59,6 +60,7 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
, _osxGrabber(nullptr)
, _hyperion(nullptr)
, _stats(nullptr)
, _ssdp(nullptr)
, _currVideoMode(VIDEO_2D)
{
HyperionDaemon::daemon = this;
@@ -67,6 +69,8 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
qRegisterMetaType<Image<ColorRgb>>("Image<ColorRgb>");
qRegisterMetaType<hyperion::Components>("hyperion::Components");
qRegisterMetaType<settings::type>("settings::type");
qRegisterMetaType<VideoMode>("VideoMode");
qRegisterMetaType<QMap<quint8,QJsonObject>>("QMap<quint8,QJsonObject>");
// init settings
_settingsManager = new SettingsManager(0,configFile);
@@ -113,11 +117,6 @@ HyperionDaemon::~HyperionDaemon()
delete _pyInit;
}
quint16 HyperionDaemon::getWebServerPort()
{
return _webserver->getPort();
}
void HyperionDaemon::setVideoMode(const VideoMode& mode)
{
if(_currVideoMode != mode)
@@ -135,19 +134,22 @@ const QJsonDocument HyperionDaemon::getSetting(const settings::type &type)
void HyperionDaemon::freeObjects()
{
_hyperion->clearall(true);
// destroy network first as a client might want to access pointers
delete _webserver;
// destroy network first as a client might want to access hyperion
delete _jsonServer;
delete _protoServer;
_flatBufferServer->thread()->quit();
_flatBufferServer->thread()->wait(1000);
//ssdp before webserver
_ssdp->thread()->quit();
_ssdp->thread()->wait(1000);
_webserver->thread()->quit();
_webserver->thread()->wait(1000);
delete _udpListener;
delete _bonjourBrowserWrapper;
delete _amlGrabber;
delete _dispmanx;
delete _fbGrabber;
delete _osxGrabber;
for(V4L2Wrapper* grabber : _v4l2Grabbers)
{
delete grabber;
@@ -162,7 +164,6 @@ void HyperionDaemon::freeObjects()
_osxGrabber = nullptr;
_webserver = nullptr;
_jsonServer = nullptr;
_protoServer = nullptr;
_udpListener = nullptr;
_stats = nullptr;
}
@@ -176,28 +177,40 @@ void HyperionDaemon::startNetworkServices()
_jsonServer = new JsonServer(getSetting(settings::JSONSERVER));
connect(this, &HyperionDaemon::settingsChanged, _jsonServer, &JsonServer::handleSettingsUpdate);
// Create Proto server
_protoServer = new ProtoServer(getSetting(settings::PROTOSERVER));
connect(this, &HyperionDaemon::settingsChanged, _protoServer, &ProtoServer::handleSettingsUpdate);
// Create FlatBuffer server & move to Thread
// Create FlatBuffer server in thread
_flatBufferServer = new FlatBufferServer(getSetting(settings::FLATBUFSERVER));
connect(this, &HyperionDaemon::settingsChanged, _flatBufferServer, &FlatBufferServer::handleSettingsUpdate);
QThread* fbThread = new QThread(this);
_flatBufferServer->moveToThread(fbThread);
connect( fbThread, &QThread::started, _flatBufferServer, &FlatBufferServer::initServer );
connect( fbThread, &QThread::finished, _flatBufferServer, &QObject::deleteLater );
connect( fbThread, &QThread::finished, fbThread, &QObject::deleteLater );
connect(this, &HyperionDaemon::settingsChanged, _flatBufferServer, &FlatBufferServer::handleSettingsUpdate);
fbThread->start();
// Create UDP listener
_udpListener = new UDPListener(getSetting(settings::UDPLISTENER));
connect(this, &HyperionDaemon::settingsChanged, _udpListener, &UDPListener::handleSettingsUpdate);
// Create Webserver
// Create Webserver in thread
_webserver = new WebServer(getSetting(settings::WEBSERVER));
QThread* wsThread = new QThread(this);
_webserver->moveToThread(wsThread);
connect( wsThread, &QThread::started, _webserver, &WebServer::initServer );
connect( wsThread, &QThread::finished, _webserver, &QObject::deleteLater );
connect( wsThread, &QThread::finished, wsThread, &QObject::deleteLater );
connect(this, &HyperionDaemon::settingsChanged, _webserver, &WebServer::handleSettingsUpdate);
wsThread->start();
// create SSDPHandler in thread
_ssdp = new SSDPHandler(_webserver, getSetting(settings::FLATBUFSERVER).object()["port"].toInt());
QThread* ssdpThread = new QThread(this);
_ssdp->moveToThread(ssdpThread);
connect( ssdpThread, &QThread::started, _ssdp, &SSDPHandler::initServer );
connect( ssdpThread, &QThread::finished, _ssdp, &QObject::deleteLater );
connect( ssdpThread, &QThread::finished, ssdpThread, &QObject::deleteLater );
connect( _webserver, &WebServer::stateChange, _ssdp, &SSDPHandler::handleWebServerStateChange);
connect(this, &HyperionDaemon::settingsChanged, _ssdp, &SSDPHandler::handleSettingsUpdate);
ssdpThread->start();
}
void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)

View File

@@ -49,13 +49,13 @@
class Hyperion;
class SysTray;
class JsonServer;
class ProtoServer;
class UDPListener;
class Stats;
class BonjourBrowserWrapper;
class WebServer;
class SettingsManager;
class PythonInit;
class SSDPHandler;
class FlatBufferServer;
class HyperionDaemon : public QObject
@@ -68,7 +68,11 @@ public:
HyperionDaemon(QString configFile, QString rootPath, QObject *parent, const bool& logLvlOverwrite );
~HyperionDaemon();
quint16 getWebServerPort();
///
/// @brief Get webserver pointer (systray)
///
WebServer* getWebServerInstance() { return _webserver; };
///
/// @brief Get the current videoMode
///
@@ -134,7 +138,6 @@ private:
PythonInit* _pyInit;
WebServer* _webserver;
JsonServer* _jsonServer;
ProtoServer* _protoServer;
UDPListener* _udpListener;
std::vector<V4L2Wrapper*> _v4l2Grabbers;
DispmanxWrapper* _dispmanx;
@@ -144,6 +147,7 @@ private:
OsxWrapper* _osxGrabber;
Hyperion* _hyperion;
Stats* _stats;
SSDPHandler* _ssdp;
FlatBufferServer* _flatBufferServer;
unsigned _grabber_width;

View File

@@ -332,7 +332,7 @@ int main(int argc, char** argv)
{
Info(log, "start systray");
QApplication::setQuitOnLastWindowClosed(false);
SysTray tray(hyperiond, hyperiond->getWebServerPort());
SysTray tray(hyperiond);
tray.hide();
rc = (qobject_cast<QApplication *>(app.data()))->exec();
}

View File

@@ -10,23 +10,28 @@
#include <utils/ColorRgb.h>
#include <effectengine/EffectDefinition.h>
#include <webserver/WebServer.h>
#include "hyperiond.h"
#include "systray.h"
SysTray::SysTray(HyperionDaemon *hyperiond, quint16 webPort)
SysTray::SysTray(HyperionDaemon *hyperiond)
: QWidget()
, _colorDlg(this)
, _hyperiond(hyperiond)
, _webPort(webPort)
, _hyperion(nullptr)
, _webPort(8090)
{
Q_INIT_RESOURCE(resource);
// webserver port
WebServer* webserver = _hyperiond->getWebServerInstance();
connect(webserver, &WebServer::portChanged, this, &SysTray::webserverPortChanged);
_hyperion = Hyperion::getInstance();
createTrayIcon();
connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
connect(&_colorDlg, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(setColor(const QColor &)));
QIcon icon(":/hyperion-icon.png");
_trayIcon->setIcon(icon);

View File

@@ -15,7 +15,7 @@ class SysTray : public QWidget
Q_OBJECT
public:
SysTray(HyperionDaemon *hyperiond, quint16 webPort);
SysTray(HyperionDaemon *hyperiond);
~SysTray();
@@ -30,6 +30,11 @@ public slots:
private slots:
void iconActivated(QSystemTrayIcon::ActivationReason reason);
///
/// @brief is called whenever the webserver changes the port
///
void webserverPortChanged(const quint16& port) { _webPort = port; };
private:
void createTrayIcon();
@@ -44,7 +49,7 @@ private:
QMenu *_trayIconMenu;
QMenu *_trayIconEfxMenu;
QColorDialog _colorDlg;
HyperionDaemon *_hyperiond;
quint16 _webPort;
HyperionDaemon *_hyperiond;
Hyperion *_hyperion;
quint16 _webPort;
};