diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/JsonStringBuffer.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/JsonStringBuffer.java new file mode 100644 index 00000000..da215d1b --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/JsonStringBuffer.java @@ -0,0 +1,206 @@ +package org.hyperion.hypercon; + +public class JsonStringBuffer { + + private final StringBuffer mStrBuf = new StringBuffer(); + + private final int mStartIndentLevel; + private int mIndentLevel = 0; + + /** Flag indicating that the parts written are 'commented-out' */ + private boolean mComment = false; + + public JsonStringBuffer() { + this(0); + + mStrBuf.append("{\n"); + ++mIndentLevel; + } + + public JsonStringBuffer(int pIndentLevel) { + mStartIndentLevel = pIndentLevel; + mIndentLevel = pIndentLevel; + } + + public void newLine() { + mStrBuf.append('\n'); + } + + public void finish() { + + for (int i=0; i leds; @@ -55,14 +59,27 @@ public class LedString { String colorJson = mColorConfig.toJsonString(); fw.write(colorJson + ",\n\n"); - String ledJson = ledToJsonString(); - fw.write(ledJson + ",\n\n"); + JsonStringBuffer jsonBuf = new JsonStringBuffer(1); + + ledsAppendTo(jsonBuf); - String blackBorderJson = mProcessConfig.getBlackborderJson(); - fw.write(blackBorderJson + ",\n\n"); + jsonBuf.newLine(); - String miscJson = mMiscConfig.toJsonString(); - fw.write(miscJson + "\n"); + mProcessConfig.appendTo(jsonBuf); + + jsonBuf.newLine(); + + mMiscConfig.appendTo(jsonBuf); + + jsonBuf.newLine(); + + mEffectEngineConfig.appendTo(jsonBuf); + + jsonBuf.newLine(); + + jsonBuf.addValue("endOfJson", "endOfJson", true); + + fw.write(jsonBuf.toString()); fw.write("}\n"); } catch (IOException e) { @@ -70,42 +87,28 @@ public class LedString { } } - /** - * Converts the list with leds specifications to a JSON string as used by the Hyperion Deamon - * - * @return The JSON string with led-specifications - */ - 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"); + void ledsAppendTo(JsonStringBuffer pJsonBuf) { + String ledComment = + " The configuration for each individual led. This contains the specification of the area \n" + + " averaged of an input image for each led to determine its color. Each item in the list \n" + + " contains the following fields:\n" + + " * index: The index of the led. This determines its location in the string of leds; zero \n" + + " being the first led.\n" + + " * hscan: The fractional part of the image along the horizontal used for the averaging \n" + + " (minimum and maximum inclusive)\n" + + " * vscan: The fractional part of the image along the vertical used for the averaging \n" + + " (minimum and maximum inclusive)\n"; + pJsonBuf.writeComment(ledComment); + pJsonBuf.startArray("leds"); for (Led led : leds) { - strBuf.append("\t\t{\n"); - strBuf.append(String.format(Locale.ROOT, "\t\t\t\"index\" : %d,\n", led.mLedSeqNr)); - strBuf.append(String.format(Locale.ROOT, "\t\t\t\"hscan\" : { \"minimum\" : %.4f, \"maximum\" : %.4f },\n", led.mImageRectangle.getMinX(), led.mImageRectangle.getMaxX())); - strBuf.append(String.format(Locale.ROOT, "\t\t\t\"vscan\" : { \"minimum\" : %.4f, \"maximum\" : %.4f }\n", led.mImageRectangle.getMinY(), led.mImageRectangle.getMaxY())); - if (led != leds.lastElement()) { - strBuf.append("\t\t},\n"); - } else { - strBuf.append("\t\t}\n"); - } + pJsonBuf.startObject(""); + pJsonBuf.addValue("index", led.mLedSeqNr, false); + 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); + 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); + pJsonBuf.stopObject(led.equals(leds.get(leds.size()-1))); } - - strBuf.append("\t]"); - - return strBuf.toString(); + pJsonBuf.stopArray(); } } diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ColorSmoothingPanel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ColorSmoothingPanel.java index 0d3bdc62..376c6391 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ColorSmoothingPanel.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ColorSmoothingPanel.java @@ -135,7 +135,7 @@ public class ColorSmoothingPanel extends JPanel { @Override public void stateChanged(ChangeEvent e) { mColorConfig.mSmoothingTime_ms = (Integer)mTimeSpinner.getValue(); - mColorConfig.mSmoothingUpdateFrequency_Hz = (Integer)mUpdateFrequencySpinner.getValue(); + mColorConfig.mSmoothingUpdateFrequency_Hz = (Double)mUpdateFrequencySpinner.getValue(); } }; } diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ConfigPanel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ConfigPanel.java index 6c56bc44..5cc30b44 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ConfigPanel.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/ConfigPanel.java @@ -133,6 +133,7 @@ public class ConfigPanel extends JPanel { mSpecificationTabs.addTab("Hardware", getHardwarePanel()); mSpecificationTabs.addTab("Process", getProcessPanel()); mSpecificationTabs.addTab("External", getExternalPanel()); + mSpecificationTabs.addTab("Effect Engine", new EffectEnginePanel(ledString.mEffectEngineConfig)); } return mSpecificationTabs; } diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/EffectEnginePanel.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/EffectEnginePanel.java new file mode 100644 index 00000000..0a35feb1 --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/EffectEnginePanel.java @@ -0,0 +1,97 @@ +package org.hyperion.hypercon.gui; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; + +import org.hyperion.hypercon.spec.EffectConfig; +import org.hyperion.hypercon.spec.EffectEngineConfig; + +public class EffectEnginePanel extends JPanel { + + private final EffectEngineConfig mEffectEngingeConfig; + + private JPanel mControlPanel; + private JComboBox mEffectCombo; + private JButton mAddButton; + private JButton mDelButton; + + private JPanel mEffectPanel; + private JLabel mPythonLabel; + private JComboBox mPythonCombo; + private JLabel mJsonArgumentLabel; + private JTextArea mJsonArgumentArea; + + public EffectEnginePanel(final EffectEngineConfig pEffectEngineConfig) { + super(); + + mEffectEngingeConfig = pEffectEngineConfig; + + initialise(); + } + + private void initialise() { + setLayout(new BorderLayout()); + + add(getControlPanel(), BorderLayout.NORTH); + add(getEffectPanel(), BorderLayout.CENTER); + } + + private JPanel getControlPanel() { + if (mControlPanel == null) { + mControlPanel = new JPanel(); + mControlPanel.setPreferredSize(new Dimension(150, 35)); + mControlPanel.setLayout(new BoxLayout(mControlPanel, BoxLayout.LINE_AXIS)); + + mEffectCombo = new JComboBox<>(mEffectEngingeConfig.mEffects); + mEffectCombo.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + } + }); + mControlPanel.add(mEffectCombo); + + mAddButton = new JButton("Add"); + mControlPanel.add(mAddButton); + + mDelButton = new JButton("Del"); + mControlPanel.add(mDelButton); + } + return mControlPanel; + } + + private JPanel getEffectPanel() { + if (mEffectPanel == null) { + mEffectPanel = new JPanel(); + mEffectPanel.setBorder(BorderFactory.createTitledBorder("test-slow")); + mEffectPanel.setLayout(new BoxLayout(mEffectPanel, BoxLayout.PAGE_AXIS)); + + JPanel subPanel = new JPanel(new BorderLayout()); + mEffectPanel.add(subPanel); + + mPythonLabel = new JLabel("Python: "); + subPanel.add(mPythonLabel, BorderLayout.WEST); + + mPythonCombo = new JComboBox<>(new String[] {"test.py", "rainbow-swirl.py", "rainbow-mood.py"}); + mPythonCombo.setMaximumSize(new Dimension(150, 25)); + subPanel.add(mPythonCombo); + + mJsonArgumentLabel = new JLabel("Arguments:"); + mEffectPanel.add(mJsonArgumentLabel); + + mJsonArgumentArea = new JTextArea(); + mEffectPanel.add(mJsonArgumentArea); + } + return mEffectPanel; + } +} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectConfig.java new file mode 100644 index 00000000..a8bccdde --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectConfig.java @@ -0,0 +1,33 @@ +package org.hyperion.hypercon.spec; + +import org.hyperion.hypercon.JsonStringBuffer; + +/** + * The configuration structure for a single 'effect'. + */ +public class EffectConfig { + + /** The identifier of the effect */ + public String mId; + + /** The python-script used to generate the effect */ + public String mScript; + + /** The JSON-string containing the arguments of the python-script */ + public String mArgs; + + public void append(JsonStringBuffer pJsonBuf, boolean endOfEffects) { + pJsonBuf.startObject(mId); + pJsonBuf.addValue("script", mScript, false); + + pJsonBuf.startObject("args"); + pJsonBuf.stopObject(); + + pJsonBuf.stopObject(!endOfEffects); + } + + @Override + public String toString() { + return mId; + } +} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectEngineConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectEngineConfig.java new file mode 100644 index 00000000..3ac5e956 --- /dev/null +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/EffectEngineConfig.java @@ -0,0 +1,58 @@ +package org.hyperion.hypercon.spec; + +import java.util.Vector; + +import org.hyperion.hypercon.JsonStringBuffer; + +/** + * The configuration structure for the effect engine. It contains definition for zero or more + * 'effects' + */ +public class EffectEngineConfig { + + public final Vector mEffects = new Vector<>(); + { + EffectConfig testSlow = new EffectConfig(); + testSlow.mId = "test-slow"; + testSlow.mScript = "/home/pi/hyperion/test.py"; + testSlow.mArgs = "speed : 0.5"; + + EffectConfig testFast = new EffectConfig(); + testFast.mId = "test-fast"; + testFast.mScript = "/home/pi/hyperion/test.py"; + testFast.mArgs = "speed : 2.0"; + + EffectConfig rainbowSwirl = new EffectConfig(); + rainbowSwirl.mId = "Rainbow swirl"; + rainbowSwirl.mScript = "/home/pi/hyperion/rainbow-swirl.py"; + rainbowSwirl.mArgs = + "\"rotation-time\" : 10.0,\n" + + "\"brightness\" : 1.0,\n" + + "\"reverse\" : false\n"; + + EffectConfig rainbowMood = new EffectConfig(); + rainbowMood.mId = "Rainbow mood"; + rainbowMood.mScript = "/home/pi/hyperion/rainbow-mood.py"; + rainbowMood.mArgs = + "\"rotation-time\" : 10.0,\n" + + "\"brightness\" : 1.0,\n" + + "\"reverse\" : false\n"; + + mEffects.add(testSlow); + mEffects.add(testFast); + mEffects.add(rainbowSwirl); + mEffects.add(rainbowMood); + } + + public void appendTo(JsonStringBuffer pJsonBuf) { + pJsonBuf.startObject("effects"); + + for (EffectConfig effect : mEffects) { + effect.append(pJsonBuf, effect.equals(mEffects.get(mEffects.size()-1))); + } + + pJsonBuf.addValue("endOfEffect", "endOfEffect", true); + + pJsonBuf.stopObject(); + } +} diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/ImageProcessConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/ImageProcessConfig.java index 21302be6..ba6bf312 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/ImageProcessConfig.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/ImageProcessConfig.java @@ -1,8 +1,8 @@ package org.hyperion.hypercon.spec; -import java.util.Locale; import java.util.Observable; +import org.hyperion.hypercon.JsonStringBuffer; import org.hyperion.hypercon.LedFrameFactory; /** @@ -161,17 +161,15 @@ public class ImageProcessConfig extends Observable { } } - public String getBlackborderJson() { - StringBuffer strBuf = new StringBuffer(); - - strBuf.append("\t/// The black border configuration, contains the following items: \n"); - strBuf.append("\t/// * enable : true if the detector should be activated\n"); + public void appendTo(JsonStringBuffer pJsonBuf) { + String comment = + "The black border configuration, contains the following items: \n" + + " * enable : true if the detector should be activated\n"; + pJsonBuf.writeComment(comment); - strBuf.append("\t\"blackborderdetector\" :\n"); - strBuf.append("\t{\n"); - strBuf.append(String.format(Locale.ROOT, "\t\t\"enable\" : %s\n", mBlackBorderRemoval ? "true" : "false")); - strBuf.append("\t}"); - - return strBuf.toString(); + pJsonBuf.startObject("blackborderdetector"); + pJsonBuf.addValue("enable", mBlackBorderRemoval, true); + pJsonBuf.stopObject(); } + } diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java index cadfd7d6..794f54a6 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/spec/MiscConfig.java @@ -1,6 +1,6 @@ package org.hyperion.hypercon.spec; -import java.util.Locale; +import org.hyperion.hypercon.JsonStringBuffer; /** * Miscellaneous configuration items for the Hyperion daemon. @@ -53,89 +53,116 @@ public class MiscConfig { /** The TCP port at which the Protobuf server is listening for incoming connections */ public int mBoblightPort = 19333; + public void appendTo(JsonStringBuffer strBuf) { + String bootsequenceComment = + "The boot-sequence configuration, contains the following items: \n" + + " * type : The type of the boot-sequence ('rainbow', 'knightrider', 'none') \n" + + " * duration_ms : The length of the boot-sequence [ms]\n"; + strBuf.writeComment(bootsequenceComment); + + strBuf.toggleComment(!mBootsequenceEnabled); + strBuf.startObject("bootsequence"); + strBuf.addValue("type", mBootSequence.name(), false); + strBuf.addValue("duration_ms", mBootSequenceLength_ms, true); + strBuf.stopObject(); + strBuf.toggleComment(false); + + strBuf.newLine(); + + String grabComment = + " The configuration for the frame-grabber, contains the following items: \n" + + " * width : The width of the grabbed frames [pixels]\n" + + " * height : The height of the grabbed frames [pixels]\n" + + " * frequency_Hz : The frequency of the frame grab [Hz]\n"; + strBuf.writeComment(grabComment); + + strBuf.toggleComment(!mFrameGrabberEnabled); + strBuf.startObject("framegrabber"); + strBuf.addValue("width", mFrameGrabberWidth, false); + strBuf.addValue("height", mFrameGrabberHeight, false); + strBuf.addValue("frequency_Hz", 1000.0/mFrameGrabberInterval_ms, true); + strBuf.stopObject(); + strBuf.toggleComment(false); + + strBuf.newLine(); + + String xbmcComment = + "The configuration of the XBMC connection used to enable and disable the frame-grabber. Contains the following fields: \n" + + " * xbmcAddress : The IP address of the XBMC-host\n" + + " * xbmcTcpPort : The TCP-port of the XBMC-server\n" + + " * grabVideo : Flag indicating that the frame-grabber is on(true) during video playback\n" + + " * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show\n" + + " * grabAudio : Flag indicating that the frame-grabber is on(true) during audio playback\n" + + " * grabMenu : Flag indicating that the frame-grabber is on(true) in the XBMC menu\n"; + strBuf.writeComment(xbmcComment); + + strBuf.toggleComment(!mXbmcCheckerEnabled); + strBuf.startObject("xbmcVideoChecker"); + strBuf.addValue("xbmcAddress", mXbmcAddress, false); + strBuf.addValue("xbmcTcpPort", mXbmcTcpPort, false); + strBuf.addValue("grabVideo", mVideoOn, false); + strBuf.addValue("grabPictures", mPictureOn, false); + strBuf.addValue("grabAudio", mAudioOn, false); + strBuf.addValue("grabMenu", mMenuOn, true); + strBuf.stopObject(); + strBuf.toggleComment(false); + + strBuf.newLine(); + + String jsonComment = + "The configuration of the Json server which enables the json remote interface\n" + + " * port : Port at which the json server is started\n"; + strBuf.writeComment(jsonComment); + + strBuf.toggleComment(!mJsonInterfaceEnabled); + strBuf.startObject("jsonServer"); + strBuf.addValue("port", mJsonPort, true); + strBuf.stopObject(); + strBuf.toggleComment(false); + + strBuf.newLine(); + + String protoComment = + "The configuration of the Proto server which enables the protobuffer remote interface\n" + + " * port : Port at which the protobuffer server is started\n"; + strBuf.writeComment(protoComment); + + strBuf.toggleComment(!mProtoInterfaceEnabled); + strBuf.startObject("protoServer"); + strBuf.addValue("port", mProtoPort, true); + strBuf.stopObject(); + strBuf.toggleComment(false); + + strBuf.newLine(); + + String boblightComment = + "The configuration of the boblight server which enables the boblight remote interface\n" + + " * port : Port at which the boblight server is started\n"; + strBuf.writeComment(boblightComment); + + strBuf.toggleComment(!mBoblightInterfaceEnabled); + strBuf.startObject("boblightServer"); + strBuf.addValue("port", mBoblightPort, true); + strBuf.stopObject(); + strBuf.toggleComment(false); + } /** * Creates the JSON string of the configuration as used in the Hyperion daemon configfile * * @return The JSON string of this MiscConfig */ public String toJsonString() { - StringBuffer strBuf = new StringBuffer(); - - strBuf.append("\t/// The boot-sequence configuration, contains the following items: \n"); - strBuf.append("\t/// * type : The type of the boot-sequence ('rainbow', 'knightrider', 'none') \n"); - strBuf.append("\t/// * duration_ms : The length of the boot-sequence [ms]\n"); + JsonStringBuffer jsonBuf = new JsonStringBuffer(1); + appendTo(jsonBuf); + return jsonBuf.toString(); + } + + public static void main(String[] pArgs) { + MiscConfig miscConfig = new MiscConfig(); - String bootPreamble = mBootsequenceEnabled? "\t" : "//\t"; - strBuf.append(bootPreamble).append("\"bootsequence\" :\n"); - strBuf.append(bootPreamble).append("{\n"); - strBuf.append(bootPreamble).append(String.format(Locale.ROOT, "\t\"type\" : \"%s\",\n", mBootSequence.name())); - strBuf.append(bootPreamble).append(String.format(Locale.ROOT, "\t\"duration_ms\" : %d\n", mBootSequenceLength_ms)); - strBuf.append(bootPreamble).append("},\n\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"); + JsonStringBuffer jsonBuf = new JsonStringBuffer(1); + miscConfig.appendTo(jsonBuf); - String grabPreamble = mFrameGrabberEnabled? "\t" : "//\t"; - strBuf.append(grabPreamble).append("\"framegrabber\" :\n"); - strBuf.append(grabPreamble).append("{\n"); - strBuf.append(grabPreamble).append(String.format(Locale.ROOT, "\t\"width\" : %d,\n", mFrameGrabberWidth)); - strBuf.append(grabPreamble).append(String.format(Locale.ROOT, "\t\"height\" : %d,\n", mFrameGrabberHeight)); - strBuf.append(grabPreamble).append(String.format(Locale.ROOT, "\t\"frequency_Hz\" : %.1f\n", 1000.0/mFrameGrabberInterval_ms)); - strBuf.append(grabPreamble).append("},\n\n"); - - strBuf.append("\t/// The configuration of the XBMC connection used to enable and disable the frame-grabber. Contains the following fields: \n"); - strBuf.append("\t/// * 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"); - - String xbmcPreamble = mXbmcCheckerEnabled? "\t" : "//\t"; - strBuf.append(xbmcPreamble).append("\"xbmcVideoChecker\" :\n"); - strBuf.append(xbmcPreamble).append("{\n"); - strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"xbmcAddress\" : \"%s\",\n", mXbmcAddress)); - strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"xbmcTcpPort\" : %d,\n", mXbmcTcpPort)); - strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"grabVideo\" : %s,\n", mVideoOn)); - strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"grabPictures\" : %s,\n", mPictureOn)); - strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"grabAudio\" : %s,\n", mAudioOn)); - strBuf.append(xbmcPreamble).append(String.format(Locale.ROOT, "\t\"grabMenu\" : %s\n", mMenuOn)); - strBuf.append(xbmcPreamble).append("},\n\n"); - - - strBuf.append("\t/// The configuration of the Json server which enables the json remote interface\n"); - strBuf.append("\t/// * port : Port at which the json server is started\n"); - - String jsonPreamble = mJsonInterfaceEnabled? "\t" : "//\t"; - strBuf.append(jsonPreamble).append("\"jsonServer\" :\n"); - strBuf.append(jsonPreamble).append("{\n"); - strBuf.append(jsonPreamble).append(String.format(Locale.ROOT, "\t\"port\" : %d\n", mJsonPort)); - strBuf.append(jsonPreamble).append("},\n\n"); - - - strBuf.append("\t/// The configuration of the Proto server which enables the protobuffer remote interface\n"); - strBuf.append("\t/// * port : Port at which the protobuffer server is started\n"); - - String protoPreamble = mProtoInterfaceEnabled? "\t" : "//\t"; - strBuf.append(protoPreamble).append("\"protoServer\" :\n"); - strBuf.append(protoPreamble).append("{\n"); - strBuf.append(protoPreamble).append(String.format(Locale.ROOT, "\t\"port\" : %d\n", mProtoPort)); - strBuf.append(protoPreamble).append("},\n\n"); - - - strBuf.append("\t/// The configuration of the boblight server which enables the boblight remote interface\n"); - strBuf.append("\t/// * port : Port at which the boblight server is started\n"); - - String bobligthPreamble = mBoblightInterfaceEnabled? "\t" : "//\t"; - strBuf.append(bobligthPreamble).append("\"boblightServer\" :\n"); - strBuf.append(bobligthPreamble).append("{\n"); - strBuf.append(bobligthPreamble).append(String.format(Locale.ROOT, "\t\"port\" : %d\n", mBoblightPort)); - strBuf.append(bobligthPreamble).append("},\n\n"); - - strBuf.append("\t\"end-of-json\" : \"end-of-json\""); - - return strBuf.toString(); + System.out.println(jsonBuf.toString()); } }