2013-08-13 11:10:45 +02:00
# pragma once
// STL includes
# include <vector>
# include <cstdint>
// QT includes
# include <QMap>
2017-06-17 23:29:04 +02:00
# include <QObject>
2017-09-01 08:50:37 +02:00
# include <QMap>
# include <QVector>
2013-08-13 11:10:45 +02:00
// Utils includes
2013-11-11 10:00:37 +01:00
# include <utils/ColorRgb.h>
2018-12-27 23:11:32 +01:00
# include <utils/Image.h>
2016-10-10 18:29:54 +02:00
# include <utils/Components.h>
2013-08-13 11:10:45 +02:00
2017-08-04 12:01:45 +02:00
// global defines
# define SMOOTHING_MODE_DEFAULT 0
# define SMOOTHING_MODE_PAUSE 1
2018-12-27 23:11:32 +01:00
class QTimer ;
class Logger ;
2017-08-04 12:01:45 +02:00
2013-09-06 21:26:58 +02:00
///
2018-12-27 23:11:32 +01:00
/// The PriorityMuxer handles the priority channels. Led values input/ images are written to the priority map
2013-09-06 21:26:58 +02:00
/// and the muxer keeps track of all active priorities. The current priority can be queried and per
2018-12-27 23:11:32 +01:00
/// priority the led colors. Handles also manual/auto selection mode, provides a lot of signals to hook into priority related events
2013-09-06 21:26:58 +02:00
///
2017-06-17 23:29:04 +02:00
class PriorityMuxer : public QObject
2013-08-13 11:10:45 +02:00
{
2017-06-17 23:29:04 +02:00
Q_OBJECT
2013-08-13 11:10:45 +02:00
public :
2013-09-06 21:26:58 +02:00
///
/// The information structure for a single priority channel
///
2013-08-13 11:10:45 +02:00
struct InputInfo
{
2013-09-06 21:26:58 +02:00
/// The priority of this channel
2013-08-13 11:10:45 +02:00
int priority ;
2013-09-06 21:26:58 +02:00
/// The absolute timeout of the channel
2013-08-13 11:10:45 +02:00
int64_t timeoutTime_ms ;
2013-09-06 21:26:58 +02:00
/// The colors for each led of the channel
2013-11-11 10:00:37 +01:00
std : : vector < ColorRgb > ledColors ;
2018-12-27 23:11:32 +01:00
/// The raw Image (size should be preprocessed!)
Image < ColorRgb > image ;
2017-02-28 17:53:41 +01:00
/// The component
2016-10-10 18:29:54 +02:00
hyperion : : Components componentId ;
2017-02-28 17:53:41 +01:00
/// Who set it
QString origin ;
2018-12-27 23:11:32 +01:00
/// id of smoothing config
2017-08-04 12:01:45 +02:00
unsigned smooth_cfg ;
2018-12-27 23:11:32 +01:00
/// specific owner description
QString owner ;
2013-08-13 11:10:45 +02:00
} ;
2022-02-22 20:58:59 +01:00
typedef QMap < int , InputInfo > InputsMap ;
2021-03-19 22:52:41 +01:00
//Foreground and Background priorities
const static int FG_PRIORITY ;
const static int BG_PRIORITY ;
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
const static int MANUAL_SELECTED_PRIORITY ;
2016-08-06 08:28:42 +02:00
/// The lowest possible priority, which is used when no priority channels are active
2017-09-01 08:50:37 +02:00
const static int LOWEST_PRIORITY ;
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
/// Timeout used to identify a non active priority
const static int TIMEOUT_NOT_ACTIVE_PRIO ;
2022-02-22 20:58:59 +01:00
const static int REMOVE_CLEARED_PRIO ;
2016-08-06 08:28:42 +02:00
2022-02-11 20:36:15 +01:00
const static int ENDLESS ;
2013-09-06 21:26:58 +02:00
///
2020-11-14 17:58:56 +01:00
/// Constructs the PriorityMuxer for the given number of LEDs (used to switch to black when
2013-09-06 21:26:58 +02:00
/// there are no priority channels
///
2020-11-14 17:58:56 +01:00
/// @param ledCount The number of LEDs
2013-09-06 21:26:58 +02:00
///
2020-07-19 15:13:41 +02:00
PriorityMuxer ( int ledCount , QObject * parent ) ;
2013-08-13 11:10:45 +02:00
2013-09-06 21:26:58 +02:00
///
/// Destructor
///
2020-08-08 23:12:43 +02:00
~ PriorityMuxer ( ) override ;
2013-08-13 11:10:45 +02:00
2018-12-27 23:11:32 +01:00
///
/// @brief Start/Stop the PriorityMuxer update timer; On disabled no priority and timeout updates will be performend
/// @param enable The new state
///
2020-08-08 13:09:15 +02:00
void setEnable ( bool enable ) ;
2018-12-27 23:11:32 +01:00
/// @brief Enable or disable auto source selection
/// @param enable True if it should be enabled else false
/// @param update True to update _currentPriority - INTERNAL usage.
/// @return True if changed has been applied, false if the state is unchanged
///
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 setSourceAutoSelectEnabled ( bool enable , bool update = true ) ;
2018-12-27 23:11:32 +01:00
///
/// @brief Get the state of source auto selection
/// @return True if enabled, else false
///
2020-11-14 17:58:56 +01:00
bool isSourceAutoSelectEnabled ( ) const { return _sourceAutoSelectEnabled ; }
2018-12-27 23:11:32 +01:00
///
2020-11-14 17:58:56 +01:00
/// @brief Overwrite current lowest priority with manual selection; On success disables auto selection
2018-12-27 23:11:32 +01:00
/// @param priority The
/// @return True on success, false if priority not found
///
2020-11-14 17:58:56 +01:00
bool setPriority ( int priority ) ;
2018-12-27 23:11:32 +01:00
///
2020-11-14 17:58:56 +01:00
/// @brief Update all LED-Colors with min length of >= 1 to fit the new led length
/// @param[in] ledCount The count of LEDs
2018-12-27 23:11:32 +01:00
///
2020-08-08 13:09:15 +02:00
void updateLedColorsLength ( int ledCount ) ;
2018-12-27 23:11:32 +01:00
2013-09-06 21:26:58 +02:00
///
/// Returns the current priority
///
/// @return The current priority
///
2019-02-03 14:36:57 +01:00
int getCurrentPriority ( ) const { return _currentPriority ; }
2013-08-13 11:10:45 +02:00
2020-09-14 17:19:14 +02:00
///
/// Returns the previous priority before current priority
///
/// @return The previous priority
///
int getPreviousPriority ( ) const { return _previousPriority ; }
2013-09-06 21:26:58 +02:00
///
/// Returns the state (enabled/disabled) of a specific priority channel
/// @param priority The priority channel
/// @return True if the priority channel exists else false
///
2020-08-08 13:09:15 +02:00
bool hasPriority ( int priority ) const ;
2013-08-13 11:10:45 +02:00
2013-09-06 21:26:58 +02:00
///
/// Returns the number of active priorities
///
/// @return The list with active priorities
///
2013-08-13 11:10:45 +02:00
QList < int > getPriorities ( ) const ;
2013-09-06 21:26:58 +02:00
///
2018-12-27 23:11:32 +01:00
/// Returns the information of a specified priority channel.
/// If a priority is no longer available the _lowestPriorityInfo (255) is returned
2013-09-06 21:26:58 +02:00
///
/// @param priority The priority channel
///
/// @return The information for the specified priority channel
///
2020-08-08 13:09:15 +02:00
InputInfo getInputInfo ( int priority ) const ;
2018-12-27 23:11:32 +01: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)
2020-11-14 17:58:56 +01:00
/// @param[in] owner Specific owner string, might be empty
2018-12-27 23:11:32 +01:00
/// @param[in] smooth_cfg The smooth id to use
2013-09-06 21:26:58 +02:00
///
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 = SMOOTHING_MODE_DEFAULT ) ;
2013-08-13 11:10:45 +02:00
2013-09-06 21:26:58 +02:00
///
2020-11-14 17:58:56 +01:00
/// @brief Update the current color of a priority (previous registered with registerInput())
2018-12-27 23:11:32 +01:00
/// @param priority The priority to update
/// @param ledColors The colors
/// @param timeout_ms The new timeout (defaults to -1 endless)
/// @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 , int64_t timeout_ms = ENDLESS ) ;
2018-12-27 23:11:32 +01: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())
/// @param priority The priority to update
/// @param image The new image
/// @param timeout_ms The new timeout (defaults to -1 endless)
/// @return True on success, false when priority is not found
///
2022-02-11 20:36:15 +01:00
bool setInputImage ( int priority , const Image < ColorRgb > & image , int64_t timeout_ms = ENDLESS ) ;
2013-08-13 11:10:45 +02:00
2018-12-28 18:12:45 +01:00
///
/// @brief Set the given priority to inactive
/// @param priority The priority
/// @return True on success false if not found
///
2020-11-14 17:58:56 +01:00
bool setInputInactive ( int priority ) ;
2018-12-28 18:12:45 +01:00
2013-09-06 21:26:58 +02:00
///
2018-12-27 23:11:32 +01:00
/// Clears the specified priority channel and update _currentPriority on success
2013-09-06 21:26:58 +02:00
///
/// @param[in] priority The priority of the channel to clear
2018-12-27 23:11:32 +01:00
/// @return True if priority has been cleared else false (not found)
2013-09-06 21:26:58 +02:00
///
2020-11-14 17:58:56 +01:00
bool clearInput ( int priority ) ;
2013-08-13 11:10:45 +02:00
2013-09-06 21:26:58 +02:00
///
/// Clears all priority channels
///
2017-08-12 07:55:32 +02:00
void clearAll ( bool forceClearAll = false ) ;
2013-08-13 11:10:45 +02:00
2018-12-27 23:11:32 +01:00
signals :
2017-06-17 23:29:04 +02:00
///
2018-12-27 23:11:32 +01:00
/// @brief Emits whenever the visible priority has changed
2019-02-03 14:36:57 +01:00
/// @param priority The new visible priority
2018-12-27 23:11:32 +01:00
///
2022-02-22 20:58:59 +01:00
void visiblePriorityChanged ( int priority ) ;
2018-12-27 23:11:32 +01:00
2020-02-15 22:47:27 +01:00
///
/// @brief Emits whenever the current visible component changed
/// @param comp The new component
///
2020-08-08 13:09:15 +02:00
void visibleComponentChanged ( hyperion : : Components comp ) ;
2020-02-15 22:47:27 +01:00
2018-12-27 23:11:32 +01:00
///
/// @brief Emits whenever something changes which influences the priorities listing
2022-02-22 20:58:59 +01:00
/// Emits also in 1s interval when a COLOR or EFFECT is running with a timeout > -1
/// @param currentPriority The current priority at time of emit
/// @param activeInputs The current active input map at time of emit
2017-06-17 23:29:04 +02:00
///
2022-02-22 20:58:59 +01:00
void prioritiesChanged ( int currentPriority , InputsMap activeInputs ) ;
2018-12-27 23:11:32 +01:00
///
/// internal used signal to resolve treading issues with timer
///
void signalTimeTrigger ( ) ;
2017-06-17 23:29:04 +02:00
private slots :
///
2022-02-22 20:58:59 +01:00
/// Slot which is called to adapt to 1s interval for signal prioritiesChanged()
2017-06-17 23:29:04 +02:00
///
2018-12-27 23:11:32 +01:00
void timeTrigger ( ) ;
///
2022-02-22 20:58:59 +01:00
/// Updates the current priorities. Channels with a configured time out will be checked and cleared if
/// required. Cleared priorities will be removed.
2018-12-27 23:11:32 +01:00
///
2022-02-22 20:58:59 +01:00
void updatePriorities ( ) ;
2017-06-17 23:29:04 +02:00
2013-08-13 11:10:45 +02:00
private :
2020-02-15 22:47:27 +01:00
///
/// @brief Get the component of the given priority
/// @return The component
///
2020-08-08 23:12:43 +02:00
hyperion : : Components getComponentOfPriority ( int priority ) const ;
2020-02-15 22:47:27 +01:00
2018-12-27 23:11:32 +01:00
/// Logger instance
Logger * _log ;
2013-09-06 21:26:58 +02:00
/// The current priority (lowest value in _activeInputs)
2013-08-18 13:33:56 +02:00
int _currentPriority ;
2013-08-13 11:10:45 +02:00
2020-09-14 17:19:14 +02:00
/// The previous priority before current priority
int _previousPriority ;
2018-12-27 23:11:32 +01:00
/// The manual select priority set with setPriority
int _manualSelectedPriority ;
2020-02-15 22:47:27 +01:00
// The last visible component
hyperion : : Components _prevVisComp = hyperion : : COMP_INVALID ;
2013-09-06 21:26:58 +02:00
/// The mapping from priority channel to led-information
2022-02-22 20:58:59 +01:00
InputsMap _activeInputs ;
2013-08-13 11:10:45 +02:00
2013-09-06 21:26:58 +02:00
/// The information of the lowest priority channel
2013-08-18 13:33:56 +02:00
InputInfo _lowestPriorityInfo ;
2018-12-27 23:11:32 +01:00
// Reflect the state of auto select
bool _sourceAutoSelectEnabled ;
// Timer to update Muxer times independent
QTimer * _updateTimer ;
QTimer * _timer ;
QTimer * _blockTimer ;
2013-08-13 11:10:45 +02:00
} ;