2013-07-26 22:38:34 +02:00
# pragma once
2013-08-19 20:33:36 +02:00
// stl includes
# include <list>
2013-08-14 17:02:09 +02:00
// QT includes
2016-12-14 22:45:00 +01:00
# include <QString>
2017-03-21 17:55:46 +01:00
# include <QStringList>
2016-09-21 22:01:50 +02:00
# include <QSize>
2016-09-25 21:59:31 +02:00
# include <QJsonObject>
# include <QJsonValue>
# include <QJsonArray>
2020-07-12 09:19:59 +02:00
# include <QMap>
2013-08-14 17:02:09 +02:00
2013-07-26 22:38:34 +02:00
// hyperion-utils includes
2013-11-11 10:00:37 +01:00
# include <utils/Image.h>
2016-07-01 23:20:41 +02:00
# include <utils/ColorRgb.h>
2016-08-04 13:10:53 +02:00
# include <utils/Components.h>
2017-08-04 23:08:15 +02:00
# include <utils/VideoMode.h>
2013-07-26 22:38:34 +02:00
2013-08-13 11:10:45 +02:00
// Hyperion includes
2013-07-26 22:38:34 +02:00
# include <hyperion/LedString.h>
2013-08-13 11:10:45 +02:00
# include <hyperion/PriorityMuxer.h>
2016-04-02 00:04:11 +02:00
# include <hyperion/ColorAdjustment.h>
2016-09-07 20:10:37 +02:00
# include <hyperion/ComponentRegister.h>
2013-08-13 11:10:45 +02:00
2022-02-11 20:36:15 +01:00
# if defined(ENABLE_EFFECTENGINE)
2013-12-01 14:09:01 +01:00
// Effect engine includes
# include <effectengine/EffectDefinition.h>
2021-03-19 22:52:41 +01:00
# include <effectengine/Effect.h>
2016-04-24 17:07:31 +02:00
# include <effectengine/ActiveEffectDefinition.h>
2016-10-24 23:52:53 +02:00
# include <effectengine/EffectSchema.h>
2022-02-11 20:36:15 +01:00
# endif
2013-12-01 14:09:01 +01:00
2019-12-08 13:12:01 +01:00
# include <leddevice/LedDevice.h>
2018-12-27 23:11:32 +01:00
// settings utils
# include <utils/settings.h>
2016-08-04 13:10:53 +02:00
2013-08-13 11:10:45 +02:00
// Forward class declaration
2018-12-27 23:11:32 +01:00
class HyperionDaemon ;
class ImageProcessor ;
2022-01-07 14:47:51 +01:00
# if defined(ENABLE_FORWARDER)
2018-12-27 23:11:32 +01:00
class MessageForwarder ;
2022-01-07 14:47:51 +01:00
# endif
2016-09-08 16:32:42 +02:00
class LinearColorSmoothing ;
2022-02-11 20:36:15 +01:00
# if defined(ENABLE_EFFECTENGINE)
2013-11-24 16:10:48 +01:00
class EffectEngine ;
2022-02-11 20:36:15 +01:00
# endif
2016-04-02 00:04:11 +02:00
class MultiColorAdjustment ;
2018-12-27 23:11:32 +01:00
class ColorAdjustment ;
class SettingsManager ;
class BGEffectHandler ;
class CaptureCont ;
2022-01-07 14:47:51 +01:00
# if defined(ENABLE_BOBLIGHT_SERVER)
2018-12-28 18:12:45 +01:00
class BoblightServer ;
2021-09-15 10:32:19 +02:00
# endif
2019-01-01 19:47:07 +01:00
class LedDeviceWrapper ;
2020-08-02 10:44:42 +02:00
class Logger ;
2017-08-04 12:01:45 +02:00
2013-09-06 21:26:58 +02:00
///
/// The main class of Hyperion. This gives other 'users' access to the attached LedDevice through
/// the priority muxer.
///
2013-08-14 17:02:09 +02:00
class Hyperion : public QObject
2013-07-26 22:38:34 +02:00
{
2013-08-14 17:02:09 +02:00
Q_OBJECT
2013-07-26 22:38:34 +02:00
public :
2013-09-06 21:26:58 +02:00
/// Type definition of the info structure used by the priority muxer
2020-07-12 09:19:59 +02:00
using InputInfo = PriorityMuxer : : InputInfo ;
2013-08-19 19:57:35 +02:00
2013-09-06 21:26:58 +02:00
///
2016-10-11 19:51:20 +02:00
/// Destructor; cleans up resources
2013-09-06 21:26:58 +02:00
///
2020-07-12 09:19:59 +02:00
~ Hyperion ( ) override ;
2013-07-26 22:38:34 +02:00
2016-10-10 23:08:01 +02:00
///
/// free all alocated objects, should be called only from constructor or before restarting hyperion
///
2020-08-02 22:32:00 +02:00
void freeObjects ( ) ;
2016-06-17 01:25:40 +02:00
2020-08-02 10:44:42 +02:00
ImageProcessor * getImageProcessor ( ) const { return _imageProcessor ; }
2018-12-28 18:12:45 +01:00
2019-07-14 22:43:22 +02:00
///
/// @brief Get instance index of this instance
/// @return The index of this instance
///
2020-08-02 10:44:42 +02:00
quint8 getInstanceIndex ( ) const { return _instIndex ; }
2019-07-14 22:43:22 +02:00
2018-12-27 23:11:32 +01:00
///
/// @brief Return the size of led grid
///
2020-07-12 09:19:59 +02:00
QSize getLedGridSize ( ) const { return _ledGridSize ; }
2016-09-21 22:01:50 +02:00
2016-12-20 19:55:54 +01:00
/// gets the methode how image is maped to leds
2020-08-02 10:44:42 +02:00
int getLedMappingType ( ) const ;
2016-12-20 19:55:54 +01:00
2017-08-04 12:01:45 +02:00
/// forward smoothing config
unsigned addSmoothingConfig ( int settlingTime_ms , double ledUpdateFrequency_hz = 25.0 , unsigned updateDelay = 0 ) ;
2020-02-10 15:21:58 +01:00
unsigned updateSmoothingConfig ( unsigned id , int settlingTime_ms = 200 , double ledUpdateFrequency_hz = 25.0 , unsigned updateDelay = 0 ) ;
2020-08-02 10:44:42 +02:00
VideoMode getCurrentVideoMode ( ) const ;
2017-08-04 23:08:15 +02:00
2013-09-06 21:26:58 +02:00
///
2018-12-27 23:11:32 +01:00
/// @brief Get the current active led device
2020-07-12 09:19:59 +02:00
/// @return The device name
///
2020-08-02 10:44:42 +02:00
QString getActiveDeviceType ( ) const ;
Media Foundation/V4L2 grabber ... (#1119)
* - New Media Foundation grabber
- JsonAPI available grabber fix
- commented json config removed
* Added libjpeg-turbo to dependencies
* Fix OSX build
Removed Azure Pipelines from build scripts
* Remove Platform from Dashboard
* Correct Grabber Namings
* Grabber UI improvements, generic JSONEditor Selection Update
* Active grabber fix
* Stop Framebuffer grabber on failure
* - Image format NV12 and I420 added
- Flip mode
- Scaling factor for MJPEG
- VSCode (compile before run)
- CI (push) dependency libjpeg-turbo added
* Refactor MediaFoundation (Part 1)
* Remove QDebug output
* Added image flipping ability to MF Grabber
* fix issue 1160
* -Reload MF Grabber only once per WebUI update
- Cleanup
* Improvements
* - Set 'Software Frame Decimation' begin to 0
- Removed grabber specific device name from Log
- Keep pixel format when switching resolution
- Display 'Flip mode' correct in Log
- BGR24 images always flipped
* Refactor MediaFoundation (Part 2)
* Refactor V4L2 grabber (part 1) (#62)
* Media Foundation grabber adapted to V4L2 change
* Enable Media Foundation grabber on windows
* Have fps as int, fix height typo
* Added video standards to JsonAPI output
* Error handling in source reader improved
* Fix "Frame to small" error
* Discovery VideoSources and Dynamically Update Editor
* Hide all element when no video grabber discovered, upate naming
* Do not show unsupported grabbers
* Copy Log to Clipboard
* Update Grabber schema and Defaults
* Update access levels and validate crop ranges
* Height and width in Qt grabber corrected
* Correct formatting
* Untabify
* Global component states across instances
* Components divided on the dashboard
* refactor
* Fix Merge-issues
* Database migration aligning with updated grabber model
* Align Grabber.js with new utility functions
* Allow editor-validation for enum-lists
* Handle "Show Explainations scenario" correctly
* Grabber - Ensure save is only possible on valid content
* Dashboard update + fix GlobalSignal connection
* Ensure default database is populated with current release
* Correct grabber4L2 access level
* Display Signal detection area in preview
* Write Hyperion version into default config on compiling.
* Create defaultconfig.json dynamically
* WebUI changes
* Correct grabber config look-ups
* Refactor i18n language loading
* Fix en.json
* Split global capture from instance capture config
* Update grabber default values
* Standalone grabber: Add --debug switch
* Enhance showInputOptionsForKey for multiple keys
* Add grabber instance link to system grabber config
* Only show signal detection area, if grabber is enabled
* Always show Active element on grabber page
* Remote control - Only display gabber status, if global grabber is enabled
* WebUI optimization (thx to @mkcologne)
Start Grabber only when global settings are enabled
Fixed an issue in the WebUI preview
* V4L2/MF changes
* Jsoneditor, Correct translation for default values
* Refactor LED-Device handling in UI and make element naming consistent
* MF Discovery extended
* Fix LGTM finding
* Support Grabber Bri, Hue, Sat and Con in UI, plus their defaults
* Concider Access level for item filtering
* Concider Access level for item filtering
* Revert "Concider Access level for item filtering"
This reverts commit 5b0ce3c0f2de67e0c43788190cfff45614706129.
* Disable fpsSoftwareDecimation for framegrabber, as not supported yet
* JSON-Editor- Add updated schema for validation on dynamic elements
* added V4L2 color IDs
* LGTM findings fix
* destroy SR callback only on exit
* Grabber.js - Hide elements not supported by platform
* Fixed freezing start effect
* Grabber UI - Hardware controls - Show current values and allow to reset to defaults
* Grabber - Discovery - Add current values to properties
* Small things
* Clean-up Effects and have ENDLESS consistently defined
* Fix on/off/on priority during startup, by initializing _prevVisComp in line with background priority
* Add missing translation mappings
* DirectX Grabber reactivated/ QT Grabber size decimation fixed
* typo in push-master workflow
* Use PreciseTimer for Grabber to ensure stable FPS timing
* Set default Screencapture rate consistently
* Fix libjpeg-turbo download
* Remove Zero character from file
* docker-compile Add PLATFORM parameter, only copy output file after successful compile
* Framebuffer, Dispmanx, OSX, AML Grabber discovery, various clean-up and consistencies across grabbers
* Fix merge problem - on docker-compile Add PLATFORM parameter, only copy output file after successful compile
* Fix definition
* OSXFRameGrabber - Revert cast
* Clean-ups nach Feedback
* Disable certain libraries when building armlogic via standard stretch image as developer
* Add CEC availability to ServerInfo to have it platform independent
* Grabber UI - Fix problem that crop values are not populated when refining editor rage
* Preserve value when updating json-editor range
* LEDVisualisation - Clear image when source changes
* Fix - Preserve value when updating json-editor range
* LEDVisualisation - Clear image when no component is active
* Allow to have password handled by Password-Manager (#1263)
* Update default signal detection area to green assuming rainbow grabber
* LED Visualisation - Handle empty priority update
* Fix yuv420 in v4l2 grabber
* V4L2-Grabber discovery - Only report grabbers with valid video input information
* Grabber - Update static variables to have them working in release build
* LED Visualisation - ClearImage when no priorities
* LED Visualisation - Fix Logo resizing issue
* LED Visualisation - Have nearly black background and negative logo
Co-authored-by: LordGrey <lordgrey.emmel@gmail.com>
Co-authored-by: LordGrey <48840279+Lord-Grey@users.noreply.github.com>
2021-07-14 20:48:33 +02:00
bool getReadOnlyMode ( ) { return _readOnlyMode ; }
2020-11-01 19:47:30 +01:00
2020-08-02 10:44:42 +02:00
public slots :
2019-12-08 13:12:01 +01:00
///
2020-08-02 10:44:42 +02:00
/// Updates the priority muxer with the current time and (re)writes the led color with applied
/// transforms.
2019-12-08 13:12:01 +01:00
///
2020-08-02 10:44:42 +02:00
void update ( ) ;
2020-07-22 16:43:24 +02:00
///
/// Returns the number of attached leds
///
2020-11-14 17:58:56 +01:00
int getLedCount ( ) const ;
2020-03-26 17:59:41 +01:00
2019-07-29 19:09:26 +02:00
///
/// @brief Register a new input by priority, the priority is not active (timeout -100 isn't muxer recognized) until you start to update the data with setInput()
/// A repeated call to update the base data of a known priority won't overwrite their current timeout
/// @param[in] priority The priority of the channel
/// @param[in] component The component of the channel
/// @param[in] origin Who set the channel (CustomString@IP)
/// @param[in] owner Specific owner string, might be empty
/// @param[in] smooth_cfg The smooth id to use
///
2020-08-08 13:09:15 +02:00
void registerInput ( int priority , hyperion : : Components component , const QString & origin = " System " , const QString & owner = " " , unsigned smooth_cfg = 0 ) ;
2019-07-29 19:09:26 +02:00
2013-09-06 21:26:58 +02:00
///
2018-12-27 23:11:32 +01:00
/// @brief Update the current color of a priority (prev registered with registerInput())
/// DO NOT use this together with setInputImage() at the same time!
/// @param priority The priority to update
/// @param ledColors The colors
/// @param timeout_ms The new timeout (defaults to -1 endless)
/// @param clearEffect Should be true when NOT called from an effect
/// @return True on success, false when priority is not found
2013-09-06 21:26:58 +02:00
///
2022-02-11 20:36:15 +01:00
bool setInput ( int priority , const std : : vector < ColorRgb > & ledColors , int timeout_ms = PriorityMuxer : : ENDLESS , bool clearEffect = true ) ;
2013-08-18 13:33:56 +02:00
2013-09-06 21:26:58 +02:00
///
2018-12-27 23:11:32 +01:00
/// @brief Update the current image of a priority (prev registered with registerInput())
/// DO NOT use this together with setInput() at the same time!
/// @param priority The priority to update
/// @param image The new image
/// @param timeout_ms The new timeout (defaults to -1 endless)
/// @param clearEffect Should be true when NOT called from an effect
/// @return True on success, false when priority is not found
2013-09-06 21:26:58 +02:00
///
2022-02-11 20:36:15 +01:00
bool setInputImage ( int priority , const Image < ColorRgb > & image , int64_t timeout_ms = PriorityMuxer : : ENDLESS , bool clearEffect = true ) ;
2013-08-18 13:33:56 +02:00
2016-12-18 19:00:14 +01:00
///
2018-12-27 23:11:32 +01:00
/// Writes a single color to all the leds for the given time and priority
/// Registers comp color or provided type against muxer
/// Should be never used to update leds continuous
2016-12-18 19:00:14 +01:00
///
2018-12-27 23:11:32 +01:00
/// @param[in] priority The priority of the written color
2020-02-26 18:54:56 +01:00
/// @param[in] ledColors The color to write to the leds
2018-12-27 23:11:32 +01:00
/// @param[in] timeout_ms The time the leds are set to the given color [ms]
2019-07-29 19:09:26 +02:00
/// @param[in] origin The setter
/// @param clearEffect Should be true when NOT called from an effect
2016-12-18 19:00:14 +01:00
///
2022-02-11 20:36:15 +01:00
void setColor ( int priority , const std : : vector < ColorRgb > & ledColors , int timeout_ms = PriorityMuxer : : ENDLESS , const QString & origin = " System " , bool clearEffects = true ) ;
2016-12-18 19:00:14 +01:00
2019-07-14 22:43:22 +02:00
///
/// @brief Set the given priority to inactive
/// @param priority The priority
/// @return True on success false if not found
///
2020-08-08 13:09:15 +02:00
bool setInputInactive ( quint8 priority ) ;
2019-07-14 22:43:22 +02:00
2016-04-02 00:04:11 +02:00
///
/// Returns the list with unique adjustment identifiers
/// @return The list with adjustment identifiers
///
2020-08-08 23:12:43 +02:00
QStringList getAdjustmentIds ( ) const ;
2016-10-10 18:29:54 +02:00
2016-04-02 00:04:11 +02:00
///
/// Returns the ColorAdjustment with the given identifier
/// @return The adjustment with the given identifier (or nullptr if the identifier does not exist)
///
2020-08-02 10:44:42 +02:00
ColorAdjustment * getAdjustment ( const QString & id ) const ;
2016-10-10 18:29:54 +02:00
2016-04-02 00:04:11 +02:00
/// Tell Hyperion that the corrections have changed and the leds need to be updated
void adjustmentsUpdated ( ) ;
2013-09-06 21:26:58 +02:00
///
/// Clears the given priority channel. This will switch the led-colors to the colors of the next
/// lower priority channel (or off if no more channels are set)
///
2020-02-26 18:54:56 +01:00
/// @param[in] priority The priority channel. -1 clears all priorities
/// @param[in] forceClearAll Force the clear
2018-12-27 23:11:32 +01:00
/// @return True on success else false (not found)
2013-09-06 21:26:58 +02:00
///
2020-08-08 13:09:15 +02:00
bool clear ( int priority , bool forceClearAll = false ) ;
2013-07-26 22:38:34 +02:00
2022-02-11 20:36:15 +01:00
# if defined(ENABLE_EFFECTENGINE)
2020-03-26 17:59:41 +01:00
/// #############
Media Foundation/V4L2 grabber ... (#1119)
* - New Media Foundation grabber
- JsonAPI available grabber fix
- commented json config removed
* Added libjpeg-turbo to dependencies
* Fix OSX build
Removed Azure Pipelines from build scripts
* Remove Platform from Dashboard
* Correct Grabber Namings
* Grabber UI improvements, generic JSONEditor Selection Update
* Active grabber fix
* Stop Framebuffer grabber on failure
* - Image format NV12 and I420 added
- Flip mode
- Scaling factor for MJPEG
- VSCode (compile before run)
- CI (push) dependency libjpeg-turbo added
* Refactor MediaFoundation (Part 1)
* Remove QDebug output
* Added image flipping ability to MF Grabber
* fix issue 1160
* -Reload MF Grabber only once per WebUI update
- Cleanup
* Improvements
* - Set 'Software Frame Decimation' begin to 0
- Removed grabber specific device name from Log
- Keep pixel format when switching resolution
- Display 'Flip mode' correct in Log
- BGR24 images always flipped
* Refactor MediaFoundation (Part 2)
* Refactor V4L2 grabber (part 1) (#62)
* Media Foundation grabber adapted to V4L2 change
* Enable Media Foundation grabber on windows
* Have fps as int, fix height typo
* Added video standards to JsonAPI output
* Error handling in source reader improved
* Fix "Frame to small" error
* Discovery VideoSources and Dynamically Update Editor
* Hide all element when no video grabber discovered, upate naming
* Do not show unsupported grabbers
* Copy Log to Clipboard
* Update Grabber schema and Defaults
* Update access levels and validate crop ranges
* Height and width in Qt grabber corrected
* Correct formatting
* Untabify
* Global component states across instances
* Components divided on the dashboard
* refactor
* Fix Merge-issues
* Database migration aligning with updated grabber model
* Align Grabber.js with new utility functions
* Allow editor-validation for enum-lists
* Handle "Show Explainations scenario" correctly
* Grabber - Ensure save is only possible on valid content
* Dashboard update + fix GlobalSignal connection
* Ensure default database is populated with current release
* Correct grabber4L2 access level
* Display Signal detection area in preview
* Write Hyperion version into default config on compiling.
* Create defaultconfig.json dynamically
* WebUI changes
* Correct grabber config look-ups
* Refactor i18n language loading
* Fix en.json
* Split global capture from instance capture config
* Update grabber default values
* Standalone grabber: Add --debug switch
* Enhance showInputOptionsForKey for multiple keys
* Add grabber instance link to system grabber config
* Only show signal detection area, if grabber is enabled
* Always show Active element on grabber page
* Remote control - Only display gabber status, if global grabber is enabled
* WebUI optimization (thx to @mkcologne)
Start Grabber only when global settings are enabled
Fixed an issue in the WebUI preview
* V4L2/MF changes
* Jsoneditor, Correct translation for default values
* Refactor LED-Device handling in UI and make element naming consistent
* MF Discovery extended
* Fix LGTM finding
* Support Grabber Bri, Hue, Sat and Con in UI, plus their defaults
* Concider Access level for item filtering
* Concider Access level for item filtering
* Revert "Concider Access level for item filtering"
This reverts commit 5b0ce3c0f2de67e0c43788190cfff45614706129.
* Disable fpsSoftwareDecimation for framegrabber, as not supported yet
* JSON-Editor- Add updated schema for validation on dynamic elements
* added V4L2 color IDs
* LGTM findings fix
* destroy SR callback only on exit
* Grabber.js - Hide elements not supported by platform
* Fixed freezing start effect
* Grabber UI - Hardware controls - Show current values and allow to reset to defaults
* Grabber - Discovery - Add current values to properties
* Small things
* Clean-up Effects and have ENDLESS consistently defined
* Fix on/off/on priority during startup, by initializing _prevVisComp in line with background priority
* Add missing translation mappings
* DirectX Grabber reactivated/ QT Grabber size decimation fixed
* typo in push-master workflow
* Use PreciseTimer for Grabber to ensure stable FPS timing
* Set default Screencapture rate consistently
* Fix libjpeg-turbo download
* Remove Zero character from file
* docker-compile Add PLATFORM parameter, only copy output file after successful compile
* Framebuffer, Dispmanx, OSX, AML Grabber discovery, various clean-up and consistencies across grabbers
* Fix merge problem - on docker-compile Add PLATFORM parameter, only copy output file after successful compile
* Fix definition
* OSXFRameGrabber - Revert cast
* Clean-ups nach Feedback
* Disable certain libraries when building armlogic via standard stretch image as developer
* Add CEC availability to ServerInfo to have it platform independent
* Grabber UI - Fix problem that crop values are not populated when refining editor rage
* Preserve value when updating json-editor range
* LEDVisualisation - Clear image when source changes
* Fix - Preserve value when updating json-editor range
* LEDVisualisation - Clear image when no component is active
* Allow to have password handled by Password-Manager (#1263)
* Update default signal detection area to green assuming rainbow grabber
* LED Visualisation - Handle empty priority update
* Fix yuv420 in v4l2 grabber
* V4L2-Grabber discovery - Only report grabbers with valid video input information
* Grabber - Update static variables to have them working in release build
* LED Visualisation - ClearImage when no priorities
* LED Visualisation - Fix Logo resizing issue
* LED Visualisation - Have nearly black background and negative logo
Co-authored-by: LordGrey <lordgrey.emmel@gmail.com>
Co-authored-by: LordGrey <48840279+Lord-Grey@users.noreply.github.com>
2021-07-14 20:48:33 +02:00
/// EFFECTENGINE
2020-03-26 17:59:41 +01:00
///
/// @brief Get a pointer to the effect engine
/// @return EffectEngine instance pointer
///
2020-08-02 10:44:42 +02:00
EffectEngine * getEffectEngineInstance ( ) const { return _effectEngine ; }
2022-02-11 20:36:15 +01:00
2020-03-26 17:59:41 +01:00
///
/// @brief Save an effect
/// @param obj The effect args
/// @return Empty on success else error message
///
QString saveEffect ( const QJsonObject & obj ) ;
///
/// @brief Delete an effect by name.
/// @param effectName The effect name to delete
/// @return Empty on success else error message
///
QString deleteEffect ( const QString & effectName ) ;
2013-11-24 16:10:48 +01:00
/// Run the specified effect on the given priority channel and optionally specify a timeout
/// @param effectName Name of the effec to run
/// @param priority The priority channel of the effect
2016-10-11 19:51:20 +02:00
/// @param timeout The timeout of the effect (after the timout, the effect will be cleared)
2022-02-11 20:36:15 +01:00
int setEffect ( const QString & effectName , int priority , int timeout = PriorityMuxer : : ENDLESS , const QString & origin = " System " ) ;
2013-11-24 16:10:48 +01:00
2013-12-01 14:09:01 +01:00
/// Run the specified effect on the given priority channel and optionally specify a timeout
/// @param effectName Name of the effec to run
2013-12-01 16:35:45 +01:00
/// @param args arguments of the effect script
2013-12-01 14:09:01 +01:00
/// @param priority The priority channel of the effect
2016-10-11 19:51:20 +02:00
/// @param timeout The timeout of the effect (after the timout, the effect will be cleared)
2019-01-06 19:49:56 +01:00
int setEffect ( const QString & effectName
, const QJsonObject & args
, int priority
2022-02-11 20:36:15 +01:00
, int timeout = PriorityMuxer : : ENDLESS
2019-01-06 19:49:56 +01:00
, const QString & pythonScript = " "
, const QString & origin = " System "
, const QString & imageData = " "
) ;
2013-12-01 14:09:01 +01:00
2020-03-26 17:59:41 +01:00
/// Get the list of available effects
/// @return The list of available effects
2020-08-08 23:12:43 +02:00
std : : list < EffectDefinition > getEffects ( ) const ;
2020-03-26 17:59:41 +01:00
/// Get the list of active effects
/// @return The list of active effects
2020-08-08 23:12:43 +02:00
std : : list < ActiveEffectDefinition > getActiveEffects ( ) const ;
2020-03-26 17:59:41 +01:00
/// Get the list of available effect schema files
/// @return The list of available effect schema files
2020-08-08 23:12:43 +02:00
std : : list < EffectSchema > getEffectSchemas ( ) const ;
2022-02-11 20:36:15 +01:00
# endif
2020-03-26 17:59:41 +01:00
/// #############
/// PRIORITYMUXER
///
/// @brief Get a pointer to the priorityMuxer instance
/// @return PriorityMuxer instance pointer
///
2022-01-22 17:48:03 +01:00
PriorityMuxer * getMuxerInstance ( ) { return _muxer ; }
2020-03-26 17:59:41 +01:00
///
/// @brief enable/disable automatic/priorized source selection
/// @param state The new state
///
2020-08-08 13:09:15 +02:00
void setSourceAutoSelect ( bool state ) ;
2020-03-26 17:59:41 +01:00
///
/// @brief set current input source to visible
/// @param priority the priority channel which should be vidible
/// @return true if success, false on error
///
2020-08-08 13:09:15 +02:00
bool setVisiblePriority ( int priority ) ;
2020-03-26 17:59:41 +01:00
/// gets current state of automatic/priorized source selection
/// @return the state
2020-08-08 23:12:43 +02:00
bool sourceAutoSelectEnabled ( ) const ;
2020-03-26 17:59:41 +01:00
///
/// Returns the current priority
///
/// @return The current priority
///
int getCurrentPriority ( ) const ;
///
/// Returns true if current priority is given priority
///
/// @return bool
///
2020-08-08 13:09:15 +02:00
bool isCurrentPriority ( int priority ) const ;
2020-03-26 17:59:41 +01:00
///
/// Returns a list of all registered priorities
///
/// @return The list with priorities
///
QList < int > getActivePriorities ( ) const ;
///
/// Returns the information of a specific priorrity channel
///
/// @param[in] priority The priority channel
///
/// @return The information of the given, a not found priority will return lowest priority as fallback
///
2020-11-14 17:58:56 +01:00
PriorityMuxer : : InputInfo getPriorityInfo ( int priority ) const ;
2020-03-26 17:59:41 +01:00
/// #############
/// SETTINGSMANAGER
///
/// @brief Get a setting by settings::type from SettingsManager
/// @param type The settingsType from enum
/// @return Data Document
///
2020-08-08 13:09:15 +02:00
QJsonDocument getSetting ( settings : : type type ) const ;
2020-03-26 17:59:41 +01:00
/// gets the current json config object from SettingsManager
/// @return json config
2020-08-08 23:12:43 +02:00
QJsonObject getQJsonConfig ( ) const ;
2020-03-26 17:59:41 +01:00
///
/// @brief Save a complete json config
/// @param config The entire config object
/// @param correct If true will correct json against schema before save
/// @return True on success else false
///
2020-08-08 23:12:43 +02:00
bool saveSettings ( const QJsonObject & config , bool correct = false ) ;
2020-03-26 17:59:41 +01:00
2021-11-17 21:30:43 +01:00
///
/// @brief Restore a complete json config
/// @param config The entire config object
/// @param correct If true will correct json against schema before save
/// @return True on success else false
///
bool restoreSettings ( const QJsonObject & config , bool correct = false ) ;
2020-03-26 17:59:41 +01:00
/// ############
/// COMPONENTREGISTER
///
/// @brief Get the component Register
/// return Component register pointer
///
2022-01-22 17:48:03 +01:00
ComponentRegister * getComponentRegister ( ) { return _componentRegister ; }
2020-03-26 17:59:41 +01:00
///
/// @brief Called from components to update their current state. DO NOT CALL FROM USERS
/// @param[in] component The component from enum
/// @param[in] state The state of the component [true | false]
///
2020-08-08 13:09:15 +02:00
void setNewComponentState ( hyperion : : Components component , bool state ) ;
2020-03-26 17:59:41 +01:00
///
/// @brief Get a list of all contrable components and their current state
/// @return list of components
///
2020-08-02 10:44:42 +02:00
std : : map < hyperion : : Components , bool > getAllComponents ( ) const ;
2020-03-26 17:59:41 +01:00
///
/// @brief Test if a component is enabled
/// @param The component to test
/// @return Component state
///
2020-08-08 23:12:43 +02:00
int isComponentEnabled ( hyperion : : Components comp ) const ;
2020-03-26 17:59:41 +01:00
2018-12-27 23:11:32 +01:00
/// sets the methode how image is maped to leds at ImageProcessor
2020-08-08 13:09:15 +02:00
void setLedMappingType ( int mappingType ) ;
2017-06-24 11:52:22 +02:00
2017-08-04 23:08:15 +02:00
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
2020-08-08 13:09:15 +02:00
void setVideoMode ( VideoMode mode ) ;
2017-10-12 11:55:03 +02:00
2019-07-14 22:43:22 +02:00
///
/// @brief Init after thread start
///
void start ( ) ;
///
/// @brief Stop the execution of this thread, helper to properly track eventing
///
void stop ( ) ;
2016-06-17 01:25:40 +02:00
2020-08-02 10:44:42 +02:00
int getLatchTime ( ) const ;
2022-12-22 12:40:39 +01:00
///
/// @brief Set hyperion in suspend mode or resume from suspend/idle.
/// All instances and components will be disabled/enabled.
/// @param isSupend True, components will be deactivated, else put into their previous state before suspend
///
void setSuspend ( bool isSupend ) ;
///
/// @brief Set hyperion in idle /working mode.
/// In idle, all instances and components will be disabled besides the output processing (LED-Devices, smoothing).
/// @param isIdle True, selected components will be deactivated, else put into their previous state before idle
///
void setIdle ( bool isIdle ) ;
2013-11-24 16:10:48 +01:00
signals :
/// Signal which is emitted when a priority channel is actively cleared
/// This signal will not be emitted when a priority channel time out
void channelCleared ( int priority ) ;
/// Signal which is emitted when all priority channels are actively cleared
/// This signal will not be emitted when a priority channel time out
void allChannelsCleared ( ) ;
2018-12-27 23:11:32 +01:00
///
/// @brief Emits whenever a user request a component state change, it's up the component to listen
/// and update the component state at the componentRegister
/// @param component The component from enum
/// @param enabled The new state of the component
///
2020-08-08 13:09:15 +02:00
void compStateChangeRequest ( hyperion : : Components component , bool enabled ) ;
2016-08-11 07:13:55 +02:00
2022-12-22 12:40:39 +01:00
///
/// @brief Emits when all (besides excluded) components are subject to state changes
/// @param isActive The new state for all components
/// @param execlude List of excluded components
void compStateChangeRequestAll ( bool isActive , const ComponentList & excludeList = { } ) ;
/// Signal which is emitted, when system is to be suspended/resumed
void suspendRequest ( bool isSuspend ) ;
/// Signal which is emitted, when system should go into idle/working mode
void idleRequest ( bool isIdle ) ;
2018-12-27 23:11:32 +01:00
///
/// @brief Emits whenever the imageToLedsMapping has changed
/// @param mappingType The new mapping type
///
2020-08-08 13:09:15 +02:00
void imageToLedsMappingChanged ( int mappingType ) ;
2018-12-27 23:11:32 +01:00
///
/// @brief Emits whenever the visible priority delivers a image which is applied in update()
/// priorities with ledColors won't emit this signal
/// @param image The current image
///
void currentImage ( const Image < ColorRgb > & image ) ;
2017-06-24 11:52:22 +02:00
/// Signal which is emitted, when a new json message should be forwarded
void forwardJsonMessage ( QJsonObject ) ;
2019-07-02 19:06:36 +02:00
/// Signal which is emitted, when a new system proto image should be forwarded
2020-08-08 23:12:43 +02:00
void forwardSystemProtoMessage ( const QString & , const Image < ColorRgb > & ) ;
2019-07-02 19:06:36 +02:00
/// Signal which is emitted, when a new V4l proto image should be forwarded
2020-08-08 23:12:43 +02:00
void forwardV4lProtoMessage ( const QString & , const Image < ColorRgb > & ) ;
2019-02-03 14:36:57 +01:00
2022-05-29 17:47:08 +02:00
# if defined(ENABLE_FLATBUF_SERVER) || defined(ENABLE_PROTOBUF_SERVER)
/// Signal which is emitted, when a new Flat-/Proto- Buffer image should be forwarded
void forwardBufferMessage ( const QString & , const Image < ColorRgb > & ) ;
# endif
2018-12-27 23:11:32 +01:00
///
/// @brief Is emitted from clients who request a videoMode change
///
2020-08-08 13:09:15 +02:00
void videoMode ( VideoMode mode ) ;
2018-12-27 23:11:32 +01:00
///
/// @brief A new videoMode was requested (called from Daemon!)
///
2020-08-08 13:09:15 +02:00
void newVideoMode ( VideoMode mode ) ;
2018-12-27 23:11:32 +01:00
///
/// @brief Emits whenever a config part changed. SIGNAL PIPE helper for SettingsManager -> HyperionDaemon
/// @param type The settings type from enum
/// @param data The data as QJsonDocument
///
2020-08-08 13:09:15 +02:00
void settingsChanged ( settings : : type type , const QJsonDocument & data ) ;
2017-06-17 23:29:04 +02:00
2018-12-27 23:11:32 +01:00
///
/// @brief Emits whenever the adjustments have been updated
///
void adjustmentChanged ( ) ;
2017-08-04 23:08:15 +02:00
2022-02-11 20:36:15 +01:00
# if defined(ENABLE_EFFECTENGINE)
2018-12-20 15:01:46 +01:00
///
2018-12-27 23:11:32 +01:00
/// @brief Signal pipe from EffectEngine to external, emits when effect list has been updated
2018-12-20 15:01:46 +01:00
///
2018-12-27 23:11:32 +01:00
void effectListUpdated ( ) ;
2022-02-11 20:36:15 +01:00
# endif
2018-12-27 23:11:32 +01:00
///
2019-01-01 19:47:07 +01:00
/// @brief Emits whenever new data should be pushed to the LedDeviceWrapper which forwards it to the threaded LedDevice
2018-12-27 23:11:32 +01:00
///
2019-01-01 19:47:07 +01:00
void ledDeviceData ( const std : : vector < ColorRgb > & ledValues ) ;
2018-12-20 15:01:46 +01:00
2018-12-31 15:48:29 +01:00
///
/// @brief Emits whenever new untransformed ledColos data is available, reflects the current visible device
///
void rawLedColors ( const std : : vector < ColorRgb > & ledValues ) ;
2019-07-14 22:43:22 +02:00
///
/// @brief Emits before thread quit is requested
///
void finished ( ) ;
///
/// @brief Emits after thread has been started
///
void started ( ) ;
2019-07-20 16:13:40 +02:00
private slots :
2018-12-27 23:11:32 +01:00
///
2020-02-15 22:47:27 +01:00
/// @brief Handle whenever the visible component changed
/// @param comp The new component
2018-12-27 23:11:32 +01:00
///
2020-08-08 13:09:15 +02:00
void handleVisibleComponentChanged ( hyperion : : Components comp ) ;
2018-12-27 23:11:32 +01:00
///
/// @brief Apply settings updates for LEDS and COLOR
/// @param type The type from enum
/// @param config The configuration
///
2020-08-08 13:09:15 +02:00
void handleSettingsUpdate ( settings : : type type , const QJsonDocument & config ) ;
2018-12-27 23:11:32 +01:00
2019-07-14 22:43:22 +02:00
///
/// @brief Apply new videoMode from Daemon to _currVideoMode
///
2020-08-08 13:09:15 +02:00
void handleNewVideoMode ( VideoMode mode ) { _currVideoMode = mode ; }
2019-07-14 22:43:22 +02:00
2021-08-31 10:56:06 +02:00
///
/// @brief Handle the scenario when no/an input source is available
/// @param priority Current priority
///
2022-02-22 20:58:59 +01:00
void handleSourceAvailability ( int priority ) ;
2020-09-14 17:19:14 +02:00
2013-07-26 22:38:34 +02:00
private :
2019-07-14 22:43:22 +02:00
friend class HyperionDaemon ;
friend class HyperionIManager ;
2017-06-24 11:52:22 +02:00
2016-06-17 01:25:40 +02:00
///
2019-07-14 22:43:22 +02:00
/// @brief Constructs the Hyperion instance, just accessible for HyperionIManager
/// @param instance The instance index
2016-06-17 01:25:40 +02:00
///
2020-11-01 19:47:30 +01:00
Hyperion ( quint8 instance , bool readonlyMode = false ) ;
2018-12-27 23:11:32 +01:00
2019-07-14 22:43:22 +02:00
/// instance index
const quint8 _instIndex ;
2018-12-27 23:11:32 +01:00
/// Settings manager of this instance
SettingsManager * _settingsManager ;
/// Register that holds component states
2022-01-22 17:48:03 +01:00
ComponentRegister * _componentRegister ;
2016-06-17 01:25:40 +02:00
2013-09-06 21:26:58 +02:00
/// The specifiation of the led frame construction and picture integration
2013-08-18 13:33:56 +02:00
LedString _ledString ;
2013-07-26 22:38:34 +02:00
2018-12-27 23:11:32 +01:00
/// Image Processor
ImageProcessor * _imageProcessor ;
2016-08-08 00:17:00 +02:00
std : : vector < ColorOrder > _ledStringColorOrder ;
2017-06-24 11:52:22 +02:00
2013-09-06 21:26:58 +02:00
/// The priority muxer
2022-01-22 17:48:03 +01:00
PriorityMuxer * _muxer ;
2013-07-26 22:38:34 +02:00
2016-04-02 00:04:11 +02:00
/// The adjustment from raw colors to led colors
MultiColorAdjustment * _raw2ledAdjustment ;
2017-06-24 11:52:22 +02:00
2019-01-01 19:47:07 +01:00
/// The actual LedDeviceWrapper
LedDeviceWrapper * _ledDeviceWrapper ;
2013-08-14 17:02:09 +02:00
2016-09-08 16:32:42 +02:00
/// The smoothing LedDevice
LinearColorSmoothing * _deviceSmooth ;
2022-02-11 20:36:15 +01:00
# if defined(ENABLE_EFFECTENGINE)
2013-11-24 16:10:48 +01:00
/// Effect engine
EffectEngine * _effectEngine ;
2022-02-11 20:36:15 +01:00
# endif
2017-06-24 11:52:22 +02:00
2022-01-07 14:47:51 +01:00
# if defined(ENABLE_FORWARDER)
2019-07-20 11:28:16 +02:00
// Message forwarder
MessageForwarder * _messageForwarder ;
2022-01-07 14:47:51 +01:00
# endif
2016-07-30 13:07:53 +02:00
2016-07-01 23:20:41 +02:00
/// Logger instance
Logger * _log ;
2016-07-30 13:07:53 +02:00
2016-07-01 23:20:41 +02:00
/// count of hardware leds
2020-11-14 17:58:56 +01:00
int _hwLedCount ;
2016-07-30 13:07:53 +02:00
2016-09-21 22:01:50 +02:00
QSize _ledGridSize ;
2017-06-24 11:52:22 +02:00
2018-12-27 23:11:32 +01:00
/// Background effect instance, kept active to react on setting changes
BGEffectHandler * _BGEffectHandler ;
/// Capture control for Daemon native capture
CaptureCont * _captureCont ;
2017-10-12 11:55:03 +02:00
2018-12-27 23:11:32 +01:00
/// buffer for leds (with adjustment)
std : : vector < ColorRgb > _ledBuffer ;
2018-12-28 18:12:45 +01:00
2020-06-28 23:05:32 +02:00
VideoMode _currVideoMode = VideoMode : : VIDEO_2D ;
2019-07-14 22:43:22 +02:00
2022-01-07 14:47:51 +01:00
# if defined(ENABLE_BOBLIGHT_SERVER)
2018-12-28 18:12:45 +01:00
/// Boblight instance
BoblightServer * _boblightServer ;
2021-09-15 10:32:19 +02:00
# endif
2020-11-01 19:47:30 +01:00
bool _readOnlyMode ;
2013-07-26 22:38:34 +02:00
} ;