2019-04-08 23:13:11 +02:00
// Local-Hyperion includes
# include "LedDeviceNanoleaf.h"
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>
2022-05-01 19:42:47 +02:00
//std includes
# include <sstream>
# include <iomanip>
2023-10-15 17:04:51 +02:00
# include <cmath>
2019-04-08 23:13:11 +02:00
// Qt includes
# include <QNetworkReply>
2020-11-14 17:58:56 +01:00
# include <QtEndian>
2019-04-08 23:13:11 +02: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>
2022-05-01 19:42:47 +02:00
# include <ssdp/SSDPDiscover.h>
# include <utils/QStringUtils.h>
// mDNS discover
# ifdef ENABLE_MDNS
# include <mdns/MdnsBrowser.h>
# include <mdns/MdnsServiceRegister.h>
# endif
# include <utils/NetUtils.h>
2019-12-08 13:12:01 +01:00
2020-07-12 20:27:56 +02:00
// Constants
namespace {
2023-10-15 17:04:51 +02:00
const bool verbose = false ;
const bool verbose3 = false ;
// Configuration settings
const char CONFIG_HOST [ ] = " host " ;
const char CONFIG_AUTH_TOKEN [ ] = " token " ;
const char CONFIG_RESTORE_STATE [ ] = " restoreOriginalState " ;
const char CONFIG_BRIGHTNESS [ ] = " brightness " ;
const char CONFIG_BRIGHTNESS_OVERWRITE [ ] = " overwriteBrightness " ;
const char CONFIG_PANEL_ORDER_TOP_DOWN [ ] = " panelOrderTopDown " ;
const char CONFIG_PANEL_ORDER_LEFT_RIGHT [ ] = " panelOrderLeftRight " ;
const bool DEFAULT_IS_RESTORE_STATE = true ;
const bool DEFAULT_IS_BRIGHTNESS_OVERWRITE = true ;
const int BRI_MAX = 100 ;
// Panel configuration settings
const char PANEL_GLOBALORIENTATION [ ] = " globalOrientation " ;
const char PANEL_GLOBALORIENTATION_VALUE [ ] = " value " ;
const char PANEL_LAYOUT [ ] = " layout " ;
const char PANEL_NUM [ ] = " numPanels " ;
const char PANEL_ID [ ] = " panelId " ;
const char PANEL_POSITIONDATA [ ] = " positionData " ;
const char PANEL_SHAPE_TYPE [ ] = " shapeType " ;
const char PANEL_POS_X [ ] = " x " ;
const char PANEL_POS_Y [ ] = " y " ;
// List of State Information
const char STATE_ON [ ] = " on " ;
const char STATE_BRI [ ] = " brightness " ;
const char STATE_HUE [ ] = " hue " ;
const char STATE_SAT [ ] = " sat " ;
const char STATE_CT [ ] = " ct " ;
const char STATE_COLORMODE [ ] = " colorMode " ;
const QStringList COLOR_MODES { " hs " , " ct " , " effect " } ;
const char STATE_VALUE [ ] = " value " ;
// Device Data elements
const char DEV_DATA_NAME [ ] = " name " ;
const char DEV_DATA_MODEL [ ] = " model " ;
const char DEV_DATA_MANUFACTURER [ ] = " manufacturer " ;
const char DEV_DATA_FIRMWAREVERSION [ ] = " firmwareVersion " ;
// Nanoleaf Stream Control elements
const quint16 STREAM_CONTROL_DEFAULT_PORT = 60222 ;
// Nanoleaf OpenAPI URLs
const int API_DEFAULT_PORT = 16021 ;
const char API_BASE_PATH [ ] = " /api/v1/%1/ " ;
const char API_ROOT [ ] = " " ;
const char API_EXT_MODE_STRING_V2 [ ] = " { \" write \" : { \" command \" : \" display \" , \" animType \" : \" extControl \" , \" extControlVersion \" : \" v2 \" }} " ;
const char API_STATE [ ] = " state " ;
const char API_PANELLAYOUT [ ] = " panelLayout " ;
const char API_EFFECT [ ] = " effects " ;
const char API_IDENTIFY [ ] = " identify " ;
const char API_ADD_USER [ ] = " new " ;
const char API_EFFECT_SELECT [ ] = " select " ;
//Nanoleaf Control data stream
const int STREAM_FRAME_PANEL_NUM_SIZE = 2 ;
const int STREAM_FRAME_PANEL_INFO_SIZE = 8 ;
// Nanoleaf ssdp services
const char SSDP_ID [ ] = " ssdp:all " ;
const char SSDP_FILTER_HEADER [ ] = " ST " ;
const char SSDP_NANOLEAF [ ] = " nanoleaf:nl* " ;
const char SSDP_LIGHTPANELS [ ] = " nanoleaf_aurora:light " ;
const double ROTATION_STEPS_DEGREE = 15.0 ;
2019-04-08 23:13:11 +02:00
2023-10-15 17:04:51 +02:00
} //End of constants
2019-04-08 23:13:11 +02:00
// Nanoleaf external control versions
enum EXTCONTROLVERSIONS {
2019-12-08 13:12:01 +01:00
EXTCTRLVER_V1 = 1 ,
EXTCTRLVER_V2
2019-04-08 23:13:11 +02:00
} ;
2020-11-14 17:58:56 +01:00
LedDeviceNanoleaf : : LedDeviceNanoleaf ( const QJsonObject & deviceConfig )
2020-08-08 00:21:19 +02:00
: ProviderUdp ( deviceConfig )
2023-10-15 17:04:51 +02:00
, _restApi ( nullptr )
, _apiPort ( API_DEFAULT_PORT )
, _topDown ( true )
, _leftRight ( true )
, _extControlVersion ( EXTCTRLVER_V2 )
, _panelLedCount ( 0 )
2019-04-08 23:13:11 +02: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>
2022-05-01 19:42:47 +02:00
# ifdef ENABLE_MDNS
2024-02-25 17:35:39 +01:00
QMetaObject : : invokeMethod ( MdnsBrowser : : getInstance ( ) . data ( ) , " browseForServiceType " ,
2023-10-15 17:04:51 +02:00
Qt : : QueuedConnection , Q_ARG ( QByteArray , MdnsServiceRegister : : getServiceType ( _activeDeviceType ) ) ) ;
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>
2022-05-01 19:42:47 +02:00
# endif
2019-04-08 23:13:11 +02:00
}
2020-11-14 17:58:56 +01:00
LedDevice * LedDeviceNanoleaf : : construct ( const QJsonObject & deviceConfig )
2020-02-10 15:21:58 +01:00
{
2020-07-12 20:27:56 +02:00
return new LedDeviceNanoleaf ( deviceConfig ) ;
2020-02-10 15:21:58 +01:00
}
2020-07-12 20:27:56 +02:00
LedDeviceNanoleaf : : ~ LedDeviceNanoleaf ( )
2019-04-08 23:13:11 +02:00
{
2020-08-08 00:21:19 +02:00
delete _restApi ;
_restApi = nullptr ;
2019-04-08 23:13:11 +02:00
}
2020-11-14 17:58:56 +01:00
bool LedDeviceNanoleaf : : init ( const QJsonObject & deviceConfig )
2020-02-10 15:21:58 +01:00
{
2023-10-15 17:04:51 +02:00
bool isInitOK { false } ;
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>
2022-05-01 19:42:47 +02:00
2020-02-10 15:21:58 +01:00
// Overwrite non supported/required features
2020-09-14 17:19:14 +02:00
setLatchTime ( 0 ) ;
setRewriteTime ( 0 ) ;
2020-02-10 15:21:58 +01:00
if ( deviceConfig [ " rewriteTime " ] . toInt ( 0 ) > 0 )
{
2020-11-14 17:58:56 +01:00
Info ( _log , " Device Nanoleaf does not require rewrites. Refresh time is ignored. " ) ;
2020-02-10 15:21:58 +01:00
}
2019-04-08 23:13:11 +02:00
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " deviceConfig: [%s] " , QString ( QJsonDocument ( _devConfig ) . toJson ( QJsonDocument : : Compact ) ) . toUtf8 ( ) . constData ( ) ) ;
2019-04-08 23:13:11 +02:00
2023-10-15 17:04:51 +02:00
if ( ProviderUdp : : init ( deviceConfig ) )
2020-02-10 15:21:58 +01: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>
2022-05-01 19:42:47 +02:00
//Set hostname as per configuration and default port
_hostName = deviceConfig [ CONFIG_HOST ] . toString ( ) ;
_port = STREAM_CONTROL_DEFAULT_PORT ;
_apiPort = API_DEFAULT_PORT ;
_authToken = deviceConfig [ CONFIG_AUTH_TOKEN ] . toString ( ) ;
2020-02-10 15:21:58 +01:00
2021-08-31 10:55:49 +02:00
_isRestoreOrigState = _devConfig [ CONFIG_RESTORE_STATE ] . toBool ( DEFAULT_IS_RESTORE_STATE ) ;
_isBrightnessOverwrite = _devConfig [ CONFIG_BRIGHTNESS_OVERWRITE ] . toBool ( DEFAULT_IS_BRIGHTNESS_OVERWRITE ) ;
_brightness = _devConfig [ CONFIG_BRIGHTNESS ] . toInt ( BRI_MAX ) ;
2023-10-15 17:04:51 +02:00
Debug ( _log , " Hostname/IP : %s " , QSTRING_CSTR ( _hostName ) ) ;
2021-08-31 10:55:49 +02:00
Debug ( _log , " RestoreOrigState : %d " , _isRestoreOrigState ) ;
Debug ( _log , " Overwrite Brightn.: %d " , _isBrightnessOverwrite ) ;
Debug ( _log , " Set Brightness to : %d " , _brightness ) ;
2020-06-12 11:16:39 +02:00
// Read panel organisation configuration
2023-10-15 17:04:51 +02:00
_topDown = deviceConfig [ CONFIG_PANEL_ORDER_TOP_DOWN ] . toString ( " top2down " ) = = " top2down " ;
_leftRight = deviceConfig [ CONFIG_PANEL_ORDER_LEFT_RIGHT ] . toString ( " left2right " ) = = " left2right " ;
2020-06-12 11:16:39 +02:00
2023-10-15 17:04:51 +02:00
isInitOK = true ;
}
return isInitOK ;
}
int LedDeviceNanoleaf : : getHwLedCount ( const QJsonObject & jsonLayout ) const
{
int hwLedCount { 0 } ;
const QJsonArray positionData = jsonLayout [ PANEL_POSITIONDATA ] . toArray ( ) ;
for ( const QJsonValue & value : positionData )
{
QJsonObject panelObj = value . toObject ( ) ;
int panelId = panelObj [ PANEL_ID ] . toInt ( ) ;
int panelshapeType = panelObj [ PANEL_SHAPE_TYPE ] . toInt ( ) ;
DebugIf ( verbose , _log , " Panel [%d] - Type: [%d] " , panelId , panelshapeType ) ;
if ( hasLEDs ( static_cast < SHAPETYPES > ( panelshapeType ) ) )
2020-07-12 20:27:56 +02:00
{
2023-10-15 17:04:51 +02:00
+ + hwLedCount ;
2020-07-12 20:27:56 +02:00
}
2020-06-12 11:16:39 +02:00
else
2020-07-12 20:27:56 +02:00
{
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " Rhythm/Shape/Lines Controller panel skipped. " ) ;
2020-07-12 20:27:56 +02:00
}
2023-10-15 17:04:51 +02:00
}
return hwLedCount ;
}
2020-07-12 20:27:56 +02:00
2023-10-15 17:04:51 +02:00
bool LedDeviceNanoleaf : : hasLEDs ( const SHAPETYPES & panelshapeType ) const
{
bool hasLED { true } ;
// Skip non LED panel types
switch ( panelshapeType )
{
case SHAPES_CONTROLLER :
case LINES_CONECTOR :
case CONTROLLER_CAP :
case POWER_CONNECTOR :
case RHYTM :
DebugIf ( verbose , _log , " Rhythm/Shape/Lines Controller panel skipped. " ) ;
hasLED = false ;
break ;
default :
break ;
2020-02-10 15:21:58 +01:00
}
2023-10-15 17:04:51 +02:00
return hasLED ;
2020-02-10 15:21:58 +01:00
}
2020-07-12 20:27:56 +02:00
bool LedDeviceNanoleaf : : initLedsConfiguration ( )
2020-02-10 15:21:58 +01:00
{
bool isInitOK = true ;
2019-12-08 13:12:01 +01:00
//Get Nanoleaf device details and configuration
2019-04-08 23:13:11 +02:00
2019-12-08 13:12:01 +01:00
// Read Panel count and panel Ids
2020-07-12 20:27:56 +02:00
_restApi - > setPath ( API_ROOT ) ;
httpResponse response = _restApi - > get ( ) ;
2020-11-14 17:58:56 +01:00
if ( response . error ( ) )
2020-02-10 15:21:58 +01:00
{
2021-03-19 22:52:04 +01:00
QString errorReason = QString ( " Getting device details failed with error: '%1' " ) . arg ( response . getErrorReason ( ) ) ;
2023-10-15 17:04:51 +02:00
this - > setInError ( errorReason ) ;
2020-02-10 15:21:58 +01:00
isInitOK = false ;
}
else
{
2020-07-12 20:27:56 +02:00
QJsonObject jsonAllPanelInfo = response . getBody ( ) . object ( ) ;
2019-04-08 23:13:11 +02:00
2020-02-10 15:21:58 +01:00
QString deviceName = jsonAllPanelInfo [ DEV_DATA_NAME ] . toString ( ) ;
_deviceModel = jsonAllPanelInfo [ DEV_DATA_MODEL ] . toString ( ) ;
QString deviceManufacturer = jsonAllPanelInfo [ DEV_DATA_MANUFACTURER ] . toString ( ) ;
_deviceFirmwareVersion = jsonAllPanelInfo [ DEV_DATA_FIRMWAREVERSION ] . toString ( ) ;
2019-04-08 23:13:11 +02:00
2020-11-14 17:58:56 +01:00
Debug ( _log , " Name : %s " , QSTRING_CSTR ( deviceName ) ) ;
Debug ( _log , " Model : %s " , QSTRING_CSTR ( _deviceModel ) ) ;
Debug ( _log , " Manufacturer : %s " , QSTRING_CSTR ( deviceManufacturer ) ) ;
Debug ( _log , " FirmwareVersion: %s " , QSTRING_CSTR ( _deviceFirmwareVersion ) ) ;
2019-04-08 23:13:11 +02:00
2020-02-10 15:21:58 +01:00
// Get panel details from /panelLayout/layout
QJsonObject jsonPanelLayout = jsonAllPanelInfo [ API_PANELLAYOUT ] . toObject ( ) ;
2023-10-15 17:04:51 +02:00
const QJsonObject globalOrientation = jsonPanelLayout [ PANEL_GLOBALORIENTATION ] . toObject ( ) ;
int orientation = globalOrientation [ PANEL_GLOBALORIENTATION_VALUE ] . toInt ( ) ;
int degreesToRotate { orientation } ;
bool isRotated { false } ;
if ( degreesToRotate > 0 )
{
isRotated = true ;
int degreeRounded = static_cast < int > ( round ( degreesToRotate / ROTATION_STEPS_DEGREE ) * ROTATION_STEPS_DEGREE ) ;
degreesToRotate = ( degreeRounded + 360 ) % 360 ;
}
//Nanoleaf orientation is counter-clockwise
degreesToRotate * = - 1 ;
double radians = ( degreesToRotate * std : : acos ( - 1 ) ) / 180 ;
DebugIf ( verbose , _log , " globalOrientation: %d, degreesToRotate: %d, radians: %0.2f " , orientation , degreesToRotate , radians ) ;
2020-02-10 15:21:58 +01:00
QJsonObject jsonLayout = jsonPanelLayout [ PANEL_LAYOUT ] . toObject ( ) ;
2019-04-08 23:13:11 +02:00
2023-10-15 17:04:51 +02:00
_panelLedCount = getHwLedCount ( jsonLayout ) ;
_devConfig [ " hardwareLedCount " ] = _panelLedCount ;
2020-11-14 17:58:56 +01:00
int panelNum = jsonLayout [ PANEL_NUM ] . toInt ( ) ;
2021-11-16 17:12:56 +00:00
const QJsonArray positionData = jsonLayout [ PANEL_POSITIONDATA ] . toArray ( ) ;
2019-04-08 23:13:11 +02:00
2020-11-14 17:58:56 +01:00
std : : map < int , std : : map < int , int > > panelMap ;
2019-04-08 23:13:11 +02:00
2020-02-10 15:21:58 +01:00
// Loop over all children.
2023-10-15 17:04:51 +02:00
for ( const QJsonValue & value : positionData )
2020-02-10 15:21:58 +01:00
{
QJsonObject panelObj = value . toObject ( ) ;
2019-12-08 13:12:01 +01:00
2020-11-14 17:58:56 +01:00
int panelId = panelObj [ PANEL_ID ] . toInt ( ) ;
int panelshapeType = panelObj [ PANEL_SHAPE_TYPE ] . toInt ( ) ;
2023-10-15 17:04:51 +02:00
int posX = panelObj [ PANEL_POS_X ] . toInt ( ) ;
int posY = panelObj [ PANEL_POS_Y ] . toInt ( ) ;
2019-12-08 13:12:01 +01:00
2023-10-15 17:04:51 +02:00
int panelX ;
int panelY ;
if ( isRotated )
{
panelX = static_cast < int > ( round ( posX * cos ( radians ) - posY * sin ( radians ) ) ) ;
panelY = static_cast < int > ( round ( posX * sin ( radians ) + posY * cos ( radians ) ) ) ;
}
else
{
panelX = posX ;
panelY = posY ;
}
2019-12-08 13:12:01 +01:00
2023-10-15 17:04:51 +02:00
if ( hasLEDs ( static_cast < SHAPETYPES > ( panelshapeType ) ) )
2020-02-10 15:21:58 +01:00
{
panelMap [ panelY ] [ panelX ] = panelId ;
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " Use Panel [%d] (%d,%d) - Type: [%d] " , panelId , panelX , panelY , panelshapeType ) ;
2020-02-10 15:21:58 +01:00
}
else
2023-10-15 17:04:51 +02:00
{
DebugIf ( verbose , _log , " Skip Panel [%d] (%d,%d) - Type: [%d] " , panelId , panelX , panelY , panelshapeType ) ;
2020-02-10 15:21:58 +01:00
}
2019-12-08 13:12:01 +01:00
}
2020-06-12 11:16:39 +02:00
// Travers panels top down
2023-10-15 17:04:51 +02:00
_panelIds . clear ( ) ;
2020-11-14 17:58:56 +01:00
for ( auto posY = panelMap . crbegin ( ) ; posY ! = panelMap . crend ( ) ; + + posY )
2020-02-10 15:21:58 +01:00
{
2020-06-12 11:16:39 +02:00
// Sort panels left to right
2020-11-14 17:58:56 +01:00
if ( _leftRight )
2020-06-12 11:16:39 +02:00
{
2020-11-14 17:58:56 +01:00
for ( auto posX = posY - > second . cbegin ( ) ; posX ! = posY - > second . cend ( ) ; + + posX )
2020-06-12 11:16:39 +02:00
{
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " panelMap[%d][%d]=%d " , posY - > first , posX - > first , posX - > second ) ;
2020-06-12 11:16:39 +02:00
2020-11-14 17:58:56 +01:00
if ( _topDown )
2020-07-12 20:27:56 +02:00
{
2020-06-12 11:16:39 +02:00
_panelIds . push_back ( posX - > second ) ;
2020-07-12 20:27:56 +02:00
}
2020-06-12 11:16:39 +02:00
else
2020-07-12 20:27:56 +02:00
{
2020-06-12 11:16:39 +02:00
_panelIds . push_front ( posX - > second ) ;
2020-07-12 20:27:56 +02:00
}
2020-06-12 11:16:39 +02:00
}
}
else
2020-02-10 15:21:58 +01:00
{
2020-06-12 11:16:39 +02:00
// Sort panels right to left
2020-11-14 17:58:56 +01:00
for ( auto posX = posY - > second . crbegin ( ) ; posX ! = posY - > second . crend ( ) ; + + posX )
2020-06-12 11:16:39 +02:00
{
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " panelMap[%d][%d]=%d " , posY - > first , posX - > first , posX - > second ) ;
2020-06-12 11:16:39 +02:00
2020-11-14 17:58:56 +01:00
if ( _topDown )
2020-07-12 20:27:56 +02:00
{
2020-06-12 11:16:39 +02:00
_panelIds . push_back ( posX - > second ) ;
2020-07-12 20:27:56 +02:00
}
2020-06-12 11:16:39 +02:00
else
2020-07-12 20:27:56 +02:00
{
2020-06-12 11:16:39 +02:00
_panelIds . push_front ( posX - > second ) ;
2020-07-12 20:27:56 +02:00
}
2020-06-12 11:16:39 +02:00
}
2020-02-10 15:21:58 +01:00
}
2019-12-08 13:12:01 +01:00
}
2020-06-12 11:16:39 +02:00
2020-11-14 17:58:56 +01:00
Debug ( _log , " PanelsNum : %d " , panelNum ) ;
Debug ( _log , " PanelLedCount : %d " , _panelLedCount ) ;
2020-06-12 11:16:39 +02:00
Debug ( _log , " Sort Top>Down : %d " , _topDown ) ;
Debug ( _log , " Sort Left>Right: %d " , _leftRight ) ;
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " PanelMap size : %d " , panelMap . size ( ) ) ;
DebugIf ( verbose , _log , " PanelIds count : %d " , _panelIds . size ( ) ) ;
// Check. if enough panels were found.
int configuredLedCount = this - > getLedCount ( ) ;
2020-11-14 17:58:56 +01:00
if ( _panelLedCount < configuredLedCount )
2020-02-10 15:21:58 +01:00
{
QString errorReason = QString ( " Not enough panels [%1] for configured LEDs [%2] found! " )
2023-10-15 17:04:51 +02:00
. arg ( _panelLedCount )
. arg ( configuredLedCount ) ;
this - > setInError ( errorReason , false ) ;
2020-02-10 15:21:58 +01:00
isInitOK = false ;
}
else
{
2020-11-14 17:58:56 +01:00
if ( _panelLedCount > this - > getLedCount ( ) )
2020-02-10 15:21:58 +01:00
{
2020-11-14 17:58:56 +01:00
Info ( _log , " %s: More panels [%d] than configured LEDs [%d]. " , QSTRING_CSTR ( this - > getActiveDeviceType ( ) ) , _panelLedCount , configuredLedCount ) ;
2020-06-12 11:16:39 +02:00
}
2023-10-15 17:04:51 +02:00
//Check that panel count matches working list created for processing
if ( _panelLedCount ! = _panelIds . size ( ) )
2020-06-12 11:16:39 +02:00
{
2023-10-15 17:04:51 +02:00
QString errorReason = QString ( " Number of available panels [%1] do not match panel-ID look-up list [%2]! " )
. arg ( _panelLedCount )
. arg ( _panelIds . size ( ) ) ;
this - > setInError ( errorReason , false ) ;
2020-06-12 11:16:39 +02:00
isInitOK = false ;
2020-02-10 15:21:58 +01:00
}
2023-10-15 17:04:51 +02:00
2019-12-08 13:12:01 +01:00
}
}
2020-07-12 20:27:56 +02:00
return isInitOK ;
}
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>
2022-05-01 19:42:47 +02:00
bool LedDeviceNanoleaf : : openRestAPI ( )
2020-07-12 20:27:56 +02:00
{
2023-10-15 17:04:51 +02:00
bool isInitOK { true } ;
2020-07-12 20:27:56 +02:00
2020-11-14 17:58:56 +01:00
if ( _restApi = = nullptr )
2020-07-12 20:27:56 +02: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>
2022-05-01 19:42:47 +02:00
_restApi = new ProviderRestApi ( _address . toString ( ) , _apiPort ) ;
_restApi - > setLogger ( _log ) ;
2020-07-12 20:27:56 +02:00
//Base-path is api-path + authentication token
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>
2022-05-01 19:42:47 +02:00
_restApi - > setBasePath ( QString ( API_BASE_PATH ) . arg ( _authToken ) ) ;
2020-07-12 20:27:56 +02:00
}
2020-02-10 15:21:58 +01:00
return isInitOK ;
}
2019-04-08 23:13:11 +02:00
2020-02-10 15:21:58 +01:00
int LedDeviceNanoleaf : : open ( )
{
int retval = - 1 ;
2020-07-12 20:27:56 +02:00
_isDeviceReady = false ;
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>
2022-05-01 19:42:47 +02:00
if ( NetUtils : : resolveHostToAddress ( _log , _hostName , _address , _apiPort ) )
2020-07-12 20:27:56 +02:00
{
2023-10-15 17:04:51 +02:00
if ( openRestAPI ( ) )
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>
2022-05-01 19:42:47 +02:00
{
// Read LedDevice configuration and validate against device configuration
if ( initLedsConfiguration ( ) )
{
if ( ProviderUdp : : open ( ) = = 0 )
{
// Everything is OK, device is ready
_isDeviceReady = true ;
retval = 0 ;
}
}
}
else
{
_restApi - > setHost ( _address . toString ( ) ) ;
_restApi - > setPort ( _apiPort ) ;
}
2020-02-10 15:21:58 +01:00
}
return retval ;
2019-04-08 23:13:11 +02:00
}
2021-03-19 22:52:04 +01:00
QJsonArray LedDeviceNanoleaf : : discover ( )
2020-02-10 15:21:58 +01:00
{
2020-07-12 20:27:56 +02:00
QJsonArray deviceList ;
2019-04-08 23:13:11 +02:00
2019-12-08 13:12:01 +01:00
SSDPDiscover discover ;
2020-07-12 20:27:56 +02:00
// Search for Canvas and Light-Panels
2021-08-31 10:55:49 +02:00
QString searchTargetFilter = QString ( " %1|%2 " ) . arg ( SSDP_NANOLEAF , SSDP_LIGHTPANELS ) ;
2019-12-08 13:12:01 +01:00
2020-07-12 20:27:56 +02:00
discover . setSearchFilter ( searchTargetFilter , SSDP_FILTER_HEADER ) ;
QString searchTarget = SSDP_ID ;
2019-12-08 13:12:01 +01:00
2020-11-14 17:58:56 +01:00
if ( discover . discoverServices ( searchTarget ) > 0 )
2020-07-12 20:27:56 +02:00
{
deviceList = discover . getServicesDiscoveredJson ( ) ;
2019-12-08 13:12:01 +01:00
}
2021-03-19 22:52:04 +01:00
return deviceList ;
}
QJsonObject LedDeviceNanoleaf : : discover ( const QJsonObject & /*params*/ )
{
QJsonObject devicesDiscovered ;
devicesDiscovered . insert ( " ledDeviceType " , _activeDeviceType ) ;
QJsonArray deviceList ;
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>
2022-05-01 19:42:47 +02:00
# ifdef ENABLE_MDNS
QString discoveryMethod ( " mDNS " ) ;
2024-02-25 17:35:39 +01:00
deviceList = MdnsBrowser : : getInstance ( ) . data ( ) - > getServicesDiscoveredJson (
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>
2022-05-01 19:42:47 +02:00
MdnsServiceRegister : : getServiceType ( _activeDeviceType ) ,
MdnsServiceRegister : : getServiceNameFilter ( _activeDeviceType ) ,
DEFAULT_DISCOVER_TIMEOUT
2023-10-15 17:04:51 +02: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>
2022-05-01 19:42:47 +02:00
# else
QString discoveryMethod ( " ssdp " ) ;
2021-03-19 22:52:04 +01:00
deviceList = discover ( ) ;
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>
2022-05-01 19:42:47 +02:00
# endif
2021-03-19 22:52:04 +01:00
devicesDiscovered . insert ( " discoveryMethod " , discoveryMethod ) ;
2020-07-12 20:27:56 +02:00
devicesDiscovered . insert ( " devices " , deviceList ) ;
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>
2022-05-01 19:42:47 +02:00
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " devicesDiscovered: [%s] " , QString ( QJsonDocument ( devicesDiscovered ) . toJson ( QJsonDocument : : Compact ) ) . toUtf8 ( ) . constData ( ) ) ;
2019-04-08 23:13:11 +02:00
2020-07-12 20:27:56 +02:00
return devicesDiscovered ;
}
2020-02-10 15:21:58 +01:00
2020-07-12 20:27:56 +02:00
QJsonObject LedDeviceNanoleaf : : getProperties ( const QJsonObject & params )
2020-02-10 15:21:58 +01:00
{
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " params: [%s] " , QString ( QJsonDocument ( params ) . toJson ( QJsonDocument : : Compact ) ) . toUtf8 ( ) . constData ( ) ) ;
2020-07-12 20:27:56 +02:00
QJsonObject properties ;
2019-04-08 23:13:11 +02: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>
2022-05-01 19:42:47 +02:00
_hostName = params [ CONFIG_HOST ] . toString ( " " ) ;
_apiPort = API_DEFAULT_PORT ;
2023-10-15 17:04:51 +02:00
_authToken = params [ CONFIG_AUTH_TOKEN ] . toString ( " " ) ;
2019-12-08 13:12:01 +01:00
2023-10-15 17:04:51 +02:00
Info ( _log , " Get properties for %s, hostname (%s) " , QSTRING_CSTR ( _activeDeviceType ) , QSTRING_CSTR ( _hostName ) ) ;
2019-04-08 23:13:11 +02: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>
2022-05-01 19:42:47 +02:00
if ( NetUtils : : resolveHostToAddress ( _log , _hostName , _address , _apiPort ) )
{
2023-10-15 17:04:51 +02:00
if ( openRestAPI ( ) )
2020-07-12 20:27:56 +02: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>
2022-05-01 19:42:47 +02:00
QString filter = params [ " filter " ] . toString ( " " ) ;
_restApi - > setPath ( filter ) ;
2019-04-08 23:13:11 +02: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>
2022-05-01 19:42:47 +02:00
// Perform request
httpResponse response = _restApi - > get ( ) ;
if ( response . error ( ) )
{
Warning ( _log , " %s get properties failed with error: '%s' " , QSTRING_CSTR ( _activeDeviceType ) , QSTRING_CSTR ( response . getErrorReason ( ) ) ) ;
}
2023-10-15 17:04:51 +02:00
QJsonObject propertiesDetails = response . getBody ( ) . object ( ) ;
if ( ! propertiesDetails . isEmpty ( ) )
{
QJsonObject jsonLayout = propertiesDetails . value ( API_PANELLAYOUT ) . toObject ( ) . value ( PANEL_LAYOUT ) . toObject ( ) ;
_panelLedCount = getHwLedCount ( jsonLayout ) ;
propertiesDetails . insert ( " ledCount " , getHwLedCount ( jsonLayout ) ) ;
}
properties . insert ( " properties " , propertiesDetails ) ;
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>
2022-05-01 19:42:47 +02:00
}
2019-12-08 13:12:01 +01: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>
2022-05-01 19:42:47 +02:00
DebugIf ( verbose , _log , " properties: [%s] " , QString ( QJsonDocument ( properties ) . toJson ( QJsonDocument : : Compact ) ) . toUtf8 ( ) . constData ( ) ) ;
2019-12-08 13:12:01 +01:00
}
2020-07-12 20:27:56 +02:00
return properties ;
2019-04-08 23:13:11 +02:00
}
2020-07-12 20:27:56 +02:00
void LedDeviceNanoleaf : : identify ( const QJsonObject & params )
2020-02-10 15:21:58 +01:00
{
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " params: [%s] " , QString ( QJsonDocument ( params ) . toJson ( QJsonDocument : : Compact ) ) . toUtf8 ( ) . constData ( ) ) ;
2019-04-08 23:13:11 +02: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>
2022-05-01 19:42:47 +02:00
_hostName = params [ CONFIG_HOST ] . toString ( " " ) ;
2023-10-15 17:04:51 +02:00
_apiPort = API_DEFAULT_PORT ;
_authToken = params [ CONFIG_AUTH_TOKEN ] . toString ( " " ) ;
2019-12-08 13:12:01 +01:00
2023-10-15 17:04:51 +02:00
Info ( _log , " Identify %s, hostname (%s) " , QSTRING_CSTR ( _activeDeviceType ) , QSTRING_CSTR ( _hostName ) ) ;
2019-12-08 13:12:01 +01: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>
2022-05-01 19:42:47 +02:00
if ( NetUtils : : resolveHostToAddress ( _log , _hostName , _address , _apiPort ) )
{
2023-10-15 17:04:51 +02:00
if ( openRestAPI ( ) )
2020-07-12 20:27:56 +02:00
{
2023-10-15 17:04:51 +02:00
_restApi - > setPath ( API_IDENTIFY ) ;
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>
2022-05-01 19:42:47 +02:00
httpResponse response = _restApi - > put ( ) ;
if ( response . error ( ) )
{
Warning ( _log , " %s identification failed with error: '%s' " , QSTRING_CSTR ( _activeDeviceType ) , QSTRING_CSTR ( response . getErrorReason ( ) ) ) ;
}
2020-07-12 20:27:56 +02:00
}
}
}
2019-12-08 13:12:01 +01:00
2023-10-15 17:04:51 +02:00
QJsonObject LedDeviceNanoleaf : : addAuthorization ( const QJsonObject & params )
{
Debug ( _log , " params: [%s] " , QJsonDocument ( params ) . toJson ( QJsonDocument : : Compact ) . constData ( ) ) ;
QJsonObject responseBody ;
_hostName = params [ CONFIG_HOST ] . toString ( " " ) ;
_apiPort = API_DEFAULT_PORT ;
Info ( _log , " Generate user authorization token for %s, hostname (%s) " , QSTRING_CSTR ( _activeDeviceType ) , QSTRING_CSTR ( _hostName ) ) ;
if ( NetUtils : : resolveHostToAddress ( _log , _hostName , _address , _apiPort ) )
{
if ( openRestAPI ( ) )
{
_restApi - > setBasePath ( QString ( API_BASE_PATH ) . arg ( API_ADD_USER ) ) ;
httpResponse response = _restApi - > post ( ) ;
if ( response . error ( ) )
{
Warning ( _log , " %s generating user authorization token failed with error: '%s' " , QSTRING_CSTR ( _activeDeviceType ) , QSTRING_CSTR ( response . getErrorReason ( ) ) ) ;
}
else
{
Debug ( _log , " Generated user authorization token: \" %s \" " , QSTRING_CSTR ( response . getBody ( ) . object ( ) . value ( " auth_token " ) . toString ( ) ) ) ;
responseBody = response . getBody ( ) . object ( ) ;
}
}
}
return responseBody ;
}
2020-07-12 20:27:56 +02:00
bool LedDeviceNanoleaf : : powerOn ( )
{
2021-03-19 22:52:04 +01:00
bool on = false ;
2020-11-14 17:58:56 +01:00
if ( _isDeviceReady )
2019-12-08 13:12:01 +01:00
{
2021-03-19 22:52:04 +01:00
if ( changeToExternalControlMode ( ) )
{
2021-08-31 10:55:49 +02:00
QJsonObject newState ;
2023-10-15 17:04:51 +02:00
QJsonObject onValue { { STATE_VALUE , true } } ;
2021-08-31 10:55:49 +02:00
newState . insert ( STATE_ON , onValue ) ;
2023-10-15 17:04:51 +02:00
if ( _isBrightnessOverwrite )
2021-08-31 10:55:49 +02:00
{
2023-10-15 17:04:51 +02:00
QJsonObject briValue { { STATE_VALUE , _brightness } } ;
2021-08-31 10:55:49 +02:00
newState . insert ( STATE_BRI , briValue ) ;
}
2021-03-19 22:52:04 +01:00
//Power-on Nanoleaf device
_restApi - > setPath ( API_STATE ) ;
2021-08-31 10:55:49 +02:00
httpResponse response = _restApi - > put ( newState ) ;
2021-03-19 22:52:04 +01:00
if ( response . error ( ) )
{
QString errorReason = QString ( " Power-on request failed with error: '%1' " ) . arg ( response . getErrorReason ( ) ) ;
2023-10-15 17:04:51 +02:00
this - > setInError ( errorReason ) ;
2021-03-19 22:52:04 +01:00
on = false ;
2023-10-15 17:04:51 +02:00
}
else {
2021-08-31 10:55:49 +02:00
on = true ;
2021-03-19 22:52:04 +01:00
}
2021-08-31 10:55:49 +02:00
2021-03-19 22:52:04 +01:00
}
2019-12-08 13:12:01 +01:00
}
2021-03-19 22:52:04 +01:00
return on ;
2020-07-12 20:27:56 +02:00
}
bool LedDeviceNanoleaf : : powerOff ( )
{
2021-03-19 22:52:04 +01:00
bool off = true ;
2020-11-14 17:58:56 +01:00
if ( _isDeviceReady )
2019-12-08 13:12:01 +01:00
{
2021-08-31 10:55:49 +02:00
QJsonObject newState ;
2023-10-15 17:04:51 +02:00
QJsonObject onValue { { STATE_VALUE , false } } ;
2021-08-31 10:55:49 +02:00
newState . insert ( STATE_ON , onValue ) ;
2020-07-12 20:27:56 +02:00
//Power-off the Nanoleaf device physically
_restApi - > setPath ( API_STATE ) ;
2021-08-31 10:55:49 +02:00
httpResponse response = _restApi - > put ( newState ) ;
2021-03-19 22:52:04 +01:00
if ( response . error ( ) )
{
QString errorReason = QString ( " Power-off request failed with error: '%1' " ) . arg ( response . getErrorReason ( ) ) ;
2023-10-15 17:04:51 +02:00
this - > setInError ( errorReason ) ;
2021-03-19 22:52:04 +01:00
off = false ;
}
2019-12-08 13:12:01 +01:00
}
2021-03-19 22:52:04 +01:00
return off ;
2019-04-08 23:13:11 +02:00
}
2021-08-31 10:55:49 +02:00
bool LedDeviceNanoleaf : : storeState ( )
2019-04-08 23:13:11 +02:00
{
2021-08-31 10:55:49 +02:00
bool rc = true ;
2023-10-15 17:04:51 +02:00
if ( _isRestoreOrigState )
2021-08-31 10:55:49 +02:00
{
_restApi - > setPath ( API_STATE ) ;
httpResponse response = _restApi - > get ( ) ;
2023-10-15 17:04:51 +02:00
if ( response . error ( ) )
2021-08-31 10:55:49 +02:00
{
QString errorReason = QString ( " Storing device state failed with error: '%1' " ) . arg ( response . getErrorReason ( ) ) ;
setInError ( errorReason ) ;
rc = false ;
}
else
{
_originalStateProperties = response . getBody ( ) . object ( ) ;
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " state: [%s] " , QString ( QJsonDocument ( _originalStateProperties ) . toJson ( QJsonDocument : : Compact ) ) . toUtf8 ( ) . constData ( ) ) ;
2021-08-31 10:55:49 +02:00
QJsonObject isOn = _originalStateProperties . value ( STATE_ON ) . toObject ( ) ;
if ( ! isOn . isEmpty ( ) )
{
_originalIsOn = isOn [ STATE_VALUE ] . toBool ( ) ;
}
QJsonObject bri = _originalStateProperties . value ( STATE_BRI ) . toObject ( ) ;
if ( ! bri . isEmpty ( ) )
{
_originalBri = bri [ STATE_VALUE ] . toInt ( ) ;
}
_originalColorMode = _originalStateProperties [ STATE_COLORMODE ] . toString ( ) ;
2023-10-15 17:04:51 +02:00
switch ( COLOR_MODES . indexOf ( _originalColorMode ) ) {
2021-08-31 10:55:49 +02:00
case 0 :
{
// hs
QJsonObject hue = _originalStateProperties . value ( STATE_HUE ) . toObject ( ) ;
if ( ! hue . isEmpty ( ) )
{
_originalHue = hue [ STATE_VALUE ] . toInt ( ) ;
}
QJsonObject sat = _originalStateProperties . value ( STATE_SAT ) . toObject ( ) ;
if ( ! sat . isEmpty ( ) )
{
_originalSat = sat [ STATE_VALUE ] . toInt ( ) ;
}
break ;
}
case 1 :
{
// ct
QJsonObject ct = _originalStateProperties . value ( STATE_CT ) . toObject ( ) ;
if ( ! ct . isEmpty ( ) )
{
_originalCt = ct [ STATE_VALUE ] . toInt ( ) ;
}
break ;
}
case 2 :
{
// effect
_restApi - > setPath ( API_EFFECT ) ;
2022-12-27 08:36:10 +01:00
httpResponse responseEffects = _restApi - > get ( ) ;
2023-10-15 17:04:51 +02:00
if ( responseEffects . error ( ) )
2021-08-31 10:55:49 +02:00
{
2022-12-27 08:36:10 +01:00
QString errorReason = QString ( " Storing device state failed with error: '%1' " ) . arg ( responseEffects . getErrorReason ( ) ) ;
2021-08-31 10:55:49 +02:00
setInError ( errorReason ) ;
rc = false ;
}
else
{
2022-12-27 08:36:10 +01:00
QJsonObject effects = responseEffects . getBody ( ) . object ( ) ;
2023-10-15 17:04:51 +02:00
DebugIf ( verbose , _log , " effects: [%s] " , QString ( QJsonDocument ( _originalStateProperties ) . toJson ( QJsonDocument : : Compact ) ) . toUtf8 ( ) . constData ( ) ) ;
2021-08-31 10:55:49 +02:00
_originalEffect = effects [ API_EFFECT_SELECT ] . toString ( ) ;
2024-04-16 21:57:51 +02:00
_originalIsDynEffect = _originalEffect ! = " *Dynamic* " | | _originalEffect = = " *Solid* " | | _originalEffect = = " *ExtControl* " ;
2021-08-31 10:55:49 +02:00
}
break ;
}
default :
QString errorReason = QString ( " Unknown ColorMode: '%1' " ) . arg ( _originalColorMode ) ;
setInError ( errorReason ) ;
rc = false ;
break ;
}
}
}
return rc ;
}
bool LedDeviceNanoleaf : : restoreState ( )
{
bool rc = true ;
2023-10-15 17:04:51 +02:00
if ( _isRestoreOrigState )
2021-08-31 10:55:49 +02:00
{
QJsonObject newState ;
2023-10-15 17:04:51 +02:00
switch ( COLOR_MODES . indexOf ( _originalColorMode ) ) {
2021-08-31 10:55:49 +02:00
case 0 :
{ // hs
2023-10-15 17:04:51 +02:00
QJsonObject hueValue { { STATE_VALUE , _originalHue } } ;
2021-08-31 10:55:49 +02:00
newState . insert ( STATE_HUE , hueValue ) ;
2023-10-15 17:04:51 +02:00
QJsonObject satValue { { STATE_VALUE , _originalSat } } ;
2021-08-31 10:55:49 +02:00
newState . insert ( STATE_SAT , satValue ) ;
break ;
}
case 1 :
{ // ct
2023-10-15 17:04:51 +02:00
QJsonObject ctValue { { STATE_VALUE , _originalCt } } ;
2021-08-31 10:55:49 +02:00
newState . insert ( STATE_CT , ctValue ) ;
break ;
}
case 2 :
{ // effect
if ( ! _originalIsDynEffect )
{
QJsonObject newEffect ;
newEffect [ API_EFFECT_SELECT ] = _originalEffect ;
_restApi - > setPath ( API_EFFECT ) ;
httpResponse response = _restApi - > put ( newEffect ) ;
2023-10-15 17:04:51 +02:00
if ( response . error ( ) )
2021-08-31 10:55:49 +02:00
{
2023-10-15 17:04:51 +02:00
Warning ( _log , " %s restoring effect failed with error: '%s' " , QSTRING_CSTR ( _activeDeviceType ) , QSTRING_CSTR ( response . getErrorReason ( ) ) ) ;
2021-08-31 10:55:49 +02:00
}
2023-10-15 17:04:51 +02:00
}
else {
2024-04-16 21:57:51 +02:00
Info ( _log , " %s cannot restore dynamic or solid effects. Device is switched off instead " , QSTRING_CSTR ( _activeDeviceType ) ) ;
2021-08-31 10:55:49 +02:00
_originalIsOn = false ;
}
break ;
}
default :
2023-10-15 17:04:51 +02:00
Warning ( _log , " %s restoring failed with error: Unknown ColorMode " , QSTRING_CSTR ( _activeDeviceType ) ) ;
2021-08-31 10:55:49 +02:00
rc = false ;
}
if ( ! _originalIsDynEffect )
{
2023-10-15 17:04:51 +02:00
QJsonObject briValue { { STATE_VALUE , _originalBri } } ;
2021-08-31 10:55:49 +02:00
newState . insert ( STATE_BRI , briValue ) ;
}
2023-10-15 17:04:51 +02:00
QJsonObject onValue { { STATE_VALUE , _originalIsOn } } ;
2021-08-31 10:55:49 +02:00
newState . insert ( STATE_ON , onValue ) ;
_restApi - > setPath ( API_STATE ) ;
httpResponse response = _restApi - > put ( newState ) ;
2023-10-15 17:04:51 +02:00
if ( response . error ( ) )
2021-08-31 10:55:49 +02:00
{
2023-10-15 17:04:51 +02:00
Warning ( _log , " %s restoring state failed with error: '%s' " , QSTRING_CSTR ( _activeDeviceType ) , QSTRING_CSTR ( response . getErrorReason ( ) ) ) ;
2021-08-31 10:55:49 +02:00
rc = false ;
}
}
return rc ;
2020-07-12 20:27:56 +02:00
}
2021-03-19 22:52:04 +01:00
bool LedDeviceNanoleaf : : changeToExternalControlMode ( )
2020-07-12 20:27:56 +02:00
{
2021-03-19 22:52:04 +01:00
QJsonDocument resp ;
return changeToExternalControlMode ( resp ) ;
}
bool LedDeviceNanoleaf : : changeToExternalControlMode ( QJsonDocument & resp )
{
bool success = false ;
2020-09-14 17:19:14 +02:00
Debug ( _log , " Set Nanoleaf to External Control (UDP) streaming mode " ) ;
2020-07-12 20:27:56 +02:00
_extControlVersion = EXTCTRLVER_V2 ;
//Enable UDP Mode v2
2019-04-08 23:13:11 +02:00
2020-07-12 20:27:56 +02:00
_restApi - > setPath ( API_EFFECT ) ;
2020-11-14 17:58:56 +01:00
httpResponse response = _restApi - > put ( API_EXT_MODE_STRING_V2 ) ;
2021-03-19 22:52:04 +01:00
if ( response . error ( ) )
{
QString errorReason = QString ( " Change to external control mode failed with error: '%1' " ) . arg ( response . getErrorReason ( ) ) ;
2023-10-15 17:04:51 +02:00
this - > setInError ( errorReason ) ;
2021-03-19 22:52:04 +01:00
}
else
{
resp = response . getBody ( ) ;
success = true ;
}
return success ;
2020-07-12 20:27:56 +02:00
}
2020-11-14 17:58:56 +01:00
int LedDeviceNanoleaf : : write ( const std : : vector < ColorRgb > & ledValues )
2020-07-12 20:27:56 +02:00
{
2019-12-08 13:12:01 +01:00
int retVal = 0 ;
//
// nPanels 2B
// panelID 2B
// <R> <G> <B> 3B
// <W> 1B
// tranitionTime 2B
//
// Note: Nanoleaf Light Panels (Aurora) now support External Control V2 (tested with FW 3.2.0)
2019-04-08 23:13:11 +02:00
2020-11-14 17:58:56 +01:00
int udpBufferSize = STREAM_FRAME_PANEL_NUM_SIZE + _panelLedCount * STREAM_FRAME_PANEL_INFO_SIZE ;
2019-04-08 23:13:11 +02:00
2020-11-14 17:58:56 +01:00
QByteArray udpbuffer ;
udpbuffer . resize ( udpBufferSize ) ;
2019-04-08 23:13:11 +02:00
2020-11-14 17:58:56 +01:00
int i = 0 ;
2019-04-08 23:13:11 +02:00
2019-12-08 13:12:01 +01:00
// Set number of panels
2020-11-14 17:58:56 +01:00
qToBigEndian < quint16 > ( static_cast < quint16 > ( _panelLedCount ) , udpbuffer . data ( ) + i ) ;
i + = 2 ;
2019-04-08 23:13:11 +02:00
2019-12-08 13:12:01 +01:00
ColorRgb color ;
2020-06-12 11:16:39 +02:00
2023-10-15 17:04:51 +02:00
for ( int panelCounter = 0 ; panelCounter < _panelLedCount ; + + panelCounter )
2019-12-08 13:12:01 +01:00
{
2023-10-15 17:04:51 +02:00
// Set panelID
2020-11-14 17:58:56 +01:00
int panelID = _panelIds [ panelCounter ] ;
2023-10-15 17:04:51 +02:00
qToBigEndian < quint16 > ( static_cast < quint16 > ( panelID ) , udpbuffer . data ( ) + i ) ;
i + = 2 ;
2019-04-08 23:13:11 +02:00
2023-10-15 17:04:51 +02:00
// Set panel's color LEDs
if ( panelCounter < this - > getLedCount ( ) ) {
color = static_cast < ColorRgb > ( ledValues . at ( panelCounter ) ) ;
2019-12-08 13:12:01 +01:00
}
else
{
2022-12-27 08:36:10 +01:00
// Set panels not configured to black
2019-12-08 13:12:01 +01:00
color = ColorRgb : : BLACK ;
2023-10-15 17:04:51 +02:00
DebugIf ( verbose3 , _log , " [%u] >= panelLedCount [%u] => Set to BLACK " , panelCounter , _panelLedCount ) ;
2019-12-08 13:12:01 +01:00
}
2020-11-14 17:58:56 +01:00
udpbuffer [ i + + ] = static_cast < char > ( color . red ) ;
udpbuffer [ i + + ] = static_cast < char > ( color . green ) ;
udpbuffer [ i + + ] = static_cast < char > ( color . blue ) ;
2019-12-08 13:12:01 +01:00
// Set white LED
udpbuffer [ i + + ] = 0 ; // W not set manually
// Set transition time
unsigned char tranitionTime = 1 ; // currently fixed at value 1 which corresponds to 100ms
2020-11-14 17:58:56 +01:00
qToBigEndian < quint16 > ( static_cast < quint16 > ( tranitionTime ) , udpbuffer . data ( ) + i ) ;
i + = 2 ;
2019-04-08 23:13:11 +02:00
2020-11-14 17:58:56 +01:00
DebugIf ( verbose3 , _log , " [%u] Color: {%u,%u,%u} " , panelCounter , color . red , color . green , color . blue ) ;
2019-12-08 13:12:01 +01:00
}
2019-04-08 23:13:11 +02:00
2020-11-14 17:58:56 +01:00
if ( verbose3 )
2019-12-08 13:12:01 +01:00
{
2020-11-14 17:58:56 +01:00
Debug ( _log , " UDP-Address [%s], UDP-Port [%u], udpBufferSize[%d], Bytes to send [%d] " , QSTRING_CSTR ( _address . toString ( ) ) , _port , udpBufferSize , i ) ;
2023-10-15 17:04:51 +02:00
Debug ( _log , " packet: [%s] " , QSTRING_CSTR ( toHex ( udpbuffer , 64 ) ) ) ;
2019-12-08 13:12:01 +01:00
}
2020-11-14 17:58:56 +01:00
retVal = writeBytes ( udpbuffer ) ;
return retVal ;
2019-04-08 23:13:11 +02:00
}