2323QJsonObject JsonInfo::getInfo (const Hyperion* hyperion, Logger* log)
2424{
2525 QJsonObject info {};
26+
2627 // Global information
2728 info[" ledDevices" ] = JsonInfo::getAvailableLedDevices ();
2829 info[" cec" ] = JsonInfo::getCecInfo ();
@@ -35,32 +36,40 @@ QJsonObject JsonInfo::getInfo(const Hyperion* hyperion, Logger* log)
3536 info[" components" ] = JsonInfo::getComponents (hyperion);
3637
3738 // Instance specific information
39+ info[" priorities" ] = JsonInfo::getPrioritiestInfo (hyperion);
40+ info[" adjustment" ] = JsonInfo::getAdjustmentInfo (hyperion, log);
41+ info[" activeLedColor" ] = JsonInfo::getActiveColors (hyperion);
42+ #if defined(ENABLE_EFFECTENGINE)
43+ info[" activeEffects" ] = JsonInfo::getActiveEffects (hyperion);
44+ #endif
3845 if (hyperion != nullptr )
3946 {
40- info[" priorities" ] = JsonInfo::getPrioritiestInfo (hyperion);
4147 info[" priorities_autoselect" ] = hyperion->sourceAutoSelectEnabled ();
42- info[" adjustment" ] = JsonInfo::getAdjustmentInfo (hyperion, log);
4348 info[" videomode" ] = QString (videoMode2String (hyperion->getCurrentVideoMode ()));
44-
45- info[" imageToLedMappingType" ] = ImageProcessor::mappingTypeToStr (hyperion->getLedMappingType ());
49+ info[" imageToLedMappingType" ] = ImageProcessor::mappingTypeToStr (0 );
4650 info[" leds" ] = hyperion->getSetting (settings::LEDS).array ();
47- info[" activeLedColor" ] = JsonInfo::getActiveColors (hyperion);
48- #if defined(ENABLE_EFFECTENGINE)
49- info[" activeEffects" ] = JsonInfo::getActiveEffects (hyperion);
50- #endif
51+ }
52+ else
53+ {
54+ info[" priorities_autoselect" ] = false ;
55+ info[" videomode" ] = QString (videoMode2String (VideoMode::VIDEO_2D));
56+ info[" imageToLedMappingType" ] = ImageProcessor::mappingTypeToStr (0 );
57+ info[" leds" ] = QJsonArray ();
5158 }
5259
5360 // BEGIN | The following entries are deprecated but used to ensure backward compatibility with hyperion Classic or up to Hyperion 2.0.16
5461 info[" hostname" ] = QHostInfo::localHostName ();
55- if (hyperion != nullptr )
56- {
57- info[" transform" ] = JsonInfo::getTransformationInfo (hyperion);
58- }
62+ info[" transform" ] = JsonInfo::getTransformationInfo (hyperion);
5963 return info;
6064}
6165
6266QJsonArray JsonInfo::getAdjustmentInfo (const Hyperion* hyperion, Logger* log)
6367{
68+ if (hyperion == nullptr )
69+ {
70+ return QJsonArray ();
71+ }
72+
6473 QJsonArray adjustmentArray;
6574 for (const QString &adjustmentId : hyperion->getAdjustmentIds ())
6675 {
@@ -136,7 +145,12 @@ QJsonArray JsonInfo::getAdjustmentInfo(const Hyperion* hyperion, Logger* log)
136145
137146QJsonArray JsonInfo::getPrioritiestInfo (const Hyperion* hyperion)
138147{
139- return getPrioritiestInfo (hyperion->getCurrentPriority (), hyperion->getPriorityInfo ());
148+ if (hyperion == nullptr )
149+ {
150+ return QJsonArray ();
151+ }
152+
153+ return getPrioritiestInfo (hyperion->getCurrentPriority (), hyperion->getPriorityInfo ());
140154}
141155
142156QJsonArray JsonInfo::getPrioritiestInfo (int currentPriority, const PriorityMuxer::InputsMap& activeInputs)
@@ -300,7 +314,7 @@ QJsonObject JsonInfo::getGrabbers(const Hyperion* hyperion)
300314{
301315 QJsonObject grabbers;
302316
303- quint8 idx {0 };
317+ quint8 idx { GLOABL_INSTANCE_ID };
304318 if (hyperion != nullptr )
305319 {
306320 idx = hyperion->getInstanceIndex ();
@@ -456,6 +470,12 @@ QJsonArray JsonInfo::getTransformationInfo(const Hyperion* hyperion)
456470{
457471 // TRANSFORM INFORMATION (DEFAULT VALUES)
458472 QJsonArray transformArray;
473+
474+ if (hyperion == nullptr )
475+ {
476+ return transformArray;
477+ }
478+
459479 for (const QString &transformId : hyperion->getAdjustmentIds ())
460480 {
461481 QJsonObject transform;
@@ -493,6 +513,12 @@ QJsonArray JsonInfo::getActiveEffects(const Hyperion* hyperion)
493513{
494514 // ACTIVE EFFECT INFO
495515 QJsonArray activeEffects;
516+
517+ if (hyperion == nullptr )
518+ {
519+ return activeEffects;
520+ }
521+
496522#if defined(ENABLE_EFFECTENGINE)
497523 for (const ActiveEffectDefinition &activeEffectDefinition : hyperion->getActiveEffects ())
498524 {
@@ -515,6 +541,12 @@ QJsonArray JsonInfo::getActiveColors(const Hyperion* hyperion)
515541{
516542 // ACTIVE STATIC LED COLOR
517543 QJsonArray activeLedColors;
544+
545+ if (hyperion == nullptr )
546+ {
547+ return activeLedColors;
548+ }
549+
518550 const Hyperion::InputInfo &priorityInfo = hyperion->getPriorityInfo (hyperion->getCurrentPriority ());
519551 if (priorityInfo.componentId == hyperion::COMP_COLOR && !priorityInfo.ledColors .empty ())
520552 {
@@ -555,7 +587,7 @@ QJsonArray JsonInfo::getActiveColors(const Hyperion* hyperion)
555587 return activeLedColors;
556588}
557589
558- QJsonObject JsonInfo::getSystemInfo (const Hyperion* hyperion )
590+ QJsonObject JsonInfo::getSystemInfo ()
559591{
560592 QJsonObject info;
561593
0 commit comments