├── .gitignore ├── .travis.yml ├── ConfigTool ├── .classpath ├── .gitignore ├── .project ├── ConfigTool.iml ├── buid_ssh.xml ├── build.xml ├── classes │ └── .gitignore ├── lib │ ├── ColorPicker.jar │ ├── jdom-1.1.3.jar │ └── jsch-0.1.54.jar └── src │ └── org │ └── hyperion │ ├── hypercon │ ├── ConfigurationFile.java │ ├── ErrorHandling.java │ ├── HyperConConfig.java │ ├── HyperConIcon_32.png │ ├── HyperConIcon_64.png │ ├── JavaVersion.java │ ├── JsonStringBuffer.java │ ├── LedFrameFactory.java │ ├── LedString.java │ ├── Main.java │ ├── Restart.java │ ├── SshConnectionModel.java │ ├── UpdateTool.java │ ├── gui │ │ ├── ConfigPanel.java │ │ ├── External_Tab │ │ │ ├── BootEffectPanel.java │ │ │ ├── ForwardPanel.java │ │ │ ├── InterfacePanel.java │ │ │ └── XbmcPanel.java │ │ ├── Grabber_Tab │ │ │ ├── FrameGrabberPanel.java │ │ │ └── Grabberv4l2Panel.java │ │ ├── Hardware_Tab │ │ │ ├── BlackBorderPanel.java │ │ │ ├── DevicePanel.java │ │ │ ├── ImageProcessPanel.java │ │ │ ├── LedFramePanel.java │ │ │ └── device │ │ │ │ ├── AtmoOrbPanel.java │ │ │ │ ├── DeviceTypePanel.java │ │ │ │ ├── FadeCandyPanel.java │ │ │ │ ├── LightPackPanel.java │ │ │ │ ├── PhilipsHuePanel.java │ │ │ │ ├── PiBlasterPanel.java │ │ │ │ ├── SerialPanel.java │ │ │ │ ├── SpiDevPanel.java │ │ │ │ ├── TestDevicePanel.java │ │ │ │ ├── TinkerForgePanel.java │ │ │ │ ├── UDPPanel.java │ │ │ │ ├── WS281XPanel.java │ │ │ │ └── rawhidPanel.java │ │ ├── LedDivideDialog.java │ │ ├── LedSimulation │ │ │ ├── ImageComponent.java │ │ │ ├── LedSimulationComponent.java │ │ │ ├── LedSimulationWorker.java │ │ │ ├── LedTvComponent.java │ │ │ ├── TestImageBBB_01.png │ │ │ ├── TestImageBBB_02.png │ │ │ ├── TestImageBBB_03.png │ │ │ ├── TestImage_01.png │ │ │ ├── TestImage_02.png │ │ │ ├── TestImage_03.png │ │ │ ├── TestImage_04.png │ │ │ └── TestImage_05.png │ │ ├── LoadSaveCreatePanel.java │ │ ├── Process_Tab │ │ │ ├── ColorSmoothingPanel.java │ │ │ ├── ColorTransformPanel.java │ │ │ ├── ColorsPanel.java │ │ │ └── SshColorTransformPanel.java │ │ └── SSH_Tab │ │ │ ├── SSHTrafficPrinterFrame.java │ │ │ ├── SshColorPickingPanel.java │ │ │ ├── SshCommandSenderPanel.java │ │ │ ├── SshConnectionPanel.java │ │ │ ├── SshManageHyperionPanel.java │ │ │ └── SshSendConfigPanel.java │ ├── language │ │ ├── language.java │ │ ├── language.properties │ │ ├── language_cz.properties │ │ ├── language_de.properties │ │ ├── language_es.properties │ │ └── language_it.properties │ ├── spec │ │ ├── BlackBorderStandard.java │ │ ├── BorderSide.java │ │ ├── ColorByteOrder.java │ │ ├── ColorConfig.java │ │ ├── ColorSmoothingType.java │ │ ├── DeviceConfig.java │ │ ├── DeviceType.java │ │ ├── DimensionModes.java │ │ ├── EffectStandard.java │ │ ├── Grabberv4l2Config.java │ │ ├── HyperionRemoteCalls.java │ │ ├── ImageProcessConfig.java │ │ ├── Led.java │ │ ├── LedFrameConstruction.java │ │ ├── MiscConfig.java │ │ ├── SshAndColorPickerConfig.java │ │ ├── SshCommand.java │ │ ├── TemperatureConfig.java │ │ ├── TransformConfig.java │ │ └── VideoStandard.java │ └── test │ │ └── TesConfigWriter.java │ └── ssh │ ├── ConnectionAdapter.java │ ├── ConnectionListener.java │ ├── ConnectionMessageCollector.java │ ├── HyperionSshPanel.java │ └── PiSshConnection.java ├── HyperionSsh ├── .classpath ├── .gitignore └── .project ├── README.md ├── build.gradle ├── debug └── HyperCon_Ssh.jar └── update.xml /.gitignore: -------------------------------------------------------------------------------- 1 | /.metadata 2 | .idea/ 3 | ConfigTool/hypercon.dat 4 | ConfigTool/src/META-INF/MANIFEST.MF 5 | ConfigTool/ConfigTool.iml 6 | 7 | # Gradle ignores 8 | .gradle 9 | /build/ 10 | 11 | # Ignore Gradle GUI config 12 | gradle-app.setting 13 | 14 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 15 | !gradle-wrapper.jar 16 | 17 | # Cache of project 18 | .gradletasknamecache 19 | 20 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 21 | # gradle/wrapper/gradle-wrapper.properties 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: java 3 | script: 4 | - gradle --version 5 | - gradle main --info --stacktrace 6 | jdk: 7 | - oraclejdk8 8 | - oraclejdk7 9 | -------------------------------------------------------------------------------- /ConfigTool/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ConfigTool/.gitignore: -------------------------------------------------------------------------------- 1 | /.settings 2 | /hyerpcon.dat 3 | -------------------------------------------------------------------------------- /ConfigTool/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ConfigTool 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /ConfigTool/ConfigTool.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ConfigTool/buid_ssh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ConfigTool/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ConfigTool/classes/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything within this directory but keep it for building 2 | * 3 | # Keep the ignore file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /ConfigTool/lib/ColorPicker.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/lib/ColorPicker.jar -------------------------------------------------------------------------------- /ConfigTool/lib/jdom-1.1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/lib/jdom-1.1.3.jar -------------------------------------------------------------------------------- /ConfigTool/lib/jsch-0.1.54.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/lib/jsch-0.1.54.jar -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/ErrorHandling.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon; 2 | 3 | 4 | import javax.swing.*; 5 | import java.awt.*; 6 | import java.io.PrintStream; 7 | import java.io.PrintWriter; 8 | import java.io.StringWriter; 9 | 10 | /** 11 | * Created by Fabian on 15.02.2015. 12 | */ 13 | public class ErrorHandling { 14 | 15 | 16 | public static JFrame mainframe; 17 | 18 | 19 | public static void ShowException(Exception e){ 20 | StringWriter sw = new StringWriter(); 21 | e.printStackTrace(new PrintWriter(sw)); 22 | String exceptionAsString = sw.toString(); 23 | 24 | JOptionPane.showMessageDialog(mainframe, e.getMessage() + "\n\n" + exceptionAsString, "Error", JOptionPane.OK_OPTION); //$NON-NLS-1$ //$NON-NLS-2$ 25 | 26 | } 27 | 28 | public static void ShowMessage(String Message){ 29 | 30 | JOptionPane.showMessageDialog(mainframe,Message, "Info", JOptionPane.OK_OPTION); //$NON-NLS-1$ 31 | 32 | } 33 | 34 | public static void ShowMessage(String Message, String title){ 35 | 36 | JOptionPane.showMessageDialog(mainframe,Message, title, JOptionPane.OK_OPTION); 37 | 38 | } 39 | 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/HyperConConfig.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon; 2 | 3 | public class HyperConConfig { 4 | 5 | public boolean loadDefaultEffect = true; 6 | } 7 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/HyperConIcon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/HyperConIcon_32.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/HyperConIcon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/HyperConIcon_64.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/JavaVersion.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon; 2 | 3 | public class JavaVersion 4 | { 5 | //specifies minimum major version. Examples: 5 (JRE 5), 6 (JRE 6), 7 (JRE 7) etc. 6 | private static final int MAJOR_VERSION = 7; 7 | 8 | //specifies minimum minor version. Examples: 12 (JRE 6u12), 23 (JRE 6u23), 2 (JRE 7u2) etc. 9 | private static final int MINOR_VERSION = 1; 10 | 11 | //checks if the version of the currently running JVM is bigger than 12 | //the minimum version required to run this program. 13 | //returns true if it's ok, false otherwise 14 | public static boolean isOKJVMVersion() 15 | { 16 | //get the JVM version 17 | String version = System.getProperty("java.version"); 18 | 19 | //extract the major version from it 20 | int sys_major_version; 21 | try 22 | { 23 | sys_major_version = Integer.parseInt(String.valueOf(version.charAt (2))); 24 | } 25 | catch(Exception e) { 26 | sys_major_version = 9; 27 | } 28 | 29 | //if the major version is too low (unlikely !!), it's not good 30 | if (sys_major_version < MAJOR_VERSION) { 31 | return false; 32 | } else if (sys_major_version > MAJOR_VERSION) { 33 | return true; 34 | } else { 35 | //find the underline ( "_" ) in the version string 36 | int underlinepos = version.lastIndexOf("_"); 37 | 38 | try { 39 | //everything after the underline is the minor version. 40 | //extract that 41 | int mv = Integer.parseInt(version.substring(underlinepos + 1)); 42 | 43 | //if the minor version passes, wonderful 44 | return (mv >= MINOR_VERSION); 45 | 46 | } catch (NumberFormatException e) { 47 | //if it's not ok, then the version is probably not good 48 | return false; 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/JsonStringBuffer.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon; 2 | 3 | public class JsonStringBuffer { 4 | 5 | private final StringBuffer mStrBuf = new StringBuffer(); 6 | 7 | private final int mStartIndentLevel; 8 | private int mIndentLevel = 0; 9 | 10 | /** Flag indicating that the parts written are 'commented-out' */ 11 | private boolean mComment = false; 12 | 13 | public JsonStringBuffer() { 14 | this(0); 15 | 16 | mStrBuf.append("{\n"); 17 | ++mIndentLevel; 18 | } 19 | 20 | public JsonStringBuffer(int pIndentLevel) { 21 | mStartIndentLevel = pIndentLevel; 22 | mIndentLevel = pIndentLevel; 23 | } 24 | 25 | public void newLine() { 26 | mStrBuf.append('\n'); 27 | } 28 | 29 | public void finish() { 30 | 31 | for (int i=0; i leds; 35 | 36 | /** 37 | * Writes the configuration to the given file 38 | * 39 | * @param mFilename The absolute filename 40 | * 41 | * @throws IOException If unable to write the given file 42 | */ 43 | public void saveConfigFile(String mFilename) throws IOException { 44 | 45 | try (FileWriter fw = new FileWriter(mFilename)) { 46 | fw.write("// Automatically generated configuration file for Hyperion ambilight daemon\n"); 47 | fw.write("// Notice: All values are explained with comments at our wiki: wiki.hyperion-project.org (config area) \n"); 48 | fw.write("// Generated by: HyperCon (The Hyperion deamon configuration file builder)\n" 49 | + "// "+ "Created with HyperCon " + (Main.versionStr) + " " +(Main.DateStr) + "\n"); 50 | fw.write("\n"); 51 | fw.write("{\n"); 52 | 53 | String deviceJson = mDeviceConfig.toJsonString(); 54 | fw.write(deviceJson + ",\n\n"); 55 | 56 | String colorJson = mColorConfig.toJsonString(); 57 | fw.write(colorJson + ",\n\n"); 58 | 59 | JsonStringBuffer jsonBuf = new JsonStringBuffer(1); 60 | 61 | mGrabberv4l2Config.appendTo(jsonBuf); 62 | 63 | mMiscConfig.appendTo(jsonBuf); 64 | 65 | ledsAppendTo(jsonBuf); 66 | 67 | jsonBuf.newLine(); 68 | 69 | jsonBuf.addValue("endOfJson", "endOfJson", true); 70 | 71 | fw.write(jsonBuf.toString()); 72 | 73 | fw.write("}\n"); 74 | } catch (IOException e) { 75 | throw e; 76 | } 77 | } 78 | 79 | void ledsAppendTo(JsonStringBuffer pJsonBuf) { 80 | String ledComment = "LED CONFIGURATION"; 81 | pJsonBuf.writeComment(ledComment); 82 | 83 | pJsonBuf.startArray("leds"); //$NON-NLS-1$ 84 | for (Led led : leds) 85 | { 86 | pJsonBuf.startObject(""); //$NON-NLS-1$ 87 | pJsonBuf.addValue("index", led.mLedSeqNr, false); //$NON-NLS-1$ 88 | pJsonBuf.addRawValue("hscan", String.format(Locale.ENGLISH, "{ %1$cminimum%1$c : %2$.4f, %1$cmaximum%1$c : %3$.4f }", '"', led.mImageRectangle.getMinX(), led.mImageRectangle.getMaxX()), false); //$NON-NLS-1$ //$NON-NLS-2$ 89 | pJsonBuf.addRawValue("vscan", String.format(Locale.ENGLISH, "{ %1$cminimum%1$c : %2$.4f, %1$cmaximum%1$c : %3$.4f }", '"', led.mImageRectangle.getMinY(), led.mImageRectangle.getMaxY()), true); //$NON-NLS-1$ //$NON-NLS-2$ 90 | pJsonBuf.stopObject(led.equals(leds.get(leds.size()-1))); 91 | } 92 | pJsonBuf.stopArray(false); 93 | } 94 | 95 | public static void main(String[] pArgs) { 96 | 97 | LedString ls = new LedString(); 98 | Led led = new Led(); 99 | led.mImageRectangle = new Rectangle(1,1,1,1); 100 | led.mLedSeqNr = 0; 101 | led.mLocation = new Point(1,2); 102 | led.mSide = BorderSide.bottom; 103 | ls.leds = new Vector(); 104 | ls.leds.add(led); 105 | try { 106 | ls.saveConfigFile("testclassconfig.json"); //$NON-NLS-1$ 107 | 108 | }catch (Exception e){ 109 | e.printStackTrace(); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/Main.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon; 2 | 3 | import java.awt.event.WindowAdapter; 4 | import java.awt.event.WindowEvent; 5 | import java.io.File; 6 | 7 | import javax.swing.*; 8 | 9 | import org.hyperion.hypercon.JavaVersion; 10 | import org.hyperion.hypercon.gui.ConfigPanel; 11 | import org.hyperion.hypercon.gui.SSH_Tab.SSHTrafficPrinterFrame; 12 | import org.hyperion.hypercon.language.language; 13 | import org.hyperion.hypercon.spec.SshAndColorPickerConfig; 14 | import org.hyperion.hypercon.spec.TransformConfig; 15 | 16 | /** 17 | * (static) Main-class for starting HyperCon (the Hyperion configuration file builder) as a standard 18 | * JAVA application (contains the entry-point). 19 | */ 20 | public class Main { 21 | public static final String configFilename = "hypercon.dat"; 22 | 23 | /** Some application settings (for easy/dirty access) */ 24 | public static final HyperConConfig HyperConConfig = new HyperConConfig(); 25 | 26 | public static String versionStr = "V1.03.3"; 27 | public static String DateStr = "(22.10.2017)"; 28 | /** 29 | * Entry point to start HyperCon 30 | * 31 | * @param pArgs HyperCon does not have command line arguments 32 | */ 33 | 34 | public static void main(String[] pArgs) { 35 | 36 | final LedString ledString = new LedString(); 37 | final SshAndColorPickerConfig sshConfig = new SshAndColorPickerConfig(); 38 | try { 39 | // Configure swing to use the system default look and feel 40 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 41 | } catch (Exception e) {} 42 | 43 | 44 | //check if the minimum java version is ok 45 | if (! JavaVersion.isOKJVMVersion()) { 46 | String message=language.getString("general.JavaVerionInfoMessage"); 47 | JOptionPane.showMessageDialog(new JFrame(), message, language.getString("general.HyperConInformationDialogTitle"), 48 | JOptionPane.INFORMATION_MESSAGE); 49 | } 50 | //Check for HyperCon version 51 | UpdateTool.main(pArgs); 52 | 53 | // Create a frame for the configuration panel 54 | JFrame frame = new JFrame(); 55 | ErrorHandling.mainframe = frame; 56 | String title = language.getString("general.title") + " -" + ((versionStr != null && !versionStr.isEmpty())? (" (" + versionStr + ")") : "") + " " + DateStr; 57 | frame.setTitle(title); 58 | frame.setSize(1400, 800); 59 | frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 60 | frame.setIconImage(new ImageIcon(Main.class.getResource("HyperConIcon_64.png")).getImage()); 61 | frame.addWindowListener(new WindowAdapter() { 62 | @Override 63 | public void windowClosing(WindowEvent e) { 64 | try { 65 | ConfigurationFile configFile = new ConfigurationFile(); 66 | configFile.store(Main.HyperConConfig); 67 | configFile.store(ledString.mDeviceConfig); 68 | configFile.store(ledString.mLedFrameConfig); 69 | configFile.store(ledString.mProcessConfig); 70 | configFile.store(ledString.mColorConfig); 71 | configFile.store(ledString.mMiscConfig); 72 | configFile.store(sshConfig); 73 | configFile.store(ledString.mGrabberv4l2Config); 74 | configFile.save(configFilename); 75 | } catch (Throwable t) { 76 | System.err.println(language.getString("general.failedtosave") + configFilename); 77 | } 78 | SshConnectionModel.getInstance().disconnect(); 79 | SSHTrafficPrinterFrame.close(); 80 | System.exit(0); return; 81 | } 82 | }); 83 | 84 | if (new File(configFilename).exists()) { 85 | try { 86 | ConfigurationFile configFile = new ConfigurationFile(); 87 | configFile.load(configFilename); 88 | configFile.restore(Main.HyperConConfig); 89 | configFile.restore(ledString.mDeviceConfig); 90 | configFile.restore(ledString.mLedFrameConfig); 91 | configFile.restore(ledString.mProcessConfig); 92 | configFile.restore(ledString.mColorConfig); 93 | configFile.restore(ledString.mMiscConfig); 94 | configFile.restore(sshConfig); 95 | configFile.restore(ledString.mGrabberv4l2Config); 96 | } catch (Throwable t) { 97 | System.err.println(language.getString("general.failedtoload") + configFilename); 98 | } 99 | if (ledString.mColorConfig.mTransforms.isEmpty()) { 100 | ledString.mColorConfig.mTransforms.add(new TransformConfig()); 101 | } 102 | } 103 | 104 | // Add the HyperCon configuration panel 105 | frame.setContentPane(new ConfigPanel(ledString, sshConfig)); 106 | 107 | // Show the frame 108 | frame.setVisible(true); 109 | } 110 | 111 | static void ShowError(String message){ 112 | new JOptionPane(message, JOptionPane.ERROR_MESSAGE); 113 | 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/Restart.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon; 2 | 3 | import java.awt.Window; 4 | import java.io.File; 5 | import java.io.IOException; 6 | import java.lang.management.ManagementFactory; 7 | import java.net.URISyntaxException; 8 | import java.util.ArrayList; 9 | 10 | public class Restart { 11 | 12 | public static void main(String[] args) throws IOException, InterruptedException { 13 | StringBuilder cmd = new StringBuilder(); 14 | cmd.append(System.getProperty("java.home") + File.separator + "bin" + File.separator + "java "); 15 | for (String jvmArg : ManagementFactory.getRuntimeMXBean().getInputArguments()) { 16 | cmd.append(jvmArg + " "); 17 | } 18 | cmd.append("-cp ").append(ManagementFactory.getRuntimeMXBean().getClassPath()).append(" "); 19 | cmd.append(Window.class.getName()).append(" "); 20 | 21 | try { 22 | Runtime.getRuntime().exec(cmd.toString()); 23 | } catch (IOException e) { 24 | // TODO Auto-generated catch block 25 | e.printStackTrace(); 26 | } 27 | 28 | // System.exit(0); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/UpdateTool.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon; 2 | 3 | import java.awt.Desktop; 4 | import java.io.IOException; 5 | import java.net.MalformedURLException; 6 | import java.net.URI; 7 | import java.net.URISyntaxException; 8 | import java.net.URL; 9 | 10 | import javax.swing.JFrame; 11 | import javax.swing.JOptionPane; 12 | import javax.xml.parsers.DocumentBuilder; 13 | import javax.xml.parsers.DocumentBuilderFactory; 14 | import javax.xml.parsers.ParserConfigurationException; 15 | 16 | import org.hyperion.hypercon.language.language; 17 | import org.jdom.Element; 18 | import org.jdom.input.DOMBuilder; 19 | import org.w3c.dom.Document; 20 | import org.xml.sax.SAXException; 21 | 22 | public class UpdateTool { 23 | 24 | private static final String UPDATE_URL = "https://raw.githubusercontent.com/hyperion-project/hypercon/master/update.xml"; 25 | private static final String ACTUAL_VERSION = Main.versionStr; 26 | 27 | public static void main(String[] args) { 28 | checkForUpdate(UPDATE_URL); 29 | } 30 | 31 | /** 32 | * This function checks for the update, and calls 33 | * {@link #getElementFromURL(String)} to catch an {@link Element} from the 34 | * given UPDATE_URL String. After that it will check if an update is 35 | * available for the current version with {@link #isVersionActual(String)}. 36 | * 37 | * If this is the case, then {@link #getElementFromURL(String)} will be 38 | * called to open the system web browser that is linked to the http url. 39 | * 40 | * If not so, then only a message is actually shown that there is no update 41 | * available. 42 | * 43 | * @param updateUrl the URL with the well formed xml that holds in the update information for hyperion 44 | * 45 | */ 46 | public static void checkForUpdate(String updateUrl) { 47 | try { 48 | 49 | Element rootElement = getElementFromURL(updateUrl); 50 | 51 | String actualVersion = rootElement.getChildText("actualVersion"); 52 | String versionInfo = rootElement.getChildText("versionInfo"); 53 | String updateURL = rootElement.getChildText("updateURL"); 54 | 55 | if (isVersionActual(actualVersion)) { 56 | String message=language.getString("general.versioncheck.newversionmessage") + "\n\n" + language.getString("general.versioncheck.currentversiontitle") +" "+ Main.versionStr + "\n" + language.getString("general.versioncheck.newversiontitle") +" "+ actualVersion + "\n" + language.getString("general.versioncheck.changelogtitle") +" "+ versionInfo + "\n\n" + language.getString("general.versioncheck.askfordownload"); 57 | int reply = JOptionPane.showConfirmDialog(new JFrame(), message, language.getString("general.HyperConInformationDialogTitle"), 58 | JOptionPane.YES_NO_OPTION); 59 | if (reply == JOptionPane.YES_OPTION) { 60 | try { 61 | openWebpage(new URL(updateURL)); 62 | System.exit(0); return; 63 | }finally { 64 | } 65 | } 66 | } else { 67 | System.out.println("UpdateCheck: There is no new version available"); 68 | } 69 | 70 | } catch (ParserConfigurationException e) { 71 | e.printStackTrace(); 72 | } catch (SAXException e){ 73 | e.printStackTrace(); 74 | } catch (IOException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | 79 | /** 80 | * This function catches the given URL and returns a {@link Element} 81 | * 82 | * @param updateUrl The url to get the XML file from web. 83 | * 84 | * @return a {@link Element} 85 | * 86 | * @throws ParserConfigurationException 87 | * @throws SAXException 88 | * @throws IOException 89 | * @throws MalformedURLException 90 | */ 91 | private static Element getElementFromURL(String updateUrl) 92 | throws ParserConfigurationException, SAXException, IOException, MalformedURLException { 93 | DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 94 | DocumentBuilder db = dbf.newDocumentBuilder(); 95 | Document doc = db.parse(new URL(updateUrl).openStream()); 96 | DOMBuilder builder = new DOMBuilder(); 97 | org.jdom.Document rootDocument = builder.build(doc); 98 | Element rootElement = rootDocument.getRootElement(); 99 | return rootElement; 100 | } 101 | 102 | /** 103 | * This function compares the parameter updateVersion with the static String 104 | * ACTUAL_VERSION. If updateVersion is greater than the ACTUAL_VERSION, true 105 | * will be returned, otherwise, the return value is false. 106 | * 107 | * @param updateVersion 108 | * the parsed version Info as {@link String} 109 | * @return a {@link Boolean} 110 | */ 111 | private static boolean isVersionActual(String updateVersion) { 112 | updateVersion = updateVersion.replace("V", "").replace(".", ""); 113 | Integer updateVersionAsInt = Integer.parseInt(updateVersion); 114 | String actualVersion = ACTUAL_VERSION.replace("V", "").replace(".", ""); 115 | Integer actualVersionAsInt = Integer.parseInt(actualVersion); 116 | return updateVersionAsInt > actualVersionAsInt; 117 | } 118 | 119 | /** 120 | * This function opens a given {@link URI} with the System Desktop 121 | * functions. 122 | * 123 | * @param uri a {@link URI} 124 | */ 125 | private static void openWebpage(URI uri) { 126 | Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; 127 | if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { 128 | try { 129 | desktop.browse(uri); 130 | } catch (Exception e) { 131 | e.printStackTrace(); 132 | } 133 | } 134 | } 135 | 136 | /** 137 | * This function converts an {@link URL} to an {@link URI} and calls 138 | * {@link #openWebpage(URI)}. 139 | * 140 | * @param url a {@link URL} 141 | */ 142 | private static void openWebpage(URL url) { 143 | try { 144 | openWebpage(url.toURI()); 145 | } catch (URISyntaxException e) { 146 | e.printStackTrace(); 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/External_Tab/BootEffectPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.External_Tab; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.beans.Transient; 7 | 8 | import javax.swing.BorderFactory; 9 | import javax.swing.GroupLayout; 10 | import javax.swing.JCheckBox; 11 | import javax.swing.JComboBox; 12 | import javax.swing.JLabel; 13 | import javax.swing.JPanel; 14 | import javax.swing.JSpinner; 15 | import javax.swing.SpinnerNumberModel; 16 | import javax.swing.event.ChangeEvent; 17 | import javax.swing.event.ChangeListener; 18 | import javax.swing.GroupLayout.Alignment; 19 | 20 | import org.hyperion.hypercon.spec.MiscConfig; 21 | import org.hyperion.hypercon.language.language; 22 | import org.hyperion.hypercon.spec.EffectStandard; 23 | 24 | public class BootEffectPanel extends JPanel { 25 | 26 | private final MiscConfig mMiscConfig; 27 | 28 | private JCheckBox mBootEffectEnable; 29 | 30 | private JLabel mEffectSetLabel; 31 | private JComboBox mEffectSetCombo; 32 | 33 | private JLabel mEffectDurationLabel; 34 | private JSpinner mEffectDurationSpinner; 35 | 36 | private JLabel mEffectPriorityLabel; 37 | private JSpinner mEffectPrioritySpinner; 38 | 39 | private JLabel mEffectColorLabel; 40 | private JSpinner mEffectColorRSpinner; 41 | private JSpinner mEffectColorGSpinner; 42 | private JSpinner mEffectColorBSpinner; 43 | 44 | public BootEffectPanel(final MiscConfig config) { 45 | 46 | super(); 47 | mMiscConfig = config; 48 | 49 | initialise(); 50 | } 51 | @Override 52 | @Transient 53 | public Dimension getMaximumSize() { 54 | Dimension maxSize = super.getMaximumSize(); 55 | Dimension prefSize = super.getPreferredSize(); 56 | return new Dimension(maxSize.width, prefSize.height); 57 | } 58 | private void initialise() { 59 | setBorder(BorderFactory.createTitledBorder(language.getString("external.effect.booteffect.title"))); //$NON-NLS-1$ 60 | 61 | mBootEffectEnable = new JCheckBox(language.getString("general.phrase.enabled")); //$NON-NLS-1$ 62 | mBootEffectEnable.setSelected(mMiscConfig.mBootEffectEnabled); 63 | mBootEffectEnable.addActionListener(mActionListener); 64 | add(mBootEffectEnable); 65 | 66 | mEffectSetLabel = new JLabel(language.getString("external.effect.booteffect.effectlabel")); //$NON-NLS-1$ 67 | add(mEffectSetLabel); 68 | 69 | mEffectSetCombo = new JComboBox<>(EffectStandard.values()); 70 | mEffectSetCombo.setSelectedItem(mMiscConfig.mEffectsetCombo); 71 | mEffectSetCombo.setToolTipText(language.getString("external.effect.booteffect.effecttooltip")); //$NON-NLS-1$ 72 | mEffectSetCombo.addActionListener(mActionListener); 73 | add(mEffectSetCombo); 74 | 75 | mEffectDurationLabel = new JLabel(language.getString("external.effect.booteffect.durationlabel")); //$NON-NLS-1$ 76 | add(mEffectDurationLabel); 77 | 78 | mEffectDurationSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mEffectDurationspinner*1, 0, null, 100)); 79 | mEffectDurationSpinner.setToolTipText(language.getString("external.effect.booteffect.durationtooltip")); //$NON-NLS-1$ 80 | mEffectDurationSpinner.addChangeListener(mChangeListener); 81 | add(mEffectDurationSpinner); 82 | 83 | mEffectPriorityLabel = new JLabel(language.getString("external.effect.booteffect.prioritylabel")); //$NON-NLS-1$ 84 | add(mEffectPriorityLabel); 85 | 86 | mEffectPrioritySpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mEffectPriorityspinner*1, 0, null, 25)); 87 | mEffectPrioritySpinner.setToolTipText(language.getString("external.effect.booteffect.prioritytooltip")); //$NON-NLS-1$ 88 | mEffectPrioritySpinner.addChangeListener(mChangeListener); 89 | add(mEffectPrioritySpinner); 90 | 91 | mEffectColorLabel = new JLabel(language.getString("external.effect.booteffect.staticcolorlabel")); //$NON-NLS-1$ 92 | add(mEffectColorLabel); 93 | 94 | mEffectColorRSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mEffectColorRspinner*1, 0, 255, 1)); 95 | mEffectColorRSpinner.setToolTipText(language.getString("external.effect.booteffect.staticcolorRtooltip")); //$NON-NLS-1$ 96 | mEffectColorRSpinner.addChangeListener(mChangeListener); 97 | 98 | mEffectColorGSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mEffectColorGspinner*1, 0, 255, 1)); 99 | mEffectColorGSpinner.setToolTipText(language.getString("external.effect.booteffect.staticcolorGtooltip")); //$NON-NLS-1$ 100 | mEffectColorGSpinner.addChangeListener(mChangeListener); 101 | 102 | mEffectColorBSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mEffectColorBspinner*1, 0, 255, 1)); 103 | mEffectColorBSpinner.setToolTipText(language.getString("external.effect.booteffect.staticcolorBtooltip")); //$NON-NLS-1$ 104 | mEffectColorBSpinner.addChangeListener(mChangeListener); 105 | 106 | GroupLayout layout = new GroupLayout(this); 107 | layout.setAutoCreateGaps(true); 108 | setLayout(layout); 109 | 110 | layout.setHorizontalGroup(layout 111 | .createSequentialGroup() 112 | .addGroup(layout.createParallelGroup() 113 | .addComponent(mBootEffectEnable) 114 | .addComponent(mEffectColorLabel) 115 | .addComponent(mEffectSetLabel) 116 | .addComponent(mEffectDurationLabel) 117 | .addComponent(mEffectPriorityLabel) 118 | ) 119 | .addGroup(layout.createParallelGroup() 120 | .addComponent(mBootEffectEnable) 121 | .addComponent(mEffectSetCombo) 122 | .addComponent(mEffectDurationSpinner) 123 | .addComponent(mEffectPrioritySpinner) 124 | .addGroup(layout.createSequentialGroup() 125 | .addComponent(mEffectColorRSpinner) 126 | .addComponent(mEffectColorGSpinner) 127 | .addComponent(mEffectColorBSpinner) 128 | ) 129 | ) 130 | 131 | ); 132 | layout.setVerticalGroup(layout 133 | .createSequentialGroup() 134 | .addComponent(mBootEffectEnable) 135 | 136 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 137 | .addComponent(mEffectColorLabel) 138 | .addComponent(mEffectColorRSpinner) 139 | .addComponent(mEffectColorGSpinner) 140 | .addComponent(mEffectColorBSpinner) 141 | ) 142 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 143 | .addComponent(mEffectSetLabel) 144 | .addComponent(mEffectSetCombo) 145 | ) 146 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 147 | .addComponent(mEffectDurationLabel) 148 | .addComponent(mEffectDurationSpinner) 149 | ) 150 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 151 | .addComponent(mEffectPriorityLabel) 152 | .addComponent(mEffectPrioritySpinner) 153 | ) 154 | ); 155 | toggleEnabled(mMiscConfig.mBootEffectEnabled); 156 | } 157 | 158 | 159 | 160 | private void toggleEnabled(boolean pEnabled) { 161 | 162 | mEffectSetLabel.setEnabled(pEnabled); 163 | mEffectSetCombo.setEnabled(pEnabled); 164 | mEffectDurationLabel.setEnabled(pEnabled); 165 | mEffectDurationSpinner.setEnabled(pEnabled); 166 | mEffectPriorityLabel.setEnabled(pEnabled); 167 | mEffectPrioritySpinner.setEnabled(pEnabled); 168 | mEffectColorLabel.setEnabled(pEnabled); 169 | mEffectColorRSpinner.setEnabled(pEnabled); 170 | mEffectColorGSpinner.setEnabled(pEnabled); 171 | mEffectColorBSpinner.setEnabled(pEnabled); 172 | } 173 | 174 | private final ActionListener mActionListener = new ActionListener() { 175 | @Override 176 | public void actionPerformed(ActionEvent e) { 177 | if (e.getSource().equals(mBootEffectEnable)) { 178 | mMiscConfig.mBootEffectEnabled = mBootEffectEnable 179 | .isSelected(); 180 | toggleEnabled(mMiscConfig.mBootEffectEnabled); 181 | } 182 | mMiscConfig.mEffectsetCombo = (EffectStandard) mEffectSetCombo.getSelectedItem(); 183 | } 184 | }; 185 | private final ChangeListener mChangeListener = new ChangeListener() { 186 | @Override 187 | public void stateChanged(ChangeEvent e) { 188 | mMiscConfig.mEffectDurationspinner = (int) mEffectDurationSpinner.getValue(); 189 | mMiscConfig.mEffectPriorityspinner = (int) mEffectPrioritySpinner.getValue(); 190 | mMiscConfig.mEffectColorRspinner = (int) mEffectColorRSpinner.getValue(); 191 | mMiscConfig.mEffectColorGspinner = (int) mEffectColorGSpinner.getValue(); 192 | mMiscConfig.mEffectColorBspinner = (int) mEffectColorBSpinner.getValue(); 193 | } 194 | }; 195 | } 196 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/External_Tab/ForwardPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.External_Tab; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.beans.Transient; 7 | 8 | import javax.swing.BorderFactory; 9 | import javax.swing.GroupLayout; 10 | import javax.swing.JCheckBox; 11 | import javax.swing.JLabel; 12 | import javax.swing.JPanel; 13 | import javax.swing.JSpinner; 14 | import javax.swing.JTextField; 15 | import javax.swing.SpinnerNumberModel; 16 | import javax.swing.event.ChangeEvent; 17 | import javax.swing.event.ChangeListener; 18 | import javax.swing.event.DocumentEvent; 19 | import javax.swing.event.DocumentListener; 20 | import javax.swing.GroupLayout.Alignment; 21 | 22 | import org.hyperion.hypercon.language.language; 23 | import org.hyperion.hypercon.spec.MiscConfig; 24 | 25 | 26 | public class ForwardPanel extends JPanel { 27 | 28 | private final MiscConfig mMiscConfig; 29 | 30 | private JCheckBox mforwardenableCheck; 31 | 32 | private JLabel mProtoLabel; 33 | private JTextField mProtoField; 34 | 35 | private JLabel mJsonLabel; 36 | private JTextField mJsonField; 37 | 38 | 39 | public ForwardPanel(final MiscConfig pMiscConfig) { 40 | super(); 41 | 42 | mMiscConfig = pMiscConfig; 43 | 44 | initialise(); 45 | } 46 | 47 | @Override 48 | @Transient 49 | public Dimension getMaximumSize() { 50 | Dimension maxSize = super.getMaximumSize(); 51 | Dimension prefSize = super.getPreferredSize(); 52 | return new Dimension(maxSize.width, prefSize.height); 53 | } 54 | 55 | private void initialise() { 56 | setBorder(BorderFactory.createTitledBorder(language.getString("external.forward.title"))); //$NON-NLS-1$ 57 | 58 | mforwardenableCheck = new JCheckBox(language.getString("general.phrase.enabled")); //$NON-NLS-1$ 59 | mforwardenableCheck.setSelected(mMiscConfig.mforwardEnabled); 60 | mforwardenableCheck.setToolTipText(language.getString("external.forward.enabledtooltip")); 61 | mforwardenableCheck.addActionListener(mActionListener); 62 | add(mforwardenableCheck); 63 | 64 | mProtoLabel = new JLabel(language.getString("external.forward.protolabel")); //$NON-NLS-1$ 65 | add(mProtoLabel); 66 | 67 | mProtoField = new JTextField(mMiscConfig.mProtofield); 68 | mProtoField.setToolTipText(language.getString("external.forward.protofieldtooltip")); //$NON-NLS-1$ 69 | mProtoField.getDocument().addDocumentListener(new DocumentListener() { 70 | @Override 71 | public void removeUpdate(DocumentEvent e) { 72 | mMiscConfig.mProtofield = mProtoField.getText(); 73 | } 74 | @Override 75 | public void insertUpdate(DocumentEvent e) { 76 | mMiscConfig.mProtofield = mProtoField.getText(); 77 | } 78 | @Override 79 | public void changedUpdate(DocumentEvent e) { 80 | mMiscConfig.mProtofield = mProtoField.getText(); 81 | } 82 | }); 83 | add(mProtoField); 84 | 85 | 86 | mJsonLabel = new JLabel(language.getString("external.forward.jsonlabel")); //$NON-NLS-1$ 87 | add(mJsonLabel); 88 | 89 | mJsonField = new JTextField(mMiscConfig.mJsonfield); 90 | mJsonField.setToolTipText(language.getString("external.forward.jsonfieldtooltip")); //$NON-NLS-1$ 91 | mJsonField.getDocument().addDocumentListener(new DocumentListener() { 92 | @Override 93 | public void removeUpdate(DocumentEvent e) { 94 | mMiscConfig.mJsonfield = mJsonField.getText(); 95 | } 96 | @Override 97 | public void insertUpdate(DocumentEvent e) { 98 | mMiscConfig.mJsonfield = mJsonField.getText(); 99 | } 100 | @Override 101 | public void changedUpdate(DocumentEvent e) { 102 | mMiscConfig.mJsonfield = mJsonField.getText(); 103 | } 104 | }); 105 | add(mJsonField); 106 | 107 | 108 | GroupLayout layout = new GroupLayout(this); 109 | layout.setAutoCreateGaps(true); 110 | setLayout(layout); 111 | 112 | layout.setHorizontalGroup(layout 113 | .createSequentialGroup() 114 | .addGroup(layout.createParallelGroup() 115 | .addComponent(mforwardenableCheck) 116 | .addComponent(mProtoLabel) 117 | .addComponent(mJsonLabel) 118 | ) 119 | .addGroup(layout.createParallelGroup() 120 | // .addComponent(mforwardenableCheck) 121 | .addComponent(mProtoField) 122 | .addComponent(mJsonField) 123 | ) 124 | ); 125 | layout.setVerticalGroup(layout 126 | .createSequentialGroup() 127 | .addComponent(mforwardenableCheck) 128 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 129 | .addComponent(mProtoLabel) 130 | .addComponent(mProtoField) 131 | ) 132 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 133 | .addComponent(mJsonLabel) 134 | .addComponent(mJsonField) 135 | ) 136 | 137 | ); 138 | toggleEnabled(mMiscConfig.mforwardEnabled); 139 | } 140 | 141 | private void toggleEnabled(boolean pEnabled) { 142 | mProtoLabel.setEnabled(pEnabled); 143 | mJsonLabel.setEnabled(pEnabled); 144 | 145 | mProtoField.setEnabled(pEnabled); 146 | mJsonField.setEnabled(pEnabled); 147 | } 148 | 149 | private final ActionListener mActionListener = new ActionListener() { 150 | @Override 151 | public void actionPerformed(ActionEvent e) { 152 | if (e.getSource().equals(mforwardenableCheck)) { 153 | mMiscConfig.mforwardEnabled = mforwardenableCheck 154 | .isSelected(); 155 | toggleEnabled(mMiscConfig.mforwardEnabled); 156 | } 157 | 158 | } 159 | }; 160 | 161 | 162 | 163 | } 164 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Grabber_Tab/FrameGrabberPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Grabber_Tab; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.beans.Transient; 7 | 8 | import javax.swing.BorderFactory; 9 | import javax.swing.GroupLayout; 10 | import javax.swing.JCheckBox; 11 | import javax.swing.JLabel; 12 | import javax.swing.JPanel; 13 | import javax.swing.JSpinner; 14 | import javax.swing.SpinnerNumberModel; 15 | import javax.swing.GroupLayout.Alignment; 16 | import javax.swing.event.ChangeEvent; 17 | import javax.swing.event.ChangeListener; 18 | 19 | import org.hyperion.hypercon.language.language; 20 | import org.hyperion.hypercon.spec.MiscConfig; 21 | 22 | public class FrameGrabberPanel extends JPanel { 23 | 24 | private final MiscConfig mMiscConfig; 25 | 26 | private JCheckBox mFrameGrabberCheck; 27 | private JLabel mWidthLabel; 28 | private JSpinner mWidthSpinner; 29 | private JLabel mHeightLabel; 30 | private JSpinner mHeightSpinner; 31 | private JLabel mIntervalLabel; 32 | private JSpinner mIntervalSpinner; 33 | private JLabel mPriorityLabel; 34 | private JSpinner mPrioritySpinner; 35 | 36 | public FrameGrabberPanel(final MiscConfig pMiscConfig) { 37 | super(); 38 | 39 | mMiscConfig = pMiscConfig; 40 | 41 | initialise(); 42 | } 43 | 44 | @Override 45 | @Transient 46 | public Dimension getMaximumSize() { 47 | Dimension maxSize = super.getMaximumSize(); 48 | Dimension prefSize = super.getPreferredSize(); 49 | return new Dimension(maxSize.width, prefSize.height); 50 | } 51 | 52 | private void initialise() { 53 | setBorder(BorderFactory.createTitledBorder(language.getString("grabber.intframegrabber.title"))); //$NON-NLS-1$ 54 | 55 | mFrameGrabberCheck = new JCheckBox(language.getString("general.phrase.enabled")); //$NON-NLS-1$ 56 | mFrameGrabberCheck.setSelected(mMiscConfig.mFrameGrabberEnabled); 57 | mFrameGrabberCheck.addActionListener(mActionListener); 58 | add(mFrameGrabberCheck); 59 | 60 | mWidthLabel = new JLabel(language.getString("grabber.intframegrabber.widthlabel")); //$NON-NLS-1$ 61 | add(mWidthLabel); 62 | 63 | mWidthSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mFrameGrabberWidth, 16, 1024, 1)); 64 | mWidthSpinner.addChangeListener(mChangeListener); 65 | add(mWidthSpinner); 66 | 67 | mHeightLabel = new JLabel(language.getString("grabber.intframegrabber.heightlabel")); //$NON-NLS-1$ 68 | add(mHeightLabel); 69 | 70 | mHeightSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mFrameGrabberHeight, 16, 1024, 1)); 71 | mHeightSpinner.addChangeListener(mChangeListener); 72 | add(mHeightSpinner); 73 | 74 | mIntervalLabel = new JLabel(language.getString("grabber.intframegrabber.intervallabel")); //$NON-NLS-1$ 75 | add(mIntervalLabel); 76 | 77 | mIntervalSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mFrameGrabberInterval_ms, 10, 60000, 10)); 78 | mIntervalSpinner.addChangeListener(mChangeListener); 79 | add(mIntervalSpinner); 80 | 81 | mPriorityLabel = new JLabel(language.getString("general.phrase.prioritylabel")); //$NON-NLS-1$ 82 | add(mPriorityLabel); 83 | 84 | mPrioritySpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mFrameGrabberPriority, 0, 5000, 1)); 85 | mPrioritySpinner.setToolTipText(language.getString("grabber.intframegrabber.prioritytooltip")); 86 | mPrioritySpinner.addChangeListener(mChangeListener); 87 | add(mPrioritySpinner); 88 | 89 | GroupLayout layout = new GroupLayout(this); 90 | layout.setAutoCreateGaps(true); 91 | setLayout(layout); 92 | 93 | layout.setHorizontalGroup(layout.createSequentialGroup() 94 | .addGroup(layout.createParallelGroup() 95 | .addComponent(mFrameGrabberCheck) 96 | .addComponent(mWidthLabel) 97 | .addComponent(mHeightLabel) 98 | .addComponent(mIntervalLabel) 99 | .addComponent(mPriorityLabel) 100 | ) 101 | .addGroup(layout.createParallelGroup() 102 | .addComponent(mFrameGrabberCheck) 103 | .addComponent(mWidthSpinner) 104 | .addComponent(mHeightSpinner) 105 | .addComponent(mIntervalSpinner) 106 | .addComponent(mPrioritySpinner) 107 | )); 108 | layout.setVerticalGroup(layout.createSequentialGroup() 109 | .addComponent(mFrameGrabberCheck) 110 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 111 | .addComponent(mWidthLabel) 112 | .addComponent(mWidthSpinner) 113 | ) 114 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 115 | .addComponent(mHeightLabel) 116 | .addComponent(mHeightSpinner) 117 | ) 118 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 119 | .addComponent(mIntervalLabel) 120 | .addComponent(mIntervalSpinner) 121 | ) 122 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 123 | .addComponent(mPriorityLabel) 124 | .addComponent(mPrioritySpinner) 125 | )); 126 | 127 | toggleEnabled(mMiscConfig.mFrameGrabberEnabled); 128 | } 129 | 130 | private void toggleEnabled(boolean pEnabled) { 131 | mWidthLabel.setEnabled(pEnabled); 132 | mWidthSpinner.setEnabled(pEnabled); 133 | mHeightLabel.setEnabled(pEnabled); 134 | mHeightSpinner.setEnabled(pEnabled); 135 | mIntervalLabel.setEnabled(pEnabled); 136 | mIntervalSpinner.setEnabled(pEnabled); 137 | mPriorityLabel.setEnabled(pEnabled); 138 | mPrioritySpinner.setEnabled(pEnabled); 139 | } 140 | 141 | private final ActionListener mActionListener = new ActionListener() { 142 | @Override 143 | public void actionPerformed(ActionEvent e) { 144 | mMiscConfig.mFrameGrabberEnabled = mFrameGrabberCheck.isSelected(); 145 | 146 | toggleEnabled(mMiscConfig.mFrameGrabberEnabled); 147 | } 148 | }; 149 | private final ChangeListener mChangeListener = new ChangeListener() { 150 | @Override 151 | public void stateChanged(ChangeEvent e) { 152 | mMiscConfig.mFrameGrabberWidth = (Integer)mWidthSpinner.getValue(); 153 | mMiscConfig.mFrameGrabberHeight = (Integer)mHeightSpinner.getValue(); 154 | mMiscConfig.mFrameGrabberInterval_ms = (Integer)mIntervalSpinner.getValue(); 155 | mMiscConfig.mFrameGrabberPriority = (Integer)mPrioritySpinner.getValue(); 156 | } 157 | }; 158 | } 159 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/DevicePanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Dimension; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.beans.Transient; 8 | 9 | import javax.swing.BorderFactory; 10 | import javax.swing.GroupLayout; 11 | import javax.swing.JComboBox; 12 | import javax.swing.JLabel; 13 | import javax.swing.JPanel; 14 | import javax.swing.JTextField; 15 | import javax.swing.GroupLayout.Alignment; 16 | import javax.swing.event.DocumentEvent; 17 | import javax.swing.event.DocumentListener; 18 | 19 | import org.hyperion.hypercon.gui.Hardware_Tab.device.DeviceTypePanel; 20 | import org.hyperion.hypercon.language.language; 21 | import org.hyperion.hypercon.spec.ColorByteOrder; 22 | import org.hyperion.hypercon.spec.DeviceConfig; 23 | import org.hyperion.hypercon.spec.DeviceType; 24 | 25 | public class DevicePanel extends JPanel { 26 | 27 | public static final String[] KnownOutputs = {"/dev/spidev0.0", "/dev/spidev0.1", "/dev/ttyS0", "/dev/ttyUSB0", "/dev/ttyprintk", "/home/pi/test.out", "/dev/null"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ 28 | 29 | private final DeviceConfig mDeviceConfig; 30 | 31 | private JLabel mNameLabel; 32 | private JTextField mNameField; 33 | 34 | private JLabel mTypeLabel; 35 | private JComboBox mTypeCombo; 36 | 37 | private JPanel mDevicePanel; 38 | 39 | private JLabel mRgbLabel; 40 | private JComboBox mRgbCombo; 41 | 42 | public DevicePanel(DeviceConfig pDeviceConfig) { 43 | super(); 44 | 45 | mDeviceConfig = pDeviceConfig; 46 | 47 | initialise(); 48 | } 49 | 50 | @Override 51 | @Transient 52 | public Dimension getMaximumSize() { 53 | Dimension maxSize = super.getMaximumSize(); 54 | Dimension prefSize = super.getPreferredSize(); 55 | return new Dimension(maxSize.width, prefSize.height); 56 | } 57 | 58 | private void initialise() { 59 | setBorder(BorderFactory.createTitledBorder(language.getString("hardware.device.title"))); //$NON-NLS-1$ 60 | 61 | mNameLabel = new JLabel(language.getString("hardware.device.namelabel")); //$NON-NLS-1$ 62 | mNameLabel.setMinimumSize(new Dimension(80, 10)); 63 | add(mNameLabel); 64 | 65 | mNameField = new JTextField(mDeviceConfig.mNameField); 66 | mNameField.getDocument().addDocumentListener(new DocumentListener() { 67 | @Override 68 | public void removeUpdate(DocumentEvent e) { 69 | mDeviceConfig.mNameField = mNameField.getText(); 70 | } 71 | 72 | @Override 73 | public void insertUpdate(DocumentEvent e) { 74 | mDeviceConfig.mNameField = mNameField.getText(); 75 | } 76 | 77 | @Override 78 | public void changedUpdate(DocumentEvent e) { 79 | mDeviceConfig.mNameField = mNameField.getText(); 80 | } 81 | }); 82 | add(mNameField); 83 | 84 | mTypeLabel = new JLabel(language.getString("hardware.device.typlabel")); //$NON-NLS-1$ 85 | mTypeLabel.setMinimumSize(new Dimension(80, 10)); 86 | add(mTypeLabel); 87 | 88 | mTypeCombo = new JComboBox<>(DeviceType.values()); 89 | mTypeCombo.setSelectedItem(mDeviceConfig.mType); 90 | mTypeCombo.addActionListener(mActionListener); 91 | add(mTypeCombo); 92 | 93 | mDevicePanel = new JPanel(); 94 | mDevicePanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); 95 | mDevicePanel.setLayout(new BorderLayout()); 96 | DeviceTypePanel typePanel = mDeviceConfig.mType.getConfigPanel(mDeviceConfig); 97 | if (typePanel != null) { 98 | mDevicePanel.add(typePanel, BorderLayout.CENTER); 99 | } 100 | add(mDevicePanel); 101 | 102 | mRgbLabel = new JLabel(language.getString("hardware.device.rgborderlabel")); //$NON-NLS-1$ 103 | mRgbLabel.setMinimumSize(new Dimension(80, 10)); 104 | add(mRgbLabel); 105 | 106 | mRgbCombo = new JComboBox<>(ColorByteOrder.values()); 107 | mRgbCombo.setSelectedItem(mDeviceConfig.mColorByteOrder); 108 | mRgbCombo.addActionListener(mActionListener); 109 | add(mRgbCombo); 110 | 111 | GroupLayout layout = new GroupLayout(this); 112 | layout.setAutoCreateGaps(true); 113 | setLayout(layout); 114 | 115 | layout.setHorizontalGroup(layout.createParallelGroup() 116 | .addGroup(layout.createSequentialGroup() 117 | .addComponent(mNameLabel) 118 | .addComponent(mNameField)) 119 | .addGroup(layout.createSequentialGroup() 120 | .addComponent(mTypeLabel) 121 | .addComponent(mTypeCombo)) 122 | .addComponent(mDevicePanel) 123 | .addGroup(layout.createSequentialGroup() 124 | .addComponent(mRgbLabel) 125 | .addComponent(mRgbCombo))); 126 | layout.setVerticalGroup(layout.createSequentialGroup() 127 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 128 | .addComponent(mNameLabel) 129 | .addComponent(mNameField)) 130 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 131 | .addComponent(mTypeLabel) 132 | .addComponent(mTypeCombo)) 133 | .addComponent(mDevicePanel) 134 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 135 | .addComponent(mRgbLabel) 136 | .addComponent(mRgbCombo))); 137 | } 138 | 139 | private final ActionListener mActionListener = new ActionListener() { 140 | @Override 141 | public void actionPerformed(ActionEvent e) { 142 | mDeviceConfig.mType = (DeviceType)mTypeCombo.getSelectedItem(); 143 | mDeviceConfig.mColorByteOrder = (ColorByteOrder)mRgbCombo.getSelectedItem(); 144 | 145 | mDevicePanel.removeAll(); 146 | DeviceTypePanel typePanel = mDeviceConfig.mType.getConfigPanel(mDeviceConfig); 147 | if (typePanel != null) { 148 | mDevicePanel.add(typePanel, BorderLayout.CENTER); 149 | } 150 | revalidate(); 151 | repaint(); 152 | } 153 | }; 154 | } 155 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/ImageProcessPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab; 2 | 3 | import java.awt.Dimension; 4 | import java.beans.Transient; 5 | 6 | import javax.swing.BorderFactory; 7 | import javax.swing.GroupLayout; 8 | import javax.swing.JLabel; 9 | import javax.swing.JPanel; 10 | import javax.swing.JSpinner; 11 | import javax.swing.SpinnerNumberModel; 12 | import javax.swing.GroupLayout.Alignment; 13 | import javax.swing.event.ChangeEvent; 14 | import javax.swing.event.ChangeListener; 15 | 16 | import org.hyperion.hypercon.language.language; 17 | import org.hyperion.hypercon.spec.ImageProcessConfig; 18 | 19 | public class ImageProcessPanel extends JPanel { 20 | 21 | private final ImageProcessConfig mProcessConfig; 22 | 23 | private JLabel mHorizontalDepthLabel; 24 | private JSpinner mHorizontalDepthSpinner; 25 | private JLabel mVerticalDepthLabel; 26 | private JSpinner mVerticalDepthSpinner; 27 | 28 | private JLabel mHorizontalGapLabel; 29 | private JSpinner mHorizontalGapSpinner; 30 | private JLabel mVerticalGapLabel; 31 | private JSpinner mVerticalGapSpinner; 32 | 33 | private JLabel mOverlapLabel; 34 | private JSpinner mOverlapSpinner; 35 | 36 | public ImageProcessPanel(ImageProcessConfig pProcessConfig) { 37 | super(); 38 | 39 | mProcessConfig = pProcessConfig; 40 | 41 | initialise(); 42 | } 43 | 44 | @Override 45 | @Transient 46 | public Dimension getMaximumSize() { 47 | Dimension maxSize = super.getMaximumSize(); 48 | Dimension prefSize = super.getPreferredSize(); 49 | return new Dimension(maxSize.width, prefSize.height); 50 | } 51 | 52 | private void initialise() { 53 | setBorder(BorderFactory.createTitledBorder(language.getString("hardware.imageprocess.title"))); //$NON-NLS-1$ 54 | 55 | mHorizontalDepthLabel = new JLabel(language.getString("hardware.imageprocess.horizontaldepthlabel")); //$NON-NLS-1$ 56 | add(mHorizontalDepthLabel); 57 | 58 | mHorizontalDepthSpinner = new JSpinner(new SpinnerNumberModel(mProcessConfig.mHorizontalDepth*100.0, 1.0, 100.0, 1.0)); 59 | mHorizontalDepthSpinner.setToolTipText(language.getString("hardware.imageprocess.horizontaldepthtooltip")); 60 | mHorizontalDepthSpinner.addChangeListener(mChangeListener); 61 | add(mHorizontalDepthSpinner); 62 | 63 | mVerticalDepthLabel = new JLabel(language.getString("hardware.imageprocess.verticaldepthlabel")); //$NON-NLS-1$ 64 | add(mVerticalDepthLabel); 65 | 66 | mVerticalDepthSpinner = new JSpinner(new SpinnerNumberModel(mProcessConfig.mVerticalDepth*100.0, 1.0, 100.0, 1.0)); 67 | mVerticalDepthSpinner.setToolTipText(language.getString("hardware.imageprocess.verticaldepthtooltip")); 68 | mVerticalDepthSpinner.addChangeListener(mChangeListener); 69 | add(mVerticalDepthSpinner); 70 | 71 | mHorizontalGapLabel = new JLabel(language.getString("hardware.imageprocess.horizontalgaplabel")); //$NON-NLS-1$ 72 | add(mHorizontalGapLabel); 73 | 74 | mHorizontalGapSpinner = new JSpinner(new SpinnerNumberModel(mProcessConfig.mHorizontalGap*100.0, 0.0, 50.0, 1.0)); 75 | mHorizontalGapSpinner.setToolTipText(language.getString("hardware.imageprocess.horizontalgaptooltip")); 76 | mHorizontalGapSpinner.addChangeListener(mChangeListener); 77 | add(mHorizontalGapSpinner); 78 | 79 | mVerticalGapLabel = new JLabel(language.getString("hardware.imageprocess.verticalgaplabel")); //$NON-NLS-1$ 80 | add(mVerticalGapLabel); 81 | 82 | mVerticalGapSpinner = new JSpinner(new SpinnerNumberModel(mProcessConfig.mVerticalGap*100.0, 0.0, 50.0, 1.0)); 83 | mVerticalGapSpinner.setToolTipText(language.getString("hardware.imageprocess.verticalgaptooltip")); 84 | mVerticalGapSpinner.addChangeListener(mChangeListener); 85 | add(mVerticalGapSpinner); 86 | 87 | mOverlapLabel = new JLabel(language.getString("hardware.imageprocess.overlaplabel")); //$NON-NLS-1$ 88 | add(mOverlapLabel); 89 | 90 | mOverlapSpinner = new JSpinner(new SpinnerNumberModel(mProcessConfig.mOverlapFraction*100.0, -100.0, 100.0, 1.0)); 91 | mOverlapSpinner.setToolTipText(language.getString("hardware.imageprocess.overlaptooltip")); 92 | mOverlapSpinner.addChangeListener(mChangeListener); 93 | add(mOverlapSpinner); 94 | 95 | GroupLayout layout = new GroupLayout(this); 96 | layout.setAutoCreateGaps(true); 97 | setLayout(layout); 98 | 99 | layout.setHorizontalGroup(layout.createSequentialGroup() 100 | .addGroup(layout.createParallelGroup() 101 | .addComponent(mHorizontalDepthLabel) 102 | .addComponent(mVerticalDepthLabel) 103 | .addComponent(mHorizontalGapLabel) 104 | .addComponent(mVerticalGapLabel) 105 | .addComponent(mOverlapLabel) 106 | ) 107 | .addGroup(layout.createParallelGroup() 108 | .addComponent(mHorizontalDepthSpinner) 109 | .addComponent(mVerticalDepthSpinner) 110 | .addComponent(mHorizontalGapSpinner) 111 | .addComponent(mVerticalGapSpinner) 112 | .addComponent(mOverlapSpinner) 113 | ) 114 | ); 115 | layout.setVerticalGroup(layout.createSequentialGroup() 116 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 117 | .addComponent(mHorizontalDepthLabel) 118 | .addComponent(mHorizontalDepthSpinner) 119 | ) 120 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 121 | .addComponent(mVerticalDepthLabel) 122 | .addComponent(mVerticalDepthSpinner) 123 | ) 124 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 125 | .addComponent(mHorizontalGapLabel) 126 | .addComponent(mHorizontalGapSpinner) 127 | ) 128 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 129 | .addComponent(mVerticalGapLabel) 130 | .addComponent(mVerticalGapSpinner) 131 | ) 132 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 133 | .addComponent(mOverlapLabel) 134 | .addComponent(mOverlapSpinner) 135 | )); 136 | } 137 | 138 | private final ChangeListener mChangeListener = new ChangeListener() { 139 | @Override 140 | public void stateChanged(ChangeEvent e) { 141 | // Update the processing configuration 142 | mProcessConfig.setHorizontalDepth(((Double)mHorizontalDepthSpinner.getValue())/100.0); 143 | mProcessConfig.setVerticalDepth(((Double)mVerticalDepthSpinner.getValue())/100.0); 144 | mProcessConfig.setHorizontalGap(((Double)mHorizontalGapSpinner.getValue())/100.0); 145 | mProcessConfig.setVerticalGap(((Double)mVerticalGapSpinner.getValue())/100.0); 146 | mProcessConfig.setOverlapFraction(((Double)mOverlapSpinner.getValue())/100.0); 147 | // Notify observers 148 | mProcessConfig.notifyObservers(this); 149 | }}; 150 | 151 | } 152 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/DeviceTypePanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import java.awt.Dimension; 4 | 5 | import javax.swing.JPanel; 6 | 7 | import org.hyperion.hypercon.spec.DeviceConfig; 8 | 9 | public abstract class DeviceTypePanel extends JPanel { 10 | 11 | protected final Dimension firstColMinDim = new Dimension(80, 10); 12 | protected final Dimension maxDim = new Dimension(1024, 20); 13 | 14 | protected DeviceConfig mDeviceConfig = null; 15 | 16 | public DeviceTypePanel() { 17 | super(); 18 | } 19 | 20 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 21 | mDeviceConfig = pDeviceConfig; 22 | } 23 | 24 | public String getValue(String pKey, String pDefault) { 25 | if (!mDeviceConfig.mDeviceProperties.contains(pKey)) { 26 | return pDefault; 27 | } 28 | return mDeviceConfig.mDeviceProperties.get(pKey).toString(); 29 | } 30 | 31 | public int getValue(String pKey, int pDefault) { 32 | if (!mDeviceConfig.mDeviceProperties.contains(pKey)) { 33 | return pDefault; 34 | } 35 | try { 36 | return Integer.parseInt(mDeviceConfig.mDeviceProperties.get(pKey).toString()); 37 | } catch (Throwable t) {} 38 | return pDefault; 39 | } 40 | 41 | public boolean getValue(String pKey, boolean pDefault) { 42 | if (!mDeviceConfig.mDeviceProperties.contains(pKey)) { 43 | return pDefault; 44 | } 45 | try { 46 | return Boolean.parseBoolean(mDeviceConfig.mDeviceProperties.get(pKey).toString()); 47 | } catch (Throwable t) {} 48 | return pDefault; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/FadeCandyPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JLabel; 5 | import javax.swing.JSpinner; 6 | import javax.swing.JTextField; 7 | import javax.swing.SpinnerNumberModel; 8 | import javax.swing.GroupLayout.Alignment; 9 | import javax.swing.event.ChangeEvent; 10 | import javax.swing.event.ChangeListener; 11 | import javax.swing.event.DocumentEvent; 12 | import javax.swing.event.DocumentListener; 13 | 14 | import org.hyperion.hypercon.language.language; 15 | import org.hyperion.hypercon.spec.DeviceConfig; 16 | 17 | public class FadeCandyPanel extends DeviceTypePanel { 18 | 19 | 20 | private JLabel mHostLabel; 21 | private JTextField mHostField; 22 | 23 | private JLabel mPortLabel; 24 | private JSpinner mPortSpinner; 25 | 26 | private JLabel mChannelLabel; 27 | private JSpinner mChannelSpinner; 28 | 29 | public FadeCandyPanel() { 30 | super(); 31 | 32 | initialise(); 33 | } 34 | 35 | @Override 36 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 37 | super.setDeviceConfig(pDeviceConfig); 38 | 39 | // Make sure that the device specific configuration (and only device specific) is set 40 | String host = getValue("output", "127.0.0.1"); 41 | int port = getValue("port", 7890); 42 | int channel = getValue("channel", 0); 43 | 44 | mDeviceConfig.mDeviceProperties.clear(); 45 | mDeviceConfig.mDeviceProperties.put("output", host); 46 | mDeviceConfig.mDeviceProperties.put("port", port); 47 | mDeviceConfig.mDeviceProperties.put("channel", channel); 48 | 49 | mHostField.setText(host); 50 | mPortSpinner.setValue(port); 51 | mChannelSpinner.setValue(channel); 52 | } 53 | 54 | private void initialise() { 55 | mHostLabel = new JLabel(language.getString("hardware.leddevice.host")); 56 | mHostLabel.setMinimumSize(firstColMinDim); 57 | add(mHostLabel); 58 | 59 | mHostField = new JTextField(); 60 | mHostField.setMaximumSize(maxDim); 61 | mHostField.getDocument().addDocumentListener(new DocumentListener() { 62 | @Override 63 | public void removeUpdate(DocumentEvent e) { 64 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 65 | } 66 | @Override 67 | public void insertUpdate(DocumentEvent e) { 68 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 69 | } 70 | @Override 71 | public void changedUpdate(DocumentEvent e) { 72 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 73 | } 74 | }); 75 | add(mHostField); 76 | 77 | mPortLabel = new JLabel(language.getString("hardware.leddevice.portLabel")); 78 | mPortLabel.setMinimumSize(firstColMinDim); 79 | add(mPortLabel); 80 | 81 | mPortSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 65535, 1)); 82 | JSpinner.NumberEditor mPortSpinnereditor = new JSpinner.NumberEditor(mPortSpinner, "#"); 83 | mPortSpinner.setEditor(mPortSpinnereditor); 84 | mPortSpinnereditor.getTextField().setHorizontalAlignment(JLabel.LEFT); 85 | mPortSpinner.setMaximumSize(maxDim); 86 | mPortSpinner.addChangeListener(mChangeListener); 87 | add(mPortSpinner); 88 | 89 | mChannelLabel = new JLabel(language.getString("hardware.leddevice.channellabel")); 90 | mChannelLabel.setMinimumSize(firstColMinDim); 91 | add(mChannelLabel); 92 | 93 | mChannelSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 99999, 1)); 94 | mChannelSpinner.setMaximumSize(maxDim); 95 | mChannelSpinner.addChangeListener(mChangeListener); 96 | add(mChannelSpinner); 97 | 98 | GroupLayout layout = new GroupLayout(this); 99 | layout.setAutoCreateGaps(true); 100 | setLayout(layout); 101 | 102 | layout.setHorizontalGroup(layout.createSequentialGroup() 103 | .addGroup(layout.createParallelGroup() 104 | .addComponent(mHostLabel) 105 | .addComponent(mPortLabel) 106 | .addComponent(mChannelLabel)) 107 | .addGroup(layout.createParallelGroup() 108 | .addComponent(mHostField) 109 | .addComponent(mPortSpinner) 110 | .addComponent(mChannelSpinner)) 111 | ); 112 | layout.setVerticalGroup(layout.createSequentialGroup() 113 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 114 | .addComponent(mHostLabel) 115 | .addComponent(mHostField)) 116 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 117 | .addComponent(mPortLabel) 118 | .addComponent(mPortSpinner)) 119 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 120 | .addComponent(mChannelLabel) 121 | .addComponent(mChannelSpinner)) 122 | ); 123 | } 124 | 125 | private ChangeListener mChangeListener = new ChangeListener() { 126 | @Override 127 | public void stateChanged(ChangeEvent e) { 128 | if (e.getSource() == mPortSpinner) { 129 | mDeviceConfig.mDeviceProperties.put("port", mPortSpinner.getValue()); 130 | } else if (e.getSource() == mChannelSpinner) { 131 | mDeviceConfig.mDeviceProperties.put("channel", mChannelSpinner.getValue()); 132 | } 133 | } 134 | }; 135 | } 136 | 137 | 138 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/LightPackPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JLabel; 5 | import javax.swing.JTextField; 6 | import javax.swing.GroupLayout.Alignment; 7 | import javax.swing.event.DocumentEvent; 8 | import javax.swing.event.DocumentListener; 9 | 10 | import org.hyperion.hypercon.language.language; 11 | import org.hyperion.hypercon.spec.DeviceConfig; 12 | 13 | public class LightPackPanel extends DeviceTypePanel { 14 | 15 | private JLabel mSerialNoLabel; 16 | private JTextField mSerialNoField; 17 | 18 | public LightPackPanel() { 19 | super(); 20 | 21 | initialise(); 22 | } 23 | 24 | @Override 25 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 26 | super.setDeviceConfig(pDeviceConfig); 27 | 28 | // Make sure that the device specific configuration (and only device specific) is set 29 | String output = getValue("output", ""); 30 | mDeviceConfig.mDeviceProperties.clear(); 31 | mDeviceConfig.mDeviceProperties.put("output", output); 32 | 33 | mSerialNoField.setText(output); 34 | } 35 | 36 | private void initialise() { 37 | mSerialNoLabel = new JLabel(language.getString("hardware.leddevice.serialno")); 38 | mSerialNoLabel.setMinimumSize(firstColMinDim); 39 | add(mSerialNoLabel); 40 | 41 | mSerialNoField = new JTextField(); 42 | mSerialNoField.setMaximumSize(maxDim); 43 | mSerialNoField.getDocument().addDocumentListener(new DocumentListener() { 44 | @Override 45 | public void removeUpdate(DocumentEvent e) { 46 | mDeviceConfig.mDeviceProperties.put("output", mSerialNoField.getText()); 47 | } 48 | @Override 49 | public void insertUpdate(DocumentEvent e) { 50 | mDeviceConfig.mDeviceProperties.put("output", mSerialNoField.getText()); 51 | } 52 | @Override 53 | public void changedUpdate(DocumentEvent e) { 54 | mDeviceConfig.mDeviceProperties.put("output", mSerialNoField.getText()); 55 | } 56 | }); 57 | add(mSerialNoField); 58 | 59 | GroupLayout layout = new GroupLayout(this); 60 | setLayout(layout); 61 | 62 | layout.setHorizontalGroup(layout.createSequentialGroup() 63 | .addComponent(mSerialNoLabel) 64 | .addComponent(mSerialNoField)); 65 | layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER) 66 | .addComponent(mSerialNoLabel) 67 | .addComponent(mSerialNoField)); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/PhilipsHuePanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JCheckBox; 5 | import javax.swing.JLabel; 6 | import javax.swing.JSpinner; 7 | import javax.swing.JTextField; 8 | import javax.swing.SpinnerNumberModel; 9 | import javax.swing.GroupLayout.Alignment; 10 | import javax.swing.event.ChangeEvent; 11 | import javax.swing.event.ChangeListener; 12 | import javax.swing.event.DocumentEvent; 13 | import javax.swing.event.DocumentListener; 14 | 15 | import org.hyperion.hypercon.language.language; 16 | import org.hyperion.hypercon.spec.DeviceConfig; 17 | 18 | public class PhilipsHuePanel extends DeviceTypePanel { 19 | 20 | private JLabel mHostLabel; 21 | private JTextField mHostField; 22 | 23 | private JLabel mUsernameLabel; 24 | private JTextField mUsernameField; 25 | 26 | private JLabel mSwitchOffOnBlackLabel; 27 | private JCheckBox mSwitchOffOnBlackBox; 28 | 29 | private JLabel mTransitionTimeLabel; 30 | private JSpinner mTransitionTimeSpinner; 31 | 32 | public PhilipsHuePanel() { 33 | super(); 34 | 35 | initialise(); 36 | } 37 | 38 | @Override 39 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 40 | super.setDeviceConfig(pDeviceConfig); 41 | 42 | // Make sure that the device specific configuration (and only device specific) is set 43 | String host = getValue("output", "127.0.0.1"); 44 | String username = getValue("username", "newdeveloper"); 45 | boolean switchOffOnBlack = getValue("switchOffOnBlack", true); 46 | int transitionTime = getValue("transitiontime", 1); 47 | mDeviceConfig.mDeviceProperties.clear(); 48 | mDeviceConfig.mDeviceProperties.put("output", host); 49 | mDeviceConfig.mDeviceProperties.put("username", username); 50 | mDeviceConfig.mDeviceProperties.put("switchOffOnBlack", switchOffOnBlack); 51 | mDeviceConfig.mDeviceProperties.put("transitiontime", transitionTime); 52 | 53 | mHostField.setText(host); 54 | mUsernameField.setText(username); 55 | mSwitchOffOnBlackBox.setSelected(switchOffOnBlack); 56 | mTransitionTimeSpinner.setValue(transitionTime); 57 | } 58 | 59 | private void initialise() { 60 | mHostLabel = new JLabel(language.getString("hardware.leddevice.host")); 61 | mHostLabel.setMinimumSize(firstColMinDim); 62 | add(mHostLabel); 63 | 64 | mHostField = new JTextField(); 65 | mHostField.setMaximumSize(maxDim); 66 | mHostField.getDocument().addDocumentListener(new DocumentListener() { 67 | @Override 68 | public void removeUpdate(DocumentEvent e) { 69 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 70 | } 71 | @Override 72 | public void insertUpdate(DocumentEvent e) { 73 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 74 | } 75 | @Override 76 | public void changedUpdate(DocumentEvent e) { 77 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 78 | } 79 | }); 80 | add(mHostField); 81 | 82 | mUsernameLabel = new JLabel(language.getString("hardware.leddevice.usernamelabel")); 83 | mUsernameLabel.setMinimumSize(firstColMinDim); 84 | add(mUsernameLabel); 85 | 86 | mUsernameField = new JTextField(); 87 | mUsernameField.setMaximumSize(maxDim); 88 | mUsernameField.getDocument().addDocumentListener(new DocumentListener() { 89 | @Override 90 | public void removeUpdate(DocumentEvent e) { 91 | mDeviceConfig.mDeviceProperties.put("username", mUsernameField.getText()); 92 | } 93 | @Override 94 | public void insertUpdate(DocumentEvent e) { 95 | mDeviceConfig.mDeviceProperties.put("username", mUsernameField.getText()); 96 | } 97 | @Override 98 | public void changedUpdate(DocumentEvent e) { 99 | mDeviceConfig.mDeviceProperties.put("username", mUsernameField.getText()); 100 | } 101 | }); 102 | add(mUsernameField); 103 | 104 | mSwitchOffOnBlackLabel = new JLabel(language.getString("hardware.leddevice.switchoffonblack")); 105 | mSwitchOffOnBlackLabel.setMinimumSize(firstColMinDim); 106 | add(mSwitchOffOnBlackLabel); 107 | 108 | mSwitchOffOnBlackBox = new JCheckBox(); 109 | mSwitchOffOnBlackBox.setMaximumSize(maxDim); 110 | mSwitchOffOnBlackBox.addChangeListener(mChangeListener); 111 | add(mSwitchOffOnBlackBox); 112 | 113 | mTransitionTimeLabel = new JLabel(language.getString("hardware.leddevice.transitiontime")); 114 | mTransitionTimeLabel.setMinimumSize(firstColMinDim); 115 | add(mTransitionTimeLabel); 116 | 117 | mTransitionTimeSpinner = new JSpinner(new SpinnerNumberModel(4, 1, 10, 1)); 118 | mTransitionTimeSpinner.setMaximumSize(maxDim); 119 | mTransitionTimeSpinner.addChangeListener(mChangeListener); 120 | add(mTransitionTimeSpinner); 121 | 122 | 123 | GroupLayout layout = new GroupLayout(this); 124 | layout.setAutoCreateGaps(true); 125 | setLayout(layout); 126 | 127 | layout.setHorizontalGroup(layout.createSequentialGroup() 128 | .addGroup(layout.createParallelGroup() 129 | .addComponent(mHostLabel) 130 | .addComponent(mUsernameLabel) 131 | .addComponent(mSwitchOffOnBlackLabel) 132 | .addComponent(mTransitionTimeLabel)) 133 | .addGroup(layout.createParallelGroup() 134 | .addComponent(mHostField) 135 | .addComponent(mUsernameField) 136 | .addComponent(mSwitchOffOnBlackBox) 137 | .addComponent(mTransitionTimeSpinner)) 138 | ); 139 | layout.setVerticalGroup(layout.createSequentialGroup() 140 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 141 | .addComponent(mHostLabel) 142 | .addComponent(mHostField)) 143 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 144 | .addComponent(mUsernameLabel) 145 | .addComponent(mUsernameField)) 146 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 147 | .addComponent(mSwitchOffOnBlackLabel) 148 | .addComponent(mSwitchOffOnBlackBox)) 149 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 150 | .addComponent(mTransitionTimeLabel) 151 | .addComponent(mTransitionTimeSpinner)) 152 | ); 153 | } 154 | 155 | private ChangeListener mChangeListener = new ChangeListener() { 156 | @Override 157 | public void stateChanged(ChangeEvent e) { 158 | if (e.getSource() == mSwitchOffOnBlackBox) { 159 | mDeviceConfig.mDeviceProperties.put("switchOffOnBlack", mSwitchOffOnBlackBox.isSelected()); 160 | } else if (e.getSource() == mTransitionTimeSpinner) { 161 | mDeviceConfig.mDeviceProperties.put("transitiontime", mTransitionTimeSpinner.getValue()); 162 | } 163 | } 164 | }; 165 | } 166 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/PiBlasterPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JLabel; 5 | import javax.swing.JTextField; 6 | import javax.swing.GroupLayout.Alignment; 7 | import javax.swing.event.DocumentEvent; 8 | import javax.swing.event.DocumentListener; 9 | 10 | import org.hyperion.hypercon.language.language; 11 | import org.hyperion.hypercon.spec.DeviceConfig; 12 | 13 | public class PiBlasterPanel extends DeviceTypePanel { 14 | 15 | private JLabel mOutputLabel; 16 | private JTextField mOutputField; 17 | 18 | private JLabel mAssignmentLabel; 19 | private JTextField mAssignmentField; 20 | 21 | public PiBlasterPanel() { 22 | super(); 23 | 24 | initialise(); 25 | } 26 | 27 | @Override 28 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 29 | super.setDeviceConfig(pDeviceConfig); 30 | 31 | // Make sure that the device specific configuration (and only device specific) is set 32 | String output = getValue("output", ""); 33 | String assignment = getValue("assignment", ""); 34 | mDeviceConfig.mDeviceProperties.clear(); 35 | mDeviceConfig.mDeviceProperties.put("output", output); 36 | mDeviceConfig.mDeviceProperties.put("assignment", assignment); 37 | 38 | mOutputField.setText(output); 39 | mAssignmentField.setText(assignment); 40 | } 41 | 42 | private void initialise() { 43 | mOutputLabel = new JLabel(language.getString("hardware.leddevice.host")); 44 | mOutputLabel.setMinimumSize(firstColMinDim); 45 | add(mOutputLabel); 46 | 47 | mOutputField = new JTextField(); 48 | mOutputField.setMaximumSize(maxDim); 49 | mOutputField.getDocument().addDocumentListener(new DocumentListener() { 50 | @Override 51 | public void removeUpdate(DocumentEvent e) { 52 | mDeviceConfig.mDeviceProperties.put("output", mOutputField.getText()); 53 | } 54 | @Override 55 | public void insertUpdate(DocumentEvent e) { 56 | mDeviceConfig.mDeviceProperties.put("output", mOutputField.getText()); 57 | } 58 | @Override 59 | public void changedUpdate(DocumentEvent e) { 60 | mDeviceConfig.mDeviceProperties.put("output", mOutputField.getText()); 61 | } 62 | }); 63 | add(mOutputField); 64 | 65 | mAssignmentLabel = new JLabel(language.getString("hardware.leddevice.baudrate")); 66 | mAssignmentLabel.setMinimumSize(firstColMinDim); 67 | add(mAssignmentLabel); 68 | 69 | mAssignmentField = new JTextField(); 70 | mAssignmentField.setMaximumSize(maxDim); 71 | mAssignmentField.getDocument().addDocumentListener(new DocumentListener() { 72 | @Override 73 | public void removeUpdate(DocumentEvent e) { 74 | mDeviceConfig.mDeviceProperties.put("assignment", mAssignmentField.getText()); 75 | } 76 | @Override 77 | public void insertUpdate(DocumentEvent e) { 78 | mDeviceConfig.mDeviceProperties.put("assignment", mAssignmentField.getText()); 79 | } 80 | @Override 81 | public void changedUpdate(DocumentEvent e) { 82 | mDeviceConfig.mDeviceProperties.put("assignment", mAssignmentField.getText()); 83 | } 84 | }); 85 | add(mAssignmentField); 86 | 87 | 88 | GroupLayout layout = new GroupLayout(this); 89 | layout.setAutoCreateGaps(true); 90 | setLayout(layout); 91 | 92 | layout.setHorizontalGroup(layout.createSequentialGroup() 93 | .addGroup(layout.createParallelGroup() 94 | .addComponent(mOutputLabel) 95 | .addComponent(mAssignmentLabel)) 96 | .addGroup(layout.createParallelGroup() 97 | .addComponent(mOutputField) 98 | .addComponent(mAssignmentField)) 99 | ); 100 | layout.setVerticalGroup(layout.createSequentialGroup() 101 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 102 | .addComponent(mOutputLabel) 103 | .addComponent(mOutputField)) 104 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 105 | .addComponent(mAssignmentLabel) 106 | .addComponent(mAssignmentField)) 107 | ); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/SerialPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.GroupLayout; 7 | import javax.swing.JComboBox; 8 | import javax.swing.JLabel; 9 | import javax.swing.JSpinner; 10 | import javax.swing.SpinnerListModel; 11 | import javax.swing.SpinnerNumberModel; 12 | import javax.swing.GroupLayout.Alignment; 13 | import javax.swing.event.ChangeEvent; 14 | import javax.swing.event.ChangeListener; 15 | 16 | import org.hyperion.hypercon.language.language; 17 | import org.hyperion.hypercon.spec.DeviceConfig; 18 | 19 | /** 20 | * Panel for configuring Ws2801 specific settings 21 | */ 22 | public class SerialPanel extends DeviceTypePanel { 23 | 24 | public static final String[] KnownOutputs = { "/dev/ttyS0", "/dev/ttyUSB0", "/dev/ttyAMA0", "/dev/ttyACM0", "/dev/null"}; 25 | 26 | private JLabel mOutputLabel; 27 | private JComboBox mOutputCombo; 28 | 29 | private JLabel mBaudrateLabel; 30 | private JSpinner mBaudrateSpinner; 31 | 32 | private JLabel mDelayLabel; 33 | private JSpinner mDelaySpinner; 34 | 35 | 36 | public SerialPanel() { 37 | super(); 38 | 39 | initialise(); 40 | } 41 | 42 | @Override 43 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 44 | super.setDeviceConfig(pDeviceConfig); 45 | 46 | // Make sure that the device specific configuration (and only device specific) is set 47 | String output = getValue("output", KnownOutputs[0]); 48 | int baudrate = getValue("rate", 921600); 49 | int delay = getValue("delayAfterConnect", 0); 50 | mDeviceConfig.mDeviceProperties.clear(); 51 | mDeviceConfig.mDeviceProperties.put("output", output); 52 | mDeviceConfig.mDeviceProperties.put("rate", baudrate); 53 | mDeviceConfig.mDeviceProperties.put("delayAfterConnect", delay); 54 | 55 | mOutputCombo.setSelectedItem(output); 56 | ((SpinnerListModel)mBaudrateSpinner.getModel()).setValue(baudrate); 57 | ((SpinnerNumberModel)mDelaySpinner.getModel()).setValue(delay); 58 | } 59 | 60 | private void initialise() { 61 | mOutputLabel = new JLabel(language.getString("hardware.leddevice.output")); 62 | mOutputLabel.setMinimumSize(firstColMinDim); 63 | add(mOutputLabel); 64 | 65 | mOutputCombo = new JComboBox<>(KnownOutputs); 66 | mOutputCombo.setMaximumSize(maxDim); 67 | mOutputCombo.setEditable(true); 68 | mOutputCombo.addActionListener(mActionListener); 69 | add(mOutputCombo); 70 | 71 | mBaudrateLabel = new JLabel(language.getString("hardware.leddevice.baudrate")); 72 | mBaudrateLabel.setMinimumSize(firstColMinDim); 73 | add(mBaudrateLabel); 74 | 75 | mBaudrateSpinner = new JSpinner(new SpinnerListModel(new Object[] { 76 | 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 230400, 460800, 921600})); 77 | mBaudrateSpinner.setMaximumSize(maxDim); 78 | mBaudrateSpinner.addChangeListener(mChangeListener); 79 | add(mBaudrateSpinner); 80 | 81 | mDelayLabel = new JLabel(language.getString("hardware.leddevice.delayinms")); 82 | mDelayLabel.setMinimumSize(firstColMinDim); 83 | add(mDelayLabel); 84 | 85 | mDelaySpinner = new JSpinner(new SpinnerNumberModel(0, 0, 10000, 100)); 86 | mDelaySpinner.setMaximumSize(maxDim); 87 | mDelaySpinner.addChangeListener(mChangeListener); 88 | add(mDelaySpinner); 89 | 90 | 91 | GroupLayout layout = new GroupLayout(this); 92 | layout.setAutoCreateGaps(true); 93 | setLayout(layout); 94 | 95 | layout.setHorizontalGroup(layout.createSequentialGroup() 96 | .addGroup(layout.createParallelGroup() 97 | .addComponent(mOutputLabel) 98 | .addComponent(mBaudrateLabel) 99 | .addComponent(mDelayLabel)) 100 | .addGroup(layout.createParallelGroup() 101 | .addComponent(mOutputCombo) 102 | .addComponent(mBaudrateSpinner) 103 | .addComponent(mDelaySpinner)) 104 | ); 105 | layout.setVerticalGroup(layout.createSequentialGroup() 106 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 107 | .addComponent(mOutputLabel) 108 | .addComponent(mOutputCombo)) 109 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 110 | .addComponent(mBaudrateLabel) 111 | .addComponent(mBaudrateSpinner)) 112 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 113 | .addComponent(mDelayLabel) 114 | .addComponent(mDelaySpinner)) 115 | ); 116 | } 117 | 118 | private ActionListener mActionListener = new ActionListener() { 119 | @Override 120 | public void actionPerformed(ActionEvent e) { 121 | if (e.getSource() == mOutputCombo) { 122 | mDeviceConfig.mDeviceProperties.put("output", mOutputCombo.getSelectedItem()); 123 | } else if (e.getSource() == mBaudrateSpinner) { 124 | mDeviceConfig.mDeviceProperties.put("rate", mBaudrateSpinner.getValue()); 125 | } else if (e.getSource() == mDelaySpinner) { 126 | mDeviceConfig.mDeviceProperties.put("delayAfterConnect", mDelaySpinner.getValue()); 127 | } 128 | 129 | } 130 | }; 131 | 132 | private ChangeListener mChangeListener = new ChangeListener() { 133 | @Override 134 | public void stateChanged(ChangeEvent e) { 135 | mDeviceConfig.mDeviceProperties.put("rate", mBaudrateSpinner.getValue()); 136 | } 137 | }; 138 | } 139 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/SpiDevPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.GroupLayout; 7 | import javax.swing.JComboBox; 8 | import javax.swing.JLabel; 9 | import javax.swing.JSpinner; 10 | import javax.swing.SpinnerListModel; 11 | import javax.swing.event.ChangeEvent; 12 | import javax.swing.event.ChangeListener; 13 | import javax.swing.GroupLayout.Alignment; 14 | 15 | import org.hyperion.hypercon.language.language; 16 | import org.hyperion.hypercon.spec.DeviceConfig; 17 | 18 | /** 19 | * Panel for configuring Ws2801 specific settings 20 | */ 21 | public class SpiDevPanel extends DeviceTypePanel { 22 | 23 | public static final String[] KnownOutputs = {"/dev/spidev0.0", "/dev/spidev0.1", "/dev/null"}; 24 | 25 | private JLabel mOutputLabel; 26 | private JComboBox mOutputCombo; 27 | 28 | private JLabel mBaudrateLabel; 29 | private JSpinner mBaudrateSpinner; 30 | 31 | 32 | public SpiDevPanel() { 33 | super(); 34 | 35 | initialise(); 36 | } 37 | 38 | @Override 39 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 40 | super.setDeviceConfig(pDeviceConfig); 41 | 42 | // Make sure that the device specific configuration (and only device specific) is set 43 | String output = getValue("output", KnownOutputs[0]); 44 | int baudrate = getValue("rate", 921600); 45 | 46 | mDeviceConfig.mDeviceProperties.clear(); 47 | mDeviceConfig.mDeviceProperties.put("output", output); 48 | mDeviceConfig.mDeviceProperties.put("rate", baudrate); 49 | 50 | mOutputCombo.setSelectedItem(output); 51 | ((SpinnerListModel)mBaudrateSpinner.getModel()).setValue(baudrate); 52 | } 53 | 54 | private void initialise() { 55 | mOutputLabel = new JLabel(language.getString("hardware.leddevice.output")); 56 | mOutputLabel.setMinimumSize(firstColMinDim); 57 | add(mOutputLabel); 58 | 59 | mOutputCombo = new JComboBox<>(KnownOutputs); 60 | mOutputCombo.setMaximumSize(maxDim); 61 | mOutputCombo.setEditable(true); 62 | mOutputCombo.addActionListener(mActionListener); 63 | add(mOutputCombo); 64 | 65 | mBaudrateLabel = new JLabel(language.getString("hardware.leddevice.baudrate")); 66 | mBaudrateLabel.setMinimumSize(firstColMinDim); 67 | add(mBaudrateLabel); 68 | 69 | mBaudrateSpinner = new JSpinner(new SpinnerListModel(new Object[] { 70 | 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 230400, 460800, 921600})); 71 | mBaudrateSpinner.setMaximumSize(maxDim); 72 | mBaudrateSpinner.addChangeListener(mChangeListener); 73 | add(mBaudrateSpinner); 74 | 75 | 76 | GroupLayout layout = new GroupLayout(this); 77 | layout.setAutoCreateGaps(true); 78 | setLayout(layout); 79 | 80 | layout.setHorizontalGroup(layout.createSequentialGroup() 81 | .addGroup(layout.createParallelGroup() 82 | .addComponent(mOutputLabel) 83 | .addComponent(mBaudrateLabel)) 84 | .addGroup(layout.createParallelGroup() 85 | .addComponent(mOutputCombo) 86 | .addComponent(mBaudrateSpinner)) 87 | ); 88 | layout.setVerticalGroup(layout.createSequentialGroup() 89 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 90 | .addComponent(mOutputLabel) 91 | .addComponent(mOutputCombo)) 92 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 93 | .addComponent(mBaudrateLabel) 94 | .addComponent(mBaudrateSpinner)) 95 | ); 96 | } 97 | 98 | private ActionListener mActionListener = new ActionListener() { 99 | @Override 100 | public void actionPerformed(ActionEvent e) { 101 | if (e.getSource() == mOutputCombo && mOutputCombo.getSelectedItem() != null) { 102 | mDeviceConfig.mDeviceProperties.put("output", mOutputCombo.getSelectedItem()); 103 | } else if (e.getSource() == mBaudrateSpinner) { 104 | mDeviceConfig.mDeviceProperties.put("rate", mBaudrateSpinner.getValue()); 105 | } 106 | } 107 | }; 108 | 109 | private ChangeListener mChangeListener = new ChangeListener() { 110 | @Override 111 | public void stateChanged(ChangeEvent e) { 112 | mDeviceConfig.mDeviceProperties.put("rate", mBaudrateSpinner.getValue()); 113 | } 114 | }; 115 | } 116 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/TestDevicePanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JLabel; 5 | import javax.swing.JTextField; 6 | import javax.swing.event.DocumentEvent; 7 | import javax.swing.event.DocumentListener; 8 | import javax.swing.GroupLayout.Alignment; 9 | 10 | import org.hyperion.hypercon.language.language; 11 | import org.hyperion.hypercon.spec.DeviceConfig; 12 | 13 | public class TestDevicePanel extends DeviceTypePanel { 14 | 15 | private JLabel mFilenameLabel; 16 | private JTextField mFilenameField; 17 | 18 | public TestDevicePanel() { 19 | super(); 20 | 21 | initialise(); 22 | } 23 | 24 | @Override 25 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 26 | super.setDeviceConfig(pDeviceConfig); 27 | 28 | // Make sure that the device specific configuration (and only device specific) is set 29 | String output = getValue("output", "/tmp/hyperion.out"); 30 | mDeviceConfig.mDeviceProperties.clear(); 31 | mDeviceConfig.mDeviceProperties.put("output", output); 32 | 33 | mFilenameField.setText(output); 34 | } 35 | 36 | private void initialise() { 37 | mFilenameLabel = new JLabel(language.getString("hardware.leddevice.filename")); 38 | mFilenameLabel.setMinimumSize(firstColMinDim); 39 | add(mFilenameLabel); 40 | 41 | mFilenameField = new JTextField(); 42 | mFilenameField.setMaximumSize(maxDim); 43 | mFilenameField.getDocument().addDocumentListener(new DocumentListener() { 44 | @Override 45 | public void removeUpdate(DocumentEvent e) { 46 | mDeviceConfig.mDeviceProperties.put("output", mFilenameField.getText()); 47 | } 48 | @Override 49 | public void insertUpdate(DocumentEvent e) { 50 | mDeviceConfig.mDeviceProperties.put("output", mFilenameField.getText()); 51 | } 52 | @Override 53 | public void changedUpdate(DocumentEvent e) { 54 | mDeviceConfig.mDeviceProperties.put("output", mFilenameField.getText()); 55 | } 56 | }); 57 | add(mFilenameField); 58 | 59 | GroupLayout layout = new GroupLayout(this); 60 | setLayout(layout); 61 | 62 | layout.setHorizontalGroup(layout.createSequentialGroup() 63 | .addComponent(mFilenameLabel) 64 | .addComponent(mFilenameField)); 65 | layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER) 66 | .addComponent(mFilenameLabel) 67 | .addComponent(mFilenameField)); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/TinkerForgePanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JLabel; 5 | import javax.swing.JSpinner; 6 | import javax.swing.JTextField; 7 | import javax.swing.SpinnerNumberModel; 8 | import javax.swing.event.ChangeEvent; 9 | import javax.swing.event.ChangeListener; 10 | import javax.swing.event.DocumentEvent; 11 | import javax.swing.event.DocumentListener; 12 | import javax.swing.GroupLayout.Alignment; 13 | 14 | import org.hyperion.hypercon.language.language; 15 | import org.hyperion.hypercon.spec.DeviceConfig; 16 | 17 | public class TinkerForgePanel extends DeviceTypePanel { 18 | 19 | private JLabel mHostLabel; 20 | private JTextField mHostField; 21 | 22 | private JLabel mPortLabel; 23 | private JSpinner mPortSpinner; 24 | 25 | private JLabel mUidLabel; 26 | private JTextField mUidField; 27 | 28 | private JLabel mRateLabel; 29 | private JSpinner mRateSpinner; 30 | 31 | 32 | public TinkerForgePanel() { 33 | super(); 34 | 35 | initialise(); 36 | } 37 | 38 | @Override 39 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 40 | super.setDeviceConfig(pDeviceConfig); 41 | 42 | // Make sure that the device specific configuration (and only device specific) is set 43 | String host = getValue("output", "127.0.0.1"); 44 | int port = getValue("port", 4223); 45 | String uid = getValue("uid", ""); 46 | int rate = getValue("rate", 100000); 47 | mDeviceConfig.mDeviceProperties.clear(); 48 | mDeviceConfig.mDeviceProperties.put("output", host); 49 | mDeviceConfig.mDeviceProperties.put("port", port); 50 | mDeviceConfig.mDeviceProperties.put("uid", uid); 51 | mDeviceConfig.mDeviceProperties.put("rate", rate); 52 | 53 | mHostField.setText(host); 54 | ((SpinnerNumberModel)mPortSpinner.getModel()).setValue(port); 55 | mUidField.setText(uid); 56 | ((SpinnerNumberModel)mRateSpinner.getModel()).setValue(rate); 57 | } 58 | 59 | private void initialise() { 60 | mHostLabel = new JLabel(language.getString("hardware.leddevice.host")); 61 | mHostLabel.setMinimumSize(firstColMinDim); 62 | add(mHostLabel); 63 | 64 | mHostField = new JTextField(); 65 | mHostField.setMaximumSize(maxDim); 66 | mHostField.getDocument().addDocumentListener(new DocumentListener() { 67 | @Override 68 | public void removeUpdate(DocumentEvent e) { 69 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 70 | } 71 | @Override 72 | public void insertUpdate(DocumentEvent e) { 73 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 74 | } 75 | @Override 76 | public void changedUpdate(DocumentEvent e) { 77 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 78 | } 79 | }); 80 | add(mHostField); 81 | 82 | mPortLabel = new JLabel(language.getString("hardware.leddevice.baudrate")); 83 | mPortLabel.setMinimumSize(firstColMinDim); 84 | add(mPortLabel); 85 | 86 | mPortSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 65535, 1)); 87 | JSpinner.NumberEditor mPortSpinnereditor = new JSpinner.NumberEditor(mPortSpinner, "#"); 88 | mPortSpinner.setEditor(mPortSpinnereditor); 89 | mPortSpinnereditor.getTextField().setHorizontalAlignment(JLabel.LEFT); 90 | mPortSpinner.setMaximumSize(maxDim); 91 | mPortSpinner.addChangeListener(mChangeListener); 92 | add(mPortSpinner); 93 | 94 | mUidLabel = new JLabel(language.getString("hardware.leddevice.uid")); 95 | mUidLabel.setMinimumSize(firstColMinDim); 96 | add(mUidLabel); 97 | 98 | mUidField = new JTextField(); 99 | mUidField.setMaximumSize(maxDim); 100 | mUidField.getDocument().addDocumentListener(new DocumentListener() { 101 | @Override 102 | public void removeUpdate(DocumentEvent e) { 103 | mDeviceConfig.mDeviceProperties.put("uid", mUidField.getText()); 104 | } 105 | @Override 106 | public void insertUpdate(DocumentEvent e) { 107 | mDeviceConfig.mDeviceProperties.put("uid", mUidField.getText()); 108 | } 109 | @Override 110 | public void changedUpdate(DocumentEvent e) { 111 | mDeviceConfig.mDeviceProperties.put("uid", mUidField.getText()); 112 | } 113 | }); 114 | add(mUidField); 115 | 116 | mRateLabel = new JLabel(language.getString("hardware.leddevice.rate")); 117 | mRateLabel.setMinimumSize(firstColMinDim); 118 | add(mRateLabel); 119 | 120 | mRateSpinner = new JSpinner(new SpinnerNumberModel(100000, 4800, 1000000, 1000)); 121 | mRateSpinner.setMaximumSize(maxDim); 122 | mRateSpinner.addChangeListener(mChangeListener); 123 | add(mRateSpinner); 124 | 125 | 126 | GroupLayout layout = new GroupLayout(this); 127 | layout.setAutoCreateGaps(true); 128 | setLayout(layout); 129 | 130 | layout.setHorizontalGroup(layout.createSequentialGroup() 131 | .addGroup(layout.createParallelGroup() 132 | .addComponent(mHostLabel) 133 | .addComponent(mPortLabel) 134 | .addComponent(mUidLabel) 135 | .addComponent(mRateLabel)) 136 | .addGroup(layout.createParallelGroup() 137 | .addComponent(mHostField) 138 | .addComponent(mPortSpinner) 139 | .addComponent(mUidField) 140 | .addComponent(mRateSpinner)) 141 | ); 142 | layout.setVerticalGroup(layout.createSequentialGroup() 143 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 144 | .addComponent(mHostLabel) 145 | .addComponent(mHostField)) 146 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 147 | .addComponent(mPortLabel) 148 | .addComponent(mPortSpinner)) 149 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 150 | .addComponent(mUidLabel) 151 | .addComponent(mUidField)) 152 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 153 | .addComponent(mRateLabel) 154 | .addComponent(mRateSpinner)) 155 | ); 156 | } 157 | 158 | private ChangeListener mChangeListener = new ChangeListener() { 159 | @Override 160 | public void stateChanged(ChangeEvent e) { 161 | if (e.getSource() == mRateSpinner) { 162 | mDeviceConfig.mDeviceProperties.put("rate", mRateSpinner.getValue()); 163 | } else if (e.getSource() == mPortSpinner) { 164 | mDeviceConfig.mDeviceProperties.put("port", mPortSpinner.getValue()); 165 | } 166 | } 167 | }; 168 | } 169 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/UDPPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JLabel; 5 | import javax.swing.JSpinner; 6 | import javax.swing.JTextField; 7 | import javax.swing.SpinnerNumberModel; 8 | import javax.swing.GroupLayout.Alignment; 9 | import javax.swing.event.ChangeEvent; 10 | import javax.swing.event.ChangeListener; 11 | import javax.swing.event.DocumentEvent; 12 | import javax.swing.event.DocumentListener; 13 | 14 | import org.hyperion.hypercon.language.language; 15 | import org.hyperion.hypercon.spec.DeviceConfig; 16 | 17 | public class UDPPanel extends DeviceTypePanel { 18 | 19 | private JLabel mHostLabel; 20 | private JTextField mHostField; 21 | 22 | private JLabel mProtocolLabel; 23 | private JSpinner mProtocolSpinner; 24 | 25 | private JLabel mRateLabel; 26 | private JSpinner mRateSpinner; 27 | 28 | private JLabel mMaxPacketLabel; 29 | private JSpinner mMaxPacketSpinner; 30 | 31 | public UDPPanel() { 32 | super(); 33 | 34 | initialise(); 35 | } 36 | 37 | @Override 38 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 39 | super.setDeviceConfig(pDeviceConfig); 40 | 41 | // Make sure that the device specific configuration (and only device specific) is set 42 | String host = getValue("output", "192.168.0.10:19446"); 43 | int protocol = getValue("protocol", 0); 44 | int rate = getValue("rate", 1000000); 45 | int maxpacket = getValue("maxpacket", 1450); 46 | mDeviceConfig.mDeviceProperties.clear(); 47 | mDeviceConfig.mDeviceProperties.put("output", host); 48 | mDeviceConfig.mDeviceProperties.put("protocol", protocol); 49 | mDeviceConfig.mDeviceProperties.put("rate", rate); 50 | mDeviceConfig.mDeviceProperties.put("maxpacket", maxpacket); 51 | 52 | mHostField.setText(host); 53 | mProtocolSpinner.setValue(protocol); 54 | mRateSpinner.setValue(rate); 55 | mMaxPacketSpinner.setValue(maxpacket); 56 | } 57 | 58 | private void initialise() { 59 | mHostLabel = new JLabel(language.getString("hardware.leddevice.output")); 60 | mHostLabel.setMinimumSize(firstColMinDim); 61 | add(mHostLabel); 62 | 63 | mHostField = new JTextField(); 64 | mHostField.setMaximumSize(maxDim); 65 | mHostField.getDocument().addDocumentListener(new DocumentListener() { 66 | @Override 67 | public void removeUpdate(DocumentEvent e) { 68 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 69 | } 70 | @Override 71 | public void insertUpdate(DocumentEvent e) { 72 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 73 | } 74 | @Override 75 | public void changedUpdate(DocumentEvent e) { 76 | mDeviceConfig.mDeviceProperties.put("output", mHostField.getText()); 77 | } 78 | }); 79 | add(mHostField); 80 | 81 | mProtocolLabel = new JLabel(language.getString("hardware.leddevice.protocol")); 82 | mProtocolLabel.setMinimumSize(firstColMinDim); 83 | add(mProtocolLabel); 84 | 85 | mProtocolSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 3, 1)); 86 | mProtocolSpinner.setMaximumSize(maxDim); 87 | mProtocolSpinner.addChangeListener(mChangeListener); 88 | add(mProtocolSpinner); 89 | 90 | mRateLabel = new JLabel(language.getString("hardware.leddevice.rate")); 91 | mRateLabel.setMinimumSize(firstColMinDim); 92 | add(mRateLabel); 93 | 94 | mRateSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 2000000, 1)); 95 | mRateSpinner.setMaximumSize(maxDim); 96 | mRateSpinner.addChangeListener(mChangeListener); 97 | add(mRateSpinner); 98 | 99 | mMaxPacketLabel = new JLabel(language.getString("hardware.leddevice.maxpacketlabel")); 100 | mMaxPacketLabel.setMinimumSize(firstColMinDim); 101 | add(mMaxPacketLabel); 102 | 103 | mMaxPacketSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 10000, 1)); 104 | mMaxPacketSpinner.setMaximumSize(maxDim); 105 | mMaxPacketSpinner.addChangeListener(mChangeListener); 106 | add(mMaxPacketSpinner); 107 | 108 | GroupLayout layout = new GroupLayout(this); 109 | layout.setAutoCreateGaps(true); 110 | setLayout(layout); 111 | 112 | layout.setHorizontalGroup(layout.createSequentialGroup() 113 | .addGroup(layout.createParallelGroup() 114 | .addComponent(mHostLabel) 115 | .addComponent(mProtocolLabel) 116 | .addComponent(mRateLabel) 117 | .addComponent(mMaxPacketLabel)) 118 | .addGroup(layout.createParallelGroup() 119 | .addComponent(mHostField) 120 | .addComponent(mProtocolSpinner) 121 | .addComponent(mRateSpinner) 122 | .addComponent(mMaxPacketSpinner)) 123 | ); 124 | layout.setVerticalGroup(layout.createSequentialGroup() 125 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 126 | .addComponent(mHostLabel) 127 | .addComponent(mHostField)) 128 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 129 | .addComponent(mProtocolLabel) 130 | .addComponent(mProtocolSpinner)) 131 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 132 | .addComponent(mRateLabel) 133 | .addComponent(mRateSpinner)) 134 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 135 | .addComponent(mMaxPacketLabel) 136 | .addComponent(mMaxPacketSpinner)) 137 | ); 138 | } 139 | 140 | private ChangeListener mChangeListener = new ChangeListener() { 141 | @Override 142 | public void stateChanged(ChangeEvent e) { 143 | if (e.getSource() == mProtocolSpinner) { 144 | mDeviceConfig.mDeviceProperties.put("protocol", mProtocolSpinner.getValue()); 145 | } else if (e.getSource() == mRateSpinner) { 146 | mDeviceConfig.mDeviceProperties.put("rate", mRateSpinner.getValue()); 147 | } else if (e.getSource() == mMaxPacketSpinner) { 148 | mDeviceConfig.mDeviceProperties.put("maxpacket", mMaxPacketSpinner.getValue()); 149 | } 150 | } 151 | }; 152 | } 153 | 154 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/WS281XPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JLabel; 5 | import javax.swing.JSpinner; 6 | import javax.swing.SpinnerNumberModel; 7 | import javax.swing.GroupLayout.Alignment; 8 | import javax.swing.event.ChangeEvent; 9 | import javax.swing.event.ChangeListener; 10 | 11 | import org.hyperion.hypercon.language.language; 12 | import org.hyperion.hypercon.spec.DeviceConfig; 13 | 14 | public class WS281XPanel extends DeviceTypePanel{ 15 | 16 | private JLabel mledCountLabel; 17 | private JSpinner mledCountSpinner; 18 | 19 | 20 | // private JComboBox mOutputCombo; 21 | 22 | private JLabel mBaudrateLabel; 23 | private JSpinner mBaudrateSpinner; 24 | 25 | 26 | public WS281XPanel() { 27 | super(); 28 | 29 | initialise(); 30 | } 31 | @Override 32 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 33 | super.setDeviceConfig(pDeviceConfig); 34 | 35 | // Make sure that the device specific configuration (and only device specific) is set 36 | int ledcount = getValue("leds", 256); 37 | 38 | 39 | mDeviceConfig.mDeviceProperties.clear(); 40 | mDeviceConfig.mDeviceProperties.put("leds", ledcount); 41 | 42 | mledCountSpinner.setValue(ledcount); 43 | } 44 | 45 | private void initialise() { 46 | 47 | mledCountLabel = new JLabel(language.getString("hardware.leddevice.numLedsLabel")); 48 | mledCountLabel.setMinimumSize(firstColMinDim); 49 | add(mledCountLabel); 50 | 51 | mledCountSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 1000, 1)); 52 | mledCountSpinner.setMaximumSize(maxDim); 53 | mledCountSpinner.addChangeListener(mChangeListener); 54 | add(mledCountSpinner); 55 | 56 | GroupLayout layout = new GroupLayout(this); 57 | layout.setAutoCreateGaps(true); 58 | setLayout(layout); 59 | 60 | layout.setHorizontalGroup(layout.createSequentialGroup() 61 | .addGroup(layout.createParallelGroup() 62 | .addComponent(mledCountLabel)) 63 | .addGroup(layout.createParallelGroup() 64 | .addComponent(mledCountSpinner) 65 | ) 66 | ); 67 | layout.setVerticalGroup(layout.createSequentialGroup() 68 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 69 | .addComponent(mledCountLabel) 70 | .addComponent(mledCountSpinner)) 71 | ); 72 | } 73 | 74 | private ChangeListener mChangeListener = new ChangeListener() { 75 | @Override 76 | public void stateChanged(ChangeEvent e) { 77 | if (e.getSource() == mledCountSpinner) { 78 | mDeviceConfig.mDeviceProperties.put("leds", mledCountSpinner.getValue()); 79 | } 80 | } 81 | }; 82 | } -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Hardware_Tab/device/rawhidPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Hardware_Tab.device; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.JLabel; 5 | import javax.swing.JSpinner; 6 | import javax.swing.JTextField; 7 | import javax.swing.SpinnerNumberModel; 8 | import javax.swing.GroupLayout.Alignment; 9 | import javax.swing.event.ChangeEvent; 10 | import javax.swing.event.ChangeListener; 11 | import javax.swing.event.DocumentEvent; 12 | import javax.swing.event.DocumentListener; 13 | 14 | import org.hyperion.hypercon.language.language; 15 | import org.hyperion.hypercon.spec.DeviceConfig; 16 | 17 | public class rawhidPanel extends DeviceTypePanel { 18 | 19 | private JLabel mdelayAfterConnectLabel; 20 | private JSpinner mdelayAtferConnectSpinner; 21 | 22 | private JLabel mPIDLabel; 23 | private JTextField mPIDField; 24 | 25 | private JLabel mVIDLabel; 26 | private JTextField mVIDField; 27 | 28 | public rawhidPanel() { 29 | super(); 30 | 31 | initialise(); 32 | } 33 | 34 | @Override 35 | public void setDeviceConfig(DeviceConfig pDeviceConfig) { 36 | super.setDeviceConfig(pDeviceConfig); 37 | 38 | // Make sure that the device specific configuration (and only device specific) is set 39 | Integer delayAfterConnect = getValue ("delayAfterConnect", 0); 40 | String pid = getValue("PID", "0x8036"); 41 | String vid = getValue("VID", "0x2341"); 42 | mDeviceConfig.mDeviceProperties.clear(); 43 | mDeviceConfig.mDeviceProperties.put("delayAfterConnect", delayAfterConnect); 44 | mDeviceConfig.mDeviceProperties.put("PID", pid); 45 | mDeviceConfig.mDeviceProperties.put("VID", vid); 46 | 47 | mdelayAtferConnectSpinner.setValue(delayAfterConnect); 48 | mPIDField.setText(pid); 49 | mVIDField.setText(vid); 50 | } 51 | 52 | private void initialise() { 53 | mdelayAfterConnectLabel = new JLabel(language.getString("hardware.leddevice.delayAfterCon")); 54 | mdelayAfterConnectLabel.setMinimumSize(firstColMinDim); 55 | add(mdelayAfterConnectLabel); 56 | 57 | mdelayAtferConnectSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 99999, 1)); 58 | mdelayAtferConnectSpinner.setMaximumSize(maxDim); 59 | mdelayAtferConnectSpinner.addChangeListener(mChangeListener); 60 | add(mdelayAtferConnectSpinner); 61 | 62 | mPIDLabel = new JLabel(language.getString("hardware.leddevice.pid")); 63 | mPIDLabel.setMinimumSize(firstColMinDim); 64 | add(mPIDLabel); 65 | 66 | mPIDField = new JTextField(); 67 | mPIDField.setMaximumSize(maxDim); 68 | mPIDField.getDocument().addDocumentListener(new DocumentListener() { 69 | @Override 70 | public void removeUpdate(DocumentEvent e) { 71 | mDeviceConfig.mDeviceProperties.put("PID", mPIDField.getText()); 72 | } 73 | @Override 74 | public void insertUpdate(DocumentEvent e) { 75 | mDeviceConfig.mDeviceProperties.put("PID", mPIDField.getText()); 76 | } 77 | @Override 78 | public void changedUpdate(DocumentEvent e) { 79 | mDeviceConfig.mDeviceProperties.put("PID", mPIDField.getText()); 80 | } 81 | }); 82 | add(mPIDField); 83 | 84 | mVIDLabel = new JLabel(language.getString("hardware.leddevice.vid")); 85 | mVIDLabel.setMinimumSize(firstColMinDim); 86 | add(mVIDLabel); 87 | 88 | mVIDField = new JTextField(); 89 | mVIDField.setMaximumSize(maxDim); 90 | mVIDField.getDocument().addDocumentListener(new DocumentListener() { 91 | @Override 92 | public void removeUpdate(DocumentEvent e) { 93 | mDeviceConfig.mDeviceProperties.put("VID", mVIDField.getText()); 94 | } 95 | @Override 96 | public void insertUpdate(DocumentEvent e) { 97 | mDeviceConfig.mDeviceProperties.put("VID", mVIDField.getText()); 98 | } 99 | @Override 100 | public void changedUpdate(DocumentEvent e) { 101 | mDeviceConfig.mDeviceProperties.put("VID", mVIDField.getText()); 102 | } 103 | }); 104 | add(mVIDField); 105 | 106 | 107 | GroupLayout layout = new GroupLayout(this); 108 | layout.setAutoCreateGaps(true); 109 | setLayout(layout); 110 | 111 | layout.setHorizontalGroup(layout.createSequentialGroup() 112 | .addGroup(layout.createParallelGroup() 113 | .addComponent(mPIDLabel) 114 | .addComponent(mVIDLabel) 115 | .addComponent(mdelayAfterConnectLabel)) 116 | .addGroup(layout.createParallelGroup() 117 | .addComponent(mPIDField) 118 | .addComponent(mVIDField) 119 | .addComponent(mdelayAtferConnectSpinner)) 120 | ); 121 | layout.setVerticalGroup(layout.createSequentialGroup() 122 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 123 | .addComponent(mPIDLabel) 124 | .addComponent(mPIDField)) 125 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 126 | .addComponent(mVIDLabel) 127 | .addComponent(mVIDField)) 128 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 129 | .addComponent(mdelayAfterConnectLabel) 130 | .addComponent(mdelayAtferConnectSpinner)) 131 | ); 132 | } 133 | private ChangeListener mChangeListener = new ChangeListener() { 134 | @Override 135 | public void stateChanged(ChangeEvent e) { 136 | if (e.getSource() == mdelayAtferConnectSpinner) { 137 | mDeviceConfig.mDeviceProperties.put("delayAfterConnect", mdelayAtferConnectSpinner.getValue()); 138 | } 139 | } 140 | }; 141 | } 142 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedDivideDialog.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui; 2 | 3 | import java.awt.GridLayout; 4 | 5 | import javax.swing.ButtonGroup; 6 | import javax.swing.JFrame; 7 | import javax.swing.JPanel; 8 | import javax.swing.JRadioButton; 9 | 10 | public class LedDivideDialog extends JFrame { 11 | 12 | private final int mLedCount; 13 | private final int mTransformCount; 14 | 15 | private JPanel mContentPanel; 16 | 17 | public LedDivideDialog(int pLedCnt, int pTransformCnt) { 18 | super(); 19 | 20 | mLedCount = pLedCnt; 21 | mTransformCount = pTransformCnt; 22 | 23 | initialise(); 24 | } 25 | 26 | private void initialise() { 27 | mContentPanel = new JPanel(); 28 | mContentPanel.setLayout(new GridLayout(mLedCount, mTransformCount, 5, 5)); 29 | 30 | for (int iLed=0; iLed { 17 | 18 | private final BufferedImage mTvImage; 19 | 20 | private final Vector mLeds; 21 | 22 | public LedSimulationWorker(BufferedImage pTvImage, Vector pLeds) { 23 | super(); 24 | 25 | mTvImage = pTvImage; 26 | mLeds = pLeds; 27 | } 28 | 29 | class LedPaint { 30 | int color; 31 | 32 | Point point; 33 | double angle_rad; 34 | } 35 | 36 | private final List mLedPaints = new Vector<>(); 37 | 38 | 39 | @Override 40 | protected BufferedImage doInBackground() throws Exception { 41 | Dimension imageDim = new Dimension(1280, 720); 42 | BufferedImage backgroundImage = new BufferedImage(imageDim.width, imageDim.height, BufferedImage.TYPE_INT_ARGB); 43 | 44 | if(mLeds == null){ 45 | return backgroundImage; 46 | } 47 | 48 | mLedPaints.clear(); 49 | 50 | setProgress(5); 51 | 52 | int imageWidth = mTvImage.getWidth(); 53 | int imageHeight = mTvImage.getHeight(); 54 | for (Led led : mLeds) { 55 | LedPaint ledPaint = new LedPaint(); 56 | 57 | // Determine the location and orientation of the led on the image 58 | ledPaint.point = tv2image(imageDim, led.mLocation); 59 | ledPaint.angle_rad = 0.5*Math.PI - led.mSide.getAngle_rad(); 60 | 61 | // Determine the color of the led 62 | int xMin = (int)(led.mImageRectangle.getMinX() * (imageWidth-1)); 63 | int xMax = (int)(led.mImageRectangle.getMaxX() * (imageWidth-1)); 64 | int yMin = (int)(led.mImageRectangle.getMinY() * (imageHeight-1)); 65 | int yMax = (int)(led.mImageRectangle.getMaxY() * (imageHeight-1)); 66 | ledPaint.color = determineColor(xMin, xMax, yMin, yMax); 67 | 68 | mLedPaints.add(ledPaint); 69 | } 70 | 71 | setProgress(10); 72 | 73 | Graphics2D g2d = backgroundImage.createGraphics(); 74 | // Clear the image with a black rectangle 75 | g2d.setColor(Color.BLACK); 76 | g2d.drawRect(0, 0, backgroundImage.getWidth(), backgroundImage.getHeight()); 77 | paintAllLeds(g2d); 78 | 79 | return backgroundImage; 80 | } 81 | 82 | Point tv2image(Dimension pImageDim, Point2D point) { 83 | double tvWidthFraction = (1.0 - 2*0.1); 84 | double tvHeightFraction = (1.0 - 2*0.2); 85 | 86 | double tvWidth = tvWidthFraction * pImageDim.width; 87 | double tvXIndex = point.getX()*tvWidth; 88 | double imageXIndex = tvXIndex + 0.1*pImageDim.width; 89 | 90 | double tvHeight = tvHeightFraction * pImageDim.height; 91 | double tvYIndex = point.getY()*tvHeight; 92 | double imageYIndex = tvYIndex + 0.2*pImageDim.height; 93 | 94 | return new Point((int)imageXIndex, (int)imageYIndex); 95 | } 96 | 97 | private int determineColor(int xMin, int xMax, int yMin, int yMax) { 98 | int red = 0; 99 | int green = 0; 100 | int blue = 0; 101 | int count = 0; 102 | 103 | for (int y = yMin; y <= yMax; ++y) { 104 | for (int x = xMin; x <= xMax; ++x) { 105 | int color = mTvImage.getRGB(x, y); 106 | red += (color >> 16) & 0xFF; 107 | green += (color >> 8) & 0xFF; 108 | blue += color & 0xFF; 109 | ++count; 110 | } 111 | } 112 | 113 | return count > 0 ? new Color(red / count, green/count, blue/count).getRGB() : 0; 114 | } 115 | 116 | private void paintAllLeds(Graphics2D g2d) { 117 | 118 | for (int i=2; i<=180; i+=4) { 119 | if (isCancelled()) { 120 | return; 121 | } 122 | int arcSize = 24 + (int)((i/12.0)*(i/12.0)); 123 | 124 | for(LedPaint led : mLedPaints) { 125 | int argb = 0x05000000 | (0x00ffffff & led.color); 126 | g2d.setColor(new Color(argb , true)); 127 | 128 | g2d.translate(led.point.getX(), led.point.getY()); 129 | g2d.rotate(led.angle_rad); 130 | g2d.fillArc(-arcSize, -arcSize, 2*arcSize, 2*arcSize, 90-(i/2), i); 131 | g2d.rotate(-led.angle_rad); 132 | g2d.translate(-led.point.getX(), -led.point.getY()); 133 | 134 | setProgress(10+i/3); 135 | } 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/LedTvComponent.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.LedSimulation; 2 | 3 | import java.awt.BasicStroke; 4 | import java.awt.Color; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.Image; 8 | import java.awt.Rectangle; 9 | import java.awt.event.MouseEvent; 10 | import java.awt.event.MouseMotionListener; 11 | import java.awt.geom.Rectangle2D; 12 | import java.awt.image.BufferedImage; 13 | import java.util.Vector; 14 | 15 | import javax.swing.JComponent; 16 | 17 | import org.hyperion.hypercon.spec.Led; 18 | 19 | public class LedTvComponent extends JComponent { 20 | 21 | private final BufferedImage mDisplayedImage = new BufferedImage(1280, 720, BufferedImage.TYPE_INT_ARGB); 22 | private final Graphics2D mImageG2d = mDisplayedImage.createGraphics(); 23 | 24 | private final int mBorderWidth = 18; 25 | 26 | 27 | 28 | private Vector mLeds; 29 | 30 | private Led mSelectedLed; 31 | 32 | public LedTvComponent(Vector pLeds) { 33 | mLeds = pLeds; 34 | 35 | addMouseMotionListener(mMouseMotionListener); 36 | } 37 | 38 | public void setLeds(Vector pLeds) { 39 | mLeds = pLeds; 40 | } 41 | 42 | public Vector getLeds() { 43 | return mLeds; 44 | } 45 | 46 | public void setImage(Image pImage) { 47 | mImageG2d.clearRect(0, 0, mDisplayedImage.getWidth(), mDisplayedImage.getHeight()); 48 | mImageG2d.drawImage(pImage, 0,0, mDisplayedImage.getWidth(), mDisplayedImage.getHeight(), null); 49 | } 50 | 51 | @Override 52 | public void paint(Graphics g) { 53 | Graphics2D g2d = (Graphics2D) g.create(); 54 | 55 | g2d.setColor(Color.DARK_GRAY.darker()); 56 | g2d.fillRect(0,0, getWidth()-1, getHeight()-1); 57 | 58 | g2d.drawImage(mDisplayedImage, mBorderWidth, mBorderWidth, getWidth()-2*mBorderWidth, getHeight()-2*mBorderWidth, null); 59 | if (mLeds == null) { 60 | return; 61 | } 62 | 63 | g2d.setColor(Color.GRAY); 64 | for (Led led : mLeds) { 65 | Rectangle rect = led2tv(led.mImageRectangle); 66 | 67 | g2d.drawRect(rect.x, rect.y, rect.width, rect.height); 68 | 69 | switch (led.mSide) { 70 | case top_left: 71 | g2d.drawString(""+led.mLedSeqNr, 0, 11); 72 | break; 73 | case top: 74 | g2d.drawString(""+led.mLedSeqNr, (int)rect.getCenterX(), 13); 75 | break; 76 | case top_right: 77 | g2d.drawString(""+led.mLedSeqNr, (int)getWidth()-11, (int)11); 78 | break; 79 | case right: 80 | g2d.drawString(""+led.mLedSeqNr, (int)getWidth()-11, (int)rect.getCenterY()); 81 | break; 82 | case bottom_right: 83 | g2d.drawString(""+led.mLedSeqNr, (int)getWidth()-11, (int)getHeight()-1); 84 | break; 85 | case bottom: 86 | g2d.drawString(""+led.mLedSeqNr, (int)rect.getCenterX(), (int)getHeight()-5); 87 | break; 88 | case bottom_left: 89 | g2d.drawString(""+led.mLedSeqNr, (int)0, (int)getHeight()-1); 90 | break; 91 | case left: 92 | g2d.drawString(""+led.mLedSeqNr, 0, (int)rect.getCenterY()); 93 | break; 94 | } 95 | } 96 | if (mSelectedLed != null) { 97 | Rectangle rect = led2tv(mSelectedLed.mImageRectangle); 98 | 99 | g2d.setStroke(new BasicStroke(3.0f)); 100 | g2d.setColor(Color.WHITE); 101 | g2d.drawRect(rect.x, rect.y, rect.width, rect.height); 102 | } 103 | } 104 | 105 | public Rectangle led2tv(Rectangle2D pLedRect) { 106 | int tvWidth = getWidth()-2*mBorderWidth; 107 | int tvHeight = getHeight()-2*mBorderWidth; 108 | 109 | int x = (int) Math.round(mBorderWidth + tvWidth*pLedRect.getX()); 110 | int y = (int) Math.round(mBorderWidth + tvHeight*pLedRect.getY()); 111 | int width = (int) Math.round(tvWidth * pLedRect.getWidth()); 112 | int height = (int) Math.round(tvHeight * pLedRect.getHeight()); 113 | 114 | return new Rectangle(x,y, width, height); 115 | } 116 | 117 | private final MouseMotionListener mMouseMotionListener = new MouseMotionListener() { 118 | @Override 119 | public void mouseMoved(MouseEvent e) { 120 | mSelectedLed = null; 121 | 122 | double x = (double)(e.getX() - mBorderWidth) / (getWidth() - mBorderWidth*2); 123 | double y = (double)(e.getY() - mBorderWidth) / (getHeight() - mBorderWidth*2); 124 | 125 | for (Led led : mLeds) { 126 | if (led.mImageRectangle.contains(x, y) || (Math.abs(led.mLocation.getX() - x) < 0.01 && Math.abs(led.mLocation.getY() - y) < 0.01)) { 127 | mSelectedLed = led; 128 | break; 129 | } 130 | } 131 | 132 | repaint(); 133 | } 134 | @Override 135 | public void mouseDragged(MouseEvent e) { 136 | 137 | } 138 | }; 139 | 140 | } 141 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImageBBB_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImageBBB_01.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImageBBB_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImageBBB_02.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImageBBB_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImageBBB_03.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_01.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_02.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_03.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_04.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulation/TestImage_05.png -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Process_Tab/ColorSmoothingPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Process_Tab; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.beans.Transient; 7 | 8 | import javax.swing.BorderFactory; 9 | import javax.swing.GroupLayout; 10 | import javax.swing.JCheckBox; 11 | import javax.swing.JComboBox; 12 | import javax.swing.JLabel; 13 | import javax.swing.JPanel; 14 | import javax.swing.JSpinner; 15 | import javax.swing.SpinnerNumberModel; 16 | import javax.swing.GroupLayout.Alignment; 17 | import javax.swing.event.ChangeEvent; 18 | import javax.swing.event.ChangeListener; 19 | 20 | import org.hyperion.hypercon.language.language; 21 | import org.hyperion.hypercon.spec.ColorConfig; 22 | import org.hyperion.hypercon.spec.ColorSmoothingType; 23 | 24 | public class ColorSmoothingPanel extends JPanel { 25 | 26 | private final ColorConfig mColorConfig; 27 | 28 | private JCheckBox mEnabledCheck; 29 | private JLabel mTypeLabel; 30 | private JComboBox mTypeCombo; 31 | private JLabel mTimeLabel; 32 | private JSpinner mTimeSpinner; 33 | private JLabel mUpdateFrequencyLabel; 34 | private JSpinner mUpdateFrequencySpinner; 35 | private JLabel mUpdateDelayLabel; 36 | private JSpinner mUpdateDelaySpinner; 37 | 38 | public ColorSmoothingPanel(final ColorConfig pColorConfig) { 39 | super(); 40 | 41 | mColorConfig = pColorConfig; 42 | 43 | initialise(); 44 | } 45 | 46 | @Override 47 | @Transient 48 | public Dimension getMaximumSize() { 49 | Dimension maxSize = super.getMaximumSize(); 50 | Dimension prefSize = super.getPreferredSize(); 51 | return new Dimension(maxSize.width, prefSize.height); 52 | } 53 | 54 | private void initialise() { 55 | setBorder(BorderFactory.createTitledBorder(language.getString("process.smoothing.title"))); //$NON-NLS-1$ 56 | 57 | mEnabledCheck = new JCheckBox(language.getString("general.phrase.enabled")); //$NON-NLS-1$ 58 | mEnabledCheck.setSelected(mColorConfig.mSmoothingEnabled); 59 | mEnabledCheck.addActionListener(mActionListener); 60 | add(mEnabledCheck); 61 | 62 | mTypeLabel = new JLabel(language.getString("process.smoothing.typlabel")); //$NON-NLS-1$ 63 | add(mTypeLabel); 64 | 65 | mTypeCombo = new JComboBox<>(ColorSmoothingType.values()); 66 | mTypeCombo.setSelectedItem(mColorConfig.mSmoothingType); 67 | mTypeCombo.addActionListener(mActionListener); 68 | add(mTypeCombo); 69 | 70 | mTimeLabel = new JLabel(language.getString("process.smoothing.timelabel")); //$NON-NLS-1$ 71 | add(mTimeLabel); 72 | 73 | mTimeSpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mSmoothingTime_ms, 1, 600, 25)); 74 | mTimeSpinner.addChangeListener(mChangeListener); 75 | add(mTimeSpinner); 76 | 77 | mUpdateFrequencyLabel = new JLabel(language.getString("process.smoothing.updatefreqlabel")); //$NON-NLS-1$ 78 | add(mUpdateFrequencyLabel); 79 | 80 | mUpdateFrequencySpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mSmoothingUpdateFrequency_Hz, 1, 100, 1)); 81 | mUpdateFrequencySpinner.addChangeListener(mChangeListener); 82 | add(mUpdateFrequencySpinner); 83 | 84 | mUpdateDelayLabel = new JLabel(language.getString("process.smoothing.updatedelaylabel")); //$NON-NLS-1$ 85 | add(mUpdateDelayLabel); 86 | 87 | mUpdateDelaySpinner = new JSpinner(new SpinnerNumberModel(mColorConfig.mUpdateDelay, 0, 2048, 1)); 88 | mUpdateDelaySpinner.setToolTipText(language.getString("process.smoothing.updatedelaytooltip")); //$NON-NLS-1$ 89 | mUpdateDelaySpinner.addChangeListener(mChangeListener); 90 | add(mUpdateDelaySpinner); 91 | 92 | GroupLayout layout = new GroupLayout(this); 93 | layout.setAutoCreateGaps(true); 94 | setLayout(layout); 95 | 96 | layout.setHorizontalGroup(layout.createSequentialGroup() 97 | .addGroup(layout.createParallelGroup() 98 | .addComponent(mEnabledCheck) 99 | .addComponent(mTypeLabel) 100 | .addComponent(mTimeLabel) 101 | .addComponent(mUpdateFrequencyLabel) 102 | .addComponent(mUpdateDelayLabel) 103 | ) 104 | .addGroup(layout.createParallelGroup() 105 | .addComponent(mEnabledCheck) 106 | .addComponent(mTypeCombo) 107 | .addComponent(mTimeSpinner) 108 | .addComponent(mUpdateFrequencySpinner) 109 | .addComponent(mUpdateDelaySpinner) 110 | )); 111 | layout.setVerticalGroup(layout.createSequentialGroup() 112 | .addComponent(mEnabledCheck) 113 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 114 | .addComponent(mTypeLabel) 115 | .addComponent(mTypeCombo) 116 | ) 117 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 118 | .addComponent(mTimeLabel) 119 | .addComponent(mTimeSpinner) 120 | ) 121 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 122 | .addComponent(mUpdateFrequencyLabel) 123 | .addComponent(mUpdateFrequencySpinner) 124 | ) 125 | .addGroup(layout.createParallelGroup(Alignment.CENTER) 126 | .addComponent(mUpdateDelayLabel) 127 | .addComponent(mUpdateDelaySpinner) 128 | )); 129 | 130 | toggleEnabled(mColorConfig.mSmoothingEnabled); 131 | } 132 | 133 | private void toggleEnabled(boolean pEnabled) { 134 | mTypeLabel.setEnabled(pEnabled); 135 | mTypeCombo.setEnabled(pEnabled); 136 | mTimeLabel.setEnabled(pEnabled); 137 | mTimeSpinner.setEnabled(pEnabled); 138 | mUpdateFrequencyLabel.setEnabled(pEnabled); 139 | mUpdateFrequencySpinner.setEnabled(pEnabled); 140 | mUpdateDelayLabel.setEnabled(pEnabled); 141 | mUpdateDelaySpinner.setEnabled(pEnabled); 142 | } 143 | 144 | private final ActionListener mActionListener = new ActionListener() { 145 | @Override 146 | public void actionPerformed(ActionEvent e) { 147 | mColorConfig.mSmoothingEnabled = mEnabledCheck.isSelected(); 148 | mColorConfig.mSmoothingType = (ColorSmoothingType)mTypeCombo.getSelectedItem(); 149 | 150 | toggleEnabled(mColorConfig.mSmoothingEnabled); 151 | } 152 | }; 153 | 154 | private final ChangeListener mChangeListener = new ChangeListener() { 155 | @Override 156 | public void stateChanged(ChangeEvent e) { 157 | mColorConfig.mSmoothingTime_ms = (Integer)mTimeSpinner.getValue(); 158 | mColorConfig.mSmoothingUpdateFrequency_Hz = (Double)mUpdateFrequencySpinner.getValue(); 159 | mColorConfig.mUpdateDelay = (Integer)mUpdateDelaySpinner.getValue(); 160 | } 161 | }; 162 | } 163 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Process_Tab/ColorsPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Process_Tab; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | import javax.swing.AbstractAction; 10 | import javax.swing.Action; 11 | import javax.swing.BorderFactory; 12 | import javax.swing.BoxLayout; 13 | import javax.swing.DefaultComboBoxModel; 14 | import javax.swing.JButton; 15 | import javax.swing.JComboBox; 16 | import javax.swing.JOptionPane; 17 | import javax.swing.JPanel; 18 | 19 | import org.hyperion.hypercon.language.language; 20 | import org.hyperion.hypercon.spec.ColorConfig; 21 | import org.hyperion.hypercon.spec.TransformConfig; 22 | 23 | public class ColorsPanel extends JPanel { 24 | 25 | private final ColorConfig mColorConfig; 26 | private final DefaultComboBoxModel mTransformsModel; 27 | 28 | private JPanel mControlPanel; 29 | private JComboBox mTransformCombo; 30 | private JButton mAddTransformButton; 31 | private JButton mDelTransformButton; 32 | 33 | private JPanel mTransformPanel; 34 | 35 | private final Map mTransformPanels = new HashMap<>(); 36 | 37 | 38 | public ColorsPanel(ColorConfig pColorConfig) { 39 | super(); 40 | 41 | mColorConfig = pColorConfig; 42 | mTransformsModel = new DefaultComboBoxModel(mColorConfig.mTransforms); 43 | 44 | initialise(); 45 | } 46 | 47 | private void initialise() { 48 | setLayout(new BorderLayout(10,10)); 49 | setBorder(BorderFactory.createTitledBorder(language.getString("process.colors.title"))); //$NON-NLS-1$ 50 | 51 | add(getControlPanel(), BorderLayout.NORTH); 52 | 53 | mTransformPanel = new JPanel(); 54 | mTransformPanel.setLayout(new BorderLayout()); 55 | add(mTransformPanel, BorderLayout.CENTER); 56 | 57 | for (TransformConfig config : mColorConfig.mTransforms) { 58 | mTransformPanels.put(config, new ColorTransformPanel(config)); 59 | } 60 | ColorTransformPanel currentPanel = mTransformPanels.get(mColorConfig.mTransforms.get(0)); 61 | mTransformPanel.add(currentPanel, BorderLayout.CENTER); 62 | } 63 | 64 | private JPanel getControlPanel() { 65 | if (mControlPanel == null) { 66 | mControlPanel = new JPanel(); 67 | mControlPanel.setLayout(new BoxLayout(mControlPanel, BoxLayout.LINE_AXIS)); 68 | 69 | mTransformCombo = new JComboBox<>(mTransformsModel); 70 | mTransformCombo.addActionListener(mComboListener); 71 | mControlPanel.add(mTransformCombo); 72 | 73 | mAddTransformButton = new JButton(mAddAction); 74 | mControlPanel.add(mAddTransformButton); 75 | 76 | mDelTransformButton = new JButton(mDelAction); 77 | mDelTransformButton.setEnabled(mTransformCombo.getItemCount() > 1); 78 | mControlPanel.add(mDelTransformButton); 79 | 80 | mAddTransformButton.setEnabled(false); 81 | } 82 | return mControlPanel; 83 | } 84 | 85 | private final Action mAddAction = new AbstractAction(language.getString("process.colors.addlabel")) { //$NON-NLS-1$ 86 | @Override 87 | public void actionPerformed(ActionEvent e) { 88 | String newId = JOptionPane.showInputDialog(language.getString("process.colors.giveanidentifiermessage")); //$NON-NLS-1$ 89 | if (newId == null || newId.isEmpty()) { 90 | // No proper value given 91 | return; 92 | } 93 | 94 | TransformConfig config = new TransformConfig(); 95 | config.mId = newId; 96 | 97 | ColorTransformPanel panel = new ColorTransformPanel(config); 98 | mTransformPanels.put(config, panel); 99 | 100 | mTransformsModel.addElement(config); 101 | mTransformsModel.setSelectedItem(config); 102 | 103 | mDelTransformButton.setEnabled(true); 104 | } 105 | }; 106 | private final Action mDelAction = new AbstractAction(language.getString("process.colors.deletelabel")) { //$NON-NLS-1$ 107 | @Override 108 | public void actionPerformed(ActionEvent e) { 109 | TransformConfig config = (TransformConfig) mTransformCombo.getSelectedItem(); 110 | mTransformPanels.remove(config); 111 | mTransformsModel.removeElement(config); 112 | 113 | mDelTransformButton.setEnabled(mTransformCombo.getItemCount() > 1); 114 | } 115 | }; 116 | 117 | private final ActionListener mComboListener = new ActionListener() { 118 | @Override 119 | public void actionPerformed(ActionEvent e) { 120 | TransformConfig selConfig = (TransformConfig) mTransformsModel.getSelectedItem(); 121 | if (selConfig == null) { 122 | // Something went wrong here, there should always be a selection! 123 | return; 124 | } 125 | 126 | ColorTransformPanel panel = mTransformPanels.get(selConfig); 127 | mTransformPanel.removeAll(); 128 | mTransformPanel.add(panel, BorderLayout.CENTER); 129 | mTransformPanel.revalidate(); 130 | mTransformPanel.repaint(); 131 | } 132 | }; 133 | } 134 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/Process_Tab/SshColorTransformPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.Process_Tab; 2 | 3 | import java.util.Observable; 4 | import java.util.Observer; 5 | 6 | import javax.swing.BorderFactory; 7 | import javax.swing.GroupLayout; 8 | import javax.swing.GroupLayout.Alignment; 9 | import javax.swing.JButton; 10 | import javax.swing.JCheckBox; 11 | import javax.swing.JPanel; 12 | 13 | import org.hyperion.hypercon.SshConnectionModel; 14 | import org.hyperion.hypercon.language.language; 15 | 16 | public class SshColorTransformPanel extends JPanel implements Observer { 17 | 18 | public JButton sendTransform; 19 | public JCheckBox sendTransformContinuousCheckBox; 20 | 21 | public SshColorTransformPanel() { 22 | super(); 23 | SshConnectionModel.getInstance().addObserver(this); 24 | initialise(); 25 | } 26 | 27 | private void initialise(){ 28 | // setBorder(BorderFactory.createTitledBorder(language.getString("process.ssh.title"))); //$NON-NLS-1$ 29 | 30 | sendTransform = new JButton(language.getString("process.ssh.sendcolortransformlabel")); //$NON-NLS-1$ 31 | sendTransform.setToolTipText(language.getString("process.ssh.sendcolortransformtooltip")); //$NON-NLS-1$ 32 | add(sendTransform); 33 | 34 | sendTransformContinuousCheckBox = new JCheckBox(language.getString("process.ssh.sendTransContinuouslabel")); //$NON-NLS-1$ 35 | sendTransformContinuousCheckBox.setToolTipText(language.getString("process.ssh.sendTransContinuoustooltip")); //$NON-NLS-1$ 36 | add(sendTransformContinuousCheckBox); 37 | 38 | 39 | 40 | GroupLayout layout = new GroupLayout(this); 41 | layout.setAutoCreateGaps(true); 42 | setLayout(layout); 43 | 44 | layout.setHorizontalGroup(layout 45 | .createSequentialGroup() 46 | .addGroup(layout.createParallelGroup() 47 | .addComponent(sendTransform) 48 | .addComponent(sendTransformContinuousCheckBox) 49 | ) 50 | ); 51 | layout.setVerticalGroup(layout 52 | .createSequentialGroup() 53 | .addComponent(sendTransform) 54 | .addComponent(sendTransformContinuousCheckBox) 55 | ); 56 | 57 | setGuiElementsEnabled(SshConnectionModel.getInstance().isConnected()); 58 | } 59 | 60 | /** 61 | * is called when the ssh connection status changes 62 | */ 63 | @Override 64 | public void update(Observable arg0, Object arg1) { 65 | if(SshConnectionModel.getInstance().isConnected()){ 66 | setGuiElementsEnabled(true); 67 | 68 | }else{ 69 | setGuiElementsEnabled(false); 70 | } 71 | 72 | } 73 | 74 | private void setGuiElementsEnabled(boolean enabled) { 75 | sendTransform.setEnabled(enabled); 76 | sendTransformContinuousCheckBox.setEnabled(enabled); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/SSH_Tab/SSHTrafficPrinterFrame.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.SSH_Tab; 2 | 3 | import org.hyperion.hypercon.Main; 4 | import org.hyperion.hypercon.SshConnectionModel; 5 | import org.hyperion.ssh.ConnectionListener; 6 | 7 | import javax.swing.*; 8 | import javax.swing.text.DefaultCaret; 9 | import java.awt.*; 10 | import java.awt.event.WindowAdapter; 11 | import java.awt.event.WindowEvent; 12 | import java.beans.Transient; 13 | 14 | /** 15 | * Created by Fabian on 22.02.2015. 16 | * 17 | * A frame to print ssh traffic 18 | */ 19 | public class SSHTrafficPrinterFrame extends JFrame implements ConnectionListener{ 20 | 21 | /** 22 | * Singleton object 23 | */ 24 | private static SSHTrafficPrinterFrame instance; 25 | 26 | /** 27 | * Singleton 28 | * @return the only instance of this object 29 | */ 30 | public static SSHTrafficPrinterFrame getInstance(){ 31 | if(instance == null){ 32 | instance = new SSHTrafficPrinterFrame(); 33 | }else{ 34 | //Show and hide this window on close and open 35 | instance.setVisible(true); 36 | } 37 | return instance; 38 | } 39 | 40 | /** 41 | * The Textarea to show the commands 42 | */ 43 | JTextArea txtArea; 44 | 45 | private SSHTrafficPrinterFrame() { 46 | 47 | super("SSH Traffic"); 48 | 49 | this.addWindowListener(new WindowAdapter() { 50 | @Override 51 | public void windowClosing(WindowEvent e) { 52 | //Show and hide this window on close and open 53 | setVisible(false); 54 | } 55 | }); 56 | 57 | try { 58 | // Configure swing to use the system default look and feel 59 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 60 | } catch (Exception e) {} 61 | 62 | SshConnectionModel.getInstance().addConnectionListener(this); 63 | 64 | setIconImage(new ImageIcon(Main.class.getResource("HyperConIcon_64.png")).getImage()); 65 | setLayout(new BorderLayout()); 66 | 67 | 68 | txtArea = new JTextArea("SSH Traffic:\n"); 69 | txtArea.setEditable(false); 70 | txtArea.setLineWrap(true); 71 | txtArea.setWrapStyleWord(true); 72 | JScrollPane scrollPane = new JScrollPane(txtArea); 73 | 74 | //Always scroll to the end 75 | DefaultCaret caret = (DefaultCaret)txtArea.getCaret(); 76 | caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); 77 | 78 | add(scrollPane, BorderLayout.CENTER); 79 | setSize(new Dimension(820,600)); 80 | } 81 | 82 | @Override 83 | @Transient 84 | public Dimension getMaximumSize() { 85 | Dimension maxSize = super.getMaximumSize(); 86 | Dimension prefSize = super.getPreferredSize(); 87 | return new Dimension(maxSize.width, prefSize.height); 88 | } 89 | 90 | /** 91 | * a static close function so the getInstance().dispose() way wont open the frame for a split second 92 | */ 93 | public static void close(){ 94 | if(instance != null){ 95 | instance.dispose(); 96 | } 97 | } 98 | 99 | @Override 100 | public void connected() { 101 | txtArea.append("ssh connected\n"); 102 | txtArea.setCaretPosition(txtArea.getDocument().getLength()); 103 | } 104 | 105 | @Override 106 | public void disconnected() { 107 | txtArea.append("ssh disconnected\n"); 108 | txtArea.setCaretPosition(txtArea.getDocument().getLength()); 109 | 110 | } 111 | 112 | @Override 113 | public void commandExec(String pCommand) { 114 | txtArea.append("ssh out: \t" + pCommand + "\n"); 115 | txtArea.setCaretPosition(txtArea.getDocument().getLength()); 116 | 117 | 118 | } 119 | 120 | @Override 121 | public void getFile(String src, String dst) { 122 | txtArea.append("sftp getFile(" + src + ", " + dst + ")\n"); 123 | txtArea.setCaretPosition(txtArea.getDocument().getLength()); 124 | 125 | } 126 | @Override 127 | public void sendConfigFile(String srcPath, String FileName, String hyperionConfigTargetCall) { 128 | txtArea.append("sftp Send Hyperion Config - Sourcepath: " + srcPath + ", Targetpath: " + hyperionConfigTargetCall +", Filename: "+ FileName +"\n"); 129 | txtArea.setCaretPosition(txtArea.getDocument().getLength()); 130 | 131 | } 132 | @Override 133 | public void commandFinished(String pCommand) { 134 | 135 | } 136 | 137 | @Override 138 | public void getFileFinished(String src, String dst) { 139 | 140 | } 141 | @Override 142 | public void sendConfigFileFinished(String srcPath, String dstPath, String fileName) { 143 | 144 | } 145 | @Override 146 | public void addLine(String pLine) { 147 | txtArea.append("ssh in: \t" + pLine + "\n"); 148 | txtArea.setCaretPosition(txtArea.getDocument().getLength()); 149 | 150 | } 151 | 152 | @Override 153 | public void addError(String pLine) { 154 | txtArea.append("ssh out: \t" + pLine + "\n"); 155 | // txtArea.append("ssh error: \t" + pLine + "\n"); 156 | txtArea.setCaretPosition(txtArea.getDocument().getLength()); 157 | 158 | 159 | } 160 | 161 | } 162 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/SSH_Tab/SshColorPickingPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.SSH_Tab; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Dimension; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.beans.PropertyChangeEvent; 8 | import java.beans.PropertyChangeListener; 9 | import java.beans.Transient; 10 | import java.util.Observable; 11 | import java.util.Observer; 12 | 13 | import javax.swing.*; 14 | 15 | import com.jcraft.jsch.JSchException; 16 | import org.hyperion.hypercon.ErrorHandling; 17 | import org.hyperion.hypercon.SshConnectionModel; 18 | import org.hyperion.hypercon.language.language; 19 | import org.hyperion.hypercon.spec.SshAndColorPickerConfig; 20 | 21 | import com.bric.swing.ColorPicker; 22 | 23 | /** 24 | * @author Fabian Hertwig 25 | * 26 | */ 27 | public class SshColorPickingPanel extends JPanel implements Observer, PropertyChangeListener{ 28 | 29 | 30 | private ColorPicker colorPicker; 31 | private JButton setLedColor; 32 | private JButton clearLedColor; 33 | private JCheckBox autoUpdateCB; 34 | private JCheckBox expertView; 35 | private JCheckBox showColorWheel; 36 | private SshAndColorPickerConfig sshConfig; 37 | 38 | 39 | /**Constructor 40 | * @param psshConfig 41 | * 42 | */ 43 | public SshColorPickingPanel(SshAndColorPickerConfig psshConfig) { 44 | super(); 45 | sshConfig = psshConfig; 46 | 47 | SshConnectionModel.getInstance().addObserver(this); 48 | 49 | initialise(); 50 | } 51 | 52 | /** 53 | * to set the Guielements sizes 54 | */ 55 | @Override 56 | @Transient 57 | public Dimension getMaximumSize() { 58 | Dimension maxSize = super.getMaximumSize(); 59 | Dimension prefSize = super.getPreferredSize(); 60 | return new Dimension(maxSize.width, prefSize.height); 61 | } 62 | 63 | /** 64 | * Create Gui elements and layout 65 | */ 66 | private void initialise() { 67 | 68 | //All the Gui elements 69 | setBorder(BorderFactory.createTitledBorder(language.getString("ssh.colorpicker.title"))); //$NON-NLS-1$ 70 | 71 | expertView = new JCheckBox(language.getString("ssh.colorpicker.expertviewlabel")); //$NON-NLS-1$ 72 | expertView.setSelected(sshConfig.colorPickerInExpertmode); 73 | expertView.addActionListener(mActionListener); 74 | add(expertView); 75 | 76 | showColorWheel = new JCheckBox(language.getString("ssh.colorpicker.colorwheellabel")); //$NON-NLS-1$ 77 | showColorWheel.setSelected(sshConfig.colorPickerShowColorWheel); 78 | showColorWheel.addActionListener(mActionListener); 79 | add(showColorWheel); 80 | 81 | colorPicker = new ColorPicker(false, false); 82 | colorPicker.setRGBControlsVisible(true); 83 | colorPicker.setPreviewSwatchVisible(true); 84 | colorPicker.setHexControlsVisible(false); 85 | colorPicker.setHSBControlsVisible(false); 86 | 87 | colorPicker.setMode(ColorPicker.HUE); 88 | colorPicker.setMinimumSize(new Dimension(150,150)); 89 | colorPicker.addPropertyChangeListener(this); 90 | //TODO: make the color picker size less static 91 | colorPicker.setPreferredSize(new Dimension(200, 200)); 92 | colorPicker.setRGB(255, 255, 255); 93 | if(!showColorWheel.isSelected()){ 94 | colorPicker.setMode(ColorPicker.HUE); 95 | }else{ 96 | colorPicker.setMode(ColorPicker.BRI); 97 | } 98 | add(colorPicker, BorderLayout.CENTER); 99 | 100 | autoUpdateCB = new JCheckBox(language.getString("ssh.colorpicker.autoupdatebutton")); //$NON-NLS-1$ 101 | autoUpdateCB.setToolTipText(language.getString("ssh.colorpicker.autoupdatetooltip")); //$NON-NLS-1$ 102 | add(autoUpdateCB); 103 | 104 | setLedColor = new JButton(language.getString("ssh.colorpicker.setledcolorbutton")); //$NON-NLS-1$ 105 | setLedColor.addActionListener(mActionListener); 106 | add(setLedColor); 107 | 108 | clearLedColor = new JButton(language.getString("ssh.colorpicker.clearbutton")); //$NON-NLS-1$ 109 | clearLedColor.addActionListener(mActionListener); 110 | add(clearLedColor); 111 | 112 | setGuiElementsEnabled(false); 113 | 114 | //The Layout 115 | 116 | GroupLayout layout = new GroupLayout(this); 117 | layout.setAutoCreateGaps(true); 118 | setLayout(layout); 119 | 120 | layout.setHorizontalGroup(layout.createParallelGroup() 121 | .addGroup(layout.createSequentialGroup() 122 | .addComponent(showColorWheel) 123 | .addComponent(expertView) 124 | ) 125 | .addGroup(layout.createParallelGroup() 126 | .addComponent(colorPicker)) 127 | .addGroup(layout.createSequentialGroup() 128 | .addComponent(autoUpdateCB)) 129 | .addGroup(layout.createSequentialGroup() 130 | .addComponent(setLedColor) 131 | .addComponent(clearLedColor) 132 | )); 133 | layout.setVerticalGroup(layout.createSequentialGroup() 134 | .addGroup(layout.createParallelGroup() 135 | .addComponent(showColorWheel) 136 | .addComponent(expertView) 137 | ) 138 | .addGroup(layout.createSequentialGroup() 139 | .addComponent(colorPicker) 140 | .addComponent(autoUpdateCB) 141 | 142 | ) 143 | 144 | .addGroup(layout.createParallelGroup() 145 | .addComponent(setLedColor) 146 | .addComponent(clearLedColor))); 147 | } 148 | 149 | /** 150 | * Listener for the buttons and checkboxes 151 | */ 152 | private final ActionListener mActionListener = new ActionListener() { 153 | @Override 154 | public void actionPerformed(ActionEvent e) { 155 | if(e.getSource() == setLedColor){ 156 | int[] chosenColor = colorPicker.getRGB(); 157 | try { 158 | SshConnectionModel.getInstance().sendLedColor(chosenColor[0], chosenColor[1], chosenColor[2]); 159 | } catch (JSchException e1) { 160 | ErrorHandling.ShowException(e1); 161 | } 162 | }else if(e.getSource() == clearLedColor){ 163 | try { 164 | SshConnectionModel.getInstance().sendClear(); 165 | } catch (JSchException e1) { 166 | ErrorHandling.ShowException(e1); 167 | } 168 | }else if(e.getSource() == expertView){ 169 | colorPicker.setExpertControlsVisible(expertView.isSelected()); 170 | sshConfig.colorPickerInExpertmode = expertView.isSelected(); 171 | 172 | }else if(e.getSource() == showColorWheel){ 173 | sshConfig.colorPickerShowColorWheel = showColorWheel.isSelected(); 174 | if(!showColorWheel.isSelected()){ 175 | colorPicker.setMode(ColorPicker.HUE); 176 | }else{ 177 | colorPicker.setMode(ColorPicker.BRI); 178 | } 179 | } 180 | 181 | 182 | } 183 | }; 184 | 185 | 186 | /** 187 | * is called when the ssh connection status changes 188 | */ 189 | @Override 190 | public void update(Observable arg0, Object arg1) { 191 | if(SshConnectionModel.getInstance().isConnected()){ 192 | setGuiElementsEnabled(true); 193 | 194 | }else{ 195 | setGuiElementsEnabled(false); 196 | } 197 | 198 | } 199 | 200 | /** 201 | * Is called from the color picker when the color changed 202 | */ 203 | @Override 204 | public void propertyChange(PropertyChangeEvent evt) { 205 | if(autoUpdateCB != null && autoUpdateCB.isSelected() && evt.getPropertyName().equals("selected color")){ 206 | int[] chosenColor = colorPicker.getRGB(); 207 | try { 208 | SshConnectionModel.getInstance().sendLedColor(chosenColor[0], chosenColor[1], chosenColor[2]); 209 | } catch (JSchException e) { 210 | ErrorHandling.ShowException(e); 211 | } 212 | } 213 | 214 | } 215 | 216 | /** 217 | * Enable or disabel all guielements which shouldnt be editable if there is no connection 218 | * @param enabled 219 | */ 220 | private void setGuiElementsEnabled(boolean enabled){ 221 | setLedColor.setEnabled(enabled); 222 | clearLedColor.setEnabled(enabled); 223 | autoUpdateCB.setEnabled(enabled); 224 | 225 | } 226 | 227 | } 228 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/SSH_Tab/SshCommandSenderPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.SSH_Tab; 2 | 3 | import com.jcraft.jsch.JSchException; 4 | import org.hyperion.hypercon.ErrorHandling; 5 | import org.hyperion.hypercon.SshConnectionModel; 6 | import org.hyperion.hypercon.language.language; 7 | import org.hyperion.hypercon.spec.SshAndColorPickerConfig; 8 | import org.hyperion.hypercon.spec.SshCommand; 9 | 10 | import javax.swing.*; 11 | import java.awt.*; 12 | import java.awt.event.ActionEvent; 13 | import java.awt.event.ActionListener; 14 | import java.beans.Transient; 15 | import java.util.Observable; 16 | import java.util.Observer; 17 | 18 | /** 19 | * Created by Fabian on 10.03.2015. 20 | */ 21 | public class SshCommandSenderPanel extends JPanel implements Observer { 22 | 23 | /** 24 | * Here the commands are saved 25 | */ 26 | private final SshAndColorPickerConfig mSshConfig; 27 | 28 | /** 29 | * the model to handle the connection 30 | */ 31 | private final SshConnectionModel sshConnection; 32 | 33 | private JComboBox commands_cb; 34 | private JButton send_but; 35 | private JButton del_but; 36 | 37 | 38 | public SshCommandSenderPanel(SshAndColorPickerConfig mSshConfig) { 39 | super(); 40 | 41 | this.mSshConfig = mSshConfig; 42 | 43 | sshConnection = SshConnectionModel.getInstance(); 44 | sshConnection.addObserver(this); 45 | 46 | initialise(); 47 | 48 | } 49 | 50 | /** 51 | * to set the Guielements sizes 52 | */ 53 | @Override 54 | @Transient 55 | public Dimension getMaximumSize() { 56 | Dimension maxSize = super.getMaximumSize(); 57 | Dimension prefSize = super.getPreferredSize(); 58 | return new Dimension(maxSize.width, prefSize.height); 59 | } 60 | 61 | /** 62 | * Create, add and layout Gui elements 63 | */ 64 | private void initialise() { 65 | 66 | setBorder(BorderFactory.createTitledBorder(language.getString("ssh.sshcommand.title"))); //$NON-NLS-1$ 67 | 68 | 69 | commands_cb = new JComboBox<>(); 70 | for (SshCommand sshCommand : mSshConfig.sshCommands) { 71 | commands_cb.addItem(sshCommand.getCommand()); 72 | } 73 | 74 | 75 | commands_cb.setEditable(true); 76 | commands_cb.addActionListener(mActionListener); 77 | add(commands_cb); 78 | 79 | send_but = new JButton(language.getString("ssh.sshcommand.sendbutton")); //$NON-NLS-1$ 80 | send_but.addActionListener(mActionListener); 81 | add(send_but); 82 | 83 | del_but = new JButton(language.getString("ssh.sshcommand.deletebutton")); //$NON-NLS-1$ 84 | del_but.addActionListener(mActionListener); 85 | add(del_but); 86 | 87 | GroupLayout layout = new GroupLayout(this); 88 | layout.setAutoCreateGaps(true); 89 | setLayout(layout); 90 | 91 | layout.setHorizontalGroup(layout.createSequentialGroup() 92 | .addGroup(layout.createParallelGroup() 93 | .addGroup(layout.createParallelGroup() 94 | .addComponent(commands_cb) 95 | ) 96 | .addGroup(layout.createSequentialGroup() 97 | .addComponent(send_but) 98 | .addComponent(del_but) 99 | ) 100 | )); 101 | 102 | layout.setVerticalGroup(layout.createSequentialGroup() 103 | .addGroup(layout.createParallelGroup() 104 | .addComponent(commands_cb)) 105 | .addGroup(layout.createParallelGroup() 106 | .addComponent(send_but) 107 | .addComponent(del_but)) 108 | ); 109 | 110 | setConnectionFieldsAcces(false); 111 | 112 | } 113 | 114 | /** 115 | * Enable or disable the Gui elememnts which depend on a shh connection 116 | * @param setEnabled 117 | */ 118 | private void setConnectionFieldsAcces(boolean setEnabled) { 119 | send_but.setEnabled(setEnabled); 120 | commands_cb.setEnabled(setEnabled); 121 | del_but.setEnabled(setEnabled); 122 | 123 | 124 | } 125 | 126 | @Override 127 | public void update(Observable o, Object arg) { 128 | if (SshConnectionModel.getInstance().isConnected()) { 129 | setConnectionFieldsAcces(true); 130 | } else { 131 | setConnectionFieldsAcces(false); 132 | } 133 | 134 | } 135 | 136 | private final ActionListener mActionListener = new ActionListener() { 137 | @Override 138 | public void actionPerformed(ActionEvent e) { 139 | 140 | if (e.getActionCommand() == "comboBoxEdited") { //$NON-NLS-1$ 141 | if(commands_cb.getSelectedIndex() == -1){ 142 | commands_cb.addItem(String.valueOf(commands_cb.getSelectedItem())); 143 | } 144 | } 145 | 146 | if (e.getSource() == send_but && commands_cb.getSelectedItem() != null) { 147 | 148 | boolean commandAlreadyInList = false; 149 | for (SshCommand sshCommand : mSshConfig.sshCommands) { 150 | if(sshCommand.getCommand().equals(commands_cb.getSelectedItem().toString())){ 151 | commandAlreadyInList = true; 152 | } 153 | } 154 | 155 | if(!commandAlreadyInList){ 156 | mSshConfig.sshCommands.add(new SshCommand(commands_cb.getSelectedItem().toString())); 157 | } 158 | try { 159 | sshConnection.sendCommandInNewThread(commands_cb.getSelectedItem().toString()); 160 | } catch (JSchException e1) { 161 | ErrorHandling.ShowException(e1); 162 | } 163 | } 164 | else if (e.getSource() == del_but && commands_cb.getSelectedItem() != null){ 165 | for (SshCommand sshCommand : mSshConfig.sshCommands) { 166 | if(sshCommand.getCommand().equals(commands_cb.getSelectedItem().toString())){ 167 | mSshConfig.sshCommands.removeElement(sshCommand); 168 | break; 169 | } 170 | } 171 | commands_cb.removeItemAt(commands_cb.getSelectedIndex()); 172 | commands_cb.setSelectedIndex(-1); 173 | } 174 | } 175 | }; 176 | 177 | 178 | 179 | 180 | } 181 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/SSH_Tab/SshManageHyperionPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.SSH_Tab; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.beans.Transient; 7 | import java.util.Observable; 8 | import java.util.Observer; 9 | 10 | import javax.swing.BorderFactory; 11 | import javax.swing.GroupLayout; 12 | import javax.swing.JButton; 13 | import javax.swing.JFrame; 14 | import javax.swing.JOptionPane; 15 | import javax.swing.JPanel; 16 | 17 | import org.hyperion.hypercon.ErrorHandling; 18 | import org.hyperion.hypercon.SshConnectionModel; 19 | import org.hyperion.hypercon.language.language; 20 | import org.hyperion.hypercon.spec.SshAndColorPickerConfig; 21 | 22 | import com.jcraft.jsch.JSchException; 23 | import javax.swing.GroupLayout.Alignment; 24 | 25 | 26 | public class SshManageHyperionPanel extends JPanel implements Observer { 27 | 28 | private final SshAndColorPickerConfig mSshConfig; 29 | /** 30 | * the model to handle the connection 31 | */ 32 | private final SshConnectionModel sshConnection; 33 | 34 | private JButton mInstallHypButton; 35 | private JButton mRemoveHypButton; 36 | private JButton mStartHypButton; 37 | private JButton mStopHypButton; 38 | private JButton mGetLogHypButton; 39 | 40 | public SshManageHyperionPanel(SshAndColorPickerConfig mSshConfig) { 41 | super(); 42 | 43 | this.mSshConfig = mSshConfig; 44 | 45 | sshConnection = SshConnectionModel.getInstance(); 46 | sshConnection.addObserver(this); 47 | 48 | initialise(); 49 | 50 | } 51 | 52 | /** 53 | * to set the Guielements sizes 54 | */ 55 | @Override 56 | @Transient 57 | public Dimension getMaximumSize() { 58 | Dimension maxSize = super.getMaximumSize(); 59 | Dimension prefSize = super.getPreferredSize(); 60 | return new Dimension(maxSize.width, prefSize.height); 61 | } 62 | 63 | /** 64 | * Create, add and layout Gui elements 65 | */ 66 | private void initialise() { 67 | setBorder(BorderFactory.createTitledBorder(language.getString("ssh.sshmanage.title"))); //$NON-NLS-1$ 68 | 69 | mInstallHypButton = new JButton(language.getString("ssh.sshmanage.InstallHypButton")); //$NON-NLS-1$ 70 | mInstallHypButton.setToolTipText(language.getString("ssh.sshmanage.InstallHypButtontooltip")); 71 | mInstallHypButton.addActionListener(mActionListener); 72 | add(mInstallHypButton); 73 | 74 | mRemoveHypButton = new JButton(language.getString("ssh.sshmanage.RemoveHypButton")); //$NON-NLS-1$ 75 | mRemoveHypButton.setToolTipText(language.getString("ssh.sshmanage.RemoveHypButtontooltip")); 76 | mRemoveHypButton.addActionListener(mActionListener); 77 | add(mRemoveHypButton); 78 | 79 | mStartHypButton = new JButton(language.getString("ssh.sshmanage.StartHypButton")); //$NON-NLS-1$ 80 | mStartHypButton.setToolTipText(language.getString("ssh.sshmanage.StartHypButtontooltip")); 81 | mStartHypButton.addActionListener(mActionListener); 82 | add(mStartHypButton); 83 | 84 | mStopHypButton = new JButton(language.getString("ssh.sshmanage.StopHypButton")); //$NON-NLS-1$ 85 | mStopHypButton.setToolTipText(language.getString("ssh.sshmanage.StopHypButtontooltip")); 86 | mStopHypButton.addActionListener(mActionListener); 87 | add(mStopHypButton); 88 | 89 | mGetLogHypButton = new JButton(language.getString("ssh.sshmanage.GetLogHypButton")); //$NON-NLS-1$ 90 | mGetLogHypButton.setToolTipText(language.getString("ssh.sshmanage.GetLogHypButtontooltip")); 91 | mGetLogHypButton.addActionListener(mActionListener); 92 | add(mGetLogHypButton); 93 | 94 | GroupLayout layout = new GroupLayout(this); 95 | layout.setHorizontalGroup( 96 | layout.createSequentialGroup() 97 | .addGroup(layout.createParallelGroup() 98 | .addGroup(layout.createSequentialGroup() 99 | .addComponent(mInstallHypButton) 100 | .addComponent(mRemoveHypButton)) 101 | .addGroup(layout.createSequentialGroup() 102 | .addComponent(mStartHypButton) 103 | .addComponent(mStopHypButton) 104 | .addComponent(mGetLogHypButton)) 105 | )); 106 | layout.setVerticalGroup( 107 | layout.createSequentialGroup() 108 | .addGroup(layout.createParallelGroup() 109 | .addComponent(mInstallHypButton) 110 | .addComponent(mRemoveHypButton)) 111 | .addGroup(layout.createParallelGroup() 112 | .addComponent(mStartHypButton) 113 | .addComponent(mStopHypButton) 114 | .addComponent(mGetLogHypButton)) 115 | ); 116 | 117 | layout.setAutoCreateGaps(true); 118 | setLayout(layout); 119 | 120 | setConnectionFieldsAcces(false); 121 | 122 | } 123 | 124 | /** 125 | * Enable or disable the Gui elememnts which depend on a shh connection 126 | * @param setEnabled 127 | */ 128 | private void setConnectionFieldsAcces(boolean setEnabled) { 129 | mInstallHypButton.setEnabled(setEnabled); 130 | mRemoveHypButton.setEnabled(setEnabled); 131 | mStartHypButton.setEnabled(setEnabled); 132 | mStopHypButton.setEnabled(setEnabled); 133 | mGetLogHypButton.setEnabled(setEnabled); 134 | } 135 | 136 | @Override 137 | public void update(Observable o, Object arg) { 138 | if (SshConnectionModel.getInstance().isConnected()) { 139 | setConnectionFieldsAcces(true); 140 | } else { 141 | setConnectionFieldsAcces(false); 142 | } 143 | } 144 | private final ActionListener mActionListener = new ActionListener() { 145 | @Override 146 | public void actionPerformed(ActionEvent e) { 147 | 148 | if(e.getSource() == mInstallHypButton){ 149 | String message=language.getString("ssh.sshmanage.InstallHyperionButtonWarnMessage"); 150 | int reply = JOptionPane.showConfirmDialog(new JFrame(), message, language.getString("general.HyperConInformationDialogTitle"), 151 | JOptionPane.YES_NO_OPTION); 152 | if (reply == JOptionPane.YES_OPTION) { 153 | try { 154 | SSHTrafficPrinterFrame.getInstance(); 155 | sshConnection.sendInstall(); 156 | } catch (JSchException e1) { 157 | // TODO Auto-generated catch block 158 | e1.printStackTrace(); 159 | } 160 | 161 | } 162 | } 163 | if(e.getSource() == mRemoveHypButton){ 164 | String message=language.getString("ssh.sshmanage.RemoveHyperionButtonWarnMessage"); 165 | int reply = JOptionPane.showConfirmDialog(new JFrame(), message, language.getString("general.HyperConInformationDialogTitle"), 166 | JOptionPane.YES_NO_OPTION); 167 | if (reply == JOptionPane.YES_OPTION) { 168 | try { 169 | SSHTrafficPrinterFrame.getInstance(); 170 | sshConnection.sendRemove(); 171 | } catch (JSchException e1) { 172 | // TODO Auto-generated catch block 173 | e1.printStackTrace(); 174 | } 175 | 176 | } 177 | } 178 | if(e.getSource() == mStartHypButton){ 179 | try { 180 | sshConnection.sendServiceStart(); 181 | } catch (JSchException e1) { 182 | ErrorHandling.ShowException(e1); 183 | } 184 | } 185 | if(e.getSource() == mStopHypButton){ 186 | try { 187 | sshConnection.sendServiceStop(); 188 | } catch (JSchException e1) { 189 | ErrorHandling.ShowException(e1); 190 | } 191 | } 192 | if(e.getSource() == mGetLogHypButton){ 193 | SSHTrafficPrinterFrame.getInstance(); 194 | try { 195 | sshConnection.sendGetLog(); 196 | } catch (JSchException e1) { 197 | ErrorHandling.ShowException(e1); 198 | } 199 | } 200 | } 201 | }; 202 | } -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/gui/SSH_Tab/SshSendConfigPanel.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.gui.SSH_Tab; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.beans.Transient; 7 | import java.io.File; 8 | import java.util.Observable; 9 | import java.util.Observer; 10 | 11 | import javax.swing.BorderFactory; 12 | import javax.swing.GroupLayout; 13 | import javax.swing.JButton; 14 | import javax.swing.JComboBox; 15 | import javax.swing.JFileChooser; 16 | import javax.swing.JFrame; 17 | import javax.swing.JOptionPane; 18 | import javax.swing.JPanel; 19 | import javax.swing.filechooser.FileNameExtensionFilter; 20 | 21 | import org.hyperion.hypercon.ErrorHandling; 22 | import org.hyperion.hypercon.SshConnectionModel; 23 | import org.hyperion.hypercon.language.language; 24 | import org.hyperion.hypercon.spec.SshAndColorPickerConfig; 25 | 26 | import com.jcraft.jsch.JSchException; 27 | import com.jcraft.jsch.SftpException; 28 | 29 | public class SshSendConfigPanel extends JPanel implements Observer { 30 | /** 31 | * Here the commands are saved 32 | */ 33 | private final SshAndColorPickerConfig mSshConfig; 34 | 35 | /** 36 | * the model to handle the connection 37 | */ 38 | private final SshConnectionModel sshConnection; 39 | 40 | private JButton SourceFileButton; 41 | private JFileChooser SourceFileChooser; 42 | 43 | private JButton sendConfigButton; 44 | 45 | 46 | public SshSendConfigPanel(SshAndColorPickerConfig mSshConfig) { 47 | super(); 48 | 49 | this.mSshConfig = mSshConfig; 50 | 51 | sshConnection = SshConnectionModel.getInstance(); 52 | sshConnection.addObserver(this); 53 | 54 | initialise(); 55 | 56 | } 57 | 58 | /** 59 | * to set the Guielements sizes 60 | */ 61 | @Override 62 | @Transient 63 | public Dimension getMaximumSize() { 64 | Dimension maxSize = super.getMaximumSize(); 65 | Dimension prefSize = super.getPreferredSize(); 66 | return new Dimension(maxSize.width, prefSize.height); 67 | } 68 | 69 | /** 70 | * Create, add and layout Gui elements 71 | */ 72 | private void initialise() { 73 | 74 | setBorder(BorderFactory.createTitledBorder(language.getString("ssh.sshsendconfig.title"))); 75 | 76 | sendConfigButton = new JButton(language.getString("ssh.sshsendconfig.sendbutton")); 77 | sendConfigButton.setToolTipText(language.getString("ssh.sshsendconfig.sendbuttontooltip")); 78 | sendConfigButton.addActionListener(mActionListener); 79 | add(sendConfigButton); 80 | 81 | SourceFileButton = new JButton(language.getString("ssh.sshsendconfig.sourcefilebutton")); 82 | SourceFileButton.setToolTipText(language.getString("ssh.sshsendconfig.sourcefilebuttontooltip")); 83 | SourceFileButton.addActionListener(mActionListener); 84 | add(SourceFileButton); 85 | 86 | SourceFileChooser = new JFileChooser(); 87 | SourceFileChooser.setCurrentDirectory(new java.io.File(".")); 88 | SourceFileChooser.setSelectedFile(new File("hyperion.config.json")); 89 | FileNameExtensionFilter filter1 = new FileNameExtensionFilter("(Hyperion) .json", "json"); 90 | SourceFileChooser.setFileFilter(filter1); 91 | SourceFileChooser.addActionListener(mActionListener); 92 | 93 | GroupLayout layout = new GroupLayout(this); 94 | layout.setAutoCreateGaps(true); 95 | setLayout(layout); 96 | 97 | layout.setHorizontalGroup(layout.createSequentialGroup() 98 | .addGroup(layout.createParallelGroup() 99 | .addGroup(layout.createSequentialGroup() 100 | .addComponent(SourceFileButton) 101 | .addComponent(sendConfigButton)) 102 | )); 103 | 104 | layout.setVerticalGroup(layout.createSequentialGroup() 105 | 106 | .addGroup(layout.createParallelGroup() 107 | .addComponent(SourceFileButton) 108 | .addComponent(sendConfigButton)) 109 | ); 110 | 111 | setConnectionFieldsAcces(false); 112 | 113 | } 114 | 115 | /** 116 | * Enable or disable the Gui elememnts which depend on a shh connection 117 | * @param setEnabled 118 | */ 119 | private void setConnectionFieldsAcces(boolean setEnabled) { 120 | sendConfigButton.setEnabled(setEnabled); 121 | SourceFileButton.setEnabled(setEnabled); 122 | 123 | 124 | } 125 | 126 | @Override 127 | public void update(Observable o, Object arg) { 128 | if (SshConnectionModel.getInstance().isConnected()) { 129 | setConnectionFieldsAcces(true); 130 | } else { 131 | setConnectionFieldsAcces(false); 132 | } 133 | 134 | } 135 | 136 | private final ActionListener mActionListener = new ActionListener() { 137 | @Override 138 | public void actionPerformed(ActionEvent e) { 139 | 140 | if(e.getSource() == sendConfigButton){ 141 | SSHTrafficPrinterFrame.getInstance(); 142 | try { 143 | sshConnection.sendConfig(mSshConfig.srcPath,mSshConfig.FileName); 144 | } 145 | catch (SftpException | JSchException e1) { 146 | // JOptionPane.showMessageDialog(new JFrame(), language.getString("ssh.sshsendconfig.confuploadfailedMessage"), language.getString("general.HyperConErrorDialogTitle"), 147 | //TODO:Move to lower stage for error exception JOptionPane.ERROR_MESSAGE); 148 | } 149 | } 150 | 151 | if(e.getSource() == SourceFileButton){ 152 | int returnVal = SourceFileChooser.showOpenDialog(null); 153 | if(returnVal == JFileChooser.APPROVE_OPTION){ 154 | try { 155 | String rawsrcPath = SourceFileChooser.getSelectedFile().getAbsolutePath(); 156 | mSshConfig.FileName = SourceFileChooser.getSelectedFile().getName(); 157 | String raw1srcPath = rawsrcPath.substring(0,rawsrcPath.lastIndexOf(File.separator)); 158 | mSshConfig.srcPath = raw1srcPath.replace("\\","/"); 159 | } catch (Throwable t) { 160 | } 161 | 162 | } 163 | } 164 | 165 | } 166 | }; 167 | 168 | 169 | 170 | 171 | } 172 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/language/language.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.language; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.util.MissingResourceException; 5 | import java.util.ResourceBundle; 6 | 7 | public class language { 8 | private static final String BUNDLE_NAME = "org.hyperion.hypercon.language.language"; //$NON-NLS-1$ 9 | 10 | private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); 11 | 12 | private language() { 13 | } 14 | 15 | public static String getString(String key) { 16 | try { 17 | return new String(RESOURCE_BUNDLE.getString(key).getBytes("ISO-8859-1"), "UTF-8"); 18 | } catch (MissingResourceException e) { 19 | return '!' + key + '!'; 20 | } 21 | catch (UnsupportedEncodingException e) { 22 | return '!' + key + '!'; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/BlackBorderStandard.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | public enum BlackBorderStandard { 4 | defaultt("default"), 5 | classic("classic"), 6 | osd("osd"); 7 | 8 | private final String text; 9 | 10 | private BlackBorderStandard(final String text){ 11 | this.text = text; 12 | } 13 | @Override 14 | public String toString() { 15 | return text; 16 | } 17 | } -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/BorderSide.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | /** 4 | * Enumeration of possible led-locations (aka border-sides). This also contains the specification of 5 | * the angle at which the led is placed along a specific border (0.0rad = pointing right). 6 | */ 7 | public enum BorderSide { 8 | top_left (0.75*Math.PI), 9 | top(0.5*Math.PI), 10 | top_right(0.25*Math.PI), 11 | right(0.0*Math.PI), 12 | bottom_right(-0.25*Math.PI), 13 | bottom(-0.5*Math.PI), 14 | bottom_left(-0.75*Math.PI), 15 | left(1.0*Math.PI); 16 | 17 | /** The angle of the led [rad] */ 18 | private final double mAngle_rad; 19 | 20 | /** 21 | * Constructs the BorderSide with the given led angle 22 | * 23 | * @param pAngle_rad The angle of the led [rad] 24 | */ 25 | BorderSide(double pAngle_rad) { 26 | mAngle_rad = pAngle_rad; 27 | } 28 | 29 | /** 30 | * Returns the angle of the led placement 31 | * 32 | * @return The angle of the led [rad] 33 | */ 34 | public double getAngle_rad() { 35 | return mAngle_rad; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/ColorByteOrder.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | public enum ColorByteOrder { 4 | RGB, RBG, BRG, BGR, GRB, GBR 5 | } 6 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/ColorConfig.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import java.util.Locale; 4 | import java.util.Vector; 5 | 6 | /** 7 | * The color tuning parameters of the different color channels (both in RGB space as in HSV space) 8 | */ 9 | public class ColorConfig { 10 | 11 | /** List with color transformations */ 12 | public Vector mTransforms = new Vector<>(); 13 | { 14 | mTransforms.add(new TransformConfig()); 15 | } 16 | 17 | public boolean mSmoothingEnabled = true; 18 | /** The type of smoothing algorithm */ 19 | public ColorSmoothingType mSmoothingType = ColorSmoothingType.linear; 20 | /** The time constant for smoothing algorithm in milliseconds */ 21 | public int mSmoothingTime_ms = 200; 22 | /** The update frequency of the leds in Hz */ 23 | public double mSmoothingUpdateFrequency_Hz = 20.0; 24 | 25 | /** The number of periods (1/mSmoothingUpdateFrequency_Hz) to delay the update of the leds */ 26 | public int mUpdateDelay = 0; 27 | 28 | /** 29 | * Creates the JSON string of the configuration as used in the Hyperion daemon configfile 30 | * 31 | * @return The JSON string of this ColorConfig 32 | */ 33 | public String toJsonString() { 34 | StringBuffer strBuf = new StringBuffer(); 35 | strBuf.append("\t// COLOR CALIBRATION CONFIG\n"); 36 | strBuf.append("\t\"color\" :\n"); 37 | strBuf.append("\t{\n"); 38 | 39 | for (int i=0; i mDeviceProperties = new Hashtable(); 17 | 18 | /** The order of the color bytes */ 19 | public ColorByteOrder mColorByteOrder = ColorByteOrder.RGB; 20 | 21 | /**Store Device specific config for .dat here too**/ 22 | // public int FCP_portSpinner=8899; 23 | 24 | 25 | /** 26 | * Creates the JSON string of the configuration as used in the Hyperion daemon configfile 27 | * 28 | * @return The JSON string of this DeviceConfig 29 | */ 30 | public String toJsonString() { 31 | StringBuffer strBuf = new StringBuffer(); 32 | 33 | strBuf.append("\t// DEVICE CONFIGURATION \n"); 34 | strBuf.append("\t\"device\" :\n"); 35 | strBuf.append("\t{\n"); 36 | 37 | strBuf.append("\t\t\"name\" : \"").append(mNameField).append("\",\n"); 38 | strBuf.append("\t\t\"type\" : \"").append(mType.getTypeId()).append("\",\n"); 39 | for (Object key : mDeviceProperties.keySet()) { 40 | Object value = mDeviceProperties.get(key); 41 | if (value instanceof String) 42 | { 43 | strBuf.append(String.format("\t\t\"%s\" : \"%s\",\n", key, value)); 44 | } 45 | else 46 | { 47 | strBuf.append(String.format("\t\t\"%s\" : %s,\n", key, value.toString())); 48 | } 49 | } 50 | strBuf.append("\t\t\"colorOrder\" : \"").append(mColorByteOrder.name().toLowerCase()).append("\"\n"); 51 | 52 | strBuf.append("\t}"); 53 | 54 | return strBuf.toString(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/DeviceType.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import org.hyperion.hypercon.gui.Hardware_Tab.device.DeviceTypePanel; 4 | import org.hyperion.hypercon.gui.Hardware_Tab.device.LightPackPanel; 5 | import org.hyperion.hypercon.gui.Hardware_Tab.device.PhilipsHuePanel; 6 | import org.hyperion.hypercon.gui.Hardware_Tab.device.PiBlasterPanel; 7 | import org.hyperion.hypercon.gui.Hardware_Tab.device.SerialPanel; 8 | import org.hyperion.hypercon.gui.Hardware_Tab.device.SpiDevPanel; 9 | import org.hyperion.hypercon.gui.Hardware_Tab.device.TestDevicePanel; 10 | import org.hyperion.hypercon.gui.Hardware_Tab.device.TinkerForgePanel; 11 | import org.hyperion.hypercon.gui.Hardware_Tab.device.AtmoOrbPanel; 12 | import org.hyperion.hypercon.gui.Hardware_Tab.device.UDPPanel; 13 | import org.hyperion.hypercon.gui.Hardware_Tab.device.WS281XPanel; 14 | import org.hyperion.hypercon.gui.Hardware_Tab.device.FadeCandyPanel; 15 | import org.hyperion.hypercon.gui.Hardware_Tab.device.rawhidPanel; 16 | /** 17 | * Enumeration of known device types 18 | */ 19 | public enum DeviceType { 20 | 21 | /** all non pwm led (stripes) **/ 22 | spileds("---------SPI---------"), 23 | apa102("APA102"), 24 | ws2801("WS2801"), 25 | p9813("P9813"), 26 | lpd6803("LPD6803"), 27 | lpd8806("LPD8806"), 28 | 29 | /** all pwm led (stripes) **/ 30 | pwmleds("---------PWM---------"), 31 | ws2812b("WS2812b (just RPi1)"), 32 | ws2812spi("WS281X-SPI"), 33 | ws281x("WS281X (RPi1, RPi2, RPi3)"), 34 | 35 | /** other devices/controller **/ 36 | otherleddevices("--------OTHER--------"), 37 | philipshue("PhilipsHUE"), 38 | atmoorb("AtmoOrb"), 39 | piblaster("PiBlaster"), 40 | tinkerforge("Tinkerforge"), 41 | fadecandy("FadeCandy"), 42 | udp("UDP"), 43 | udpraw("UDP (new-imp)"), 44 | rawhid("RawHID (USB)"), 45 | sedu("SEDU"), 46 | adalight("Adalight"), 47 | AdalightApa102("AdalightAPA102"), 48 | tpm2("TPM2"), 49 | hyperion_usbasp_ws2801("USBASP-WS2801"), 50 | hyperion_usbasp_ws2812("USBASP-WS2812"), 51 | 52 | /** 3rd party vendors/devices **/ 53 | rdpartydevices("------3rd PARTY------"), 54 | ambiled("AmbiLed"), 55 | atmo("Atmo"), 56 | lightpack("Lightpack"), 57 | multi_lightpack("Multi-Lightpack"), 58 | paintpack("Paintpack"), 59 | file("Test (file)"), 60 | none("None"); 61 | 62 | /** The 'pretty' name of the device type */ 63 | private final String mName; 64 | 65 | /** The device specific configuration panel */ 66 | private DeviceTypePanel mConfigPanel; 67 | 68 | /** 69 | * Constructs the DeviceType 70 | * 71 | * @param name The 'pretty' name of the device type 72 | * @param pConfigPanel The panel for device type specific configuration 73 | */ 74 | private DeviceType(final String name) { 75 | mName = name; 76 | } 77 | 78 | /** 79 | * Returns the type identifier as used by hyperion to determine the device type 80 | * @return 81 | */ 82 | public String getTypeId() { 83 | if (this == hyperion_usbasp_ws2801) { 84 | return "hyperion-usbasp-ws2801"; 85 | } else if (this == hyperion_usbasp_ws2812) { 86 | return "hyperion-usbasp-ws2812"; 87 | } else if (this == multi_lightpack) { 88 | return "multi-lightpack"; 89 | }return super.name(); 90 | } 91 | 92 | /** 93 | * Returns the configuration panel for the this device-type (or null if no configuration is required) 94 | * 95 | * @return The panel for configuring this device type 96 | */ 97 | public DeviceTypePanel getConfigPanel(DeviceConfig pDeviceConfig) { 98 | if (mConfigPanel == null) { 99 | switch (this) { 100 | case apa102: 101 | case lpd6803: 102 | case lpd8806: 103 | case p9813: 104 | case ws2801: 105 | mConfigPanel = new SpiDevPanel(); 106 | break; 107 | case file: 108 | mConfigPanel = new TestDevicePanel(); 109 | break; 110 | case adalight: 111 | case AdalightApa102: 112 | case ambiled: 113 | case atmo: 114 | case sedu: 115 | case tpm2: 116 | mConfigPanel = new SerialPanel(); 117 | break; 118 | case lightpack: 119 | mConfigPanel = new LightPackPanel(); 120 | break; 121 | case piblaster: 122 | mConfigPanel = new PiBlasterPanel(); 123 | break; 124 | case rawhid: 125 | mConfigPanel = new rawhidPanel(); 126 | break; 127 | case hyperion_usbasp_ws2801: 128 | case hyperion_usbasp_ws2812: 129 | case multi_lightpack: 130 | case paintpack: 131 | case ws2812b: 132 | case ws2812spi: 133 | case none: 134 | break; 135 | case ws281x: 136 | mConfigPanel = new WS281XPanel(); 137 | break; 138 | case fadecandy: 139 | mConfigPanel = new FadeCandyPanel(); 140 | break; 141 | case philipshue: 142 | mConfigPanel = new PhilipsHuePanel(); 143 | break; 144 | case atmoorb: 145 | mConfigPanel = new AtmoOrbPanel(); 146 | break; 147 | case udp: 148 | case udpraw: 149 | mConfigPanel = new UDPPanel(); 150 | break; 151 | case tinkerforge: 152 | mConfigPanel = new TinkerForgePanel(); 153 | break; 154 | default: 155 | break; 156 | } 157 | } 158 | if (mConfigPanel != null) { 159 | mConfigPanel.setDeviceConfig(pDeviceConfig); 160 | } else { 161 | pDeviceConfig.mDeviceProperties.clear(); 162 | } 163 | return mConfigPanel; 164 | } 165 | 166 | @Override 167 | public String toString() { 168 | return mName; 169 | } 170 | 171 | public static String listTypes() { 172 | StringBuilder sb = new StringBuilder(); 173 | for (DeviceType type : DeviceType.values()) { 174 | if (sb.length() != 0) { 175 | sb.append(", "); 176 | } 177 | sb.append(type.toString()); 178 | } 179 | return sb.toString(); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/DimensionModes.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | /** 4 | * Created by Fabian on 22.02.2015. 5 | */ 6 | public enum DimensionModes{ 7 | TwoD("2D") , 8 | ThreeDSBS("3DSBS"), 9 | ThreeDTAB("3DTAB"); 10 | 11 | private final String text; 12 | 13 | private DimensionModes(final String text){ 14 | this.text = text; 15 | } 16 | @Override 17 | public String toString() { 18 | return text; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/EffectStandard.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import org.hyperion.hypercon.language.language; 4 | 5 | public enum EffectStandard { 6 | none(language.getString("external.effect.booteffectlist.None")), //$NON-NLS-1$ 7 | knightrider(language.getString("external.effect.booteffectlist.Knight_Rider")), //$NON-NLS-1$ 8 | snake(language.getString("external.effect.booteffectlist.Snake")), //$NON-NLS-1$ 9 | runningdots(language.getString("external.effect.booteffectlist.Running_dots")), //$NON-NLS-1$ 10 | xmas(language.getString("external.effect.booteffectlist.X_mas")), //$NON-NLS-1$ 11 | random(language.getString("external.effect.booteffectlist.Random")), //$NON-NLS-1$ 12 | systemshutdown(language.getString("external.effect.booteffectlist.System_Shutdown")), //$NON-NLS-1$ 13 | traces(language.getString("external.effect.booteffectlist.Color_traces")), //$NON-NLS-1$ 14 | cinemabright(language.getString("external.effect.booteffectlist.Cinema_brighten_lights")), //$NON-NLS-1$ 15 | cinemadim(language.getString("external.effect.booteffectlist.Cinema_dim_lights")), //$NON-NLS-1$ 16 | sparks(language.getString("external.effect.booteffectlist.Sparks")), //$NON-NLS-1$ 17 | sparkscolor(language.getString("external.effect.booteffectlist.Sparks_Colors")), //$NON-NLS-1$ 18 | policelightssingle(language.getString("external.effect.booteffectlist.Police_lights_single")), //$NON-NLS-1$ 19 | policelightssolid(language.getString("external.effect.booteffectlist.Police_lights_solid")), //$NON-NLS-1$ 20 | rainbowswirlfast(language.getString("external.effect.booteffectlist.Rainbow_swirl_fast")), //$NON-NLS-1$ 21 | rainbowswirl(language.getString("external.effect.booteffectlist.Rainbow_swirl")), //$NON-NLS-1$ 22 | rainbowmood(language.getString("external.effect.booteffectlist.Rainbow_mood")), //$NON-NLS-1$ 23 | moodblobsblue(language.getString("external.effect.booteffectlist.Blue_mood_blobs")), //$NON-NLS-1$ 24 | moodblobscold(language.getString("external.effect.booteffectlist.Cold_mood_blobs")), //$NON-NLS-1$ 25 | moodblobsfull(language.getString("external.effect.booteffectlist.Full_color_mood_blobs")), //$NON-NLS-1$ 26 | moodblobsgreen(language.getString("external.effect.booteffectlist.Green_mood_blobs")), //$NON-NLS-1$ 27 | moodblobsred(language.getString("external.effect.booteffectlist.Red_mood_blobs")), //$NON-NLS-1$ 28 | moodblobswarm(language.getString("external.effect.booteffectlist.Warm_mood_blobs")), //$NON-NLS-1$ 29 | strobeblue(language.getString("external.effect.booteffectlist.Strobe_blue")), //$NON-NLS-1$ 30 | stroberaspbmc(language.getString("external.effect.booteffectlist.Strobe_raspbmc")), //$NON-NLS-1$ 31 | strobewhite(language.getString("external.effect.booteffectlist.Strobe_white")); //$NON-NLS-1$ 32 | 33 | private final String mtext; 34 | 35 | private EffectStandard(final String name){ 36 | mtext = name; 37 | } 38 | /** 39 | * Returns the type identifier as used by hyperion effects 40 | * @return 41 | */ 42 | public String getTypeId() { 43 | if (this == none) {return "";} //$NON-NLS-1$ 44 | else if (this == knightrider) {return "Knight rider";} //$NON-NLS-1$ 45 | else if (this == snake) {return "Snake";} //$NON-NLS-1$ 46 | else if (this == runningdots) {return "Running dots";} //$NON-NLS-1$ 47 | else if (this == xmas) {return "X-Mas";} //$NON-NLS-1$ 48 | else if (this == random) {return "Random";} //$NON-NLS-1$ 49 | else if (this == systemshutdown) {return "System Shutdown";} //$NON-NLS-1$ 50 | else if (this == traces) {return "Color traces";} //$NON-NLS-1$ 51 | else if (this == cinemabright) {return "Cinema brighten lights";} //$NON-NLS-1$ 52 | else if (this == cinemadim) {return "Cinema dim lights";} //$NON-NLS-1$ 53 | else if (this == sparks) {return "Sparks";} //$NON-NLS-1$ 54 | else if (this == sparkscolor) {return "Sparks Color";} //$NON-NLS-1$ 55 | else if (this == policelightssingle) {return "Police Lights Single";} //$NON-NLS-1$ 56 | else if (this == policelightssolid) {return "Police Lights Solid";} //$NON-NLS-1$ 57 | else if (this == rainbowswirlfast) {return "Rainbow swirl fast";} //$NON-NLS-1$ 58 | else if (this == rainbowswirl) {return "Rainbow swirl";} //$NON-NLS-1$ 59 | else if (this == rainbowmood) {return "Rainbow mood";} //$NON-NLS-1$ 60 | else if (this == moodblobsblue) {return "Blue mood blobs";} //$NON-NLS-1$ 61 | else if (this == moodblobscold) {return "Cold mood blobs";} //$NON-NLS-1$ 62 | else if (this == moodblobsfull) {return "Full color mood blobs";} //$NON-NLS-1$ 63 | else if (this == moodblobsgreen) {return "Green mood blobs";} //$NON-NLS-1$ 64 | else if (this == moodblobsred) {return "Red mood blobs";} //$NON-NLS-1$ 65 | else if (this == moodblobswarm) {return "Warm mood blobs";} //$NON-NLS-1$ 66 | else if (this == strobeblue) {return "Strobe blue";} //$NON-NLS-1$ 67 | else if (this == stroberaspbmc) {return "Strobe Raspbmc";} //$NON-NLS-1$ 68 | else if (this == strobewhite) {return "Strobe white";} //$NON-NLS-1$ 69 | return super.name(); 70 | } 71 | @Override 72 | public String toString() { 73 | return mtext; 74 | } 75 | } -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/Grabberv4l2Config.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import org.hyperion.hypercon.JsonStringBuffer; 4 | 5 | /** 6 | * Created by Fabian on 14.02.2015. 7 | */ 8 | public class Grabberv4l2Config { 9 | 10 | public boolean mGrabberv4l2Enabled = false; 11 | 12 | public String mDevice = "/dev/video0"; 13 | public int mInput = 0; 14 | public VideoStandard mStandard = VideoStandard.PAL; 15 | public int mWidth = -1; 16 | public int mHeight = -1; 17 | public int mFrameDecimation = 2; 18 | public int mSizeDecimation = 8; 19 | public int mPriority = 900; 20 | public DimensionModes mMode = DimensionModes.TwoD; 21 | public int mCropLeft = 0; 22 | public int mCropRight = 0; 23 | public int mCropTop = 0; 24 | public int mCropBottom = 0; 25 | public double mRedSignalThreshold = 0.0; 26 | public double mGreenSignalThreshold = 0.0; 27 | public double mBlueSignalThreshold = 0.0; 28 | 29 | 30 | public void appendTo(JsonStringBuffer strBuf) { 31 | 32 | if (mGrabberv4l2Enabled==true){ 33 | String grabberv4l2Comment = "V4L2 GRABBER CONFIG"; 34 | strBuf.writeComment(grabberv4l2Comment); 35 | 36 | strBuf.startObject("grabber-v4l2"); 37 | strBuf.addValue("device", mDevice, false); 38 | strBuf.addValue("input", mInput, false); 39 | strBuf.addValue("standard", mStandard.toString(), false); 40 | strBuf.addValue("width", mWidth, false); 41 | strBuf.addValue("height", mHeight, false); 42 | strBuf.addValue("frameDecimation", mFrameDecimation, false); 43 | strBuf.addValue("sizeDecimation", mSizeDecimation, false); 44 | strBuf.addValue("priority", mPriority, false); 45 | strBuf.addValue("mode", mMode.toString(), false); 46 | strBuf.addValue("cropLeft", mCropLeft, false); 47 | strBuf.addValue("cropRight", mCropRight, false); 48 | strBuf.addValue("cropTop", mCropTop, false); 49 | strBuf.addValue("cropBottom", mCropBottom, false); 50 | strBuf.addValue("redSignalThreshold", mRedSignalThreshold, false); 51 | strBuf.addValue("greenSignalThreshold", mGreenSignalThreshold, false); 52 | strBuf.addValue("blueSignalThreshold", mBlueSignalThreshold, true); 53 | strBuf.stopObject(); 54 | 55 | strBuf.newLine(); 56 | }else{ 57 | String grabComment = "NO V4L2 GRABBER CONFIG"; 58 | strBuf.writeComment(grabComment); 59 | } 60 | 61 | } 62 | 63 | /** 64 | * Creates the JSON string of the configuration as used in the Hyperion 65 | * daemon configfile 66 | * 67 | * @return The JSON string of this Config 68 | */ 69 | public String toJsonString() { 70 | JsonStringBuffer jsonBuf = new JsonStringBuffer(1); 71 | appendTo(jsonBuf); 72 | return jsonBuf.toString(); 73 | } 74 | 75 | public static void main(String[] pArgs) { 76 | Grabberv4l2Config config = new Grabberv4l2Config(); 77 | 78 | JsonStringBuffer jsonBuf = new JsonStringBuffer(1); 79 | config.appendTo(jsonBuf); 80 | 81 | System.out.println(jsonBuf.toString()); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/HyperionRemoteCalls.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import java.util.Vector; 4 | 5 | import org.hyperion.hypercon.language.language; 6 | 7 | /** 8 | * Created by Fabian on 02.04.2015. 9 | */ 10 | public final class HyperionRemoteCalls { 11 | 12 | public enum SystemTypes{ 13 | allsystems(language.getString("ssh.systemlist.allsystemsitem")), 14 | openelec("OpenELEC / LE"); 15 | 16 | private final String text; 17 | 18 | private SystemTypes(final String text){ 19 | this.text = text; 20 | } 21 | @Override 22 | public String toString() { 23 | return text; 24 | } 25 | } 26 | 27 | public static String getHyperionRemoteCallForSystemType(SystemTypes type){ 28 | if(type == SystemTypes.allsystems){ 29 | return "hyperion-remote "; 30 | }else if(type == SystemTypes.openelec){ 31 | return "/storage/hyperion/bin/hyperion-remote.sh "; 32 | } 33 | return ""; 34 | } 35 | 36 | public static String getGrabberv4l2CallForSystemType(SystemTypes type){ 37 | if(type == SystemTypes.allsystems){ 38 | return "hyperion-v4l2 "; 39 | }else if(type == SystemTypes.openelec){ 40 | return "/storage/hyperion/bin/hyperion-v4l2.sh "; 41 | } 42 | return ""; 43 | } 44 | public static String getConfigTargetCallForSystemType(SystemTypes type){ 45 | if(type == SystemTypes.allsystems){ 46 | return "/etc/hyperion/"; 47 | }else if(type == SystemTypes.openelec){ 48 | return "/storage/.config/"; 49 | } 50 | return ""; 51 | } 52 | 53 | public static String getHyperionInstallCallForSystemType(SystemTypes type){ 54 | if(type == SystemTypes.allsystems){ 55 | return "cd /tmp && wget -nv -N https://raw.github.com/hyperion-project/hyperion/master/bin/install_hyperion.sh && chmod +x install_hyperion.sh && sudo sh ./install_hyperion.sh HyperConInstall ; rm install_hyperion.sh"; 56 | }else if(type == SystemTypes.openelec){ 57 | return "cd /tmp && curl -# -k -L --output install_hyperion.sh --get https://raw.github.com/hyperion-project/hyperion/master/bin/install_hyperion.sh && sh ./install_hyperion.sh HyperConInstall ; rm install_hyperion.sh"; 58 | } 59 | return ""; 60 | } 61 | public static String getHyperionRemoveCallForSystemType(SystemTypes type){ 62 | if(type == SystemTypes.allsystems){ 63 | return "cd /tmp && wget -nv -N https://raw.github.com/hyperion-project/hyperion/master/bin/remove_hyperion.sh && chmod +x remove_hyperion.sh && sudo sh ./remove_hyperion.sh HyperConRemove ; rm remove_hyperion.sh"; 64 | }else if(type == SystemTypes.openelec){ 65 | return "cd /tmp && curl -# -k -L --output remove_hyperion.sh --get https://raw.github.com/hyperion-project/hyperion/master/bin/remove_hyperion.sh && sh ./remove_hyperion.sh HyperConRemove ; rm remove_hyperion.sh"; 66 | } 67 | return ""; 68 | } 69 | public static String getHyperionStartServiceCallForSystemType(SystemTypes type){ 70 | if(type == SystemTypes.allsystems){ 71 | return "sudo systemctl start hyperion.service 2>/dev/null ; sudo /etc/init.d/hyperion start 2>/dev/null ; sudo /sbin/initctl start hyperion 2>/dev/null"; 72 | }else if(type == SystemTypes.openelec){ 73 | return "/storage/.config/autostart.sh > /dev/null 2>&1 &"; 74 | } 75 | return ""; 76 | } 77 | public static String getHyperionStopServiceCallForSystemType(SystemTypes type){ 78 | if(type == SystemTypes.allsystems){ 79 | return "sudo systemctl stop hyperion.service 2>/dev/null; sudo /etc/init.d/hyperion stop 2>/dev/null ; sudo /sbin/initctl stop hyperion 2>/dev/null"; 80 | }else if(type == SystemTypes.openelec){ 81 | return "killall hyperiond 2>/dev/null; killall hyperion-x11 2>/dev/null"; 82 | } 83 | return ""; 84 | } 85 | public static String getHyperionLogCallForSystemType(SystemTypes type){ 86 | if(type == SystemTypes.allsystems){ 87 | return "sudo journalctl -u hyperion.service 2>/dev/null"; 88 | }else if(type == SystemTypes.openelec){ 89 | return "cat /storage/logfiles/hyperion.log"; 90 | } 91 | return ""; 92 | } 93 | public static Vector getSystemTypesAsVecor(){ 94 | Vector result = new Vector(); 95 | 96 | for(SystemTypes type : SystemTypes.values()){ 97 | result.add(type.toString()); 98 | } 99 | 100 | return result; 101 | 102 | } 103 | 104 | public static SystemTypes fromString(String string) throws Exception { 105 | 106 | SystemTypes result = null; 107 | 108 | for(SystemTypes type : SystemTypes.values()) { 109 | if (type.toString().equals(string)) { 110 | result = type; 111 | } 112 | } 113 | if(result == null){ 114 | throw new Exception("There is no Systemtype specified with the Name \"" + string + "\""); 115 | } 116 | 117 | return result; 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/ImageProcessConfig.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import java.util.Observable; 4 | 5 | import org.hyperion.hypercon.LedFrameFactory; 6 | /** 7 | * Configuration parameters for the image processing. These settings are translated using the 8 | * {@link LedFrameFactory} to configuration items used in the Hyperion daemon configfile. 9 | * 10 | */ 11 | public class ImageProcessConfig extends Observable { 12 | 13 | /** The 'integration depth' of the leds along the horizontal axis of the tv */ 14 | public double mHorizontalDepth = 0.08; 15 | /** The 'integration depth' of the leds along the vertical axis of the tv */ 16 | public double mVerticalDepth = 0.05; 17 | 18 | /** The gap between the border integration area for the horizontal leds */ 19 | public double mHorizontalGap = 0.0; 20 | /** The gap between the border integration area for the vertical leds */ 21 | public double mVerticalGap = 0.0; 22 | 23 | /** The fraction of overlap from one to another led */ 24 | public double mOverlapFraction = 0.0; 25 | 26 | /** 27 | * Returns the horizontal depth (top and bottom) of the image integration as a fraction of the 28 | * image [0.0; 1.0] 29 | * 30 | * @return The horizontal integration depth [0.0; 1.0] 31 | */ 32 | public double getHorizontalDepth() { 33 | return mHorizontalDepth; 34 | } 35 | 36 | /** 37 | * Sets the horizontal depth (top and bottom) of the image integration as a fraction of the 38 | * image [0.0; 1.0] 39 | * 40 | * @param pHorizontalDepth The horizontal integration depth [0.0; 1.0] 41 | */ 42 | public void setHorizontalDepth(double pHorizontalDepth) { 43 | if (mHorizontalDepth != pHorizontalDepth) { 44 | mHorizontalDepth = pHorizontalDepth; 45 | setChanged(); 46 | } 47 | } 48 | 49 | /** 50 | * Returns the horizontal gap (top and bottom) of the image integration area from the side of the 51 | * screen [0.0; 1.0] 52 | * 53 | * @return The horizontal gap [0.0; 1.0] 54 | */ 55 | public double getHorizontalGap() { 56 | return mHorizontalGap; 57 | } 58 | 59 | /** 60 | * Sets the horizontal gap (top and bottom) of the image integration area from the side as a fraction of the 61 | * screen [0.0; 1.0] 62 | * 63 | * @param pHorizontalGap The horizontal integration area gap from the side [0.0; 1.0] 64 | */ 65 | public void setHorizontalGap(double pHorizontalGap) { 66 | if (mHorizontalGap != pHorizontalGap) { 67 | mHorizontalGap = pHorizontalGap; 68 | setChanged(); 69 | } 70 | } 71 | 72 | /** 73 | * Returns the vertical depth (left and right) of the image integration as a fraction of the 74 | * image [0.0; 1.0] 75 | * 76 | * @return The vertical integration depth [0.0; 1.0] 77 | */ 78 | public double getVerticalDepth() { 79 | return mVerticalDepth; 80 | } 81 | 82 | /** 83 | * Sets the vertical depth (left and right) of the image integration as a fraction of the 84 | * image [0.0; 1.0] 85 | * 86 | * @param pVerticalDepth The vertical integration depth [0.0; 1.0] 87 | */ 88 | public void setVerticalDepth(double pVerticalDepth) { 89 | if (mVerticalDepth != pVerticalDepth) { 90 | mVerticalDepth = pVerticalDepth; 91 | setChanged(); 92 | } 93 | } 94 | 95 | /** 96 | * Returns the vertical gap (left and right) of the image integration area from the side of the 97 | * screen [0.0; 1.0] 98 | * 99 | * @return The vertical gap [0.0; 1.0] 100 | */ 101 | public double getVerticalGap() { 102 | return mVerticalGap; 103 | } 104 | 105 | /** 106 | * Sets the horizontal gap (top and bottom) of the image integration area from the side as a fraction of the 107 | * screen [0.0; 1.0] 108 | * 109 | * @param pHorizontalGap The horizontal integration area gap from the side [0.0; 1.0] 110 | */ 111 | public void setVerticalGap(double pVerticalGap) { 112 | if (mVerticalGap != pVerticalGap) { 113 | mVerticalGap = pVerticalGap; 114 | setChanged(); 115 | } 116 | } 117 | 118 | 119 | /** 120 | * Returns the fractional overlap of one integration tile with its neighbors 121 | * 122 | * @return The fractional overlap of the integration tiles 123 | */ 124 | public double getOverlapFraction() { 125 | return mOverlapFraction; 126 | } 127 | 128 | /** 129 | * Sets the fractional overlap of one integration tile with its neighbors 130 | * 131 | * @param pOverlapFraction The fractional overlap of the integration tiles 132 | */ 133 | public void setOverlapFraction(double pOverlapFraction) { 134 | if (mOverlapFraction != pOverlapFraction) { 135 | mOverlapFraction = pOverlapFraction; 136 | setChanged(); 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/Led.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import java.awt.geom.Point2D; 4 | import java.awt.geom.Rectangle2D; 5 | 6 | 7 | /** 8 | * Led specification with fractional location along screen border and fractional-rectangle for 9 | * integrating an image into led color 10 | */ 11 | public class Led { 12 | /** The sequence number of the led */ 13 | public int mLedSeqNr; 14 | 15 | /** The side along which the led is placed */ 16 | public BorderSide mSide; 17 | 18 | /** The fractional location of the led */ 19 | public Point2D mLocation; 20 | 21 | /** The fractional rectangle for image integration */ 22 | public Rectangle2D mImageRectangle; 23 | 24 | /** 25 | * String representation of the led specification 26 | * 27 | * @return The led specs as nice readable string 28 | */ 29 | @Override 30 | public String toString() { 31 | return "Led[" + mLedSeqNr + "] Location=" + mLocation + " Rectangle=" + mImageRectangle; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/LedFrameConstruction.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import java.util.Observable; 4 | 5 | import org.hyperion.hypercon.language.language; 6 | 7 | 8 | 9 | /** 10 | * The LedFrame describes the construction of leds along the sides of the TV screen. 11 | */ 12 | public class LedFrameConstruction extends Observable { 13 | /** 14 | * Enumeration of the led configuration direction 15 | */ 16 | // public enum Direction { 17 | // /** Clockwise led configuration */ 18 | // clockwise, 19 | // /** Counter Clockwise led configuration */ 20 | // counter_clockwise; 21 | // } 22 | public enum Direction { 23 | clockwise(language.getString("hardware.directionlist.clockwise")), 24 | counter_clockwise(language.getString("hardware.directionlist.counter_clockwise")); 25 | 26 | private final String mtext; 27 | 28 | private Direction(final String name){ 29 | mtext = name; 30 | } 31 | @Override 32 | public String toString() { 33 | return mtext; 34 | } 35 | } 36 | /** True if the leds are organised clockwise else false (counter clockwise) */ 37 | public boolean clockwiseDirection = true; 38 | 39 | public boolean topleftCorner = false; 40 | public boolean toprightCorner = false; 41 | public boolean bottomleftCorner = false; 42 | public boolean bottomrightCorner = false; 43 | /** The number of leds between the top-left corner and the top-right corner of the screen 44 | (excluding the corner leds) */ 45 | public int topLedCnt = 16; 46 | /** The number of leds between the bottom-left corner and the bottom-right corner of the screen 47 | (excluding the corner leds) */ 48 | public int bottomLedCnt = 16; 49 | 50 | /** The number of leds between the top-left corner and the bottom-left corner of the screen 51 | (excluding the corner leds) */ 52 | public int leftLedCnt = 7; 53 | /** The number of leds between the top-right corner and the bottom-right corner of the screen 54 | (excluding the corner leds) */ 55 | public int rightLedCnt = 7; 56 | 57 | /** The offset (in leds) of the starting led counted clockwise from the top-left corner */ 58 | public int firstLedOffset = -16; 59 | 60 | public int bottomGapCnt = 0; 61 | /** 62 | * Returns the total number of leds 63 | * 64 | * @return The total number of leds 65 | */ 66 | 67 | public int getLedCount() { 68 | int cornerLedCnt = 0; 69 | if (topleftCorner) cornerLedCnt+=1; 70 | if (toprightCorner) cornerLedCnt+=1; 71 | if (bottomleftCorner) cornerLedCnt+=1; 72 | if (bottomrightCorner) cornerLedCnt+=1; 73 | 74 | return topLedCnt + bottomLedCnt + leftLedCnt + rightLedCnt + cornerLedCnt; 75 | } 76 | 77 | @Override 78 | public void setChanged() { 79 | super.setChanged(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/SshAndColorPickerConfig.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | import java.util.Vector; 4 | 5 | /** 6 | * @author Fabian Hertwig 7 | * 8 | */ 9 | public class SshAndColorPickerConfig { 10 | 11 | public String ipAdress; 12 | public int port; 13 | public String username; 14 | public String password; 15 | public boolean colorPickerInExpertmode; 16 | public boolean colorPickerShowColorWheel; 17 | public Vector sshCommands; 18 | public HyperionRemoteCalls.SystemTypes selectedSystemType; 19 | public String srcPath; 20 | public String FileName; 21 | 22 | /**Constructor 23 | * 24 | */ 25 | public SshAndColorPickerConfig() { 26 | ipAdress = "192.168.0.3"; 27 | port = 22; 28 | username = "pi"; 29 | password = "raspberry"; 30 | colorPickerInExpertmode = false; 31 | colorPickerShowColorWheel = true; 32 | srcPath = ""; 33 | FileName = "hyperion.config.json"; 34 | 35 | sshCommands = new Vector<>(); 36 | 37 | sshCommands.add(new SshCommand("sudo service hyperion start")); 38 | sshCommands.add(new SshCommand("sudo service hyperion stop")); 39 | sshCommands.add(new SshCommand("sudo service hyperion restart")); 40 | sshCommands.add(new SshCommand("sudo killall hyperionv4l2")); 41 | 42 | selectedSystemType = HyperionRemoteCalls.SystemTypes.allsystems; 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/SshCommand.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | /** 4 | * Created by Fabian on 01.04.2015. 5 | */ 6 | public class SshCommand { 7 | public String getCommand() { 8 | return command; 9 | } 10 | 11 | public String command; 12 | 13 | public SshCommand(){ 14 | command = ""; 15 | } 16 | 17 | public SshCommand(String string){ 18 | command = string; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/TemperatureConfig.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | public class TemperatureConfig extends TransformConfig { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/spec/VideoStandard.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.spec; 2 | 3 | /** 4 | * Created by Fabian on 22.02.2015. 5 | */ 6 | public enum VideoStandard{ 7 | PAL("PAL"), 8 | NTSC("NTSC"); 9 | 10 | private final String text; 11 | 12 | private VideoStandard(final String text){ 13 | this.text = text; 14 | } 15 | @Override 16 | public String toString() { 17 | return text; 18 | } 19 | } -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/hypercon/test/TesConfigWriter.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.hypercon.test; 2 | 3 | import org.hyperion.hypercon.ConfigurationFile; 4 | import org.hyperion.hypercon.spec.ColorByteOrder; 5 | import org.hyperion.hypercon.spec.ColorConfig; 6 | import org.hyperion.hypercon.spec.DeviceConfig; 7 | import org.hyperion.hypercon.spec.DeviceType; 8 | import org.hyperion.hypercon.spec.ImageProcessConfig; 9 | import org.hyperion.hypercon.spec.LedFrameConstruction; 10 | import org.hyperion.hypercon.spec.MiscConfig; 11 | 12 | public class TesConfigWriter { 13 | 14 | public static void main(String[] pArgs) { 15 | DeviceConfig deviceConfig = new DeviceConfig(); 16 | LedFrameConstruction frameConfig = new LedFrameConstruction(); 17 | ColorConfig colorConfig = new ColorConfig(); 18 | ImageProcessConfig imageConfig = new ImageProcessConfig(); 19 | MiscConfig miscConfig = new MiscConfig(); 20 | 21 | deviceConfig.mNameField = "DAG"; 22 | deviceConfig.mType = DeviceType.lpd6803; 23 | deviceConfig.mDeviceProperties.put("output", "/dev/null"); 24 | deviceConfig.mDeviceProperties.put("baudrate", 4800); 25 | deviceConfig.mColorByteOrder = ColorByteOrder.BGR; 26 | 27 | 28 | ConfigurationFile configFile = new ConfigurationFile(); 29 | configFile.store(deviceConfig); 30 | configFile.store(frameConfig); 31 | configFile.store(colorConfig); 32 | configFile.store(imageConfig); 33 | configFile.store(miscConfig); 34 | configFile.save("./HyperCon.dat"); 35 | 36 | ConfigurationFile configFile2 = new ConfigurationFile(); 37 | configFile2.load("./HyperCon.dat"); 38 | configFile2.restore(deviceConfig); 39 | configFile2.restore(frameConfig); 40 | configFile2.restore(colorConfig); 41 | configFile2.restore(imageConfig); 42 | configFile2.restore(miscConfig); 43 | 44 | System.out.println(configFile2); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/ssh/ConnectionAdapter.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.ssh; 2 | 3 | public abstract class ConnectionAdapter implements ConnectionListener { 4 | 5 | @Override 6 | public void connected() {} 7 | 8 | @Override 9 | public void disconnected() {} 10 | 11 | @Override 12 | public void commandExec(String pCommand) {} 13 | 14 | @Override 15 | public void getFile(String src, String dst) {} 16 | 17 | @Override 18 | public void commandFinished(String pCommand) {} 19 | 20 | @Override 21 | public void getFileFinished(String src, String dst){} 22 | 23 | @Override 24 | public void sendConfigFileFinished(String srcPath, String dstPath, String fileName){} 25 | 26 | @Override 27 | public void addLine(String pLine) {} 28 | 29 | @Override 30 | public void addError(String pLine) {} 31 | 32 | } 33 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/ssh/ConnectionListener.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.ssh; 2 | 3 | public interface ConnectionListener { 4 | 5 | public void connected(); 6 | 7 | public void disconnected(); 8 | 9 | public void commandExec(String pCommand); 10 | 11 | public void getFile(String src, String dst); 12 | 13 | public void commandFinished(String pCommand); 14 | 15 | public void getFileFinished(String src, String dst); 16 | 17 | public void addLine(String pLine); 18 | 19 | public void addError(String pLine); 20 | 21 | public void sendConfigFile(String dstPath, String srcPath, String fileName); 22 | 23 | public void sendConfigFileFinished(String dstPath, String srcPath, String fileName); 24 | } 25 | -------------------------------------------------------------------------------- /ConfigTool/src/org/hyperion/ssh/ConnectionMessageCollector.java: -------------------------------------------------------------------------------- 1 | package org.hyperion.ssh; 2 | 3 | import java.util.Vector; 4 | 5 | public class ConnectionMessageCollector extends ConnectionAdapter { 6 | 7 | public final Vector mLines = new Vector<>(); 8 | 9 | public final Vector mErrors = new Vector<>(); 10 | 11 | @Override 12 | public void addLine(String pLine) { 13 | mLines.add(pLine); 14 | } 15 | 16 | @Override 17 | public void addError(String pLine) { 18 | mErrors.add(pLine); 19 | } 20 | 21 | @Override 22 | public void sendConfigFile(String dstPath, String srcPath, String fileName) { 23 | // TODO: implement 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /HyperionSsh/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HyperionSsh/.gitignore: -------------------------------------------------------------------------------- 1 | /classes 2 | -------------------------------------------------------------------------------- /HyperionSsh/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | HyperionSsh 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HyperCon - Hyperion Configuration tool 2 | 3 | For a HyperCon guide (EN/DE) and settings explanation please visit our pages! 4 | 5 | More information can be found on the official Hyperion! 6 | [Wiki](https://wiki.hyperion-project.org) 7 | 8 | If you need further support please open a topic at the our new forum! 9 | [Hyperion webpage/forum](https://www.hyperion-project.org). 10 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This build file was auto generated by running the Gradle 'init' task 3 | * by 'rick' at '6/27/16 12:26 AM' with Gradle 2.14 4 | * 5 | * This generated file contains a commented-out sample Java project to get you started. 6 | * For more details take a look at the Java Quickstart chapter in the Gradle 7 | * user guide available at https://docs.gradle.org/2.14/userguide/tutorial_java_projects.html 8 | */ 9 | 10 | // Apply the java plugin to add support for Java 11 | apply plugin: 'java' 12 | 13 | version = '1.03.3' 14 | 15 | sourceSets { 16 | main { 17 | java { 18 | srcDir 'ConfigTool/src' 19 | } 20 | resources { 21 | srcDir 'ConfigTool/src' 22 | 23 | } 24 | } 25 | } 26 | 27 | jar { 28 | manifest { 29 | attributes 'Main-Class': 'org.hyperion.hypercon.Main', 30 | 'Specification-Title': 'HyperCon', 31 | 'Specification-Version': version, 32 | 'Specification-Vendor': 'Hyperion Team', 33 | 'Implementation-Title': 'org.hyperion', 34 | 'Implementation-Version': version, 35 | 'Implementation-Vendor': 'Hyperion Team'; 36 | } 37 | from { 38 | configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } 39 | } 40 | } 41 | 42 | // In this section you declare where to find the dependencies of your project 43 | repositories { 44 | // Use 'jcenter' for resolving your dependencies. 45 | // You can declare any Maven/Ivy/file repository here. 46 | jcenter() 47 | } 48 | 49 | // In this section you declare the dependencies for your production and test code 50 | dependencies { 51 | // The production code uses the SLF4J logging API at compile time 52 | compile 'org.slf4j:slf4j-api:1.7.21' 53 | 54 | compile files('ConfigTool/lib/ColorPicker.jar') 55 | 56 | // Declare the dependency for your favourite test framework you want to use in your tests. 57 | // TestNG is also supported by the Gradle Test task. Just change the 58 | // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add 59 | // 'test.useTestNG()' to your build script. 60 | testCompile 'junit:junit:4.12' 61 | 62 | // https://mvnrepository.com/artifact/com.jcraft/jsch 63 | compile group: 'com.jcraft', name: 'jsch', version: '0.1.53' 64 | 65 | // https://mvnrepository.com/artifact/org.jdom/jdom 66 | compile group: 'org.jdom', name: 'jdom', version: '1.1.3' 67 | } 68 | -------------------------------------------------------------------------------- /debug/HyperCon_Ssh.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hypercon/60975057d74212fc2c9acc243d417d864ce4456a/debug/HyperCon_Ssh.jar -------------------------------------------------------------------------------- /update.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | V1.03.3 4 | Please visit: www.hyperion-project.org 5 | https://sourceforge.net/projects/hyperion-project/files/hypercon/HyperCon.jar/download 6 | --------------------------------------------------------------------------------