use of net.sourceforge.usbdm.deviceEditor.information.DeviceVariantInformation in project usbdm-eclipse-plugins by podonoghue.
the class FamilyXmlWriter method writeXmlFile.
/**
* Writes XML file
*
* @param xmlFilePath Path to write XML to
* @param deviceInfomation Data to write
* @throws Exception
*/
public void writeXmlFile(Path xmlFilePath) throws Exception {
String xmlFilename = xmlFilePath.getFileName().toString();
BufferedWriter writer = Files.newBufferedWriter(xmlFilePath, StandardCharsets.UTF_8);
XmlDocumentUtilities documentUtilities = new XmlDocumentUtilities(writer);
documentUtilities.writeXmlFilePreamble(xmlFilename, DeviceInfo.DTD_FILE, "Generated from " + fDeviceInfo.getSourceFilename());
documentUtilities.openTag("root");
documentUtilities.writeAttribute("version", DeviceInfo.VERSION);
documentUtilities.openTag("family");
documentUtilities.writeAttribute("name", fDeviceInfo.getDeviceSubFamily());
for (String key : fDeviceInfo.getDeviceVariants().keySet()) {
DeviceVariantInformation deviceInformation = fDeviceInfo.findVariant(key);
documentUtilities.openTag("device");
documentUtilities.writeAttribute("name", deviceInformation.getName());
documentUtilities.writeAttribute("manual", deviceInformation.getManual());
documentUtilities.writeAttribute("package", deviceInformation.getPackage().getName());
documentUtilities.closeTag();
}
documentUtilities.closeTag();
writePeripherals(documentUtilities);
// writeSignals(documentUtilities);
writePins(documentUtilities);
writePackages(documentUtilities);
documentUtilities.closeTag();
writer.close();
}
use of net.sourceforge.usbdm.deviceEditor.information.DeviceVariantInformation in project usbdm-eclipse-plugins by podonoghue.
the class TestParseXML method report.
static void report(DeviceInfo deviceInfo) {
for (String key : deviceInfo.getDeviceVariants().keySet()) {
DeviceVariantInformation deviceInformation = deviceInfo.findVariant(key);
System.err.println("deviceInformation = " + deviceInformation);
}
for (String packageName : deviceInfo.getDevicePackages().keySet()) {
DevicePackage devicePackage = deviceInfo.findDevicePackage(packageName);
System.err.println("Package = " + devicePackage);
for (String pinName : devicePackage.getPins().keySet()) {
String location = devicePackage.getLocation(pinName);
System.err.print(pinName + " => " + location + ", ");
}
System.err.println();
}
for (String pinName : deviceInfo.getPins().keySet()) {
Pin pin = deviceInfo.findPin(pinName);
System.err.print("Pin = " + pin.getName() + ", ");
}
;
System.err.println();
for (String peripheralName : deviceInfo.getPeripheralNames()) {
System.err.print("Peripheral = " + peripheralName + ", ");
}
;
System.err.println();
for (String signals : deviceInfo.getSignals().keySet()) {
System.err.print("Signal = " + signals + ", ");
}
;
System.err.println();
}
use of net.sourceforge.usbdm.deviceEditor.information.DeviceVariantInformation in project usbdm-eclipse-plugins by podonoghue.
the class PackageImageModel method createImage.
/**
* Creates the image representing the package
*
* @return Image created (transfers ownership!)
*/
private Image createImage() {
try {
DeviceVariantInformation deviceVariant = fModelFactory.getDeviceInfo().getVariant();
IPath path = Usbdm.getResourcePath().append("Stationery/Packages/Images/" + deviceVariant.getPackage().getName() + ".png");
return new Image(Display.getCurrent(), path.toString());
} catch (Exception e) {
System.err.println("Failed to load device image, reason: )" + e.getMessage());
return null;
}
}
Aggregations