Added comment generation to configuration file writer. Added icon to main-frame. Update of jar.

Former-commit-id: f620c0cae0f7bd26fa1ef3c5b10cb26d2975b2eb
This commit is contained in:
T. van der Zwan 2013-10-01 15:42:49 +02:00
parent ed4596f3aa
commit 352d9f5652
8 changed files with 71 additions and 14 deletions

View File

@ -1 +1 @@
c8654fba4777ea4222897a55d1d24517cc636482
76f29d2a8a10e60629d08889f183d318dfee9f3f

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -43,19 +43,19 @@ public class LedString {
public void saveConfigFile(String mFilename) throws IOException {
try (FileWriter fw = new FileWriter(mFilename)) {
fw.write("// Automatically generated configuration file for 'Hyperion'\n");
fw.write("// Generated by: 'Hyperion configuration Tool\n");
fw.write("// Automatically generated configuration file for 'Hyperion daemon'\n");
fw.write("// Generated by: HyperCon (The Hyperion deamon configuration file builder\n");
fw.write("\n");
fw.write("{\n");
String deviceJson = mDeviceConfig.toJsonString();
fw.write(deviceJson + ",\n");
fw.write(deviceJson + ",\n\n");
String colorJson = mColorConfig.toJsonString();
fw.write(colorJson + ",\n");
fw.write(colorJson + ",\n\n");
String ledJson = ledToJsonString();
fw.write(ledJson + ",\n");
fw.write(ledJson + ",\n\n");
String miscJson = mMiscConfig.toJsonString();
fw.write(miscJson + "\n");
@ -73,6 +73,17 @@ public class LedString {
*/
String ledToJsonString() {
StringBuffer strBuf = new StringBuffer();
strBuf.append("\t/// The configuration for each individual led. This contains the specification of the area \n");
strBuf.append("\t/// averaged of an input image for each led to determine its color. Each item in the list \n");
strBuf.append("\t/// contains the following fields:\n");
strBuf.append("\t/// * index: The index of the led. This determines its location in the string of leds; zero \n");
strBuf.append("\t/// being the first led.\n");
strBuf.append("\t/// * hscan: The fractional part of the image along the horizontal used for the averaging \n");
strBuf.append("\t/// (minimum and maximum inclusive)\n");
strBuf.append("\t/// * vscan: The fractional part of the image along the vertical used for the averaging \n");
strBuf.append("\t/// (minimum and maximum inclusive)\n");
strBuf.append("\t\"leds\" : \n");
strBuf.append("\t[\n");

View File

@ -1,5 +1,6 @@
package org.hyperion.hypercon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.UIManager;
@ -27,6 +28,7 @@ public class Main {
frame.setTitle("Hyperion configuration Tool");
frame.setSize(1300, 600);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setIconImage(new ImageIcon(Main.class.getResource("HyperConIcon_64.png")).getImage());
// Add the HyperCon configuration panel
frame.setContentPane(new ConfigPanel());

View File

@ -46,6 +46,17 @@ public class ColorConfig {
*/
public String toJsonString() {
StringBuffer strBuf = new StringBuffer();
strBuf.append("\t/// Color manipulation configuration used to tune the output colors to specific surroundings. Contains the following fields:\n");
strBuf.append("\t/// * 'hsv' : The manipulation in the Hue-Saturation-Value color domain with the following tuning parameters:\n");
strBuf.append("\t/// - 'saturationGain' The gain adjustement of the saturation\n");
strBuf.append("\t/// - 'valueGain' The gain adjustement of the value\n");
strBuf.append("\t/// * 'red'/'green'/'blue' : The manipulation in the Red-Green-Blue color domain with the following tuning parameters for each channel:\n");
strBuf.append("\t/// - 'threshold' The minimum required input value for the channel to be on (else zero)\n");
strBuf.append("\t/// - 'gamma' The gamma-curve correction factor\n");
strBuf.append("\t/// - 'blacklevel' The lowest possible value (when the channel is black)\n");
strBuf.append("\t/// - 'whitelevel' The highest possible value (when the channel is white)\n");
strBuf.append("\t\"color\" :\n");
strBuf.append("\t{\n");
strBuf.append(hsvToJsonString() + ",\n");
@ -65,7 +76,7 @@ public class ColorConfig {
strBuf.append("\t\t\"hsv\" :\n");
strBuf.append("\t\t{\n");
strBuf.append(String.format(Locale.ROOT, "\t\t\tsaturationGain : %.4f,\n", mSaturationGain));
strBuf.append(String.format(Locale.ROOT, "\t\t\tsaturationGain : %.4f\n", mValueGain));
strBuf.append(String.format(Locale.ROOT, "\t\t\tvaluGain : %.4f\n", mValueGain));
strBuf.append("\t\t}");
return strBuf.toString();

View File

@ -21,6 +21,15 @@ public class DeviceConfig {
*/
public String toJsonString() {
StringBuffer strBuf = new StringBuffer();
strBuf.append("\t/// Device configuration contains the following fields: \n");
strBuf.append("\t/// * 'name' : The user friendly name of the device (only used for display purposes)\n");
strBuf.append("\t/// * 'type' : The type of the device or leds (known types for now are 'ws2801', 'test' and 'none')\n");
strBuf.append("\t/// * 'output' : The output specification depends on selected device\n");
strBuf.append("\t/// - 'ws2801' this is the device (eg '/dev/spidev0.0')\n");
strBuf.append("\t/// - 'test' this is the file used to write test output (eg '/home/pi/hyperion.out')\n");
strBuf.append("\t/// * 'rate' : The baudrate of the output to the device (only applicable for 'ws2801')\n");
strBuf.append("\t\"device\" :\n");
strBuf.append("\t{\n");

View File

@ -40,24 +40,48 @@ public class MiscConfig {
*/
public String toJsonString() {
StringBuffer strBuf = new StringBuffer();
strBuf.append("\t/// The configuration of the XBMC connection used to enable and disable the frame-grabber. Contains the following fields: \n");
strBuf.append("\t/// * enable : Flag for enabling or disabling the XBMC-based frame grabbing\n");
strBuf.append("\t/// * xbmcAddress : The IP address of the XBMC-host\n");
strBuf.append("\t/// * xbmcTcpPort : The TCP-port of the XBMC-server\n");
strBuf.append("\t/// * grabVideo : Flag indicating that the frame-grabber is on(true) during video playback\n");
strBuf.append("\t/// * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show\n");
strBuf.append("\t/// * grabAudio : Flag indicating that the frame-grabber is on(true) during audio playback\n");
strBuf.append("\t/// * grabMenu : Flag indicating that the frame-grabber is on(true) in the XBMC menu\n");
strBuf.append("\t\"xbmcVideoChecker\" :\n");
strBuf.append("\t{\n");
strBuf.append(String.format(Locale.ROOT, "\t\t\"enable\" : %s,\n", mXbmcChecker));
strBuf.append(String.format(Locale.ROOT, "\t\t\"xbmcAddress\" : \"%s\",\n", mXbmcAddress));
strBuf.append(String.format(Locale.ROOT, "\t\t\"xbmcTcpPort\" : %d,\n", mXbmcTcpPort));
strBuf.append(String.format(Locale.ROOT, "\t\t\"grabVideo\" : %s,\n", mVideoOn));
strBuf.append(String.format(Locale.ROOT, "\t\t\"grabPictures\" : %s,\n", mPictureOn));
strBuf.append(String.format(Locale.ROOT, "\t\t\"grabAudio\" : %s,\n", mAudioOn));
strBuf.append(String.format(Locale.ROOT, "\t\t\"grabMenu\" : %s\n", mMenuOn));
strBuf.append("\t},\n");
strBuf.append("\t/// The boot-sequence configuration, contains the following items: \n");
strBuf.append("\t/// * type : The type of the boot-sequence ('rainbow', 'knight_rider', 'none') \n");
strBuf.append("\t/// * duration_ms : The length of the boot-sequence [ms]\n");
strBuf.append("\t\"bootsequence\" :\n");
strBuf.append("\t{\n");
strBuf.append(String.format(Locale.ROOT, "\t\t\"type\" : \"%s\",\n", mBootSequence));
strBuf.append(String.format(Locale.ROOT, "\t\t\"duration_ms\" : %d\n", mBootSequenceLength_ms));
strBuf.append("\t},\n");
strBuf.append("\t/// The configuration for the frame-grabber, contains the following items: \n");
strBuf.append("\t/// * width : The width of the grabbed frames [pixels]\n");
strBuf.append("\t/// * height : The height of the grabbed frames [pixels]\n");
strBuf.append("\t/// * frequency_Hz : The frequency of the frame grab [Hz]\n");
strBuf.append("\t\"framegrabber\" :\n");
strBuf.append("\t{\n");
strBuf.append(String.format(Locale.ROOT, "\t\t\"width\" : %d,\n", mFrameGrabberWidth));
strBuf.append(String.format(Locale.ROOT, "\t\t\"height\" : %d,\n", mFrameGrabberHeight));
strBuf.append(String.format(Locale.ROOT, "\t\t\"frequency_Hz\" : %.1f\n", 1000.0/mFrameGrabberInterval_ms));
strBuf.append("\t},\n");
strBuf.append("\t\"xbmcVideoChecker\" :\n");
strBuf.append("\t{\n");
strBuf.append(String.format(Locale.ROOT, "\t\t\"enable\" : %s,\n", mXbmcChecker));
strBuf.append(String.format(Locale.ROOT, "\t\t\"xbmcAddress\" : \"%s\",\n", mXbmcAddress));
strBuf.append(String.format(Locale.ROOT, "\t\t\"xbmcTcpPort\" : %d\n", mXbmcTcpPort));
strBuf.append("\t}");
return strBuf.toString();