2018-12-28 18:12:45 +01:00
|
|
|
// proj incl
|
|
|
|
#include <api/JsonCB.h>
|
|
|
|
|
|
|
|
// hyperion
|
|
|
|
#include <hyperion/Hyperion.h>
|
2019-07-14 22:43:22 +02:00
|
|
|
|
|
|
|
// HyperionIManager
|
|
|
|
#include <hyperion/HyperionIManager.h>
|
2018-12-28 18:12:45 +01:00
|
|
|
// components
|
2019-07-14 22:43:22 +02:00
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
#include <hyperion/ComponentRegister.h>
|
|
|
|
// priorityMuxer
|
2019-07-14 22:43:22 +02:00
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
#include <hyperion/PriorityMuxer.h>
|
2019-07-14 22:43:22 +02:00
|
|
|
|
|
|
|
// utils
|
2018-12-28 18:12:45 +01:00
|
|
|
#include <utils/ColorSys.h>
|
2019-07-14 22:43:22 +02:00
|
|
|
|
|
|
|
// qt
|
2018-12-28 18:12:45 +01:00
|
|
|
#include <QDateTime>
|
2020-05-12 19:51:19 +02:00
|
|
|
#include <QVariant>
|
2018-12-28 18:12:45 +01:00
|
|
|
|
|
|
|
// Image to led map helper
|
|
|
|
#include <hyperion/ImageProcessor.h>
|
|
|
|
|
|
|
|
using namespace hyperion;
|
|
|
|
|
2019-09-17 21:33:46 +02:00
|
|
|
JsonCB::JsonCB(QObject* parent)
|
2018-12-28 18:12:45 +01:00
|
|
|
: QObject(parent)
|
2019-09-17 21:33:46 +02:00
|
|
|
, _hyperion(nullptr)
|
|
|
|
, _componentRegister(nullptr)
|
|
|
|
, _prioMuxer(nullptr)
|
2018-12-28 18:12:45 +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
|
|
|
_availableCommands << "components-update" << "priorities-update" << "imageToLedMapping-update"
|
2022-02-11 20:36:15 +01:00
|
|
|
<< "adjustment-update" << "videomode-update" << "settings-update" << "leds-update" << "instance-update" << "token-update";
|
|
|
|
|
|
|
|
#if defined(ENABLE_EFFECTENGINE)
|
|
|
|
_availableCommands << "effects-update";
|
|
|
|
#endif
|
2022-02-22 20:58:59 +01:00
|
|
|
|
|
|
|
qRegisterMetaType<PriorityMuxer::InputsMap>("InputsMap");
|
2018-12-28 18:12:45 +01:00
|
|
|
}
|
|
|
|
|
2020-08-08 13:09:15 +02:00
|
|
|
bool JsonCB::subscribeFor(const QString& type, bool unsubscribe)
|
2018-12-28 18:12:45 +01:00
|
|
|
{
|
|
|
|
if(!_availableCommands.contains(type))
|
|
|
|
return false;
|
|
|
|
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
_subscribedCommands.removeAll(type);
|
|
|
|
else
|
|
|
|
_subscribedCommands << type;
|
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
if(type == "components-update")
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
disconnect(_componentRegister, &ComponentRegister::updatedComponentState, this, &JsonCB::handleComponentState);
|
|
|
|
else
|
|
|
|
connect(_componentRegister, &ComponentRegister::updatedComponentState, this, &JsonCB::handleComponentState, Qt::UniqueConnection);
|
2018-12-28 18:12:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(type == "priorities-update")
|
|
|
|
{
|
2020-11-01 19:15:22 +01:00
|
|
|
if (unsubscribe)
|
2021-10-16 13:55:23 +02:00
|
|
|
disconnect(_prioMuxer, &PriorityMuxer::prioritiesChanged, this, &JsonCB::handlePriorityUpdate);
|
2020-11-01 19:15:22 +01:00
|
|
|
else
|
2019-09-17 21:33:46 +02:00
|
|
|
connect(_prioMuxer, &PriorityMuxer::prioritiesChanged, this, &JsonCB::handlePriorityUpdate, Qt::UniqueConnection);
|
2018-12-28 18:12:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(type == "imageToLedMapping-update")
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
disconnect(_hyperion, &Hyperion::imageToLedsMappingChanged, this, &JsonCB::handleImageToLedsMappingChange);
|
|
|
|
else
|
|
|
|
connect(_hyperion, &Hyperion::imageToLedsMappingChanged, this, &JsonCB::handleImageToLedsMappingChange, Qt::UniqueConnection);
|
2018-12-28 18:12:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(type == "adjustment-update")
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
disconnect(_hyperion, &Hyperion::adjustmentChanged, this, &JsonCB::handleAdjustmentChange);
|
|
|
|
else
|
|
|
|
connect(_hyperion, &Hyperion::adjustmentChanged, this, &JsonCB::handleAdjustmentChange, Qt::UniqueConnection);
|
2018-12-28 18:12:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(type == "videomode-update")
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
disconnect(_hyperion, &Hyperion::newVideoMode, this, &JsonCB::handleVideoModeChange);
|
|
|
|
else
|
|
|
|
connect(_hyperion, &Hyperion::newVideoMode, this, &JsonCB::handleVideoModeChange, Qt::UniqueConnection);
|
2018-12-28 18:12:45 +01:00
|
|
|
}
|
|
|
|
|
2022-02-11 20:36:15 +01:00
|
|
|
#if defined(ENABLE_EFFECTENGINE)
|
2018-12-28 18:12:45 +01:00
|
|
|
if(type == "effects-update")
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
disconnect(_hyperion, &Hyperion::effectListUpdated, this, &JsonCB::handleEffectListChange);
|
|
|
|
else
|
|
|
|
connect(_hyperion, &Hyperion::effectListUpdated, this, &JsonCB::handleEffectListChange, Qt::UniqueConnection);
|
2018-12-28 18:12:45 +01:00
|
|
|
}
|
2022-02-11 20:36:15 +01:00
|
|
|
#endif
|
2018-12-28 18:12:45 +01:00
|
|
|
|
|
|
|
if(type == "settings-update")
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
disconnect(_hyperion, &Hyperion::settingsChanged, this, &JsonCB::handleSettingsChange);
|
|
|
|
else
|
|
|
|
connect(_hyperion, &Hyperion::settingsChanged, this, &JsonCB::handleSettingsChange, Qt::UniqueConnection);
|
2018-12-28 18:12:45 +01:00
|
|
|
}
|
|
|
|
|
2019-07-20 11:28:16 +02:00
|
|
|
if(type == "leds-update")
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
disconnect(_hyperion, &Hyperion::settingsChanged, this, &JsonCB::handleLedsConfigChange);
|
|
|
|
else
|
|
|
|
connect(_hyperion, &Hyperion::settingsChanged, this, &JsonCB::handleLedsConfigChange, Qt::UniqueConnection);
|
2019-07-20 11:28:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-07-14 22:43:22 +02:00
|
|
|
if(type == "instance-update")
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
if(unsubscribe)
|
|
|
|
disconnect(HyperionIManager::getInstance(), &HyperionIManager::change, this, &JsonCB::handleInstanceChange);
|
|
|
|
else
|
|
|
|
connect(HyperionIManager::getInstance(), &HyperionIManager::change, this, &JsonCB::handleInstanceChange, Qt::UniqueConnection);
|
2019-07-14 22:43:22 +02:00
|
|
|
}
|
|
|
|
|
2020-03-26 17:59:41 +01:00
|
|
|
if (type == "token-update")
|
|
|
|
{
|
|
|
|
if (unsubscribe)
|
|
|
|
disconnect(AuthManager::getInstance(), &AuthManager::tokenChange, this, &JsonCB::handleTokenChange);
|
|
|
|
else
|
|
|
|
connect(AuthManager::getInstance(), &AuthManager::tokenChange, this, &JsonCB::handleTokenChange, Qt::UniqueConnection);
|
|
|
|
}
|
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-08-02 10:44:42 +02:00
|
|
|
void JsonCB::resetSubscriptions()
|
|
|
|
{
|
|
|
|
for(const auto & entry : getSubscribedCommands())
|
|
|
|
{
|
2019-09-17 21:33:46 +02:00
|
|
|
subscribeFor(entry, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-02 10:44:42 +02:00
|
|
|
void JsonCB::setSubscriptionsTo(Hyperion* hyperion)
|
|
|
|
{
|
2022-01-22 17:48:03 +01:00
|
|
|
assert(hyperion);
|
2021-10-16 13:55:23 +02:00
|
|
|
|
2019-09-17 21:33:46 +02:00
|
|
|
// get current subs
|
|
|
|
QStringList currSubs(getSubscribedCommands());
|
|
|
|
|
|
|
|
// stop subs
|
|
|
|
resetSubscriptions();
|
|
|
|
|
|
|
|
// update pointer
|
|
|
|
_hyperion = hyperion;
|
2022-01-22 17:48:03 +01:00
|
|
|
_componentRegister = _hyperion->getComponentRegister();
|
2019-09-17 21:33:46 +02:00
|
|
|
_prioMuxer = _hyperion->getMuxerInstance();
|
|
|
|
|
|
|
|
// re-apply subs
|
|
|
|
for(const auto & entry : currSubs)
|
|
|
|
{
|
|
|
|
subscribeFor(entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
void JsonCB::doCallback(const QString& cmd, const QVariant& data)
|
|
|
|
{
|
|
|
|
QJsonObject obj;
|
2022-12-19 14:04:35 +01:00
|
|
|
obj["instance"] = _hyperion->getInstanceIndex();
|
2018-12-28 18:12:45 +01:00
|
|
|
obj["command"] = cmd;
|
|
|
|
|
2021-11-16 18:12:56 +01:00
|
|
|
if (data.userType() == QMetaType::QJsonArray)
|
2018-12-28 18:12:45 +01:00
|
|
|
obj["data"] = data.toJsonArray();
|
|
|
|
else
|
|
|
|
obj["data"] = data.toJsonObject();
|
|
|
|
|
|
|
|
emit newCallback(obj);
|
|
|
|
}
|
|
|
|
|
2020-08-08 13:09:15 +02:00
|
|
|
void JsonCB::handleComponentState(hyperion::Components comp, bool state)
|
2018-12-28 18:12:45 +01:00
|
|
|
{
|
|
|
|
QJsonObject data;
|
|
|
|
data["name"] = componentToIdString(comp);
|
|
|
|
data["enabled"] = state;
|
|
|
|
|
|
|
|
doCallback("components-update", QVariant(data));
|
|
|
|
}
|
2022-02-22 20:58:59 +01:00
|
|
|
|
|
|
|
void JsonCB::handlePriorityUpdate(int currentPriority, const PriorityMuxer::InputsMap& activeInputs)
|
2018-12-28 18:12:45 +01:00
|
|
|
{
|
|
|
|
QJsonObject data;
|
|
|
|
QJsonArray priorities;
|
|
|
|
uint64_t now = QDateTime::currentMSecsSinceEpoch();
|
2022-02-22 20:58:59 +01:00
|
|
|
QList<int> activePriorities = activeInputs.keys();
|
|
|
|
|
|
|
|
activePriorities.removeAll(PriorityMuxer::LOWEST_PRIORITY);
|
|
|
|
|
2023-09-09 22:10:22 +02:00
|
|
|
for (int priority : std::as_const(activePriorities)) {
|
2022-02-22 20:58:59 +01:00
|
|
|
|
|
|
|
const Hyperion::InputInfo& priorityInfo = activeInputs[priority];
|
2018-12-28 18:12:45 +01:00
|
|
|
|
|
|
|
QJsonObject item;
|
|
|
|
item["priority"] = priority;
|
2022-02-22 20:58:59 +01:00
|
|
|
|
2018-12-31 15:48:29 +01:00
|
|
|
if (priorityInfo.timeoutTime_ms > 0 )
|
2022-02-22 20:58:59 +01:00
|
|
|
{
|
2018-12-28 18:12:45 +01:00
|
|
|
item["duration_ms"] = int(priorityInfo.timeoutTime_ms - now);
|
2022-02-22 20:58:59 +01:00
|
|
|
}
|
2018-12-31 15:48:29 +01:00
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
// owner has optional informations to the component
|
|
|
|
if(!priorityInfo.owner.isEmpty())
|
2022-02-22 20:58:59 +01:00
|
|
|
{
|
2018-12-28 18:12:45 +01:00
|
|
|
item["owner"] = priorityInfo.owner;
|
2022-02-22 20:58:59 +01:00
|
|
|
}
|
2018-12-28 18:12:45 +01:00
|
|
|
|
|
|
|
item["componentId"] = QString(hyperion::componentToIdString(priorityInfo.componentId));
|
|
|
|
item["origin"] = priorityInfo.origin;
|
|
|
|
item["active"] = (priorityInfo.timeoutTime_ms >= -1);
|
|
|
|
item["visible"] = (priority == currentPriority);
|
|
|
|
|
|
|
|
if(priorityInfo.componentId == hyperion::COMP_COLOR && !priorityInfo.ledColors.empty())
|
|
|
|
{
|
|
|
|
QJsonObject LEDcolor;
|
|
|
|
|
|
|
|
// add RGB Value to Array
|
|
|
|
QJsonArray RGBValue;
|
|
|
|
RGBValue.append(priorityInfo.ledColors.begin()->red);
|
|
|
|
RGBValue.append(priorityInfo.ledColors.begin()->green);
|
|
|
|
RGBValue.append(priorityInfo.ledColors.begin()->blue);
|
|
|
|
LEDcolor.insert("RGB", RGBValue);
|
|
|
|
|
|
|
|
uint16_t Hue;
|
2022-02-22 20:58:59 +01:00
|
|
|
float Saturation;
|
|
|
|
float Luminace;
|
2018-12-28 18:12:45 +01:00
|
|
|
|
|
|
|
// add HSL Value to Array
|
|
|
|
QJsonArray HSLValue;
|
|
|
|
ColorSys::rgb2hsl(priorityInfo.ledColors.begin()->red,
|
|
|
|
priorityInfo.ledColors.begin()->green,
|
|
|
|
priorityInfo.ledColors.begin()->blue,
|
|
|
|
Hue, Saturation, Luminace);
|
|
|
|
|
|
|
|
HSLValue.append(Hue);
|
|
|
|
HSLValue.append(Saturation);
|
|
|
|
HSLValue.append(Luminace);
|
|
|
|
LEDcolor.insert("HSL", HSLValue);
|
|
|
|
|
|
|
|
item["value"] = LEDcolor;
|
|
|
|
}
|
|
|
|
priorities.append(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
data["priorities"] = priorities;
|
|
|
|
data["priorities_autoselect"] = _hyperion->sourceAutoSelectEnabled();
|
|
|
|
|
|
|
|
doCallback("priorities-update", QVariant(data));
|
|
|
|
}
|
|
|
|
|
2020-08-08 13:09:15 +02:00
|
|
|
void JsonCB::handleImageToLedsMappingChange(int mappingType)
|
2018-12-28 18:12:45 +01:00
|
|
|
{
|
|
|
|
QJsonObject data;
|
|
|
|
data["imageToLedMappingType"] = ImageProcessor::mappingTypeToStr(mappingType);
|
|
|
|
|
|
|
|
doCallback("imageToLedMapping-update", QVariant(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
void JsonCB::handleAdjustmentChange()
|
|
|
|
{
|
|
|
|
QJsonArray adjustmentArray;
|
|
|
|
for (const QString& adjustmentId : _hyperion->getAdjustmentIds())
|
|
|
|
{
|
|
|
|
const ColorAdjustment * colorAdjustment = _hyperion->getAdjustment(adjustmentId);
|
|
|
|
if (colorAdjustment == nullptr)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
QJsonObject adjustment;
|
|
|
|
adjustment["id"] = adjustmentId;
|
|
|
|
|
|
|
|
QJsonArray whiteAdjust;
|
|
|
|
whiteAdjust.append(colorAdjustment->_rgbWhiteAdjustment.getAdjustmentR());
|
|
|
|
whiteAdjust.append(colorAdjustment->_rgbWhiteAdjustment.getAdjustmentG());
|
|
|
|
whiteAdjust.append(colorAdjustment->_rgbWhiteAdjustment.getAdjustmentB());
|
|
|
|
adjustment.insert("white", whiteAdjust);
|
|
|
|
|
|
|
|
QJsonArray redAdjust;
|
|
|
|
redAdjust.append(colorAdjustment->_rgbRedAdjustment.getAdjustmentR());
|
|
|
|
redAdjust.append(colorAdjustment->_rgbRedAdjustment.getAdjustmentG());
|
|
|
|
redAdjust.append(colorAdjustment->_rgbRedAdjustment.getAdjustmentB());
|
|
|
|
adjustment.insert("red", redAdjust);
|
|
|
|
|
|
|
|
QJsonArray greenAdjust;
|
|
|
|
greenAdjust.append(colorAdjustment->_rgbGreenAdjustment.getAdjustmentR());
|
|
|
|
greenAdjust.append(colorAdjustment->_rgbGreenAdjustment.getAdjustmentG());
|
|
|
|
greenAdjust.append(colorAdjustment->_rgbGreenAdjustment.getAdjustmentB());
|
|
|
|
adjustment.insert("green", greenAdjust);
|
|
|
|
|
|
|
|
QJsonArray blueAdjust;
|
|
|
|
blueAdjust.append(colorAdjustment->_rgbBlueAdjustment.getAdjustmentR());
|
|
|
|
blueAdjust.append(colorAdjustment->_rgbBlueAdjustment.getAdjustmentG());
|
|
|
|
blueAdjust.append(colorAdjustment->_rgbBlueAdjustment.getAdjustmentB());
|
|
|
|
adjustment.insert("blue", blueAdjust);
|
|
|
|
|
|
|
|
QJsonArray cyanAdjust;
|
|
|
|
cyanAdjust.append(colorAdjustment->_rgbCyanAdjustment.getAdjustmentR());
|
|
|
|
cyanAdjust.append(colorAdjustment->_rgbCyanAdjustment.getAdjustmentG());
|
|
|
|
cyanAdjust.append(colorAdjustment->_rgbCyanAdjustment.getAdjustmentB());
|
|
|
|
adjustment.insert("cyan", cyanAdjust);
|
|
|
|
|
|
|
|
QJsonArray magentaAdjust;
|
|
|
|
magentaAdjust.append(colorAdjustment->_rgbMagentaAdjustment.getAdjustmentR());
|
|
|
|
magentaAdjust.append(colorAdjustment->_rgbMagentaAdjustment.getAdjustmentG());
|
|
|
|
magentaAdjust.append(colorAdjustment->_rgbMagentaAdjustment.getAdjustmentB());
|
|
|
|
adjustment.insert("magenta", magentaAdjust);
|
|
|
|
|
|
|
|
QJsonArray yellowAdjust;
|
|
|
|
yellowAdjust.append(colorAdjustment->_rgbYellowAdjustment.getAdjustmentR());
|
|
|
|
yellowAdjust.append(colorAdjustment->_rgbYellowAdjustment.getAdjustmentG());
|
|
|
|
yellowAdjust.append(colorAdjustment->_rgbYellowAdjustment.getAdjustmentB());
|
|
|
|
adjustment.insert("yellow", yellowAdjust);
|
|
|
|
|
|
|
|
adjustment["backlightThreshold"] = colorAdjustment->_rgbTransform.getBacklightThreshold();
|
|
|
|
adjustment["backlightColored"] = colorAdjustment->_rgbTransform.getBacklightColored();
|
|
|
|
adjustment["brightness"] = colorAdjustment->_rgbTransform.getBrightness();
|
|
|
|
adjustment["brightnessCompensation"] = colorAdjustment->_rgbTransform.getBrightnessCompensation();
|
|
|
|
adjustment["gammaRed"] = colorAdjustment->_rgbTransform.getGammaR();
|
|
|
|
adjustment["gammaGreen"] = colorAdjustment->_rgbTransform.getGammaG();
|
|
|
|
adjustment["gammaBlue"] = colorAdjustment->_rgbTransform.getGammaB();
|
|
|
|
|
|
|
|
adjustmentArray.append(adjustment);
|
|
|
|
}
|
|
|
|
|
|
|
|
doCallback("adjustment-update", QVariant(adjustmentArray));
|
|
|
|
}
|
|
|
|
|
2020-08-08 13:09:15 +02:00
|
|
|
void JsonCB::handleVideoModeChange(VideoMode mode)
|
2018-12-28 18:12:45 +01:00
|
|
|
{
|
|
|
|
QJsonObject data;
|
|
|
|
data["videomode"] = QString(videoMode2String(mode));
|
|
|
|
doCallback("videomode-update", QVariant(data));
|
|
|
|
}
|
|
|
|
|
2022-02-11 20:36:15 +01:00
|
|
|
#if defined(ENABLE_EFFECTENGINE)
|
2018-12-28 18:12:45 +01:00
|
|
|
void JsonCB::handleEffectListChange()
|
|
|
|
{
|
|
|
|
QJsonArray effectList;
|
|
|
|
QJsonObject effects;
|
|
|
|
const std::list<EffectDefinition> & effectsDefinitions = _hyperion->getEffects();
|
|
|
|
for (const EffectDefinition & effectDefinition : effectsDefinitions)
|
|
|
|
{
|
|
|
|
QJsonObject effect;
|
|
|
|
effect["name"] = effectDefinition.name;
|
|
|
|
effect["file"] = effectDefinition.file;
|
|
|
|
effect["script"] = effectDefinition.script;
|
|
|
|
effect["args"] = effectDefinition.args;
|
|
|
|
effectList.append(effect);
|
|
|
|
};
|
|
|
|
effects["effects"] = effectList;
|
|
|
|
doCallback("effects-update", QVariant(effects));
|
|
|
|
}
|
2022-02-11 20:36:15 +01:00
|
|
|
#endif
|
2018-12-28 18:12:45 +01:00
|
|
|
|
2020-08-08 13:09:15 +02:00
|
|
|
void JsonCB::handleSettingsChange(settings::type type, const QJsonDocument& data)
|
2018-12-28 18:12:45 +01:00
|
|
|
{
|
|
|
|
QJsonObject dat;
|
|
|
|
if(data.isObject())
|
|
|
|
dat[typeToString(type)] = data.object();
|
|
|
|
else
|
|
|
|
dat[typeToString(type)] = data.array();
|
|
|
|
|
|
|
|
doCallback("settings-update", QVariant(dat));
|
|
|
|
}
|
2019-07-14 22:43:22 +02:00
|
|
|
|
2020-08-08 13:09:15 +02:00
|
|
|
void JsonCB::handleLedsConfigChange(settings::type type, const QJsonDocument& data)
|
2019-07-20 11:28:16 +02:00
|
|
|
{
|
|
|
|
if(type == settings::LEDS)
|
|
|
|
{
|
|
|
|
QJsonObject dat;
|
|
|
|
dat[typeToString(type)] = data.array();
|
|
|
|
doCallback("leds-update", QVariant(dat));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-14 22:43:22 +02:00
|
|
|
void JsonCB::handleInstanceChange()
|
|
|
|
{
|
|
|
|
QJsonArray arr;
|
|
|
|
|
|
|
|
for(const auto & entry : HyperionIManager::getInstance()->getInstanceData())
|
|
|
|
{
|
|
|
|
QJsonObject obj;
|
|
|
|
obj.insert("friendly_name", entry["friendly_name"].toString());
|
|
|
|
obj.insert("instance", entry["instance"].toInt());
|
|
|
|
obj.insert("running", entry["running"].toBool());
|
|
|
|
arr.append(obj);
|
|
|
|
}
|
|
|
|
doCallback("instance-update", QVariant(arr));
|
|
|
|
}
|
2020-03-26 17:59:41 +01:00
|
|
|
|
|
|
|
void JsonCB::handleTokenChange(const QVector<AuthManager::AuthDefinition> &def)
|
|
|
|
{
|
|
|
|
QJsonArray arr;
|
|
|
|
for (const auto &entry : def)
|
|
|
|
{
|
|
|
|
QJsonObject sub;
|
|
|
|
sub["comment"] = entry.comment;
|
|
|
|
sub["id"] = entry.id;
|
|
|
|
sub["last_use"] = entry.lastUse;
|
|
|
|
arr.push_back(sub);
|
|
|
|
}
|
|
|
|
doCallback("token-update", QVariant(arr));
|
|
|
|
}
|