|  |  |  | @@ -52,44 +52,45 @@ int main(int argc, char * argv[]) | 
		
	
		
			
				|  |  |  |  | 		// create the option parser and initialize all parameters | 
		
	
		
			
				|  |  |  |  | 		OptionsParser optionParser("Simple application to send a command to hyperion using the Json interface"); | 
		
	
		
			
				|  |  |  |  | 		ParameterSet & parameters = optionParser.getParameters(); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argAddress    = parameters.add<StringParameter>   ('a', "address"   , QString("Set the address of the hyperion server [default: %1]").arg(defaultServerAddress).toLatin1().constData()); | 
		
	
		
			
				|  |  |  |  | 		IntParameter       & argPriority   = parameters.add<IntParameter>      ('p', "priority"  , QString("Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]").arg(defaultPriority).toLatin1().constData()); | 
		
	
		
			
				|  |  |  |  | 		IntParameter       & argDuration   = parameters.add<IntParameter>      ('d', "duration"  , "Specify how long the leds should be switched on in millseconds [default: infinity]"); | 
		
	
		
			
				|  |  |  |  | 		ColorParameter     & argColor      = parameters.add<ColorParameter>    ('c', "color"     , "Set all leds to a constant color (either RRGGBB hex value or a color name. The color may be repeated multiple time like: RRGGBBRRGGBB)"); | 
		
	
		
			
				|  |  |  |  | 		ImageParameter     & argImage      = parameters.add<ImageParameter>    ('i', "image"     , "Set the leds to the colors according to the given image file"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argEffect     = parameters.add<StringParameter>   ('e', "effect"    , "Enable the effect with the given name"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argEffectArgs = parameters.add<StringParameter>   (0x0, "effectArgs", "Arguments to use in combination with the specified effect. Should be a Json object string."); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argServerInfo = parameters.add<SwitchParameter<> >('l', "list"      , "List server info and active effects with priority and duration"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argClear      = parameters.add<SwitchParameter<> >('x', "clear"     , "Clear data for the priority channel provided by the -p option"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argClearAll   = parameters.add<SwitchParameter<> >(0x0, "clearall"  , "Clear data for all active priority channels"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argEnableComponent     = parameters.add<StringParameter>   ('E', "enable"    , "Enable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER]"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argDisableComponent     = parameters.add<StringParameter>   ('D', "disable"    , "Disable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER]"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argId         = parameters.add<StringParameter>   ('q', "qualifier" , "Identifier(qualifier) of the transform to set"); | 
		
	
		
			
				|  |  |  |  | 		DoubleParameter    & argSaturation = parameters.add<DoubleParameter>   ('s', "saturation", "!DEPRECATED! Will be removed soon! Set the HSV saturation gain of the leds"); | 
		
	
		
			
				|  |  |  |  | 		DoubleParameter    & argValue      = parameters.add<DoubleParameter>   ('v', "value"     , "!DEPRECATED! Will be removed soon! Set the HSV value gain of the leds"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argAddress     = parameters.add<StringParameter>   ('a', "address"   , QString("Set the address of the hyperion server [default: %1]").arg(defaultServerAddress).toLatin1().constData()); | 
		
	
		
			
				|  |  |  |  | 		IntParameter       & argPriority    = parameters.add<IntParameter>      ('p', "priority"  , QString("Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]").arg(defaultPriority).toLatin1().constData()); | 
		
	
		
			
				|  |  |  |  | 		IntParameter       & argDuration    = parameters.add<IntParameter>      ('d', "duration"  , "Specify how long the leds should be switched on in millseconds [default: infinity]"); | 
		
	
		
			
				|  |  |  |  | 		ColorParameter     & argColor       = parameters.add<ColorParameter>    ('c', "color"     , "Set all leds to a constant color (either RRGGBB hex value or a color name. The color may be repeated multiple time like: RRGGBBRRGGBB)"); | 
		
	
		
			
				|  |  |  |  | 		ImageParameter     & argImage       = parameters.add<ImageParameter>    ('i', "image"     , "Set the leds to the colors according to the given image file"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argEffect      = parameters.add<StringParameter>   ('e', "effect"    , "Enable the effect with the given name"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argEffectArgs  = parameters.add<StringParameter>   (0x0, "effectArgs", "Arguments to use in combination with the specified effect. Should be a Json object string."); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argServerInfo  = parameters.add<SwitchParameter<> >('l', "list"      , "List server info and active effects with priority and duration"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argClear       = parameters.add<SwitchParameter<> >('x', "clear"     , "Clear data for the priority channel provided by the -p option"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argClearAll    = parameters.add<SwitchParameter<> >(0x0, "clearall"  , "Clear data for all active priority channels"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argEnableComponent  = parameters.add<StringParameter>   ('E', "enable"    , "Enable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER]"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argDisableComponent = parameters.add<StringParameter>   ('D', "disable"    , "Disable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER]"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argId          = parameters.add<StringParameter>   ('q', "qualifier" , "Identifier(qualifier) of the transform to set"); | 
		
	
		
			
				|  |  |  |  | 		DoubleParameter    & argSaturation  = parameters.add<DoubleParameter>   ('s', "saturation", "!DEPRECATED! Will be removed soon! Set the HSV saturation gain of the leds"); | 
		
	
		
			
				|  |  |  |  | 		DoubleParameter    & argValue       = parameters.add<DoubleParameter>   ('v', "value"     , "!DEPRECATED! Will be removed soon! Set the HSV value gain of the leds"); | 
		
	
		
			
				|  |  |  |  | 		DoubleParameter    & argSaturationL = parameters.add<DoubleParameter>  ('u', "saturationL", "Set the HSL saturation gain of the leds"); | 
		
	
		
			
				|  |  |  |  | 		DoubleParameter    & argLuminance   = parameters.add<DoubleParameter>   ('m', "luminance" , "Set the HSL luminance gain of the leds"); | 
		
	
		
			
				|  |  |  |  | 		DoubleParameter    & argLuminanceMin= parameters.add<DoubleParameter>   ('n', "luminanceMin" , "Set the HSL luminance minimum of the leds (backlight)"); | 
		
	
		
			
				|  |  |  |  | 		TransformParameter & argGamma      = parameters.add<TransformParameter>('g', "gamma"     , "Set the gamma of the leds (requires 3 space seperated values)"); | 
		
	
		
			
				|  |  |  |  | 		TransformParameter & argThreshold  = parameters.add<TransformParameter>('t', "threshold" , "Set the threshold of the leds (requires 3 space seperated values between 0.0 and 1.0)"); | 
		
	
		
			
				|  |  |  |  | 		TransformParameter & argBlacklevel = parameters.add<TransformParameter>('b', "blacklevel", "!DEPRECATED! Will be removed soon! Set the blacklevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); | 
		
	
		
			
				|  |  |  |  | 		TransformParameter & argWhitelevel = parameters.add<TransformParameter>('w', "whitelevel", "!DEPRECATED! Will be removed soon! Set the whitelevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argPrint      = parameters.add<SwitchParameter<> >(0x0, "print"     , "Print the json input and output messages on stdout"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argHelp       = parameters.add<SwitchParameter<> >('h', "help"      , "Show this help message and exit"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argIdC        = parameters.add<StringParameter>   ('y', "qualifier" , "!DEPRECATED! Will be removed soon! Identifier(qualifier) of the correction to set"); | 
		
	
		
			
				|  |  |  |  | 		CorrectionParameter & argCorrection= parameters.add<CorrectionParameter>('Y', "correction" , "!DEPRECATED! Will be removed soon! Set the correction of the leds (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argIdT        = parameters.add<StringParameter>   ('z', "qualifier" , "Identifier(qualifier) of the temperature correction to set"); | 
		
	
		
			
				|  |  |  |  | 		TransformParameter & argGamma       = parameters.add<TransformParameter>('g', "gamma"     , "Set the gamma of the leds (requires 3 space seperated values)"); | 
		
	
		
			
				|  |  |  |  | 		TransformParameter & argThreshold   = parameters.add<TransformParameter>('t', "threshold" , "Set the threshold of the leds (requires 3 space seperated values between 0.0 and 1.0)"); | 
		
	
		
			
				|  |  |  |  | 		TransformParameter & argBlacklevel  = parameters.add<TransformParameter>('b', "blacklevel", "!DEPRECATED! Will be removed soon! Set the blacklevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); | 
		
	
		
			
				|  |  |  |  | 		TransformParameter & argWhitelevel  = parameters.add<TransformParameter>('w', "whitelevel", "!DEPRECATED! Will be removed soon! Set the whitelevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argPrint       = parameters.add<SwitchParameter<> >(0x0, "print"     , "Print the json input and output messages on stdout"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argHelp        = parameters.add<SwitchParameter<> >('h', "help"      , "Show this help message and exit"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argIdC         = parameters.add<StringParameter>   ('y', "qualifier" , "!DEPRECATED! Will be removed soon! Identifier(qualifier) of the correction to set"); | 
		
	
		
			
				|  |  |  |  | 		CorrectionParameter & argCorrection = parameters.add<CorrectionParameter>('Y', "correction" , "!DEPRECATED! Will be removed soon! Set the correction of the leds (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argIdT         = parameters.add<StringParameter>   ('z', "qualifier" , "Identifier(qualifier) of the temperature correction to set"); | 
		
	
		
			
				|  |  |  |  | 		CorrectionParameter & argTemperature= parameters.add<CorrectionParameter>('Z', "temperature" , "Set the temperature correction of the leds (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argIdA      = parameters.add<StringParameter>    ('j', "qualifier" , "Identifier(qualifier) of the adjustment to set"); | 
		
	
		
			
				|  |  |  |  | 		AdjustmentParameter & argRAdjust = parameters.add<AdjustmentParameter>('R', "redAdjustment" , "Set the adjustment of the red color (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		AdjustmentParameter & argGAdjust = parameters.add<AdjustmentParameter>('G', "greenAdjustment", "Set the adjustment of the green color (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		AdjustmentParameter & argBAdjust = parameters.add<AdjustmentParameter>('B', "blueAdjustment", "Set the adjustment of the blue color (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		IntParameter       & argSource   = parameters.add<IntParameter>      (0x0, "sourceSelect"  , "Set current active priority channel and deactivate auto source switching"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argSourceAuto = parameters.add<SwitchParameter<> >(0x0, "sourceAutoSelect", "Enables auto source, if disabled prio by manual selecting input source"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argSourceOff = parameters.add<SwitchParameter<> >(0x0, "sourceOff", "select no source, this results in leds activly set to black (=off)"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter    & argIdA         = parameters.add<StringParameter>    ('j', "qualifier" , "Identifier(qualifier) of the adjustment to set"); | 
		
	
		
			
				|  |  |  |  | 		AdjustmentParameter & argRAdjust    = parameters.add<AdjustmentParameter>('R', "redAdjustment" , "Set the adjustment of the red color (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		AdjustmentParameter & argGAdjust    = parameters.add<AdjustmentParameter>('G', "greenAdjustment", "Set the adjustment of the green color (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		AdjustmentParameter & argBAdjust    = parameters.add<AdjustmentParameter>('B', "blueAdjustment", "Set the adjustment of the blue color (requires 3 space seperated values between 0 and 255)"); | 
		
	
		
			
				|  |  |  |  | 		IntParameter       & argSource      = parameters.add<IntParameter>      (0x0, "sourceSelect"  , "Set current active priority channel and deactivate auto source switching"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argSourceAuto  = parameters.add<SwitchParameter<> >(0x0, "sourceAutoSelect", "Enables auto source, if disabled prio by manual selecting input source"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argSourceOff   = parameters.add<SwitchParameter<> >(0x0, "sourceOff", "select no source, this results in leds activly set to black (=off)"); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argConfigGet   = parameters.add<SwitchParameter<> >(0x0, "configGet"  , "Print the current loaded Hyperion configuration file"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter & argConfigSet = parameters.add<StringParameter>('W', "configSet", "Write to the actual loaded configuration file. Should be a Json object string."); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<> & argCreate = parameters.add<SwitchParameter<> >(0x0, "createkeys", "Create non exist Json Entry(s) in the actual loaded configuration file. Argument to use in combination with configSet."); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<>  & argSchemaGet   = parameters.add<SwitchParameter<> >(0x0, "schemaGet"  , "Print the json schema for Hyperion configuration"); | 
		
	
		
			
				|  |  |  |  | 		StringParameter & argConfigSet      = parameters.add<StringParameter>('W', "configSet", "Write to the actual loaded configuration file. Should be a Json object string."); | 
		
	
		
			
				|  |  |  |  | 		SwitchParameter<> & argCreate       = parameters.add<SwitchParameter<> >(0x0, "createkeys", "Create non exist Json Entry(s) in the actual loaded configuration file. Argument to use in combination with configSet."); | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		// set the default values | 
		
	
		
			
				|  |  |  |  | 		argAddress.setDefault(defaultServerAddress.toStdString()); | 
		
	
	
		
			
				
					
					|  |  |  | @@ -113,7 +114,12 @@ int main(int argc, char * argv[]) | 
		
	
		
			
				|  |  |  |  | 		bool colorModding = colorTransform || colorAdjust || argCorrection.isSet() || argTemperature.isSet(); | 
		
	
		
			
				|  |  |  |  | 		 | 
		
	
		
			
				|  |  |  |  | 		// check that exactly one command was given | 
		
	
		
			
				|  |  |  |  |         int commandCount = count({argColor.isSet(), argImage.isSet(), argEffect.isSet(), argServerInfo.isSet(), argClear.isSet(), argClearAll.isSet(), argEnableComponent.isSet(), argDisableComponent.isSet(), colorModding, argSource.isSet(), argSourceAuto.isSet(), argSourceOff.isSet(), argConfigGet.isSet(), argConfigSet.isSet()}); | 
		
	
		
			
				|  |  |  |  |         int commandCount = count({ | 
		
	
		
			
				|  |  |  |  | 			argColor.isSet(), argImage.isSet(), argEffect.isSet(), argServerInfo.isSet(), argClear.isSet(), argClearAll.isSet(), argEnableComponent.isSet(), | 
		
	
		
			
				|  |  |  |  | 			argDisableComponent.isSet(), colorModding, argSource.isSet(), argSourceAuto.isSet(), argSourceOff.isSet(), argSchemaGet.isSet(), argConfigGet.isSet(), | 
		
	
		
			
				|  |  |  |  | 			argConfigSet.isSet() | 
		
	
		
			
				|  |  |  |  | 		}); | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		if (commandCount != 1) | 
		
	
		
			
				|  |  |  |  | 		{ | 
		
	
		
			
				|  |  |  |  | 			std::cerr << (commandCount == 0 ? "No command found." : "Multiple commands found.") << " Provide exactly one of the following options:" << std::endl; | 
		
	
	
		
			
				
					
					|  |  |  | @@ -128,6 +134,7 @@ int main(int argc, char * argv[]) | 
		
	
		
			
				|  |  |  |  | 			std::cerr << "  " << argSource.usageLine() << std::endl; | 
		
	
		
			
				|  |  |  |  | 			std::cerr << "  " << argSourceAuto.usageLine() << std::endl; | 
		
	
		
			
				|  |  |  |  | 			std::cerr << "  " << argConfigGet.usageLine() << std::endl; | 
		
	
		
			
				|  |  |  |  | 			std::cerr << "  " << argSchemaGet.usageLine() << std::endl; | 
		
	
		
			
				|  |  |  |  | 			std::cerr << "  " << argConfigSet.usageLine() << std::endl; | 
		
	
		
			
				|  |  |  |  | 			std::cerr << "or one or more of the available color modding operations:" << std::endl; | 
		
	
		
			
				|  |  |  |  | 			std::cerr << "  " << argId.usageLine() << std::endl; | 
		
	
	
		
			
				
					
					|  |  |  | @@ -202,12 +209,17 @@ int main(int argc, char * argv[]) | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  | 		else if (argConfigGet.isSet()) | 
		
	
		
			
				|  |  |  |  | 		{ | 
		
	
		
			
				|  |  |  |  | 			QString info = connection.getConfigFile(); | 
		
	
		
			
				|  |  |  |  | 			std::cout << "Configuration File:\n" << info.toStdString() << std::endl; | 
		
	
		
			
				|  |  |  |  | 			QString info = connection.getConfig("config"); | 
		
	
		
			
				|  |  |  |  | 			std::cout << "Configuration:\n" << info.toStdString() << std::endl; | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  | 		else if (argSchemaGet.isSet()) | 
		
	
		
			
				|  |  |  |  | 		{ | 
		
	
		
			
				|  |  |  |  | 			QString info = connection.getConfig("schema"); | 
		
	
		
			
				|  |  |  |  | 			std::cout << "Configuration Schema\n" << info.toStdString() << std::endl; | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  | 		else if (argConfigSet.isSet()) | 
		
	
		
			
				|  |  |  |  | 		{ | 
		
	
		
			
				|  |  |  |  | 			connection.setConfigFile(argConfigSet.getValue(), argCreate.isSet()); | 
		
	
		
			
				|  |  |  |  | 			connection.setConfig(argConfigSet.getValue(), argCreate.isSet()); | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  | 		else if (colorModding) | 
		
	
		
			
				|  |  |  |  | 		{	 | 
		
	
	
		
			
				
					
					|  |  |  |   |