package org.manzerbredes.open_klm.app;

import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.manzerbredes.open_klm.client.MainWindow;
import org.manzerbredes.open_klm.drivers.*;
import org.manzerbredes.open_klm.drivers.DriverTypeA.*;

/**
 * Hello world!
 *
 */
public class App 
{
	@Option(name="-leftColor",usage="Set the left color")
	public String leftColor=null;
	@Option(name="-middleColor",usage="Set the middle color")
	public String middleColor=null;
	@Option(name="-rightColor",usage="Set the right color")
	public String rightColor=null;
	
	public void parseArguments(){
		if(this.leftColor!=null || this.rightColor!=null || this.middleColor!=null){
			try {
				DriverTypeA device=new Driver_1770_ff00();
				
				if(this.leftColor==null)
					this.leftColor="OFF";
				if(this.middleColor==null)
					this.middleColor="OFF";
				if(this.rightColor==null)
					this.rightColor="OFF";
				device.setRegionColor(Region.LEFT, Color.valueOf(leftColor), Intensity.HIGH);
				device.setRegionColor(Region.MIDDLE, Color.valueOf(middleColor), Intensity.HIGH);
				device.setRegionColor(Region.RIGHT, Color.valueOf(rightColor), Intensity.HIGH);

			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			System.exit(0);
		}
		
	}
	
    public static void main( String[] args ) throws InstantiationException, CmdLineException
    {
    	 App app =new App();
    	 CmdLineParser parser = new CmdLineParser(app);
    	 parser.parseArgument(args);
    	app.parseArguments();
    	new MainWindow();
	/*	DriverTypeA device=new Driver_1770_ff00();
		Driver a=(Driver) device;
		a.initDriver();
		device.setRegionColor(Region.LEFT, Color.RED, Intensity.HIGH);
		device.setRegionColor(Region.MIDDLE, Color.ORANGE, Intensity.HIGH);
		device.setRegionColor(Region.RIGHT, Color.PURPLE, Intensity.HIGH);

		device.setMode(Mode.WAVE);*/

    }
}
