2016-06-17 01:25:40 +02:00
|
|
|
#pragma once
|
|
|
|
|
add Hue EntertainmentAPI + Forwarder & other Fixes (#592)
* whitespaces + typo fixes
* JS / LGTM fixes
* SSDP Handler crash fix
* MessageForwarder handlePriorityChanges Slave fixes
* use aboutToQuit Signal
* complete rewriten Hue Entertainment API structure
combined Philips Hue and Entertainment API
with new MbedTLS based SSL UDP Provider
* add required cross-compile submodules
* logical rebuild fn: initLeds, setLights + new logs
-more detailed checks and error handling inside iniLeds and setLights
- logical script procedure before ProviderUdpSSL init
- first steps for multiple ProviderUdpSSL usage
- better fallback support to old RestAPI, if entertainment api is not supported
- just 4 u LordGrey: new log fn for cosmetic config outputs ;)
* add OSX CompileHowTo - undo from CrossCompileHowTo
* whitespace fixes
* lightID toString fix
* fix unsigned int E-API + debug output
* bugfixes, reworked black signal detection, wizard:
- change device config field light-ids from int to string -> real unsigned int fix
- add signal detection brightness minimum threshold value
0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection
reason: input may not 100% black, like mine - i have a deep dark gray input signal
-> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black
- wizard optimations, with fallback without entertainment support (beta state)
- whitespace fixes
* cleanup + minor fixes
* change fixed Hue UPD SSL config to _devConfig paras
* Hotfix SSL Connection, new light models, wizard:
- Fix UPD SSL Connection failed Problems
- add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003
- wizard: extend fallback support to classic mode + hints
* whitespace, typo fix
* uncheck useEntertainmentAPI, if noAPISupport detected + hint
* coredump fix -> add _blackLightsTimer nullptr init
* code cleanup / remove old debugs + whitespacefixes
* add gamut C LCP001, LCP002
* SSL UDP config made more flexible + remove qDebug
-> switch to hyerion.ng _log
-> replace logCommand with verbose
-> code cleanups etc...
* extended mbedtls debugging infos
* add adjustable ssl timeout settings
* error handling
* streamdebugger bugfixes
* UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix +
- verbose option available without dependencies
- whitespace fixes
* Philips Hue Assistant now recognizes non-original bridges better...
+ Added note if no clientkey is set when using the entertainment API
+ User creation (+ clientkey) for non-original bridges can now also be used
+ Minor changes and bug fixes
* CMAKE mbedTLS detection
* minor bug fixes + code cleanups
* FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling
Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true:
conf_grabber don't displays other devices, if V4L2 is not available
* compile mbedtls via cmake as static lib
* remove libmbedtls-dev from compileHowto / scripts
* Fix Windows build
* Fix windows build (part 2)
* removed unnecessary osx x11 include directory path
* QTimer Shutdown bugfix
* cmake win32 fix + minor bugfixes
* cmake debug msg used mbedtls libs
* Bugfix: noSignalDetection wasn't switchedOn again
if no signal was previously detected
* Some code fixes based on alerts from lgtm.com
Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
|
|
|
#include <QApplication>
|
2016-06-17 01:25:40 +02:00
|
|
|
#include <QObject>
|
2017-08-12 07:55:32 +02:00
|
|
|
#include <QJsonObject>
|
2016-06-17 01:25:40 +02:00
|
|
|
|
|
|
|
#ifdef ENABLE_DISPMANX
|
|
|
|
#include <grabber/DispmanxWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject DispmanxWrapper;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_V4L2
|
|
|
|
#include <grabber/V4L2Wrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject V4L2Wrapper;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_FB
|
|
|
|
#include <grabber/FramebufferWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject FramebufferWrapper;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_AMLOGIC
|
|
|
|
#include <grabber/AmlogicWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject AmlogicWrapper;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_OSX
|
|
|
|
#include <grabber/OsxWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject OsxWrapper;
|
|
|
|
#endif
|
|
|
|
|
2016-07-24 15:18:34 +02:00
|
|
|
#ifdef ENABLE_X11
|
|
|
|
#include <grabber/X11Wrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject X11Wrapper;
|
|
|
|
#endif
|
|
|
|
|
2019-01-06 19:49:56 +01:00
|
|
|
#ifdef ENABLE_QT
|
|
|
|
#include <grabber/QtWrapper.h>
|
|
|
|
#else
|
|
|
|
typedef QObject QtWrapper;
|
|
|
|
#endif
|
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
#include <utils/Logger.h>
|
2018-12-27 23:11:32 +01:00
|
|
|
#include <utils/VideoMode.h>
|
2016-06-19 00:56:47 +02:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
// settings management
|
|
|
|
#include <utils/settings.h>
|
2019-07-14 22:43:22 +02:00
|
|
|
#include <utils/Components.h>
|
2016-06-19 00:56:47 +02:00
|
|
|
|
2019-07-14 22:43:22 +02:00
|
|
|
class HyperionIManager;
|
2017-08-01 17:29:47 +02:00
|
|
|
class SysTray;
|
2018-12-27 23:11:32 +01:00
|
|
|
class JsonServer;
|
|
|
|
class BonjourBrowserWrapper;
|
|
|
|
class WebServer;
|
|
|
|
class SettingsManager;
|
|
|
|
class PythonInit;
|
2018-12-30 22:07:53 +01:00
|
|
|
class SSDPHandler;
|
2018-12-28 18:12:45 +01:00
|
|
|
class FlatBufferServer;
|
2019-02-17 15:26:11 +01:00
|
|
|
class ProtoServer;
|
2019-07-12 16:54:26 +02:00
|
|
|
class AuthManager;
|
|
|
|
class NetOrigin;
|
2017-08-01 17:29:47 +02:00
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
class HyperionDaemon : public QObject
|
|
|
|
{
|
2017-01-22 14:31:11 +01:00
|
|
|
Q_OBJECT
|
2017-09-02 22:26:22 +02:00
|
|
|
|
2017-08-01 17:29:47 +02:00
|
|
|
friend SysTray;
|
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
public:
|
2019-09-17 21:33:46 +02:00
|
|
|
HyperionDaemon(QString rootPath, QObject *parent, const bool& logLvlOverwrite);
|
2016-06-19 00:56:47 +02:00
|
|
|
~HyperionDaemon();
|
2017-07-30 13:32:10 +02:00
|
|
|
|
2018-12-30 22:07:53 +01:00
|
|
|
///
|
|
|
|
/// @brief Get webserver pointer (systray)
|
|
|
|
///
|
|
|
|
WebServer* getWebServerInstance() { return _webserver; };
|
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
///
|
|
|
|
/// @brief Get the current videoMode
|
|
|
|
///
|
|
|
|
const VideoMode & getVideoMode() { return _currVideoMode; };
|
|
|
|
|
|
|
|
///
|
|
|
|
/// @brief get the settings
|
|
|
|
///
|
|
|
|
const QJsonDocument getSetting(const settings::type& type);
|
2016-06-19 00:56:47 +02:00
|
|
|
|
|
|
|
void startNetworkServices();
|
2016-06-17 01:25:40 +02:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
static HyperionDaemon* getInstance() { return daemon; };
|
|
|
|
static HyperionDaemon* daemon;
|
2016-06-17 01:25:40 +02:00
|
|
|
|
2017-01-22 14:31:11 +01:00
|
|
|
public slots:
|
|
|
|
void freeObjects();
|
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
signals:
|
2019-07-14 22:43:22 +02:00
|
|
|
///////////////////////////////////////
|
|
|
|
/// FROM HYPERIONDAEMON TO HYPERION ///
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
|
|
|
///
|
|
|
|
/// @brief After eval of setVideoMode this signal emits with a new one on change
|
|
|
|
///
|
|
|
|
void videoMode(const VideoMode& mode);
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
/// FROM HYPERION TO HYPERIONDAEMON ///
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
///
|
|
|
|
/// @brief PIPE settings events from Hyperion class to HyperionDaemon components
|
|
|
|
///
|
|
|
|
void settingsChanged(const settings::type& type, const QJsonDocument& data);
|
|
|
|
|
|
|
|
///
|
2019-07-14 22:43:22 +02:00
|
|
|
/// @brief PIPE component state changes events from Hyperion class to HyperionDaemon components
|
2018-12-27 23:11:32 +01:00
|
|
|
///
|
2020-02-26 18:54:56 +01:00
|
|
|
void compStateChangeRequest(const hyperion::Components component, bool enable);
|
2018-12-27 23:11:32 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
///
|
|
|
|
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
|
|
|
|
/// @param type settingyType from enum
|
|
|
|
/// @param config configuration object
|
|
|
|
///
|
|
|
|
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
|
|
|
|
|
|
|
|
///
|
|
|
|
/// @brief Listen for videoMode changes and emit videoMode in case of a change, update _currVideoMode
|
|
|
|
/// @param mode The requested video mode
|
|
|
|
///
|
|
|
|
void setVideoMode(const VideoMode& mode);
|
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
private:
|
2016-07-27 22:52:59 +02:00
|
|
|
void createGrabberDispmanx();
|
|
|
|
void createGrabberAmlogic();
|
2016-08-04 10:53:26 +02:00
|
|
|
void createGrabberFramebuffer(const QJsonObject & grabberConfig);
|
|
|
|
void createGrabberOsx(const QJsonObject & grabberConfig);
|
|
|
|
void createGrabberX11(const QJsonObject & grabberConfig);
|
2019-01-06 19:49:56 +01:00
|
|
|
void createGrabberQt(const QJsonObject & grabberConfig);
|
2016-07-24 15:18:34 +02:00
|
|
|
|
2019-02-17 15:26:11 +01:00
|
|
|
Logger* _log;
|
2019-07-14 22:43:22 +02:00
|
|
|
HyperionIManager* _instanceManager;
|
2019-07-12 16:54:26 +02:00
|
|
|
AuthManager* _authManager;
|
2019-02-17 15:26:11 +01:00
|
|
|
BonjourBrowserWrapper* _bonjourBrowserWrapper;
|
2019-07-12 16:54:26 +02:00
|
|
|
NetOrigin* _netOrigin;
|
2019-02-17 15:26:11 +01:00
|
|
|
PythonInit* _pyInit;
|
|
|
|
WebServer* _webserver;
|
2019-08-21 16:09:28 +02:00
|
|
|
WebServer* _sslWebserver;
|
2019-02-17 15:26:11 +01:00
|
|
|
JsonServer* _jsonServer;
|
2019-05-03 17:54:43 +02:00
|
|
|
V4L2Wrapper* _v4l2Grabber;
|
2019-02-17 15:26:11 +01:00
|
|
|
DispmanxWrapper* _dispmanx;
|
|
|
|
X11Wrapper* _x11Grabber;
|
|
|
|
AmlogicWrapper* _amlGrabber;
|
|
|
|
FramebufferWrapper* _fbGrabber;
|
|
|
|
OsxWrapper* _osxGrabber;
|
|
|
|
QtWrapper* _qtGrabber;
|
|
|
|
SSDPHandler* _ssdp;
|
|
|
|
FlatBufferServer* _flatBufferServer;
|
|
|
|
ProtoServer* _protoServer;
|
|
|
|
|
|
|
|
unsigned _grabber_width;
|
|
|
|
unsigned _grabber_height;
|
|
|
|
unsigned _grabber_frequency;
|
|
|
|
unsigned _grabber_cropLeft;
|
|
|
|
unsigned _grabber_cropRight;
|
|
|
|
unsigned _grabber_cropTop;
|
|
|
|
unsigned _grabber_cropBottom;
|
|
|
|
int _grabber_ge2d_mode;
|
|
|
|
QString _grabber_device;
|
2018-12-31 15:48:29 +01:00
|
|
|
|
2019-07-12 16:54:26 +02:00
|
|
|
QString _prevType;
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-07-12 16:54:26 +02:00
|
|
|
VideoMode _currVideoMode;
|
|
|
|
SettingsManager* _settingsManager;
|
2016-06-19 00:56:47 +02:00
|
|
|
};
|