mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Differentiate between LED-Device Enable/Disable and Switch On/Off (#960)
* Switch Off devices, when no input source * Realign Enable/SwitchOn, Disable/SwitchOff * Align to updated LedDevice-Flow * Remove debug statements slipped in * Send last color update after enabling again * Fix WLED getProperties API call * Remove unused signals * LedDevice process flow documentation * LedDevice process flow documentation Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
@@ -473,6 +473,9 @@ private slots:
|
||||
///
|
||||
void handleNewVideoMode(VideoMode mode) { _currVideoMode = mode; }
|
||||
|
||||
|
||||
void handlPriorityChangedLedDevice(const quint8& priority);
|
||||
|
||||
private:
|
||||
friend class HyperionDaemon;
|
||||
friend class HyperionIManager;
|
||||
|
@@ -109,6 +109,13 @@ public:
|
||||
///
|
||||
int getCurrentPriority() const { return _currentPriority; }
|
||||
|
||||
///
|
||||
/// Returns the previous priority before current priority
|
||||
///
|
||||
/// @return The previous priority
|
||||
///
|
||||
int getPreviousPriority() const { return _previousPriority; }
|
||||
|
||||
///
|
||||
/// Returns the state (enabled/disabled) of a specific priority channel
|
||||
/// @param priority The priority channel
|
||||
@@ -193,13 +200,6 @@ signals:
|
||||
///
|
||||
void timeRunner();
|
||||
|
||||
///
|
||||
/// @brief A priority has been added (registerInput()) or deleted, method clear or timeout clear
|
||||
/// @param priority The priority which has changed
|
||||
/// @param state If true it was added else it was removed!
|
||||
///
|
||||
void priorityChanged(quint8 priority, bool state);
|
||||
|
||||
///
|
||||
/// @brief Emits whenever the visible priority has changed
|
||||
/// @param priority The new visible priority
|
||||
@@ -261,6 +261,9 @@ private:
|
||||
/// The current priority (lowest value in _activeInputs)
|
||||
int _currentPriority;
|
||||
|
||||
/// The previous priority before current priority
|
||||
int _previousPriority;
|
||||
|
||||
/// The manual select priority set with setPriority
|
||||
int _manualSelectedPriority;
|
||||
|
||||
|
@@ -64,13 +64,6 @@ public:
|
||||
///
|
||||
void setLedCount(unsigned int ledCount);
|
||||
|
||||
///
|
||||
/// @brief Check, if the device is enabled.
|
||||
///
|
||||
/// @return True, if enabled
|
||||
///
|
||||
bool isEnabled() const { return _isEnabled; }
|
||||
|
||||
///
|
||||
/// @brief Set a device's latch time.
|
||||
///
|
||||
@@ -81,6 +74,15 @@ public:
|
||||
///
|
||||
void setLatchTime(int latchTime_ms);
|
||||
|
||||
///
|
||||
/// @brief Set a device's rewrite time.
|
||||
///
|
||||
/// Rewrite time is the time frame a devices requires to be refreshed, if no updated happened in the meantime.
|
||||
///
|
||||
/// @param[in] rewriteTime_ms Rewrite time in milliseconds
|
||||
///
|
||||
void setRewriteTime(int rewriteTime_ms);
|
||||
|
||||
///
|
||||
/// @brief Discover devices of this type available (for configuration).
|
||||
/// @note Mainly used for network devices. Allows to find devices, e.g. via ssdp, mDNS or cloud ways.
|
||||
@@ -172,15 +174,6 @@ public slots:
|
||||
///
|
||||
virtual int updateLeds(const std::vector<ColorRgb>& ledValues);
|
||||
|
||||
///
|
||||
/// @brief Enables/disables the device for output.
|
||||
///
|
||||
/// If the device is not ready, it will not be enabled.
|
||||
///
|
||||
/// @param[in] enable The new state of the device
|
||||
///
|
||||
void setEnable(bool enable);
|
||||
|
||||
///
|
||||
/// @brief Get the currently defined LatchTime.
|
||||
///
|
||||
@@ -188,6 +181,13 @@ public slots:
|
||||
///
|
||||
int getLatchTime() const { return _latchTime_ms; }
|
||||
|
||||
///
|
||||
/// @brief Get the currently defined RewriteTime.
|
||||
///
|
||||
/// @return Rewrite time in milliseconds
|
||||
///
|
||||
int getRewriteTime() const { return _refreshTimerInterval_ms; }
|
||||
|
||||
///
|
||||
/// @brief Get the number of LEDs supported by the device.
|
||||
///
|
||||
@@ -212,7 +212,46 @@ public slots:
|
||||
///
|
||||
/// @return True, if enabled
|
||||
///
|
||||
inline bool componentState() const { return isEnabled(); }
|
||||
inline bool componentState() const { return _isEnabled; }
|
||||
|
||||
///
|
||||
/// @brief Enables the device for output.
|
||||
///
|
||||
/// If the device is not ready, it will not be enabled.
|
||||
///
|
||||
void enable();
|
||||
|
||||
///
|
||||
/// @brief Disables the device for output.
|
||||
///
|
||||
void disable();
|
||||
|
||||
///
|
||||
/// @brief Switch the LEDs on.
|
||||
///
|
||||
/// Takes care that the device is opened and powered-on.
|
||||
/// Depending on the configuration, the device may store its current state for later restore.
|
||||
/// @see powerOn, storeState
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
virtual bool switchOn();
|
||||
|
||||
///
|
||||
/// @brief Switch the LEDs off.
|
||||
///
|
||||
/// Takes care that the LEDs and device are switched-off and device is closed.
|
||||
/// Depending on the configuration, the device may be powered-off or restored to its previous state.
|
||||
/// @see powerOff, restoreState
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
virtual bool switchOff();
|
||||
|
||||
bool switchOnOff(bool onState)
|
||||
{
|
||||
return onState == true ? switchOn() : switchOff();
|
||||
}
|
||||
|
||||
signals:
|
||||
///
|
||||
@@ -264,28 +303,6 @@ protected:
|
||||
///
|
||||
virtual int writeBlack(int numberOfBlack=1);
|
||||
|
||||
///
|
||||
/// @brief Switch the LEDs on.
|
||||
///
|
||||
/// Takes care that the device is opened and powered-on.
|
||||
/// Depending on the configuration, the device may store its current state for later restore.
|
||||
/// @see powerOn, storeState
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
virtual bool switchOn();
|
||||
|
||||
///
|
||||
/// @brief Switch the LEDs off.
|
||||
///
|
||||
/// Takes care that the LEDs and device are switched-off and device is closed.
|
||||
/// Depending on the configuration, the device may be powered-off or restored to its previous state.
|
||||
/// @see powerOff, restoreState
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
virtual bool switchOff();
|
||||
|
||||
///
|
||||
/// @brief Power-/turn on the LED-device.
|
||||
///
|
||||
@@ -378,6 +395,9 @@ protected:
|
||||
/// Is the device ready for processing?
|
||||
bool _isDeviceReady;
|
||||
|
||||
/// Is the device switched on?
|
||||
bool _isOn;
|
||||
|
||||
/// Is the device in error state and stopped?
|
||||
bool _isDeviceInError;
|
||||
|
||||
|
@@ -90,8 +90,27 @@ signals:
|
||||
///
|
||||
int updateLeds(const std::vector<ColorRgb>& ledValues);
|
||||
|
||||
void setEnable(bool enable);
|
||||
void closeLedDevice();
|
||||
///
|
||||
/// @brief Enables the LED-Device.
|
||||
///
|
||||
void enable();
|
||||
|
||||
///
|
||||
/// @brief Disables the LED-Device.
|
||||
///
|
||||
void disable();
|
||||
|
||||
///
|
||||
/// @brief Switch the LEDs on.
|
||||
///
|
||||
void switchOn();
|
||||
|
||||
///
|
||||
/// @brief Switch the LEDs off.
|
||||
///
|
||||
void switchOff();
|
||||
|
||||
void stopLedDevice();
|
||||
|
||||
private slots:
|
||||
///
|
||||
|
Reference in New Issue
Block a user