XML tune export progress
This commit is contained in:
parent
af8de4c84f
commit
9b838f9eff
|
@ -2,6 +2,7 @@ package com.rusefi.tools;
|
|||
|
||||
import com.fathzer.soft.javaluator.DoubleEvaluator;
|
||||
import com.opensr5.ConfigurationImage;
|
||||
import com.opensr5.ini.IniFileModel;
|
||||
import com.opensr5.io.ConfigurationImageFile;
|
||||
import com.rusefi.*;
|
||||
import com.rusefi.autodetect.PortDetector;
|
||||
|
@ -13,8 +14,11 @@ import com.rusefi.io.IoStream;
|
|||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.io.serial.SerialIoStreamJSerialComm;
|
||||
import com.rusefi.maintenance.ExecHelper;
|
||||
import com.rusefi.tune.xml.Msq;
|
||||
import com.rusefi.xml.XmlUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
@ -33,6 +37,7 @@ public class ConsoleTools {
|
|||
TOOLS.put("functional_test", ConsoleTools::runFunctionalTest);
|
||||
TOOLS.put("compile_fsio_file", ConsoleTools::runCompileTool);
|
||||
TOOLS.put("firing_order", ConsoleTools::runFiringOrderTool);
|
||||
TOOLS.put("fun_convert", ConsoleTools::convertBinaryToXml);
|
||||
TOOLS.put("reboot_ecu", args -> sendCommand(Fields.CMD_REBOOT));
|
||||
TOOLS.put(Fields.CMD_REBOOT_DFU, args -> sendCommand(Fields.CMD_REBOOT_DFU));
|
||||
}
|
||||
|
@ -194,6 +199,24 @@ public class ConsoleTools {
|
|||
return autoDetectedPort;
|
||||
}
|
||||
|
||||
private static void convertBinaryToXml(String[] args) throws IOException, JAXBException {
|
||||
Msq tune = new Msq();
|
||||
|
||||
XmlUtil.writeXml(tune, Msq.class, "a.xml");
|
||||
|
||||
|
||||
|
||||
if (args.length < 2) {
|
||||
System.err.println("Binary file input expected");
|
||||
System.exit(-1);
|
||||
}
|
||||
String fileName = args[1];
|
||||
ConfigurationImage image = ConfigurationImageFile.readFromFile(fileName);
|
||||
System.out.println("Got " + image.getSize() + " of configuration from " + fileName);
|
||||
|
||||
IniFileModel ini = IniFileModel.getInstance(Launcher.INI_FILE_PATH);
|
||||
}
|
||||
|
||||
interface ConsoleTool {
|
||||
void runTool(String args[]) throws Exception;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.rusefi.tune.xml;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
public class Bibliography {
|
||||
@XmlAttribute
|
||||
public String getAuthor() {
|
||||
return "rusEFI";
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getTuneComment() {
|
||||
return "comments";
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getWriteDate() {
|
||||
return "date";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.rusefi.tune.xml;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
public class Constant {
|
||||
private final String name;
|
||||
private final String units;
|
||||
|
||||
public Constant(String name, String units) {
|
||||
this.name = name;
|
||||
this.units = units;
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getUnits() {
|
||||
return units;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.rusefi.tune.xml;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class Msq {
|
||||
@XmlAttribute
|
||||
public String getXmlns() {
|
||||
return "http://www.msefi.com/:msq";
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public Bibliography getBibliography() {
|
||||
return new Bibliography();
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public VersionInfo getVersionInfo() {
|
||||
return new VersionInfo();
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public Page getPage() {
|
||||
return new Page();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.rusefi.tune.xml;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Page {
|
||||
public final List<Constant> constants = new ArrayList<>();
|
||||
|
||||
public Page() {
|
||||
constants.add(new Constant("name1", "units1"));
|
||||
constants.add(new Constant("name2", "units2"));
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public int getNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public int getSize() {
|
||||
return Fields.TOTAL_CONFIG_SIZE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.rusefi.tune.xml;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
public class VersionInfo {
|
||||
@XmlAttribute
|
||||
public String getVersion() {
|
||||
return "5.0";
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getFirmwareInfo() {
|
||||
return "rusEFI+v20200513%4022811";
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getNPages() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getSignature() {
|
||||
return Fields.TS_SIGNATURE;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue