mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Updated the configuration to include all available Hyperion options.
Former-commit-id: 12765ea4e1d90b4c1f791424921fd0b921e5c2ec
This commit is contained in:
		| @@ -0,0 +1,116 @@ | |||||||
|  | package org.hyperion.hypercon.gui; | ||||||
|  |  | ||||||
|  | import java.awt.event.ActionEvent; | ||||||
|  | import java.awt.event.ActionListener; | ||||||
|  |  | ||||||
|  | import javax.swing.BorderFactory; | ||||||
|  | import javax.swing.GroupLayout; | ||||||
|  | import javax.swing.JCheckBox; | ||||||
|  | import javax.swing.JComboBox; | ||||||
|  | import javax.swing.JLabel; | ||||||
|  | import javax.swing.JPanel; | ||||||
|  | import javax.swing.JSpinner; | ||||||
|  | import javax.swing.SpinnerNumberModel; | ||||||
|  | import javax.swing.event.ChangeEvent; | ||||||
|  | import javax.swing.event.ChangeListener; | ||||||
|  |  | ||||||
|  | import org.hyperion.hypercon.spec.BootSequence; | ||||||
|  | import org.hyperion.hypercon.spec.MiscConfig; | ||||||
|  |  | ||||||
|  | public class BootSequencePanel extends JPanel { | ||||||
|  |  | ||||||
|  | 	private final MiscConfig mMiscConfig; | ||||||
|  |  | ||||||
|  | 	private JCheckBox mBootSequenceCheck; | ||||||
|  | 	private JLabel mBootSequenceLabel; | ||||||
|  | 	private JComboBox<BootSequence> mBootSequenceCombo; | ||||||
|  | 	private JLabel mBootSequenceLengthLabel; | ||||||
|  | 	private JSpinner mBootSequenceLengthSpinner; | ||||||
|  | 	 | ||||||
|  | 	public BootSequencePanel(final MiscConfig pMiscconfig) { | ||||||
|  | 		super(); | ||||||
|  | 		 | ||||||
|  | 		mMiscConfig = pMiscconfig; | ||||||
|  | 		 | ||||||
|  | 		initialise(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void initialise() { | ||||||
|  | 		setBorder(BorderFactory.createTitledBorder("Boot Sequence")); | ||||||
|  | 		 | ||||||
|  | 		mBootSequenceCheck = new JCheckBox("Enabled"); | ||||||
|  | 		mBootSequenceCheck.setSelected(mMiscConfig.mBootsequenceEnabled); | ||||||
|  | 		mBootSequenceCheck.addActionListener(mActionListener); | ||||||
|  | 		add(mBootSequenceCheck); | ||||||
|  | 		 | ||||||
|  | 		mBootSequenceLabel = new JLabel("Type:"); | ||||||
|  | 		mBootSequenceLabel.setEnabled(mMiscConfig.mBootsequenceEnabled); | ||||||
|  | 		add(mBootSequenceLabel); | ||||||
|  | 		 | ||||||
|  | 		mBootSequenceCombo = new JComboBox<>(BootSequence.values()); | ||||||
|  | 		mBootSequenceCombo.setSelectedItem(mMiscConfig.mBootSequence); | ||||||
|  | 		mBootSequenceCombo.setToolTipText("The sequence used on startup to verify proper working of all the leds"); | ||||||
|  | 		mBootSequenceCombo.addActionListener(mActionListener); | ||||||
|  | 		add(mBootSequenceCombo); | ||||||
|  | 		 | ||||||
|  | 		mBootSequenceLengthLabel = new JLabel("Length [ms]"); | ||||||
|  | 		add(mBootSequenceLengthLabel); | ||||||
|  | 		 | ||||||
|  | 		mBootSequenceLengthSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mBootSequenceLength_ms, 500, 3600000, 1000)); | ||||||
|  | 		mBootSequenceLengthSpinner.addChangeListener(mChangeListener); | ||||||
|  | 		add(mBootSequenceLengthSpinner); | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
|  | 		GroupLayout layout = new GroupLayout(this); | ||||||
|  | 		layout.setAutoCreateGaps(true); | ||||||
|  | 		setLayout(layout); | ||||||
|  | 		 | ||||||
|  | 		layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mBootSequenceCheck) | ||||||
|  | 						.addComponent(mBootSequenceLabel) | ||||||
|  | 						.addComponent(mBootSequenceLengthLabel) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mBootSequenceCheck) | ||||||
|  | 						.addComponent(mBootSequenceCombo) | ||||||
|  | 						.addComponent(mBootSequenceLengthSpinner) | ||||||
|  | 						)); | ||||||
|  | 		layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addComponent(mBootSequenceCheck) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mBootSequenceLabel) | ||||||
|  | 						.addComponent(mBootSequenceCombo) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mBootSequenceLengthLabel) | ||||||
|  | 						.addComponent(mBootSequenceLengthSpinner) | ||||||
|  | 						)); | ||||||
|  | 		 | ||||||
|  | 		toggleEnabled(mMiscConfig.mBootsequenceEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void toggleEnabled(boolean pEnabled) { | ||||||
|  | 		mBootSequenceLabel.setEnabled(pEnabled); | ||||||
|  | 		mBootSequenceCombo.setEnabled(pEnabled); | ||||||
|  | 		mBootSequenceLengthLabel.setEnabled(pEnabled); | ||||||
|  | 		mBootSequenceLengthSpinner.setEnabled(pEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private final ActionListener mActionListener = new ActionListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void actionPerformed(ActionEvent e) { | ||||||
|  | 			mMiscConfig.mBootsequenceEnabled = mBootSequenceCheck.isSelected(); | ||||||
|  | 			mMiscConfig.mBootSequence = (BootSequence) mBootSequenceCombo.getSelectedItem(); | ||||||
|  | 			 | ||||||
|  | 			toggleEnabled(mMiscConfig.mBootsequenceEnabled); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
|  | 	private final ChangeListener mChangeListener = new ChangeListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void stateChanged(ChangeEvent e) { | ||||||
|  | 			mMiscConfig.mBootSequenceLength_ms = (Integer)mBootSequenceLengthSpinner.getValue(); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | } | ||||||
| @@ -1,6 +1,9 @@ | |||||||
| package org.hyperion.hypercon.gui; | package org.hyperion.hypercon.gui; | ||||||
| 
 | 
 | ||||||
|  | import java.awt.GridLayout; | ||||||
|  | 
 | ||||||
| import javax.swing.BorderFactory; | import javax.swing.BorderFactory; | ||||||
|  | import javax.swing.Box; | ||||||
| import javax.swing.BoxLayout; | import javax.swing.BoxLayout; | ||||||
| import javax.swing.GroupLayout; | import javax.swing.GroupLayout; | ||||||
| import javax.swing.JLabel; | import javax.swing.JLabel; | ||||||
| @@ -17,7 +20,7 @@ import org.hyperion.hypercon.spec.ColorConfig; | |||||||
|  *   |  *   | ||||||
|  * NB This has not been integrated in the GUI jet! |  * NB This has not been integrated in the GUI jet! | ||||||
|  */ |  */ | ||||||
| public class ColorConfigPanel extends JPanel { | public class ColorPanel extends JPanel { | ||||||
| 	 | 	 | ||||||
| 	private final ColorConfig mColorConfig; | 	private final ColorConfig mColorConfig; | ||||||
| 	 | 	 | ||||||
| @@ -47,8 +50,8 @@ public class ColorConfigPanel extends JPanel { | |||||||
| 	private JSpinner mSaturationAdjustSpinner; | 	private JSpinner mSaturationAdjustSpinner; | ||||||
| 	private JLabel mValueAdjustLabel; | 	private JLabel mValueAdjustLabel; | ||||||
| 	private JSpinner mValueAdjustSpinner; | 	private JSpinner mValueAdjustSpinner; | ||||||
| 
 | 	 | ||||||
| 	public ColorConfigPanel(ColorConfig pColorConfig) { | 	public ColorPanel(ColorConfig pColorConfig) { | ||||||
| 		super(); | 		super(); | ||||||
| 		 | 		 | ||||||
| 		mColorConfig = pColorConfig; | 		mColorConfig = pColorConfig; | ||||||
| @@ -57,6 +60,7 @@ public class ColorConfigPanel extends JPanel { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private void initialise() { | 	private void initialise() { | ||||||
|  | 		setBorder(BorderFactory.createTitledBorder("Color transform")); | ||||||
| 		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); | 		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); | ||||||
| 		 | 		 | ||||||
| 		add(getRgbPanel()); | 		add(getRgbPanel()); | ||||||
| @@ -67,19 +71,22 @@ public class ColorConfigPanel extends JPanel { | |||||||
| 		if (mRgbTransformPanel == null) { | 		if (mRgbTransformPanel == null) { | ||||||
| 			mRgbTransformPanel = new JPanel(); | 			mRgbTransformPanel = new JPanel(); | ||||||
| 			 | 			 | ||||||
| 			GroupLayout layout = new GroupLayout(mRgbTransformPanel); | 			GridLayout layout = new GridLayout(0, 5); | ||||||
|  | //			GroupLayout layout = new GroupLayout(mRgbTransformPanel); | ||||||
| 			mRgbTransformPanel.setLayout(layout); | 			mRgbTransformPanel.setLayout(layout); | ||||||
| 			 | 			 | ||||||
| 			mThresholdLabel = new JLabel("Thresold"); | 			mRgbTransformPanel.add(Box.createHorizontalBox()); | ||||||
|  | 			 | ||||||
|  | 			mThresholdLabel = new JLabel("Thres."); | ||||||
| 			mRgbTransformPanel.add(mThresholdLabel); | 			mRgbTransformPanel.add(mThresholdLabel); | ||||||
| 			 | 			 | ||||||
| 			mGammaLabel = new JLabel("Gamma"); | 			mGammaLabel = new JLabel("Gamma"); | ||||||
| 			mRgbTransformPanel.add(mGammaLabel); | 			mRgbTransformPanel.add(mGammaLabel); | ||||||
| 			 | 			 | ||||||
| 			mBlacklevelLabel = new JLabel("Blacklevel"); | 			mBlacklevelLabel = new JLabel("Blacklvl"); | ||||||
| 			mRgbTransformPanel.add(mBlacklevelLabel); | 			mRgbTransformPanel.add(mBlacklevelLabel); | ||||||
| 			 | 			 | ||||||
| 			mWhitelevelLabel = new JLabel("Whitelevel"); | 			mWhitelevelLabel = new JLabel("Whitelvl"); | ||||||
| 			mRgbTransformPanel.add(mWhitelevelLabel); | 			mRgbTransformPanel.add(mWhitelevelLabel); | ||||||
| 			 | 			 | ||||||
| 			mRedTransformLabel = new JLabel("RED"); | 			mRedTransformLabel = new JLabel("RED"); | ||||||
| @@ -126,63 +133,6 @@ public class ColorConfigPanel extends JPanel { | |||||||
| 			mBlueWhitelevelSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mBlueWhitelevel, 0.0, 1.0, 0.1)); | 			mBlueWhitelevelSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mBlueWhitelevel, 0.0, 1.0, 0.1)); | ||||||
| 			mBlueWhitelevelSpinner.addChangeListener(mChangeListener); | 			mBlueWhitelevelSpinner.addChangeListener(mChangeListener); | ||||||
| 			mRgbTransformPanel.add(mBlueWhitelevelSpinner); | 			mRgbTransformPanel.add(mBlueWhitelevelSpinner); | ||||||
| 			 |  | ||||||
| 			layout.setHorizontalGroup(layout.createSequentialGroup() |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mRedTransformLabel) |  | ||||||
| 							.addComponent(mGreenTransformLabel) |  | ||||||
| 							.addComponent(mBlueTransformLabel)) |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mThresholdLabel) |  | ||||||
| 							.addComponent(mRedThresholdSpinner) |  | ||||||
| 							.addComponent(mGreenThresholdSpinner) |  | ||||||
| 							.addComponent(mBlueThresholdSpinner)) |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mGammaLabel) |  | ||||||
| 							.addComponent(mRedGammaSpinner) |  | ||||||
| 							.addComponent(mGreenGammaSpinner) |  | ||||||
| 							.addComponent(mBlueGammaSpinner) |  | ||||||
| 							) |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mBlacklevelLabel) |  | ||||||
| 							.addComponent(mRedBlacklevelSpinner) |  | ||||||
| 							.addComponent(mGreenBlacklevelSpinner) |  | ||||||
| 							.addComponent(mBlueBlacklevelSpinner) |  | ||||||
| 							) |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mWhitelevelLabel) |  | ||||||
| 							.addComponent(mRedWhitelevelSpinner) |  | ||||||
| 							.addComponent(mGreenWhitelevelSpinner) |  | ||||||
| 							.addComponent(mBlueWhitelevelSpinner) |  | ||||||
| 							)); |  | ||||||
| 			 |  | ||||||
| 			layout.setVerticalGroup(layout.createSequentialGroup() |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mThresholdLabel) |  | ||||||
| 							.addComponent(mGammaLabel) |  | ||||||
| 							.addComponent(mBlacklevelLabel) |  | ||||||
| 							.addComponent(mWhitelevelLabel)) |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mRedTransformLabel) |  | ||||||
| 							.addComponent(mRedThresholdSpinner) |  | ||||||
| 							.addComponent(mRedGammaSpinner) |  | ||||||
| 							.addComponent(mRedBlacklevelSpinner) |  | ||||||
| 							.addComponent(mRedWhitelevelSpinner) |  | ||||||
| 							) |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mGreenTransformLabel) |  | ||||||
| 							.addComponent(mGreenThresholdSpinner) |  | ||||||
| 							.addComponent(mGreenGammaSpinner) |  | ||||||
| 							.addComponent(mGreenBlacklevelSpinner) |  | ||||||
| 							.addComponent(mGreenWhitelevelSpinner) |  | ||||||
| 							) |  | ||||||
| 					.addGroup(layout.createParallelGroup() |  | ||||||
| 							.addComponent(mBlueTransformLabel) |  | ||||||
| 							.addComponent(mBlueThresholdSpinner) |  | ||||||
| 							.addComponent(mBlueGammaSpinner) |  | ||||||
| 							.addComponent(mBlueBlacklevelSpinner) |  | ||||||
| 							.addComponent(mBlueWhitelevelSpinner) |  | ||||||
| 							)); |  | ||||||
| 		} | 		} | ||||||
| 		return mRgbTransformPanel; | 		return mRgbTransformPanel; | ||||||
| 	} | 	} | ||||||
| @@ -0,0 +1,131 @@ | |||||||
|  | package org.hyperion.hypercon.gui; | ||||||
|  |  | ||||||
|  | import java.awt.event.ActionEvent; | ||||||
|  | import java.awt.event.ActionListener; | ||||||
|  |  | ||||||
|  | import javax.swing.BorderFactory; | ||||||
|  | import javax.swing.GroupLayout; | ||||||
|  | import javax.swing.JCheckBox; | ||||||
|  | import javax.swing.JComboBox; | ||||||
|  | import javax.swing.JLabel; | ||||||
|  | import javax.swing.JPanel; | ||||||
|  | import javax.swing.JSpinner; | ||||||
|  | import javax.swing.SpinnerNumberModel; | ||||||
|  | import javax.swing.event.ChangeEvent; | ||||||
|  | import javax.swing.event.ChangeListener; | ||||||
|  |  | ||||||
|  | import org.hyperion.hypercon.spec.ColorConfig; | ||||||
|  | import org.hyperion.hypercon.spec.ColorSmoothingType; | ||||||
|  |  | ||||||
|  | public class ColorSmoothingPanel extends JPanel { | ||||||
|  |  | ||||||
|  | 	private final ColorConfig mColorConfig; | ||||||
|  |  | ||||||
|  | 	private JCheckBox mEnabledCheck; | ||||||
|  | 	private JLabel mTypeLabel; | ||||||
|  | 	private JComboBox<ColorSmoothingType> mTypeCombo; | ||||||
|  | 	private JLabel mTimeLabel; | ||||||
|  | 	private JSpinner mTimeSpinner; | ||||||
|  | 	private JLabel mUpdateFrequencyLabel; | ||||||
|  | 	private JSpinner mUpdateFrequencySpinner; | ||||||
|  |  | ||||||
|  | 	public ColorSmoothingPanel(final ColorConfig pColorConfig) { | ||||||
|  | 		super(); | ||||||
|  | 		 | ||||||
|  | 		mColorConfig = pColorConfig; | ||||||
|  | 		 | ||||||
|  | 		initialise(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void initialise() { | ||||||
|  | 		setBorder(BorderFactory.createTitledBorder("Smoothing")); | ||||||
|  | 		 | ||||||
|  | 		mEnabledCheck = new JCheckBox("Enabled"); | ||||||
|  | 		mEnabledCheck.setSelected(mColorConfig.mSmoothingEnabled); | ||||||
|  | 		mEnabledCheck.addActionListener(mActionListener); | ||||||
|  | 		add(mEnabledCheck); | ||||||
|  | 		 | ||||||
|  | 		mTypeLabel = new JLabel("Type: "); | ||||||
|  | 		add(mTypeLabel); | ||||||
|  | 		 | ||||||
|  | 		mTypeCombo = new JComboBox<>(ColorSmoothingType.values()); | ||||||
|  | 		mTypeCombo.setSelectedItem(mColorConfig.mSmoothingType); | ||||||
|  | 		mTypeCombo.addActionListener(mActionListener); | ||||||
|  | 		add(mTypeCombo); | ||||||
|  | 		 | ||||||
|  | 		mTimeLabel = new JLabel("Time [ms]: "); | ||||||
|  | 		add(mTimeLabel); | ||||||
|  | 		 | ||||||
|  | 		mTimeSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mSmoothingTime_ms, 1, 600, 100)); | ||||||
|  | 		mTimeSpinner.addChangeListener(mChangeListener); | ||||||
|  | 		add(mTimeSpinner); | ||||||
|  | 		 | ||||||
|  | 		mUpdateFrequencyLabel = new JLabel("Update Freq. [Hz]: "); | ||||||
|  | 		add(mUpdateFrequencyLabel); | ||||||
|  | 		 | ||||||
|  | 		mUpdateFrequencySpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mSmoothingUpdateFrequency_Hz, 1, 100, 1)); | ||||||
|  | 		mUpdateFrequencySpinner.addChangeListener(mChangeListener); | ||||||
|  | 		add(mUpdateFrequencySpinner); | ||||||
|  |  | ||||||
|  | 		GroupLayout layout = new GroupLayout(this); | ||||||
|  | 		layout.setAutoCreateGaps(true); | ||||||
|  | 		setLayout(layout); | ||||||
|  | 		 | ||||||
|  | 		layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mEnabledCheck) | ||||||
|  | 						.addComponent(mTypeLabel) | ||||||
|  | 						.addComponent(mTimeLabel) | ||||||
|  | 						.addComponent(mUpdateFrequencyLabel) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mEnabledCheck) | ||||||
|  | 						.addComponent(mTypeCombo) | ||||||
|  | 						.addComponent(mTimeSpinner) | ||||||
|  | 						.addComponent(mUpdateFrequencySpinner) | ||||||
|  | 						)); | ||||||
|  | 		layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addComponent(mEnabledCheck) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mTypeLabel) | ||||||
|  | 						.addComponent(mTypeCombo) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mTimeLabel) | ||||||
|  | 						.addComponent(mTimeSpinner) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mUpdateFrequencyLabel) | ||||||
|  | 						.addComponent(mUpdateFrequencySpinner) | ||||||
|  | 						)); | ||||||
|  | 		 | ||||||
|  | 		toggleEnabled(mColorConfig.mSmoothingEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void toggleEnabled(boolean pEnabled) { | ||||||
|  | 		mTypeLabel.setEnabled(pEnabled); | ||||||
|  | 		mTypeCombo.setEnabled(pEnabled); | ||||||
|  | 		mTimeLabel.setEnabled(pEnabled); | ||||||
|  | 		mTimeSpinner.setEnabled(pEnabled); | ||||||
|  | 		mUpdateFrequencyLabel.setEnabled(pEnabled); | ||||||
|  | 		mUpdateFrequencySpinner.setEnabled(pEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private final ActionListener mActionListener = new ActionListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void actionPerformed(ActionEvent e) { | ||||||
|  | 			mColorConfig.mSmoothingEnabled = mEnabledCheck.isSelected(); | ||||||
|  | 			mColorConfig.mSmoothingType = (ColorSmoothingType)mTypeCombo.getSelectedItem(); | ||||||
|  | 			 | ||||||
|  | 			toggleEnabled(mColorConfig.mSmoothingEnabled); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
|  | 	private final ChangeListener mChangeListener = new ChangeListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void stateChanged(ChangeEvent e) { | ||||||
|  | 			mColorConfig.mSmoothingTime_ms = (Integer)mTimeSpinner.getValue(); | ||||||
|  | 			mColorConfig.mSmoothingUpdateFrequency_Hz = (Integer)mUpdateFrequencySpinner.getValue(); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | } | ||||||
| @@ -1,6 +1,7 @@ | |||||||
| package org.hyperion.hypercon.gui; | package org.hyperion.hypercon.gui; | ||||||
|  |  | ||||||
| import java.awt.BorderLayout; | import java.awt.BorderLayout; | ||||||
|  | import java.awt.Dimension; | ||||||
| import java.awt.event.ActionEvent; | import java.awt.event.ActionEvent; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.Observable; | import java.util.Observable; | ||||||
| @@ -9,10 +10,12 @@ import java.util.Observer; | |||||||
| import javax.swing.AbstractAction; | import javax.swing.AbstractAction; | ||||||
| import javax.swing.Action; | import javax.swing.Action; | ||||||
| import javax.swing.BorderFactory; | import javax.swing.BorderFactory; | ||||||
|  | import javax.swing.Box; | ||||||
| import javax.swing.BoxLayout; | import javax.swing.BoxLayout; | ||||||
| import javax.swing.JButton; | import javax.swing.JButton; | ||||||
| import javax.swing.JFileChooser; | import javax.swing.JFileChooser; | ||||||
| import javax.swing.JPanel; | import javax.swing.JPanel; | ||||||
|  | import javax.swing.JTabbedPane; | ||||||
|  |  | ||||||
| import org.hyperion.hypercon.ConfigurationFile; | import org.hyperion.hypercon.ConfigurationFile; | ||||||
| import org.hyperion.hypercon.LedFrameFactory; | import org.hyperion.hypercon.LedFrameFactory; | ||||||
| @@ -59,18 +62,13 @@ public class ConfigPanel extends JPanel { | |||||||
| 	/** The simulated 'Hyperion TV' */ | 	/** The simulated 'Hyperion TV' */ | ||||||
| 	private JHyperionTv mHyperionTv; | 	private JHyperionTv mHyperionTv; | ||||||
| 	 | 	 | ||||||
|  | 	private JTabbedPane mSpecificationTabs = null; | ||||||
| 	/** The left (WEST) side panel containing the diferent configuration panels */ | 	/** The left (WEST) side panel containing the diferent configuration panels */ | ||||||
| 	private JPanel mSpecificationPanel; | 	private JPanel mHardwarePanel = null; | ||||||
| 	 | 	private JPanel mProcessPanel = null; | ||||||
| 	/** The panel for specifying the construction of the LED-Frame */ | 	private JPanel mExternalPanel = null; | ||||||
| 	private JPanel mConstructionPanel; |  | ||||||
| 	 |  | ||||||
| 	/** The panel for specifying the image integration */ |  | ||||||
| 	private JPanel mIntegrationPanel; |  | ||||||
| 	 |  | ||||||
| 	/** The panel for specifying the miscallenuous configuration */ |  | ||||||
| 	private MiscConfigPanel mMiscPanel; |  | ||||||
| 	 |  | ||||||
| 	/** The button connected to mSaveConfigAction */ | 	/** The button connected to mSaveConfigAction */ | ||||||
| 	private JButton mSaveConfigButton; | 	private JButton mSaveConfigButton; | ||||||
| 	 | 	 | ||||||
| @@ -108,9 +106,34 @@ public class ConfigPanel extends JPanel { | |||||||
| 		setLayout(new BorderLayout()); | 		setLayout(new BorderLayout()); | ||||||
| 		 | 		 | ||||||
| 		add(getTvPanel(), BorderLayout.CENTER); | 		add(getTvPanel(), BorderLayout.CENTER); | ||||||
| 		add(getSpecificationPanel(), BorderLayout.WEST); | 		add(getWestPanel(), BorderLayout.WEST); | ||||||
| 		 | 		 | ||||||
| 	} | 	} | ||||||
|  | 	private JPanel getWestPanel() { | ||||||
|  | 		JPanel mWestPanel = new JPanel(); | ||||||
|  | 		mWestPanel.setLayout(new BorderLayout()); | ||||||
|  | 		 | ||||||
|  | 		mWestPanel.add(getSpecificationTabs(), BorderLayout.CENTER); | ||||||
|  | 		 | ||||||
|  | 		JPanel panel = new JPanel(new BorderLayout()); | ||||||
|  | 		panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); | ||||||
|  | 		mSaveConfigButton = new JButton(mSaveConfigAction); | ||||||
|  | 		panel.add(mSaveConfigButton, BorderLayout.SOUTH); | ||||||
|  | 		mWestPanel.add(panel, BorderLayout.SOUTH); | ||||||
|  |  | ||||||
|  | 		return mWestPanel; | ||||||
|  | 	} | ||||||
|  | 	private JTabbedPane getSpecificationTabs() { | ||||||
|  | 		if (mSpecificationTabs == null) { | ||||||
|  | 			mSpecificationTabs = new JTabbedPane(); | ||||||
|  | 			mSpecificationTabs.setPreferredSize(new Dimension(300,150)); | ||||||
|  | 			 | ||||||
|  | 			mSpecificationTabs.addTab("Hardware", getHardwarePanel()); | ||||||
|  | 			mSpecificationTabs.addTab("Process", getProcessPanel()); | ||||||
|  | 			mSpecificationTabs.addTab("External", getExternalPanel()); | ||||||
|  | 		} | ||||||
|  | 		return mSpecificationTabs; | ||||||
|  | 	} | ||||||
| 	 | 	 | ||||||
| 	/** | 	/** | ||||||
| 	 * Created, if not exists, and returns the panel holding the simulated 'Hyperion TV' | 	 * Created, if not exists, and returns the panel holding the simulated 'Hyperion TV' | ||||||
| @@ -128,29 +151,43 @@ public class ConfigPanel extends JPanel { | |||||||
| 		return mTvPanel; | 		return mTvPanel; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private JPanel getSpecificationPanel() { | 	private JPanel getHardwarePanel() { | ||||||
| 		if (mSpecificationPanel == null) { | 		if (mHardwarePanel == null) { | ||||||
| 			mSpecificationPanel = new JPanel(); | 			mHardwarePanel = new JPanel(); | ||||||
| 			mSpecificationPanel.setLayout(new BoxLayout(mSpecificationPanel, BoxLayout.Y_AXIS)); | 			mHardwarePanel.setLayout(new BoxLayout(mHardwarePanel, BoxLayout.Y_AXIS)); | ||||||
| 			 | 			 | ||||||
| 			mConstructionPanel = new LedFramePanel(ledString.mDeviceConfig, ledString.mLedFrameConfig); | 			mHardwarePanel.add(new DevicePanel(ledString.mDeviceConfig)); | ||||||
| 			mConstructionPanel.setBorder(BorderFactory.createTitledBorder("Construction")); | 			mHardwarePanel.add(new LedFramePanel(ledString.mLedFrameConfig)); | ||||||
| 			mSpecificationPanel.add(mConstructionPanel); | 			mHardwarePanel.add(new ImageProcessPanel(ledString.mProcessConfig)); | ||||||
|  |  | ||||||
| 			mIntegrationPanel = new ImageProcessPanel(ledString.mProcessConfig); | 			mHardwarePanel.add(Box.createVerticalGlue()); | ||||||
| 			mIntegrationPanel.setBorder(BorderFactory.createTitledBorder("Image Process")); |  | ||||||
| 			mSpecificationPanel.add(mIntegrationPanel); |  | ||||||
| 			 |  | ||||||
| 			mMiscPanel = new MiscConfigPanel(ledString.mMiscConfig); |  | ||||||
| 			mMiscPanel.setBorder(BorderFactory.createTitledBorder("Misc")); |  | ||||||
| 			mSpecificationPanel.add(mMiscPanel); |  | ||||||
| 			 |  | ||||||
| 			JPanel panel = new JPanel(new BorderLayout()); |  | ||||||
| 			panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); |  | ||||||
| 			mSaveConfigButton = new JButton(mSaveConfigAction); |  | ||||||
| 			panel.add(mSaveConfigButton, BorderLayout.SOUTH); |  | ||||||
| 			mSpecificationPanel.add(panel); |  | ||||||
| 		} | 		} | ||||||
| 		return mSpecificationPanel; | 		return mHardwarePanel; | ||||||
|  | 	} | ||||||
|  | 	private JPanel getProcessPanel() { | ||||||
|  | 		if (mProcessPanel == null) { | ||||||
|  | 			mProcessPanel = new JPanel(); | ||||||
|  |  | ||||||
|  | 			mProcessPanel.setLayout(new BoxLayout(mProcessPanel, BoxLayout.Y_AXIS)); | ||||||
|  | 			 | ||||||
|  | 			mProcessPanel.add(new BootSequencePanel(ledString.mMiscConfig)); | ||||||
|  | 			mProcessPanel.add(new FrameGrabberPanel(ledString.mMiscConfig)); | ||||||
|  | 			mProcessPanel.add(new ColorSmoothingPanel(ledString.mColorConfig)); | ||||||
|  | 			mProcessPanel.add(new ColorPanel(ledString.mColorConfig)); | ||||||
|  | 		} | ||||||
|  | 		return mProcessPanel; | ||||||
|  | 	} | ||||||
|  | 	private JPanel getExternalPanel() { | ||||||
|  | 		if (mExternalPanel == null) { | ||||||
|  | 			mExternalPanel = new JPanel(); | ||||||
|  |  | ||||||
|  | 			mExternalPanel.setLayout(new BoxLayout(mExternalPanel, BoxLayout.Y_AXIS)); | ||||||
|  | 			 | ||||||
|  | 			mExternalPanel.add(new XbmcPanel(ledString.mMiscConfig)); | ||||||
|  | 			mExternalPanel.add(new InterfacePanel(ledString.mMiscConfig)); | ||||||
|  | 			 | ||||||
|  | 			mExternalPanel.add(Box.createVerticalGlue()); | ||||||
|  | 		} | ||||||
|  | 		return mExternalPanel; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,22 +3,35 @@ package org.hyperion.hypercon.gui; | |||||||
| import java.awt.event.ActionEvent; | import java.awt.event.ActionEvent; | ||||||
| import java.awt.event.ActionListener; | import java.awt.event.ActionListener; | ||||||
|  |  | ||||||
|  | import javax.swing.BorderFactory; | ||||||
|  | import javax.swing.GroupLayout; | ||||||
| import javax.swing.JComboBox; | import javax.swing.JComboBox; | ||||||
| import javax.swing.JLabel; | import javax.swing.JLabel; | ||||||
| import javax.swing.JPanel; | import javax.swing.JPanel; | ||||||
|  | import javax.swing.JSpinner; | ||||||
|  | import javax.swing.SpinnerNumberModel; | ||||||
|  | import javax.swing.event.ChangeEvent; | ||||||
|  | import javax.swing.event.ChangeListener; | ||||||
|  |  | ||||||
| import org.hyperion.hypercon.spec.ColorByteOrder; | import org.hyperion.hypercon.spec.ColorByteOrder; | ||||||
| import org.hyperion.hypercon.spec.DeviceConfig; | import org.hyperion.hypercon.spec.DeviceConfig; | ||||||
|  | import org.hyperion.hypercon.spec.DeviceType; | ||||||
|  |  | ||||||
| public class DevicePanel extends JPanel { | public class DevicePanel extends JPanel { | ||||||
| 	 |  | ||||||
|  | 	public static final String[] KnownOutputs = {"/dev/spidev0.0", "/dev/spidev0.1", "/dev/ttyS0", "/dev/ttyUSB0", "/dev/ttyprintk", "/home/pi/test.out", "/dev/null"}; | ||||||
|  |  | ||||||
| 	private final DeviceConfig mDeviceConfig; | 	private final DeviceConfig mDeviceConfig; | ||||||
| 	 | 	 | ||||||
|  | 	 | ||||||
|  | 	private JLabel mTypeLabel; | ||||||
|  | 	private JComboBox<DeviceType> mTypeCombo; | ||||||
|  |  | ||||||
| 	private JLabel mOutputLabel; | 	private JLabel mOutputLabel; | ||||||
| 	private JComboBox<String> mOutputCombo; | 	private JComboBox<String> mOutputCombo; | ||||||
| 	 | 	 | ||||||
| 	private JLabel mBaudrateLabel; | 	private JLabel mBaudrateLabel; | ||||||
| 	private JComboBox<Integer> mBaudrateCombo; | 	private JSpinner mBaudrateSpinner; | ||||||
| 	 | 	 | ||||||
| 	private JLabel mRgbLabel; | 	private JLabel mRgbLabel; | ||||||
| 	private JComboBox<ColorByteOrder> mRgbCombo; | 	private JComboBox<ColorByteOrder> mRgbCombo; | ||||||
| @@ -32,22 +45,31 @@ public class DevicePanel extends JPanel { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private void initialise() { | 	private void initialise() { | ||||||
|  | 		setBorder(BorderFactory.createTitledBorder("Device")); | ||||||
|  | 		 | ||||||
| 		mOutputLabel = new JLabel("Output"); | 		mOutputLabel = new JLabel("Output"); | ||||||
| 		add(mOutputLabel); | 		add(mOutputLabel); | ||||||
| 		 | 		 | ||||||
| 		mOutputCombo = new JComboBox<>(new String[] {"/dev/spidev0.0", " /dev/ttyUSB0", "/home/pi/test-output.txt", "/dev/null" }); | 		mOutputCombo = new JComboBox<>(KnownOutputs); | ||||||
| 		mOutputCombo.setEditable(true); | 		mOutputCombo.setEditable(true); | ||||||
| 		mOutputCombo.setSelectedItem(mDeviceConfig.mOutput); | 		mOutputCombo.setSelectedItem(mDeviceConfig.mOutput); | ||||||
| 		mOutputCombo.addActionListener(mActionListener); | 		mOutputCombo.addActionListener(mActionListener); | ||||||
| 		add(mOutputCombo); | 		add(mOutputCombo); | ||||||
| 		 | 		 | ||||||
|  | 		mTypeLabel = new JLabel("LED Type:"); | ||||||
|  | 		add(mTypeLabel); | ||||||
|  | 		 | ||||||
|  | 		mTypeCombo = new JComboBox<>(DeviceType.values()); | ||||||
|  | 		mTypeCombo.setSelectedItem(mDeviceConfig.mType); | ||||||
|  | 		mTypeCombo.addActionListener(mActionListener); | ||||||
|  | 		add(mTypeCombo); | ||||||
|  |  | ||||||
| 		mBaudrateLabel = new JLabel("Baudrate"); | 		mBaudrateLabel = new JLabel("Baudrate"); | ||||||
| 		add(mBaudrateLabel); | 		add(mBaudrateLabel); | ||||||
| 		 | 		 | ||||||
| 		mBaudrateCombo = new JComboBox<>(); | 		mBaudrateSpinner = new JSpinner(new SpinnerNumberModel(mDeviceConfig.mBaudrate, 1, 1000000, 128)); | ||||||
| 		mRgbCombo.setSelectedItem(mDeviceConfig.mBaudrate); | 		mBaudrateSpinner.addChangeListener(mChangeListener); | ||||||
| 		mRgbCombo.addActionListener(mActionListener); | 		add(mBaudrateSpinner); | ||||||
| 		add(mBaudrateCombo); |  | ||||||
| 	 | 	 | ||||||
| 		mRgbLabel = new JLabel("RGB Byte Order"); | 		mRgbLabel = new JLabel("RGB Byte Order"); | ||||||
| 		add(mRgbLabel); | 		add(mRgbLabel); | ||||||
| @@ -56,14 +78,53 @@ public class DevicePanel extends JPanel { | |||||||
| 		mRgbCombo.setSelectedItem(mDeviceConfig.mColorByteOrder); | 		mRgbCombo.setSelectedItem(mDeviceConfig.mColorByteOrder); | ||||||
| 		mRgbCombo.addActionListener(mActionListener); | 		mRgbCombo.addActionListener(mActionListener); | ||||||
| 		add(mRgbCombo); | 		add(mRgbCombo); | ||||||
|  | 		 | ||||||
|  |  | ||||||
|  | 		GroupLayout layout = new GroupLayout(this); | ||||||
|  | 		layout.setAutoCreateGaps(true); | ||||||
|  | 		setLayout(layout); | ||||||
|  | 		 | ||||||
|  | 		layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mOutputLabel) | ||||||
|  | 						.addComponent(mTypeLabel) | ||||||
|  | 						.addComponent(mBaudrateLabel) | ||||||
|  | 						.addComponent(mRgbLabel)) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mOutputCombo) | ||||||
|  | 						.addComponent(mTypeCombo) | ||||||
|  | 						.addComponent(mBaudrateSpinner) | ||||||
|  | 						.addComponent(mRgbCombo)) | ||||||
|  | 				); | ||||||
|  | 		layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mOutputLabel) | ||||||
|  | 						.addComponent(mOutputCombo)) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mTypeLabel) | ||||||
|  | 						.addComponent(mTypeCombo)) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mBaudrateLabel) | ||||||
|  | 						.addComponent(mBaudrateSpinner)) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mRgbLabel) | ||||||
|  | 						.addComponent(mRgbCombo))); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private final ActionListener mActionListener = new ActionListener() { | 	private final ActionListener mActionListener = new ActionListener() { | ||||||
| 		@Override | 		@Override | ||||||
| 		public void actionPerformed(ActionEvent e) { | 		public void actionPerformed(ActionEvent e) { | ||||||
|  | 			mDeviceConfig.mType = (DeviceType)mTypeCombo.getSelectedItem(); | ||||||
| 			mDeviceConfig.mOutput = (String)mOutputCombo.getSelectedItem(); | 			mDeviceConfig.mOutput = (String)mOutputCombo.getSelectedItem(); | ||||||
| 			mDeviceConfig.mBaudrate = (Integer)mBaudrateCombo.getSelectedItem(); | 			mDeviceConfig.mBaudrate = (Integer)mBaudrateSpinner.getValue(); | ||||||
| 			mDeviceConfig.mColorByteOrder = (ColorByteOrder)mRgbCombo.getSelectedItem(); | 			mDeviceConfig.mColorByteOrder = (ColorByteOrder)mRgbCombo.getSelectedItem(); | ||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
|  | 	 | ||||||
|  | 	private final ChangeListener mChangeListener = new ChangeListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void stateChanged(ChangeEvent e) { | ||||||
|  | 			mDeviceConfig.mBaudrate = (Integer)mBaudrateSpinner.getValue(); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,127 @@ | |||||||
|  | package org.hyperion.hypercon.gui; | ||||||
|  |  | ||||||
|  | import java.awt.event.ActionEvent; | ||||||
|  | import java.awt.event.ActionListener; | ||||||
|  |  | ||||||
|  | import javax.swing.BorderFactory; | ||||||
|  | import javax.swing.GroupLayout; | ||||||
|  | import javax.swing.JCheckBox; | ||||||
|  | import javax.swing.JLabel; | ||||||
|  | import javax.swing.JPanel; | ||||||
|  | import javax.swing.JSpinner; | ||||||
|  | import javax.swing.SpinnerNumberModel; | ||||||
|  | import javax.swing.event.ChangeEvent; | ||||||
|  | import javax.swing.event.ChangeListener; | ||||||
|  |  | ||||||
|  | import org.hyperion.hypercon.spec.MiscConfig; | ||||||
|  |  | ||||||
|  | public class FrameGrabberPanel extends JPanel { | ||||||
|  |  | ||||||
|  | 	private final MiscConfig mMiscConfig; | ||||||
|  | 	 | ||||||
|  | 	private JCheckBox mFrameGrabberCheck; | ||||||
|  | 	private JLabel mWidthLabel; | ||||||
|  | 	private JSpinner mWidthSpinner; | ||||||
|  | 	private JLabel mHeightLabel; | ||||||
|  | 	private JSpinner mHeightSpinner; | ||||||
|  | 	private JLabel mIntervalLabel; | ||||||
|  | 	private JSpinner mIntervalSpinner; | ||||||
|  | 	 | ||||||
|  | 	public FrameGrabberPanel(final MiscConfig pMiscConfig) { | ||||||
|  | 		super(); | ||||||
|  | 		 | ||||||
|  | 		mMiscConfig = pMiscConfig; | ||||||
|  | 		 | ||||||
|  | 		initialise(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void initialise() { | ||||||
|  | 		setBorder(BorderFactory.createTitledBorder("Frame Grabber")); | ||||||
|  | 		 | ||||||
|  | 		mFrameGrabberCheck = new JCheckBox("Enabled"); | ||||||
|  | 		mFrameGrabberCheck.setSelected(mMiscConfig.mFrameGrabberEnabled); | ||||||
|  | 		mFrameGrabberCheck.addActionListener(mActionListener); | ||||||
|  | 		add(mFrameGrabberCheck); | ||||||
|  | 		 | ||||||
|  | 		mWidthLabel = new JLabel("Width: "); | ||||||
|  | 		add(mWidthLabel); | ||||||
|  | 		 | ||||||
|  | 		mWidthSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mFrameGrabberWidth, 16, 1024, 8)); | ||||||
|  | 		mWidthSpinner.addChangeListener(mChangeListener); | ||||||
|  | 		add(mWidthSpinner); | ||||||
|  | 		 | ||||||
|  | 		mHeightLabel = new JLabel("Heigth: "); | ||||||
|  | 		add(mHeightLabel); | ||||||
|  | 		 | ||||||
|  | 		mHeightSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mFrameGrabberHeight, 16, 1024, 8)); | ||||||
|  | 		mHeightSpinner.addChangeListener(mChangeListener); | ||||||
|  | 		add(mHeightSpinner); | ||||||
|  | 		 | ||||||
|  | 		mIntervalLabel = new JLabel("Interval [ms]:"); | ||||||
|  | 		add(mIntervalLabel); | ||||||
|  | 		 | ||||||
|  | 		mIntervalSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mFrameGrabberInterval_ms, 10, 60000, 10)); | ||||||
|  | 		mIntervalSpinner.addChangeListener(mChangeListener); | ||||||
|  | 		add(mIntervalSpinner); | ||||||
|  |  | ||||||
|  | 		GroupLayout layout = new GroupLayout(this); | ||||||
|  | 		layout.setAutoCreateGaps(true); | ||||||
|  | 		setLayout(layout); | ||||||
|  | 		 | ||||||
|  | 		layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mFrameGrabberCheck) | ||||||
|  | 						.addComponent(mWidthLabel) | ||||||
|  | 						.addComponent(mHeightLabel) | ||||||
|  | 						.addComponent(mIntervalLabel) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mFrameGrabberCheck) | ||||||
|  | 						.addComponent(mWidthSpinner) | ||||||
|  | 						.addComponent(mHeightSpinner) | ||||||
|  | 						.addComponent(mIntervalSpinner) | ||||||
|  | 						)); | ||||||
|  | 		layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addComponent(mFrameGrabberCheck) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mWidthLabel) | ||||||
|  | 						.addComponent(mWidthSpinner) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mHeightLabel) | ||||||
|  | 						.addComponent(mHeightSpinner) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mIntervalLabel) | ||||||
|  | 						.addComponent(mIntervalSpinner) | ||||||
|  | 						)); | ||||||
|  |  | ||||||
|  | 		toggleEnabled(mMiscConfig.mFrameGrabberEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void toggleEnabled(boolean pEnabled) { | ||||||
|  | 		mWidthLabel.setEnabled(pEnabled); | ||||||
|  | 		mWidthSpinner.setEnabled(pEnabled); | ||||||
|  | 		mHeightLabel.setEnabled(pEnabled); | ||||||
|  | 		mHeightSpinner.setEnabled(pEnabled); | ||||||
|  | 		mIntervalLabel.setEnabled(pEnabled); | ||||||
|  | 		mIntervalSpinner.setEnabled(pEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private final ActionListener mActionListener = new ActionListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void actionPerformed(ActionEvent e) { | ||||||
|  | 			mMiscConfig.mFrameGrabberEnabled = mFrameGrabberCheck.isSelected(); | ||||||
|  | 			 | ||||||
|  | 			toggleEnabled(mMiscConfig.mFrameGrabberEnabled); | ||||||
|  | 		} | ||||||
|  | 	};  | ||||||
|  | 	private final ChangeListener mChangeListener = new ChangeListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void stateChanged(ChangeEvent e) { | ||||||
|  | 			mMiscConfig.mFrameGrabberWidth = (Integer)mWidthSpinner.getValue(); | ||||||
|  | 			mMiscConfig.mFrameGrabberHeight = (Integer)mHeightSpinner.getValue(); | ||||||
|  | 			mMiscConfig.mFrameGrabberInterval_ms = (Integer)mIntervalSpinner.getValue(); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | } | ||||||
| @@ -3,6 +3,7 @@ package org.hyperion.hypercon.gui; | |||||||
| import java.awt.event.ActionEvent; | import java.awt.event.ActionEvent; | ||||||
| import java.awt.event.ActionListener; | import java.awt.event.ActionListener; | ||||||
|  |  | ||||||
|  | import javax.swing.BorderFactory; | ||||||
| import javax.swing.GroupLayout; | import javax.swing.GroupLayout; | ||||||
| import javax.swing.JComboBox; | import javax.swing.JComboBox; | ||||||
| import javax.swing.JLabel; | import javax.swing.JLabel; | ||||||
| @@ -43,6 +44,8 @@ public class ImageProcessPanel extends JPanel { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private void initialise() { | 	private void initialise() { | ||||||
|  | 		setBorder(BorderFactory.createTitledBorder("Image Process")); | ||||||
|  | 		 | ||||||
| 		mHorizontalDepthLabel = new JLabel("Horizontal depth [%]:"); | 		mHorizontalDepthLabel = new JLabel("Horizontal depth [%]:"); | ||||||
| 		add(mHorizontalDepthLabel); | 		add(mHorizontalDepthLabel); | ||||||
| 		 | 		 | ||||||
|   | |||||||
| @@ -0,0 +1,205 @@ | |||||||
|  | package org.hyperion.hypercon.gui; | ||||||
|  |  | ||||||
|  | import java.awt.event.ActionEvent; | ||||||
|  | import java.awt.event.ActionListener; | ||||||
|  |  | ||||||
|  | import javax.swing.BorderFactory; | ||||||
|  | import javax.swing.BoxLayout; | ||||||
|  | import javax.swing.GroupLayout; | ||||||
|  | import javax.swing.JCheckBox; | ||||||
|  | import javax.swing.JLabel; | ||||||
|  | import javax.swing.JPanel; | ||||||
|  | import javax.swing.JSpinner; | ||||||
|  | import javax.swing.SpinnerNumberModel; | ||||||
|  | import javax.swing.event.ChangeEvent; | ||||||
|  | import javax.swing.event.ChangeListener; | ||||||
|  |  | ||||||
|  | import org.hyperion.hypercon.spec.MiscConfig; | ||||||
|  |  | ||||||
|  | public class InterfacePanel extends JPanel { | ||||||
|  |  | ||||||
|  | 	public final MiscConfig mMiscConfig; | ||||||
|  | 	 | ||||||
|  | 	private JPanel mJsonPanel; | ||||||
|  | 	private JCheckBox mJsonCheck; | ||||||
|  | 	private JLabel mJsonPortLabel; | ||||||
|  | 	private JSpinner mJsonPortSpinner; | ||||||
|  | 	 | ||||||
|  | 	private JPanel mProtoPanel; | ||||||
|  | 	private JCheckBox mProtoCheck; | ||||||
|  | 	private JLabel mProtoPortLabel; | ||||||
|  | 	private JSpinner mProtoPortSpinner; | ||||||
|  | 	 | ||||||
|  | 	private JPanel mBoblightPanel; | ||||||
|  | 	private JCheckBox mBoblightCheck; | ||||||
|  | 	private JLabel mBoblightPortLabel; | ||||||
|  | 	private JSpinner mBoblightPortSpinner; | ||||||
|  | 	 | ||||||
|  | 	public InterfacePanel(final MiscConfig pMiscConfig) { | ||||||
|  | 		super(); | ||||||
|  | 		 | ||||||
|  | 		mMiscConfig = pMiscConfig; | ||||||
|  | 		 | ||||||
|  | 		initialise(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void initialise() { | ||||||
|  | 		setBorder(BorderFactory.createTitledBorder("External interfaces")); | ||||||
|  | 		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); | ||||||
|  | 		 | ||||||
|  | 		add(getJsonPanel()); | ||||||
|  | 		add(getProtoPanel()); | ||||||
|  | 		add(getBoblightPanel()); | ||||||
|  | 		 | ||||||
|  | 		toggleEnabledFlags(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private JPanel getJsonPanel() { | ||||||
|  | 		if (mJsonPanel == null) { | ||||||
|  | 			mJsonPanel = new JPanel(); | ||||||
|  | 			mJsonPanel.setBorder(BorderFactory.createTitledBorder("JSON")); | ||||||
|  | 			 | ||||||
|  | 			mJsonCheck = new JCheckBox("Enabled"); | ||||||
|  | 			mJsonCheck.setSelected(mMiscConfig.mJsonInterfaceEnabled); | ||||||
|  | 			mJsonCheck.addActionListener(mActionListener); | ||||||
|  | 			mJsonPanel.add(mJsonCheck); | ||||||
|  | 			 | ||||||
|  | 			mJsonPortLabel = new JLabel("TCP Port: "); | ||||||
|  | 			mJsonPanel.add(mJsonPortLabel); | ||||||
|  | 			 | ||||||
|  | 			mJsonPortSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mJsonPort, 1, 65536, 1)); | ||||||
|  | 			mJsonPortSpinner.addChangeListener(mChangeListener); | ||||||
|  | 			mJsonPanel.add(mJsonPortSpinner); | ||||||
|  | 			 | ||||||
|  | 			GroupLayout layout = new GroupLayout(mJsonPanel); | ||||||
|  | 			layout.setAutoCreateGaps(true); | ||||||
|  | 			mJsonPanel.setLayout(layout); | ||||||
|  | 			 | ||||||
|  | 			layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mJsonCheck) | ||||||
|  | 							.addComponent(mJsonPortLabel) | ||||||
|  | 							) | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mJsonCheck) | ||||||
|  | 							.addComponent(mJsonPortSpinner) | ||||||
|  | 							)); | ||||||
|  | 			layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
|  | 					.addComponent(mJsonCheck) | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mJsonPortLabel) | ||||||
|  | 							.addComponent(mJsonPortSpinner) | ||||||
|  | 							)); | ||||||
|  | 		} | ||||||
|  | 		return mJsonPanel; | ||||||
|  | 	} | ||||||
|  | 	private JPanel getProtoPanel() { | ||||||
|  | 		if (mProtoPanel == null) { | ||||||
|  | 			mProtoPanel = new JPanel(); | ||||||
|  | 			mProtoPanel.setBorder(BorderFactory.createTitledBorder("PROTO")); | ||||||
|  | 			 | ||||||
|  | 			mProtoCheck = new JCheckBox("Enabled"); | ||||||
|  | 			mProtoCheck.setSelected(mMiscConfig.mProtoInterfaceEnabled); | ||||||
|  | 			mProtoCheck.addActionListener(mActionListener); | ||||||
|  | 			mProtoPanel.add(mProtoCheck); | ||||||
|  | 			 | ||||||
|  | 			mProtoPortLabel = new JLabel("TCP Port: "); | ||||||
|  | 			mProtoPanel.add(mProtoPortLabel); | ||||||
|  | 			 | ||||||
|  | 			mProtoPortSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mProtoPort, 1, 65536, 1)); | ||||||
|  | 			mProtoPortSpinner.addChangeListener(mChangeListener); | ||||||
|  | 			mProtoPanel.add(mProtoPortSpinner); | ||||||
|  | 			 | ||||||
|  | 			GroupLayout layout = new GroupLayout(mProtoPanel); | ||||||
|  | 			layout.setAutoCreateGaps(true); | ||||||
|  | 			mProtoPanel.setLayout(layout); | ||||||
|  | 			 | ||||||
|  | 			layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mProtoCheck) | ||||||
|  | 							.addComponent(mProtoPortLabel) | ||||||
|  | 							) | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mProtoCheck) | ||||||
|  | 							.addComponent(mProtoPortSpinner) | ||||||
|  | 							)); | ||||||
|  | 			layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
|  | 					.addComponent(mProtoCheck) | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mProtoPortLabel) | ||||||
|  | 							.addComponent(mProtoPortSpinner) | ||||||
|  | 							)); | ||||||
|  | 		} | ||||||
|  | 		return mProtoPanel; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private JPanel getBoblightPanel() { | ||||||
|  | 		if (mBoblightPanel == null) { | ||||||
|  | 			mBoblightPanel = new JPanel(); | ||||||
|  | 			mBoblightPanel.setBorder(BorderFactory.createTitledBorder("Boblight")); | ||||||
|  | 			 | ||||||
|  | 			mBoblightCheck = new JCheckBox("Enabled"); | ||||||
|  | 			mBoblightCheck.setSelected(mMiscConfig.mBoblightInterfaceEnabled); | ||||||
|  | 			mBoblightCheck.addActionListener(mActionListener); | ||||||
|  | 			mBoblightPanel.add(mBoblightCheck); | ||||||
|  | 			 | ||||||
|  | 			mBoblightPortLabel = new JLabel("TCP Port: "); | ||||||
|  | 			mBoblightPanel.add(mBoblightPortLabel); | ||||||
|  | 			 | ||||||
|  | 			mBoblightPortSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mBoblightPort, 1, 65536, 1)); | ||||||
|  | 			mBoblightPortSpinner.addChangeListener(mChangeListener); | ||||||
|  | 			mBoblightPanel.add(mBoblightPortSpinner); | ||||||
|  | 			 | ||||||
|  | 			GroupLayout layout = new GroupLayout(mBoblightPanel); | ||||||
|  | 			layout.setAutoCreateGaps(true); | ||||||
|  | 			mBoblightPanel.setLayout(layout); | ||||||
|  | 			 | ||||||
|  | 			layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mBoblightCheck) | ||||||
|  | 							.addComponent(mBoblightPortLabel) | ||||||
|  | 							) | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mBoblightCheck) | ||||||
|  | 							.addComponent(mBoblightPortSpinner) | ||||||
|  | 							)); | ||||||
|  | 			layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
|  | 					.addComponent(mBoblightCheck) | ||||||
|  | 					.addGroup(layout.createParallelGroup() | ||||||
|  | 							.addComponent(mBoblightPortLabel) | ||||||
|  | 							.addComponent(mBoblightPortSpinner) | ||||||
|  | 							)); | ||||||
|  | 		} | ||||||
|  | 		return mBoblightPanel; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private  void toggleEnabledFlags() { | ||||||
|  | 		mJsonPortLabel.setEnabled(mMiscConfig.mJsonInterfaceEnabled); | ||||||
|  | 		mJsonPortSpinner.setEnabled(mMiscConfig.mJsonInterfaceEnabled); | ||||||
|  | 		 | ||||||
|  | 		mProtoPortLabel.setEnabled(mMiscConfig.mProtoInterfaceEnabled); | ||||||
|  | 		mProtoPortSpinner.setEnabled(mMiscConfig.mProtoInterfaceEnabled); | ||||||
|  | 		 | ||||||
|  | 		mBoblightPortLabel.setEnabled(mMiscConfig.mBoblightInterfaceEnabled); | ||||||
|  | 		mBoblightPortSpinner.setEnabled(mMiscConfig.mBoblightInterfaceEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private final ActionListener mActionListener = new ActionListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void actionPerformed(ActionEvent e) { | ||||||
|  | 			mMiscConfig.mJsonInterfaceEnabled = mJsonCheck.isSelected(); | ||||||
|  | 			mMiscConfig.mProtoInterfaceEnabled = mProtoCheck.isSelected(); | ||||||
|  | 			mMiscConfig.mBoblightInterfaceEnabled = mBoblightCheck.isSelected(); | ||||||
|  | 			 | ||||||
|  | 			toggleEnabledFlags(); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | 	private final ChangeListener mChangeListener = new ChangeListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void stateChanged(ChangeEvent e) { | ||||||
|  | 			mMiscConfig.mJsonPort = (Integer)mJsonPortSpinner.getValue(); | ||||||
|  | 			mMiscConfig.mProtoPort = (Integer)mJsonPortSpinner.getValue(); | ||||||
|  | 			mMiscConfig.mBoblightPort = (Integer)mJsonPortSpinner.getValue(); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | } | ||||||
| @@ -13,6 +13,7 @@ import java.awt.event.ActionEvent; | |||||||
| import java.awt.event.MouseAdapter; | import java.awt.event.MouseAdapter; | ||||||
| import java.awt.event.MouseEvent; | import java.awt.event.MouseEvent; | ||||||
| import java.awt.event.MouseMotionListener; | import java.awt.event.MouseMotionListener; | ||||||
|  | import java.awt.font.LineMetrics; | ||||||
| import java.awt.geom.Rectangle2D; | import java.awt.geom.Rectangle2D; | ||||||
| import java.awt.image.BufferedImage; | import java.awt.image.BufferedImage; | ||||||
| import java.io.File; | import java.io.File; | ||||||
| @@ -239,6 +240,12 @@ public class JHyperionTv extends Component { | |||||||
| 			 | 			 | ||||||
| 			g2d.drawRect(xmin, ymin, (xmax-xmin), (ymax-ymin)); | 			g2d.drawRect(xmin, ymin, (xmax-xmin), (ymax-ymin)); | ||||||
| 		} | 		} | ||||||
|  | 		 | ||||||
|  | 		Graphics2D gCopy = (Graphics2D)g.create(); | ||||||
|  | 		gCopy.setXORMode(Color.WHITE); | ||||||
|  | 		gCopy.setFont(gCopy.getFont().deriveFont(20.0f)); | ||||||
|  | 		String ledCntStr = "Led count: " + mLeds2.size(); | ||||||
|  | 		gCopy.drawString(ledCntStr, getWidth()-150.0f, getHeight()-10.0f); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	class LedPaint { | 	class LedPaint { | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ package org.hyperion.hypercon.gui; | |||||||
| import java.awt.event.ActionEvent; | import java.awt.event.ActionEvent; | ||||||
| import java.awt.event.ActionListener; | import java.awt.event.ActionListener; | ||||||
|  |  | ||||||
|  | import javax.swing.BorderFactory; | ||||||
| import javax.swing.GroupLayout; | import javax.swing.GroupLayout; | ||||||
| import javax.swing.JComboBox; | import javax.swing.JComboBox; | ||||||
| import javax.swing.JLabel; | import javax.swing.JLabel; | ||||||
| @@ -12,18 +13,12 @@ import javax.swing.SpinnerNumberModel; | |||||||
| import javax.swing.event.ChangeEvent; | import javax.swing.event.ChangeEvent; | ||||||
| import javax.swing.event.ChangeListener; | import javax.swing.event.ChangeListener; | ||||||
|  |  | ||||||
| import org.hyperion.hypercon.spec.DeviceConfig; |  | ||||||
| import org.hyperion.hypercon.spec.DeviceType; |  | ||||||
| import org.hyperion.hypercon.spec.LedFrameConstruction; | import org.hyperion.hypercon.spec.LedFrameConstruction; | ||||||
| import org.hyperion.hypercon.spec.LedFrameConstruction.Direction; | import org.hyperion.hypercon.spec.LedFrameConstruction.Direction; | ||||||
|  |  | ||||||
| public class LedFramePanel extends JPanel { | public class LedFramePanel extends JPanel { | ||||||
| 	 | 	 | ||||||
| 	private final DeviceConfig mDeviceConfig; |  | ||||||
| 	private final LedFrameConstruction mLedFrameSpec; | 	private final LedFrameConstruction mLedFrameSpec; | ||||||
| 	 |  | ||||||
| 	private JLabel mTypeLabel; |  | ||||||
| 	private JComboBox<DeviceType> mTypeCombo; |  | ||||||
|  |  | ||||||
| 	private JLabel mHorizontalCountLabel; | 	private JLabel mHorizontalCountLabel; | ||||||
| 	private JSpinner mHorizontalCountSpinner; | 	private JSpinner mHorizontalCountSpinner; | ||||||
| @@ -44,22 +39,16 @@ public class LedFramePanel extends JPanel { | |||||||
| 	private JLabel mOffsetLabel; | 	private JLabel mOffsetLabel; | ||||||
| 	private JSpinner mOffsetSpinner; | 	private JSpinner mOffsetSpinner; | ||||||
| 	 | 	 | ||||||
| 	public LedFramePanel(DeviceConfig pDeviceConfig, LedFrameConstruction ledFrameSpec) { | 	public LedFramePanel(LedFrameConstruction ledFrameSpec) { | ||||||
| 		super(); | 		super(); | ||||||
| 		 | 		 | ||||||
| 		mDeviceConfig = pDeviceConfig; |  | ||||||
| 		mLedFrameSpec = ledFrameSpec; | 		mLedFrameSpec = ledFrameSpec; | ||||||
| 		 | 		 | ||||||
| 		initialise(); | 		initialise(); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private void initialise() { | 	private void initialise() { | ||||||
| 		mTypeLabel = new JLabel("LED Type:"); | 		setBorder(BorderFactory.createTitledBorder("Construction")); | ||||||
| 		add(mTypeLabel); |  | ||||||
| 		mTypeCombo = new JComboBox<>(DeviceType.values()); |  | ||||||
| 		mTypeCombo.setSelectedItem(mDeviceConfig.mType); |  | ||||||
| 		mTypeCombo.addActionListener(mActionListener); |  | ||||||
| 		add(mTypeCombo); |  | ||||||
| 		 | 		 | ||||||
| 		mTopCornerLabel = new JLabel("Led in top corners"); | 		mTopCornerLabel = new JLabel("Led in top corners"); | ||||||
| 		add(mTopCornerLabel); | 		add(mTopCornerLabel); | ||||||
| @@ -112,7 +101,6 @@ public class LedFramePanel extends JPanel { | |||||||
| 		 | 		 | ||||||
| 		layout.setHorizontalGroup(layout.createSequentialGroup() | 		layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
| 				.addGroup(layout.createParallelGroup() | 				.addGroup(layout.createParallelGroup() | ||||||
| 						.addComponent(mTypeLabel) |  | ||||||
| 						.addComponent(mDirectionLabel) | 						.addComponent(mDirectionLabel) | ||||||
| 						.addComponent(mTopCornerLabel) | 						.addComponent(mTopCornerLabel) | ||||||
| 						.addComponent(mBottomCornerLabel) | 						.addComponent(mBottomCornerLabel) | ||||||
| @@ -121,7 +109,6 @@ public class LedFramePanel extends JPanel { | |||||||
| 						.addComponent(mVerticalCountLabel) | 						.addComponent(mVerticalCountLabel) | ||||||
| 						.addComponent(mOffsetLabel)) | 						.addComponent(mOffsetLabel)) | ||||||
| 				.addGroup(layout.createParallelGroup() | 				.addGroup(layout.createParallelGroup() | ||||||
| 						.addComponent(mTypeCombo) |  | ||||||
| 						.addComponent(mDirectionCombo) | 						.addComponent(mDirectionCombo) | ||||||
| 						.addComponent(mTopCornerCombo) | 						.addComponent(mTopCornerCombo) | ||||||
| 						.addComponent(mBottomCornerCombo) | 						.addComponent(mBottomCornerCombo) | ||||||
| @@ -131,9 +118,6 @@ public class LedFramePanel extends JPanel { | |||||||
| 						.addComponent(mOffsetSpinner)) | 						.addComponent(mOffsetSpinner)) | ||||||
| 				); | 				); | ||||||
| 		layout.setVerticalGroup(layout.createSequentialGroup() | 		layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
| 				.addGroup(layout.createParallelGroup() |  | ||||||
| 						.addComponent(mTypeLabel) |  | ||||||
| 						.addComponent(mTypeCombo)) |  | ||||||
| 				.addGroup(layout.createParallelGroup() | 				.addGroup(layout.createParallelGroup() | ||||||
| 						.addComponent(mDirectionLabel) | 						.addComponent(mDirectionLabel) | ||||||
| 						.addComponent(mDirectionCombo)) | 						.addComponent(mDirectionCombo)) | ||||||
| @@ -159,8 +143,6 @@ public class LedFramePanel extends JPanel { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	void updateLedConstruction() { | 	void updateLedConstruction() { | ||||||
| 		mDeviceConfig.mType = (DeviceType)mTypeCombo.getSelectedItem(); |  | ||||||
| 		 |  | ||||||
| 		mLedFrameSpec.topCorners    = (Boolean)mTopCornerCombo.getSelectedItem(); | 		mLedFrameSpec.topCorners    = (Boolean)mTopCornerCombo.getSelectedItem(); | ||||||
| 		mLedFrameSpec.bottomCorners = (Boolean)mBottomCornerCombo.getSelectedItem(); | 		mLedFrameSpec.bottomCorners = (Boolean)mBottomCornerCombo.getSelectedItem(); | ||||||
| 		 | 		 | ||||||
|   | |||||||
| @@ -3,18 +3,34 @@ package org.hyperion.hypercon.gui; | |||||||
| import java.awt.event.ActionEvent; | import java.awt.event.ActionEvent; | ||||||
| import java.awt.event.ActionListener; | import java.awt.event.ActionListener; | ||||||
| 
 | 
 | ||||||
|  | import javax.swing.BorderFactory; | ||||||
| import javax.swing.GroupLayout; | import javax.swing.GroupLayout; | ||||||
|  | import javax.swing.JCheckBox; | ||||||
| import javax.swing.JComboBox; | import javax.swing.JComboBox; | ||||||
| import javax.swing.JLabel; | import javax.swing.JLabel; | ||||||
| import javax.swing.JPanel; | import javax.swing.JPanel; | ||||||
|  | import javax.swing.JSpinner; | ||||||
|  | import javax.swing.JTextField; | ||||||
|  | import javax.swing.SpinnerNumberModel; | ||||||
|  | import javax.swing.event.ChangeEvent; | ||||||
|  | import javax.swing.event.ChangeListener; | ||||||
|  | import javax.swing.event.DocumentEvent; | ||||||
|  | import javax.swing.event.DocumentListener; | ||||||
| 
 | 
 | ||||||
| import org.hyperion.hypercon.spec.BootSequence; |  | ||||||
| import org.hyperion.hypercon.spec.MiscConfig; | import org.hyperion.hypercon.spec.MiscConfig; | ||||||
| 
 | 
 | ||||||
| public class MiscConfigPanel extends JPanel { | public class XbmcPanel extends JPanel { | ||||||
| 	 | 
 | ||||||
| 	private final MiscConfig mMiscConfig; | 	private final MiscConfig mMiscConfig; | ||||||
| 	 | 	 | ||||||
|  | 	private JCheckBox mXbmcCheck; | ||||||
|  | 	 | ||||||
|  | 	private JLabel mAddressLabel; | ||||||
|  | 	private JTextField mAddressField; | ||||||
|  | 	 | ||||||
|  | 	private JLabel mTcpPortLabel; | ||||||
|  | 	private JSpinner mTcpPortSpinner; | ||||||
|  | 	 | ||||||
| 	private JLabel mMenuLabel; | 	private JLabel mMenuLabel; | ||||||
| 	private JComboBox<String> mMenuCombo; | 	private JComboBox<String> mMenuCombo; | ||||||
| 	private JLabel mVideoLabel; | 	private JLabel mVideoLabel; | ||||||
| @@ -23,11 +39,8 @@ public class MiscConfigPanel extends JPanel { | |||||||
| 	private JComboBox<String> mPictureCombo; | 	private JComboBox<String> mPictureCombo; | ||||||
| 	private JLabel mAudioLabel; | 	private JLabel mAudioLabel; | ||||||
| 	private JComboBox<String> mAudioCombo; | 	private JComboBox<String> mAudioCombo; | ||||||
| 
 | 	 | ||||||
| 	private JLabel mBootSequenceLabel; | 	public XbmcPanel(final MiscConfig pMiscConfig) { | ||||||
| 	private JComboBox<BootSequence> mBootSequenceCombo; |  | ||||||
| 
 |  | ||||||
| 	public MiscConfigPanel(MiscConfig pMiscConfig) { |  | ||||||
| 		super(); | 		super(); | ||||||
| 		 | 		 | ||||||
| 		mMiscConfig = pMiscConfig; | 		mMiscConfig = pMiscConfig; | ||||||
| @@ -36,16 +49,47 @@ public class MiscConfigPanel extends JPanel { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private void initialise() { | 	private void initialise() { | ||||||
| 		GroupLayout layout = new GroupLayout(this); | 		setBorder(BorderFactory.createTitledBorder("XBMC Checker")); | ||||||
| 		layout.setAutoCreateGaps(true); | 		 | ||||||
| 		setLayout(layout); | 		mXbmcCheck = new JCheckBox("Enabled"); | ||||||
|  | 		mXbmcCheck.setSelected(mMiscConfig.mXbmcCheckerEnabled); | ||||||
|  | 		mXbmcCheck.addActionListener(mActionListener); | ||||||
|  | 		add(mXbmcCheck); | ||||||
|  | 		 | ||||||
|  | 		mAddressLabel = new JLabel("Server address:"); | ||||||
|  | 		add(mAddressLabel); | ||||||
|  | 		 | ||||||
|  | 		mAddressField = new JTextField(mMiscConfig.mXbmcAddress); | ||||||
|  | 		mAddressField.getDocument().addDocumentListener(new DocumentListener() { | ||||||
|  | 			@Override | ||||||
|  | 			public void removeUpdate(DocumentEvent e) { | ||||||
|  | 				mMiscConfig.mXbmcAddress = mAddressField.getText(); | ||||||
|  | 			} | ||||||
|  | 			@Override | ||||||
|  | 			public void insertUpdate(DocumentEvent e) { | ||||||
|  | 				mMiscConfig.mXbmcAddress = mAddressField.getText(); | ||||||
|  | 			} | ||||||
|  | 			@Override | ||||||
|  | 			public void changedUpdate(DocumentEvent e) { | ||||||
|  | 				mMiscConfig.mXbmcAddress = mAddressField.getText(); | ||||||
|  | 			} | ||||||
|  | 		}); | ||||||
|  | 		add(mAddressField); | ||||||
|  | 		 | ||||||
|  | 		mTcpPortLabel = new JLabel("TCP port:"); | ||||||
|  | 		add(mTcpPortLabel); | ||||||
|  | 		 | ||||||
|  | 		mTcpPortSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mXbmcTcpPort, 1, 65535, 1)); | ||||||
|  | 		mTcpPortSpinner.addChangeListener(mChangeListener); | ||||||
|  | 		add(mTcpPortSpinner); | ||||||
|  | 		 | ||||||
| 		 | 		 | ||||||
| 		mMenuLabel = new JLabel("XBMC Menu"); | 		mMenuLabel = new JLabel("XBMC Menu"); | ||||||
| 		add(mMenuLabel); | 		add(mMenuLabel); | ||||||
| 		 | 		 | ||||||
| 		mMenuCombo = new JComboBox<>(new String[] {"On", "Off"}); | 		mMenuCombo = new JComboBox<>(new String[] {"On", "Off"}); | ||||||
| 		mMenuCombo.setSelectedItem(mMiscConfig.mMenuOn? "On": "Off"); | 		mMenuCombo.setSelectedItem(mMiscConfig.mMenuOn? "On": "Off"); | ||||||
| 		mMenuCombo.setToolTipText("Enables('On') or disbales('Off') the ambi-light in the XBMC Menu"); | 		mMenuCombo.setToolTipText("Enables('On') or disables('Off') the ambi-light in the XBMC Menu"); | ||||||
| 		mMenuCombo.addActionListener(mActionListener); | 		mMenuCombo.addActionListener(mActionListener); | ||||||
| 		add(mMenuCombo); | 		add(mMenuCombo); | ||||||
| 
 | 
 | ||||||
| @@ -54,7 +98,7 @@ public class MiscConfigPanel extends JPanel { | |||||||
| 
 | 
 | ||||||
| 		mVideoCombo = new JComboBox<>(new String[] {"On", "Off"}); | 		mVideoCombo = new JComboBox<>(new String[] {"On", "Off"}); | ||||||
| 		mVideoCombo.setSelectedItem(mMiscConfig.mVideoOn? "On": "Off"); | 		mVideoCombo.setSelectedItem(mMiscConfig.mVideoOn? "On": "Off"); | ||||||
| 		mVideoCombo.setToolTipText("Enables('On') or disbales('Off') the ambi-light during video playback"); | 		mVideoCombo.setToolTipText("Enables('On') or disables('Off') the ambi-light during video playback"); | ||||||
| 		mVideoCombo.addActionListener(mActionListener); | 		mVideoCombo.addActionListener(mActionListener); | ||||||
| 		add(mVideoCombo); | 		add(mVideoCombo); | ||||||
| 
 | 
 | ||||||
| @@ -63,7 +107,7 @@ public class MiscConfigPanel extends JPanel { | |||||||
| 		 | 		 | ||||||
| 		mPictureCombo = new JComboBox<>(new String[] {"On", "Off"}); | 		mPictureCombo = new JComboBox<>(new String[] {"On", "Off"}); | ||||||
| 		mPictureCombo.setSelectedItem(mMiscConfig.mPictureOn? "On": "Off"); | 		mPictureCombo.setSelectedItem(mMiscConfig.mPictureOn? "On": "Off"); | ||||||
| 		mPictureCombo.setToolTipText("Enables('On') or disbales('Off') the ambi-light when viewing pictures"); | 		mPictureCombo.setToolTipText("Enables('On') or disables('Off') the ambi-light when viewing pictures"); | ||||||
| 		mPictureCombo.addActionListener(mActionListener); | 		mPictureCombo.addActionListener(mActionListener); | ||||||
| 		add(mPictureCombo); | 		add(mPictureCombo); | ||||||
| 
 | 
 | ||||||
| @@ -72,35 +116,43 @@ public class MiscConfigPanel extends JPanel { | |||||||
| 		 | 		 | ||||||
| 		mAudioCombo = new JComboBox<>(new String[] {"On", "Off"}); | 		mAudioCombo = new JComboBox<>(new String[] {"On", "Off"}); | ||||||
| 		mAudioCombo.setSelectedItem(mMiscConfig.mAudioOn? "On": "Off"); | 		mAudioCombo.setSelectedItem(mMiscConfig.mAudioOn? "On": "Off"); | ||||||
| 		mAudioCombo.setToolTipText("Enables('On') or disbales('Off') the ambi-light when listing to audio"); | 		mAudioCombo.setToolTipText("Enables('On') or disables('Off') the ambi-light when listing to audio"); | ||||||
| 		mAudioCombo.addActionListener(mActionListener); | 		mAudioCombo.addActionListener(mActionListener); | ||||||
| 		add(mAudioCombo); | 		add(mAudioCombo); | ||||||
| 		 | 		 | ||||||
| 		mBootSequenceLabel = new JLabel("Boot Sequence:"); | 		GroupLayout layout = new GroupLayout(this); | ||||||
| 		add(mBootSequenceLabel); | 		layout.setAutoCreateGaps(true); | ||||||
| 		 | 		setLayout(layout); | ||||||
| 		mBootSequenceCombo = new JComboBox<>(BootSequence.values()); |  | ||||||
| 		mBootSequenceCombo.setSelectedItem(mMiscConfig.mBootSequence); |  | ||||||
| 		mBootSequenceCombo.setToolTipText("The sequence used on startup to verify proper working of all the leds"); |  | ||||||
| 		mBootSequenceCombo.addActionListener(mActionListener); |  | ||||||
| 		add(mBootSequenceCombo); |  | ||||||
| 		 | 		 | ||||||
| 		layout.setHorizontalGroup(layout.createSequentialGroup() | 		layout.setHorizontalGroup(layout.createSequentialGroup() | ||||||
| 				.addGroup(layout.createParallelGroup() | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mXbmcCheck) | ||||||
|  | 						.addComponent(mAddressLabel) | ||||||
|  | 						.addComponent(mTcpPortLabel) | ||||||
| 						.addComponent(mMenuLabel) | 						.addComponent(mMenuLabel) | ||||||
| 						.addComponent(mVideoLabel) | 						.addComponent(mVideoLabel) | ||||||
| 						.addComponent(mPictureLabel) | 						.addComponent(mPictureLabel) | ||||||
| 						.addComponent(mAudioLabel) | 						.addComponent(mAudioLabel) | ||||||
| 						.addComponent(mBootSequenceLabel) |  | ||||||
| 						) | 						) | ||||||
| 				.addGroup(layout.createParallelGroup() | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mXbmcCheck) | ||||||
|  | 						.addComponent(mAddressField) | ||||||
|  | 						.addComponent(mTcpPortSpinner) | ||||||
| 						.addComponent(mMenuCombo) | 						.addComponent(mMenuCombo) | ||||||
| 						.addComponent(mVideoCombo) | 						.addComponent(mVideoCombo) | ||||||
| 						.addComponent(mPictureCombo) | 						.addComponent(mPictureCombo) | ||||||
| 						.addComponent(mAudioCombo) | 						.addComponent(mAudioCombo) | ||||||
| 						.addComponent(mBootSequenceCombo) |  | ||||||
| 						)); | 						)); | ||||||
| 		layout.setVerticalGroup(layout.createSequentialGroup() | 		layout.setVerticalGroup(layout.createSequentialGroup() | ||||||
|  | 				.addComponent(mXbmcCheck) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mAddressLabel) | ||||||
|  | 						.addComponent(mAddressField) | ||||||
|  | 						) | ||||||
|  | 				.addGroup(layout.createParallelGroup() | ||||||
|  | 						.addComponent(mTcpPortLabel) | ||||||
|  | 						.addComponent(mTcpPortSpinner) | ||||||
|  | 						) | ||||||
| 				.addGroup(layout.createParallelGroup() | 				.addGroup(layout.createParallelGroup() | ||||||
| 						.addComponent(mMenuLabel) | 						.addComponent(mMenuLabel) | ||||||
| 						.addComponent(mMenuCombo) | 						.addComponent(mMenuCombo) | ||||||
| @@ -116,22 +168,46 @@ public class MiscConfigPanel extends JPanel { | |||||||
| 				.addGroup(layout.createParallelGroup() | 				.addGroup(layout.createParallelGroup() | ||||||
| 						.addComponent(mAudioLabel) | 						.addComponent(mAudioLabel) | ||||||
| 						.addComponent(mAudioCombo) | 						.addComponent(mAudioCombo) | ||||||
| 						) |  | ||||||
| 				.addGroup(layout.createParallelGroup() |  | ||||||
| 						.addComponent(mBootSequenceLabel) |  | ||||||
| 						.addComponent(mBootSequenceCombo) |  | ||||||
| 						)); | 						)); | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
|  | 		toggleEnabled(mMiscConfig.mXbmcCheckerEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private void toggleEnabled(boolean pEnabled) { | ||||||
|  | 		mAddressLabel.setEnabled(pEnabled); | ||||||
|  | 		mAddressField.setEnabled(pEnabled); | ||||||
|  | 		 | ||||||
|  | 		mTcpPortSpinner.setEnabled(pEnabled); | ||||||
|  | 		mTcpPortLabel.setEnabled(pEnabled); | ||||||
|  | 		 | ||||||
|  | 		mMenuLabel.setEnabled(pEnabled); | ||||||
|  | 		mMenuCombo.setEnabled(pEnabled); | ||||||
|  | 		mVideoLabel.setEnabled(pEnabled); | ||||||
|  | 		mVideoCombo.setEnabled(pEnabled); | ||||||
|  | 		mPictureLabel.setEnabled(pEnabled); | ||||||
|  | 		mPictureCombo.setEnabled(pEnabled); | ||||||
|  | 		mAudioLabel.setEnabled(pEnabled); | ||||||
|  | 		mAudioCombo.setEnabled(pEnabled); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private final ChangeListener mChangeListener = new ChangeListener() { | ||||||
|  | 		@Override | ||||||
|  | 		public void stateChanged(ChangeEvent e) { | ||||||
|  | 			mMiscConfig.mXbmcTcpPort = (Integer)mTcpPortSpinner.getValue(); | ||||||
|  | 		}	 | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
| 	private final ActionListener mActionListener = new ActionListener() { | 	private final ActionListener mActionListener = new ActionListener() { | ||||||
| 		@Override | 		@Override | ||||||
| 		public void actionPerformed(ActionEvent e) { | 		public void actionPerformed(ActionEvent e) { | ||||||
| 			mMiscConfig.mBootSequence = (BootSequence)mBootSequenceCombo.getSelectedItem(); | 			mMiscConfig.mXbmcCheckerEnabled = mXbmcCheck.isSelected(); | ||||||
| 			 | 
 | ||||||
| 			mMiscConfig.mMenuOn = (mMenuCombo.getSelectedItem() == "On"); | 			mMiscConfig.mMenuOn = (mMenuCombo.getSelectedItem() == "On"); | ||||||
| 			mMiscConfig.mVideoOn = (mVideoCombo.getSelectedItem() == "On"); | 			mMiscConfig.mVideoOn = (mVideoCombo.getSelectedItem() == "On"); | ||||||
| 			mMiscConfig.mPictureOn = (mPictureCombo.getSelectedItem() == "On"); | 			mMiscConfig.mPictureOn = (mPictureCombo.getSelectedItem() == "On"); | ||||||
| 			mMiscConfig.mAudioOn = (mAudioCombo.getSelectedItem() == "On"); | 			mMiscConfig.mAudioOn = (mAudioCombo.getSelectedItem() == "On"); | ||||||
|  | 
 | ||||||
|  | 			toggleEnabled(mMiscConfig.mXbmcCheckerEnabled); | ||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
| } | } | ||||||
| @@ -7,9 +7,7 @@ public enum BootSequence { | |||||||
| 	/** The rainbow boot sequence */  | 	/** The rainbow boot sequence */  | ||||||
| 	rainbow, | 	rainbow, | ||||||
| 	/** The Knight Rider (or KITT) boot sequence */ | 	/** The Knight Rider (or KITT) boot sequence */ | ||||||
| 	knight_rider, | 	knight_rider; | ||||||
| 	/** No boot sequence */ |  | ||||||
| 	none; |  | ||||||
| 	 | 	 | ||||||
| 	/** | 	/** | ||||||
| 	 * Returns a string representation of the BootSequence | 	 * Returns a string representation of the BootSequence | ||||||
| @@ -23,8 +21,6 @@ public enum BootSequence { | |||||||
| 			return "Rainbow"; | 			return "Rainbow"; | ||||||
| 		case knight_rider: | 		case knight_rider: | ||||||
| 			return "Kinght Rider"; | 			return "Kinght Rider"; | ||||||
| 		case none: |  | ||||||
| 			return "None"; |  | ||||||
| 		} | 		} | ||||||
| 		return "None"; | 		return "None"; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -38,8 +38,9 @@ public class ColorConfig { | |||||||
| 	/** The white-level of the BLUE-value (in RGB space) */ | 	/** The white-level of the BLUE-value (in RGB space) */ | ||||||
| 	public double mBlueWhitelevel = 1.0; | 	public double mBlueWhitelevel = 1.0; | ||||||
| 	 | 	 | ||||||
|  | 	public boolean mSmoothingEnabled = false; | ||||||
| 	/** The type of smoothing algorithm */ | 	/** The type of smoothing algorithm */ | ||||||
| 	public ColorSmoothingType mSmoothingType = ColorSmoothingType.none; | 	public ColorSmoothingType mSmoothingType = ColorSmoothingType.linear; | ||||||
| 	/** The time constant for smoothing algorithm in milliseconds */ | 	/** The time constant for smoothing algorithm in milliseconds */ | ||||||
| 	public int mSmoothingTime_ms = 200; | 	public int mSmoothingTime_ms = 200; | ||||||
| 	/** The update frequency of the leds in Hz */ | 	/** The update frequency of the leds in Hz */ | ||||||
| @@ -135,13 +136,15 @@ public class ColorConfig { | |||||||
| 	 */ | 	 */ | ||||||
| 	private String smoothingToString() { | 	private String smoothingToString() { | ||||||
| 		StringBuffer strBuf = new StringBuffer(); | 		StringBuffer strBuf = new StringBuffer(); | ||||||
| 		strBuf.append("\t\t\"smoothing\" :\n"); |  | ||||||
| 		strBuf.append("\t\t{\n"); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\t\"type\"            : \"%s\",\n", mSmoothingType.name())); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\t\"time_ms\"         : %d,\n", mSmoothingTime_ms)); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\t\"updateFrequency\" : %.4f\n", mSmoothingUpdateFrequency_Hz)); |  | ||||||
| 		 | 		 | ||||||
| 		strBuf.append("\t\t}"); | 		String preamble = (mSmoothingEnabled)? "\t\t" : "//\t\t"; | ||||||
|  | 		strBuf.append(preamble).append("\"smoothing\" :\n"); | ||||||
|  | 		strBuf.append(preamble).append("{\n"); | ||||||
|  | 		strBuf.append(preamble).append(String.format(Locale.ROOT, "\t\"type\"            : \"%s\",\n", mSmoothingType.name())); | ||||||
|  | 		strBuf.append(preamble).append(String.format(Locale.ROOT, "\t\"time_ms\"         : %d,\n", mSmoothingTime_ms)); | ||||||
|  | 		strBuf.append(preamble).append(String.format(Locale.ROOT, "\t\"updateFrequency\" : %.4f\n", mSmoothingUpdateFrequency_Hz)); | ||||||
|  | 		 | ||||||
|  | 		strBuf.append(preamble).append("}"); | ||||||
| 		return strBuf.toString(); | 		return strBuf.toString(); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,9 +1,6 @@ | |||||||
| package org.hyperion.hypercon.spec; | package org.hyperion.hypercon.spec; | ||||||
|  |  | ||||||
| public enum ColorSmoothingType { | public enum ColorSmoothingType { | ||||||
| 	/** No smoothing in the time domain */ |  | ||||||
| 	none("None"), |  | ||||||
| 	 |  | ||||||
| 	/** Linear smoothing of led data */ | 	/** Linear smoothing of led data */ | ||||||
| 	linear("Linear smoothing"); | 	linear("Linear smoothing"); | ||||||
| 	 | 	 | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ package org.hyperion.hypercon.spec; | |||||||
|  * The device specific configuration |  * The device specific configuration | ||||||
|  */ |  */ | ||||||
| public class DeviceConfig { | public class DeviceConfig { | ||||||
|  | 	 | ||||||
| 	/** The name of the device */ | 	/** The name of the device */ | ||||||
| 	public String mName     = "MyPi"; | 	public String mName     = "MyPi"; | ||||||
| 	/** The type specification of the device */ | 	/** The type specification of the device */ | ||||||
|   | |||||||
| @@ -8,6 +8,8 @@ public enum DeviceType { | |||||||
| 	ws2801("WS2801"), | 	ws2801("WS2801"), | ||||||
| 	/** LDP6803 Led String device with one continuous shift-register (5 bits per color channel)*/ | 	/** LDP6803 Led String device with one continuous shift-register (5 bits per color channel)*/ | ||||||
| 	ldp6803("LDP6803"), | 	ldp6803("LDP6803"), | ||||||
|  | 	/** SEDU LED device */ | ||||||
|  | 	sedu("SEDU"), | ||||||
| 	/** Test device for writing color values to file-output */ | 	/** Test device for writing color values to file-output */ | ||||||
| 	test("Test"), | 	test("Test"), | ||||||
| 	/** No device, no output is generated */ | 	/** No device, no output is generated */ | ||||||
|   | |||||||
| @@ -6,11 +6,16 @@ import java.util.Locale; | |||||||
|  * Miscellaneous configuration items for the Hyperion daemon. |  * Miscellaneous configuration items for the Hyperion daemon. | ||||||
|  */ |  */ | ||||||
| public class MiscConfig { | public class MiscConfig { | ||||||
|  | 	 | ||||||
|  | 	/** Flag indicating that the boot sequence is enabled */ | ||||||
|  | 	public boolean mBootsequenceEnabled = true; | ||||||
| 	/** The selected boot sequence */ | 	/** The selected boot sequence */ | ||||||
| 	public BootSequence mBootSequence = BootSequence.rainbow; | 	public BootSequence mBootSequence = BootSequence.rainbow; | ||||||
| 	/** The length of the boot sequence [ms] */ | 	/** The length of the boot sequence [ms] */ | ||||||
| 	public int mBootSequenceLength_ms = 3000; | 	public int mBootSequenceLength_ms = 3000; | ||||||
| 	 | 	 | ||||||
|  | 	/** Flag indicating that the Frame Grabber is enabled */ | ||||||
|  | 	public boolean mFrameGrabberEnabled = true; | ||||||
| 	/** The width of 'grabbed' frames (screen shots) [pixels] */ | 	/** The width of 'grabbed' frames (screen shots) [pixels] */ | ||||||
| 	public int mFrameGrabberWidth = 64; | 	public int mFrameGrabberWidth = 64; | ||||||
| 	/** The height of 'grabbed' frames (screen shots) [pixels] */ | 	/** The height of 'grabbed' frames (screen shots) [pixels] */ | ||||||
| @@ -18,6 +23,8 @@ public class MiscConfig { | |||||||
| 	/** The interval of frame grabs (screen shots) [ms] */ | 	/** The interval of frame grabs (screen shots) [ms] */ | ||||||
| 	public int mFrameGrabberInterval_ms = 100; | 	public int mFrameGrabberInterval_ms = 100; | ||||||
|  |  | ||||||
|  | 	/** Flag indicating that the XBMC checker is enabled */ | ||||||
|  | 	public boolean mXbmcCheckerEnabled = true; | ||||||
| 	/** The IP-address of XBMC */ | 	/** The IP-address of XBMC */ | ||||||
| 	public String mXbmcAddress  = "127.0.0.1"; | 	public String mXbmcAddress  = "127.0.0.1"; | ||||||
| 	/** The TCP JSON-Port of XBMC */ | 	/** The TCP JSON-Port of XBMC */ | ||||||
| @@ -31,11 +38,20 @@ public class MiscConfig { | |||||||
| 	/** Flag indicating that the frame-grabber is on during audio playback */ | 	/** Flag indicating that the frame-grabber is on during audio playback */ | ||||||
| 	public boolean mAudioOn = true; | 	public boolean mAudioOn = true; | ||||||
|  |  | ||||||
|  | 	/** Flag indicating that the JSON interface is enabled */ | ||||||
|  | 	public boolean mJsonInterfaceEnabled = true; | ||||||
| 	/** The TCP port at which the JSON server is listening for incoming connections */ | 	/** The TCP port at which the JSON server is listening for incoming connections */ | ||||||
| 	public int mJsonPort = 19444; | 	public int mJsonPort = 19444; | ||||||
|  |  | ||||||
|  | 	/** Flag indicating that the PROTO interface is enabled */ | ||||||
|  | 	public boolean mProtoInterfaceEnabled = true; | ||||||
| 	/** The TCP port at which the Protobuf server is listening for incoming connections */ | 	/** The TCP port at which the Protobuf server is listening for incoming connections */ | ||||||
| 	public int mProtoPort = 19445; | 	public int mProtoPort = 19445; | ||||||
|  |  | ||||||
|  | 	/** Flag indicating that the PROTO interface is enabled */ | ||||||
|  | 	public boolean mBoblightInterfaceEnabled = true; | ||||||
|  | 	/** The TCP port at which the Protobuf server is listening for incoming connections */ | ||||||
|  | 	public int mBoblightPort = 19333; | ||||||
| 	 | 	 | ||||||
| 	/** | 	/** | ||||||
| 	 * Creates the JSON string of the configuration as used in the Hyperion daemon configfile | 	 * Creates the JSON string of the configuration as used in the Hyperion daemon configfile | ||||||
| @@ -45,30 +61,42 @@ public class MiscConfig { | |||||||
| 	public String toJsonString() { | 	public String toJsonString() { | ||||||
| 		StringBuffer strBuf = new StringBuffer(); | 		StringBuffer strBuf = new StringBuffer(); | ||||||
|  |  | ||||||
|  | 		if (mBootsequenceEnabled) { | ||||||
|  | 			strBuf.append(","); | ||||||
|  | 		} | ||||||
|  | 		strBuf.append("\n\n"); | ||||||
| 		strBuf.append("\t/// The boot-sequence configuration, contains the following items: \n"); | 		strBuf.append("\t/// The boot-sequence configuration, contains the following items: \n"); | ||||||
| 		strBuf.append("\t///  * type        : The type of the boot-sequence ('rainbow', 'knight_rider', 'none') \n"); | 		strBuf.append("\t///  * type        : The type of the boot-sequence ('rainbow', 'knight_rider', 'none') \n"); | ||||||
| 		strBuf.append("\t///  * duration_ms : The length of the boot-sequence [ms]\n"); | 		strBuf.append("\t///  * duration_ms : The length of the boot-sequence [ms]\n"); | ||||||
| 		 | 		 | ||||||
| 		strBuf.append("\t\"bootsequence\" :\n"); | 		String bootPreamble = mBootsequenceEnabled? "\t" : "//\t"; | ||||||
| 		strBuf.append("\t{\n"); | 		strBuf.append(bootPreamble).append("\"bootsequence\" :\n"); | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"type\"        : \"%s\",\n", mBootSequence)); | 		strBuf.append(bootPreamble).append("{\n"); | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"duration_ms\" : %d\n", mBootSequenceLength_ms)); | 		strBuf.append(bootPreamble).append(String.format(Locale.ROOT, "\t\"type\"        : \"%s\",\n", mBootSequence)); | ||||||
| 		strBuf.append("\t},\n\n"); | 		strBuf.append(bootPreamble).append(String.format(Locale.ROOT, "\t\"duration_ms\" : %d\n", mBootSequenceLength_ms)); | ||||||
|  | 		strBuf.append(bootPreamble).append("},\n\n"); | ||||||
|  |  | ||||||
| 		 | 		if (mFrameGrabberEnabled) { | ||||||
|  | 			strBuf.append(","); | ||||||
|  | 		} | ||||||
|  | 		strBuf.append("\n\n"); | ||||||
| 		strBuf.append("\t/// The configuration for the frame-grabber, contains the following items: \n"); | 		strBuf.append("\t/// The configuration for the frame-grabber, contains the following items: \n"); | ||||||
| 		strBuf.append("\t///  * width        : The width of the grabbed frames [pixels]\n"); | 		strBuf.append("\t///  * width        : The width of the grabbed frames [pixels]\n"); | ||||||
| 		strBuf.append("\t///  * height       : The height of the grabbed frames [pixels]\n"); | 		strBuf.append("\t///  * height       : The height of the grabbed frames [pixels]\n"); | ||||||
| 		strBuf.append("\t///  * frequency_Hz : The frequency of the frame grab [Hz]\n"); | 		strBuf.append("\t///  * frequency_Hz : The frequency of the frame grab [Hz]\n"); | ||||||
| 		 | 		 | ||||||
| 		strBuf.append("\t\"framegrabber\" :\n"); | 		String grabPreamble = mFrameGrabberEnabled? "\t" : "//\t"; | ||||||
| 		strBuf.append("\t{\n"); | 		strBuf.append(grabPreamble).append("\"framegrabber\" :\n"); | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"width\"        : %d,\n", mFrameGrabberWidth)); | 		strBuf.append(grabPreamble).append("{\n"); | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"height\"       : %d,\n", mFrameGrabberHeight)); | 		strBuf.append(grabPreamble).append(String.format(Locale.ROOT, "\t\"width\"        : %d,\n", mFrameGrabberWidth)); | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"frequency_Hz\" : %.1f\n", 1000.0/mFrameGrabberInterval_ms)); | 		strBuf.append(grabPreamble).append(String.format(Locale.ROOT, "\t\"height\"       : %d,\n", mFrameGrabberHeight)); | ||||||
| 		strBuf.append("\t},\n\n"); | 		strBuf.append(grabPreamble).append(String.format(Locale.ROOT, "\t\"frequency_Hz\" : %.1f\n", 1000.0/mFrameGrabberInterval_ms)); | ||||||
|  | 		strBuf.append(grabPreamble).append("},\n\n"); | ||||||
|  |  | ||||||
| 		 | 		if (mXbmcCheckerEnabled) { | ||||||
|  | 			strBuf.append(","); | ||||||
|  | 		} | ||||||
|  | 		strBuf.append("\n\n"); | ||||||
| 		strBuf.append("\t/// The configuration of the XBMC connection used to enable and disable the frame-grabber. Contains the following fields: \n"); | 		strBuf.append("\t/// The configuration of the XBMC connection used to enable and disable the frame-grabber. Contains the following fields: \n"); | ||||||
| 		strBuf.append("\t///  * xbmcAddress  : The IP address of the XBMC-host\n"); | 		strBuf.append("\t///  * xbmcAddress  : The IP address of the XBMC-host\n"); | ||||||
| 		strBuf.append("\t///  * xbmcTcpPort  : The TCP-port of the XBMC-server\n"); | 		strBuf.append("\t///  * xbmcTcpPort  : The TCP-port of the XBMC-server\n"); | ||||||
| @@ -76,34 +104,50 @@ public class MiscConfig { | |||||||
| 		strBuf.append("\t///  * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show\n"); | 		strBuf.append("\t///  * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show\n"); | ||||||
| 		strBuf.append("\t///  * grabAudio    : Flag indicating that the frame-grabber is on(true) during audio playback\n"); | 		strBuf.append("\t///  * grabAudio    : Flag indicating that the frame-grabber is on(true) during audio playback\n"); | ||||||
| 		strBuf.append("\t///  * grabMenu     : Flag indicating that the frame-grabber is on(true) in the XBMC menu\n"); | 		strBuf.append("\t///  * grabMenu     : Flag indicating that the frame-grabber is on(true) in the XBMC menu\n"); | ||||||
|  |  | ||||||
|  | 		String xbmcPreamble = mXbmcCheckerEnabled? "\t" : "//\t"; | ||||||
|  | 		strBuf.append(xbmcPreamble).append("\"xbmcVideoChecker\" :\n"); | ||||||
|  | 		strBuf.append(xbmcPreamble).append("{\n"); | ||||||
|  | 		strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"xbmcAddress\"  : \"%s\",\n", mXbmcAddress)); | ||||||
|  | 		strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"xbmcTcpPort\"  : %d,\n", mXbmcTcpPort)); | ||||||
|  | 		strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"grabVideo\"    : %s,\n", mVideoOn)); | ||||||
|  | 		strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"grabPictures\" : %s,\n", mPictureOn)); | ||||||
|  | 		strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"grabAudio\"    : %s,\n", mAudioOn)); | ||||||
|  | 		strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"grabMenu\"     : %s\n", mMenuOn)); | ||||||
|  | 		strBuf.append(xbmcPreamble).append("},\n\n"); | ||||||
|  |  | ||||||
| 		 | 		 | ||||||
| 		strBuf.append("\t\"xbmcVideoChecker\" :\n"); |  | ||||||
| 		strBuf.append("\t{\n"); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"xbmcAddress\"  : \"%s\",\n", mXbmcAddress)); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"xbmcTcpPort\"  : %d,\n", mXbmcTcpPort)); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"grabVideo\"    : %s,\n", mVideoOn)); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"grabPictures\" : %s,\n", mPictureOn)); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"grabAudio\"    : %s,\n", mAudioOn)); |  | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"grabMenu\"     : %s\n", mMenuOn)); |  | ||||||
| 		strBuf.append("\t},\n\n"); |  | ||||||
| 		 |  | ||||||
| 				 |  | ||||||
| 		strBuf.append("\t/// The configuration of the Json server which enables the json remote interface\n"); | 		strBuf.append("\t/// The configuration of the Json server which enables the json remote interface\n"); | ||||||
| 		strBuf.append("\t///  * port : Port at which the json server is started\n"); | 		strBuf.append("\t///  * port : Port at which the json server is started\n"); | ||||||
| 		strBuf.append("\t\"jsonServer\" :\n"); | 		 | ||||||
| 		strBuf.append("\t{\n"); | 		String jsonPreamble = mJsonInterfaceEnabled? "\t" : "//\t"; | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"port\" : %d\n", mJsonPort)); | 		strBuf.append(jsonPreamble).append("\"jsonServer\" :\n"); | ||||||
| 	    strBuf.append("\t},\n\n"); | 		strBuf.append(jsonPreamble).append("{\n"); | ||||||
|  | 		strBuf.append(jsonPreamble).append(String.format(Locale.ROOT, "\t\"port\" : %d\n", mJsonPort)); | ||||||
|  | 	    strBuf.append(jsonPreamble).append("},\n\n"); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	    strBuf.append("\t/// The configuration of the Proto server which enables the protobuffer remote interface\n"); | 	    strBuf.append("\t/// The configuration of the Proto server which enables the protobuffer remote interface\n"); | ||||||
| 	    strBuf.append("\t///  * port : Port at which the protobuffer server is started\n"); | 	    strBuf.append("\t///  * port : Port at which the protobuffer server is started\n"); | ||||||
| 	     | 	     | ||||||
| 	    strBuf.append("\t\"protoServer\" :\n"); | 	    String protoPreamble = mProtoInterfaceEnabled? "\t" : "//\t"; | ||||||
| 	    strBuf.append("\t{\n"); | 	    strBuf.append(protoPreamble).append("\"protoServer\" :\n"); | ||||||
| 		strBuf.append(String.format(Locale.ROOT, "\t\t\"port\" : %d\n", mProtoPort)); | 	    strBuf.append(protoPreamble).append("{\n"); | ||||||
| 	    strBuf.append("\t}"); | 		strBuf.append(protoPreamble).append(String.format(Locale.ROOT, "\t\"port\" : %d\n", mProtoPort)); | ||||||
|  | 	    strBuf.append(protoPreamble).append("},\n\n"); | ||||||
| 	     | 	     | ||||||
| 		return strBuf.toString(); |  | ||||||
|  | 	    strBuf.append("\t/// The configuration of the boblight server which enables the boblight remote interface\n"); | ||||||
|  | 	    strBuf.append("\t///  * port : Port at which the boblight server is started\n"); | ||||||
|  | 	     | ||||||
|  | 	    String bobligthPreamble = mBoblightInterfaceEnabled? "\t" : "//\t"; | ||||||
|  | 	    strBuf.append(bobligthPreamble).append("\"boblightServer\" :\n"); | ||||||
|  | 	    strBuf.append(bobligthPreamble).append("{\n"); | ||||||
|  | 		strBuf.append(bobligthPreamble).append(String.format(Locale.ROOT, "\t\"port\" : %d\n", mBoblightPort)); | ||||||
|  | 	    strBuf.append(bobligthPreamble).append("},\n\n"); | ||||||
|  |  | ||||||
|  | 	    strBuf.append("\t\"end-of-json\" : \"end-of-json\""); | ||||||
|  | 	     | ||||||
|  | 	    return strBuf.toString(); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user