mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
mDNS Support (#1452)
* Allow build, if no grabbers are enabled * Align available functions to right Qt version * Update to next development version * Align available functions to right Qt version * fix workflows (apt/nightly) * Disable QNetworkConfigurationManager deprecation warnings * Initial go on Smart Pointers * Add Deallocation * Correct QT_WARNING_DISABLE_DEPRECATED (available since 5.9) * Cluster Build Variables * Hyperion Light * Address build warnings * Hyperion Light - UI * Update Protobuf to latest master * Removed compiler warnings * Added restart ability to systray * Correct Protobuf * Ignore 'no-return' warning on protobuf build * hyperion-remote: Fix auto discovery of hyperion server * Fix Qt version override * Update changelog * Remove Grabber Components, if no Grabber exists * Standalone Grabber - Fix fps default * Remote Control - Have Source Selction accrosswhole screen * Enable Blackborder detection only, if relevant input sources available * Enable Blackborder detection only, if relevant input sources available * Remote UI - rearrange containers * Checkout * Fix compilation on windows * Re-added qmdnsengine template cmake * chrono added for linux * Removed existing AVAHI/Bonjour, allow to enable/disable mDNS * hyperiond macos typo fix * Fix macOS Bundle build * Fix macOS bundle info details * Correct CMake files * Removed existing AVAHI/Bonjour (2) * Share hyperion's services via mDNS * Add mDNS Browser and mDNS for LED-Devices * Support mDNS discovery for standalone grabbers * Remove ZLib Dependency & Cleanup * mDNS - hanle 2.local2 an ".local." domains equally * Hue - Link discovery to bridge class, workaround port 443 for mDNS discovery * Fix save button state when switching between devices * Removed sessions (of other hyperions) * mDNS Publisher - Simplify service naming * mDNS refactoring & Forwarder discovery * mDNS Updates to use device service name * Consistency of standalone grabbers with mDNS Service Registry * Merge branch 'hyperion-project:master' into mDNS * Start JSON and WebServers only after Instance 0 is available * Remove bespoke qDebug Output again * MDNS updates and refactor Forwarder * Minor updates * Upgrade to CMake 3.1 * typo * macOS fix * Correct merge * - Remove dynamic linker flag from standalone dispmanX Grabber - Added ability to use system qmdns libs * Cec handler library will load at runtime * typo fix * protobuf changes * mDNS changes for Windows/macOS * test window build qmdnsengine * absolute path to protobuf cmake dir * Rework Hue Wizard supporting mDNS * LED-Devices - Retry support + Refactoring (excl. Hue) * LED-Devices - Refactoring/Retry support Hue + additional alignments * Address LGTM findings * Fix CI-Build, revert test changes * Build Windows in Release mode to avoid python problem * Correct that WebServerObject is available earlier * Ensure that instance name in logs for one instance are presented * Update content LEDs * Rework mDNS Address lookup * Fix LED UI * Fix for non mDNS Services (ignore default port) * Disbale device when now input is available * Revert back some updates, ensure last color is updated when switched on * Handle reopening case and changed IP, port for API-calls * Add UPD-DDP Device * WLED support for DDP * Fix printout * LEDDevice - Allow more retries, udapte defaults * LED-Net Devices - Select Custom device, if configured Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com> Co-authored-by: Paulchen Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#ifndef LEDEVICE_H
|
||||
#ifndef LEDEVICE_H
|
||||
#define LEDEVICE_H
|
||||
|
||||
// qt includes
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
|
||||
// Utility includes
|
||||
#include <utils/ColorRgb.h>
|
||||
@@ -50,6 +51,13 @@ public:
|
||||
///
|
||||
~LedDevice() override;
|
||||
|
||||
///
|
||||
/// @brief Set the common logger for LED-devices.
|
||||
///
|
||||
/// @param[in] log The logger to be used
|
||||
///
|
||||
void setLogger(Logger* log);
|
||||
|
||||
///
|
||||
/// @brief Set the current active LED-device type.
|
||||
///
|
||||
@@ -64,6 +72,8 @@ public:
|
||||
///
|
||||
void setLedCount(int ledCount);
|
||||
|
||||
void setColorOrder(const QString& colorOrder);
|
||||
|
||||
///
|
||||
/// @brief Set a device's latch time.
|
||||
///
|
||||
@@ -83,6 +93,19 @@ public:
|
||||
///
|
||||
void setRewriteTime(int rewriteTime_ms);
|
||||
|
||||
/// @brief Set a device's enablement cycle's parameters.
|
||||
///
|
||||
/// @param[in] maxEnableRetries Maximum number of attempts to enable a device, if reached retries will be stopped
|
||||
/// @param[in] enableAttemptsTimerInterval Interval in seconds between two enablement attempts
|
||||
///
|
||||
void setEnableAttempts(int maxEnablAttempts, std::chrono::seconds enableAttemptsTimerInterval);
|
||||
|
||||
/// @brief Enable a device automatically after Hyperion startup or not
|
||||
///
|
||||
/// @param[in] isAutoStart
|
||||
///
|
||||
void setAutoStart(bool isAutoStart);
|
||||
|
||||
///
|
||||
/// @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.
|
||||
@@ -120,6 +143,15 @@ public:
|
||||
///
|
||||
virtual void identify(const QJsonObject& /*params*/) {}
|
||||
|
||||
///
|
||||
/// @brief Add an authorization/client-key or token to the device
|
||||
///
|
||||
/// Used in context of a set of devices of the same type.
|
||||
///
|
||||
/// @param[in] params Parameters to address device
|
||||
/// @return A JSON structure holding the authorization key/token
|
||||
virtual QJsonObject addAuthorization(const QJsonObject& /*params*/) { return QJsonObject(); }
|
||||
|
||||
///
|
||||
/// @brief Check, if device is properly initialised
|
||||
///
|
||||
@@ -127,7 +159,7 @@ public:
|
||||
///
|
||||
/// @return True, if device is initialised
|
||||
///
|
||||
bool isInitialised() const { return _isDeviceInitialised; }
|
||||
bool isInitialised() const;
|
||||
|
||||
///
|
||||
/// @brief Check, if device is ready to be used.
|
||||
@@ -136,14 +168,14 @@ public:
|
||||
///
|
||||
/// @return True, if device is ready
|
||||
///
|
||||
bool isReady() const { return _isDeviceReady; }
|
||||
bool isReady() const;
|
||||
|
||||
///
|
||||
/// @brief Check, if device is in error state.
|
||||
///
|
||||
/// @return True, if device is in error
|
||||
///
|
||||
bool isInError() const { return _isDeviceInError; }
|
||||
bool isInError() const;
|
||||
|
||||
///
|
||||
/// @brief Prints the color values to stdout.
|
||||
@@ -152,13 +184,6 @@ public:
|
||||
///
|
||||
static void printLedValues(const std::vector<ColorRgb>& ledValues);
|
||||
|
||||
///
|
||||
/// @brief Set the common logger for LED-devices.
|
||||
///
|
||||
/// @param[in] log The logger to be used
|
||||
///
|
||||
void setLogger(Logger* log) { _log = log; }
|
||||
|
||||
public slots:
|
||||
|
||||
///
|
||||
@@ -181,47 +206,47 @@ public slots:
|
||||
/// @param[in] ledValues The color per LED
|
||||
/// @return Zero on success else negative (i.e. device is not ready)
|
||||
///
|
||||
virtual int updateLeds(const std::vector<ColorRgb>& ledValues);
|
||||
virtual int updateLeds(std::vector<ColorRgb> ledValues);
|
||||
|
||||
///
|
||||
/// @brief Get the currently defined LatchTime.
|
||||
///
|
||||
/// @return Latch time in milliseconds
|
||||
///
|
||||
int getLatchTime() const { return _latchTime_ms; }
|
||||
int getLatchTime() const;
|
||||
|
||||
///
|
||||
/// @brief Get the currently defined RewriteTime.
|
||||
///
|
||||
/// @return Rewrite time in milliseconds
|
||||
///
|
||||
int getRewriteTime() const { return _refreshTimerInterval_ms; }
|
||||
int getRewriteTime() const;
|
||||
|
||||
///
|
||||
/// @brief Get the number of LEDs supported by the device.
|
||||
///
|
||||
/// @return Number of device's LEDs, 0 = unknown number
|
||||
///
|
||||
int getLedCount() const { return _ledCount; }
|
||||
int getLedCount() const;
|
||||
|
||||
///
|
||||
/// @brief Get the current active LED-device type.
|
||||
///
|
||||
QString getActiveDeviceType() const { return _activeDeviceType; }
|
||||
QString getActiveDeviceType() const;
|
||||
|
||||
///
|
||||
/// @brief Get color order of device.
|
||||
///
|
||||
/// @return The color order
|
||||
///
|
||||
QString getColorOrder() const { return _colorOrder; }
|
||||
QString getColorOrder() const;
|
||||
|
||||
///
|
||||
/// @brief Get the LED-Device component's state.
|
||||
///
|
||||
/// @return True, if enabled
|
||||
///
|
||||
inline bool componentState() const { return _isEnabled; }
|
||||
bool componentState() const;
|
||||
|
||||
///
|
||||
/// @brief Enables the device for output.
|
||||
@@ -257,11 +282,6 @@ public slots:
|
||||
///
|
||||
virtual bool switchOff();
|
||||
|
||||
bool switchOnOff(bool onState)
|
||||
{
|
||||
return onState == true ? switchOn() : switchOff();
|
||||
}
|
||||
|
||||
signals:
|
||||
///
|
||||
/// @brief Emits whenever the LED-Device switches between on/off.
|
||||
@@ -361,6 +381,16 @@ protected:
|
||||
///
|
||||
virtual bool restoreState();
|
||||
|
||||
///
|
||||
/// @brief Start a new enable cycle
|
||||
///
|
||||
void startEnableAttemptsTimer();
|
||||
|
||||
///
|
||||
/// @brief Stop a new enable cycle
|
||||
///
|
||||
void stopEnableAttemptsTimer();
|
||||
|
||||
///
|
||||
/// @brief Converts an uint8_t array to hex string.
|
||||
///
|
||||
@@ -368,7 +398,7 @@ protected:
|
||||
/// @param size of the array
|
||||
/// @param number Number of array items to be converted.
|
||||
/// @return array as string of hex values
|
||||
QString uint8_t_to_hex_string(const uint8_t * data, const int size, int number = -1) const;
|
||||
static QString uint8_t_to_hex_string(const uint8_t * data, const int size, int number = -1) ;
|
||||
|
||||
///
|
||||
/// @brief Converts a ByteArray to hex string.
|
||||
@@ -376,7 +406,7 @@ protected:
|
||||
/// @param data ByteArray
|
||||
/// @param number Number of array items to be converted.
|
||||
/// @return array as string of hex values
|
||||
QString toHex(const QByteArray& data, int number = -1) const;
|
||||
static QString toHex(const QByteArray& data, int number = -1) ;
|
||||
|
||||
/// Current device's type
|
||||
QString _activeDeviceType;
|
||||
@@ -414,6 +444,7 @@ protected:
|
||||
QJsonObject _orignalStateValues;
|
||||
|
||||
// Device states
|
||||
|
||||
/// Is the device enabled?
|
||||
bool _isEnabled;
|
||||
|
||||
@@ -429,9 +460,6 @@ protected:
|
||||
/// Is the device in error state and stopped?
|
||||
bool _isDeviceInError;
|
||||
|
||||
/// Is the device in the switchOff process?
|
||||
bool _isInSwitchOff;
|
||||
|
||||
/// Timestamp of last write
|
||||
QDateTime _lastWriteTime;
|
||||
|
||||
@@ -459,6 +487,15 @@ private:
|
||||
/// @brief Stop refresh cycle
|
||||
void stopRefreshTimer();
|
||||
|
||||
/// Timer that enables a device (used to retry enablement, if enabled failed before)
|
||||
QTimer* _enableAttemptsTimer;
|
||||
|
||||
// Device configuration parameters
|
||||
|
||||
std::chrono::seconds _enableAttemptTimerInterval;
|
||||
int _enableAttempts;
|
||||
int _maxEnableAttempts;
|
||||
|
||||
/// Is last write refreshing enabled?
|
||||
bool _isRefreshEnabled;
|
||||
|
||||
|
Reference in New Issue
Block a user