diff --git a/APED/app/src/main/java/com/example/aped/communication/IXML.java b/APED/app/src/main/java/com/example/aped/communication/IXML.java index 880941a..0c2b4a0 100644 --- a/APED/app/src/main/java/com/example/aped/communication/IXML.java +++ b/APED/app/src/main/java/com/example/aped/communication/IXML.java @@ -1,16 +1,38 @@ package com.example.aped.communication; +import java.util.Dictionary; +import java.util.List; + public interface IXML { /** - * - * @return hat Funktioniert? + * downloads the XML from the raspberry to the local folder + * @return 0 for no errors */ int download(); /** - * - * @return hat Funktioniert? + * uploads the local XML to the raspberry + * @return 0 for no errors */ int upload(); + /** + * reads the list of available devices from the XML + * @return the device names as a list of strings + */ + List getDeviceNames(); + + /** + * reads the value info of a given device from the XML + * @param deviceName the name of the relevant device + * @return the value info as a Dictionary + */ + Dictionary getValueInfo(String deviceName); + + /** + * reads the port information of a given device from the XML + * @param deviceName the name of the relevant device + * @return the value info as a Dictionary + */ + Dictionary getPort(String deviceName); } diff --git a/APED/app/src/main/java/com/example/aped/communication/TestXML.java b/APED/app/src/main/java/com/example/aped/communication/TestXML.java index 0b43443..3e043d4 100644 --- a/APED/app/src/main/java/com/example/aped/communication/TestXML.java +++ b/APED/app/src/main/java/com/example/aped/communication/TestXML.java @@ -1,6 +1,11 @@ package com.example.aped.communication; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; + public class TestXML implements IXML { /** Test Klasse.*/ @Override @@ -12,4 +17,33 @@ public class TestXML implements IXML { public int upload() { return 0; } + + @Override + public List getDeviceNames() { + List returnList = new ArrayList<>(); + returnList.add("stoff"); + returnList.add("schnaps"); + return returnList; + } + + @Override + public Dictionary getValueInfo(String deviceName) { + Dictionary returnDict = new Hashtable<>(); + returnDict.put("type","boolean"); + returnDict.put("unit",""); + returnDict.put("Offset",1.0); + returnDict.put("Factor",1.0); + return returnDict; + } + + @Override + public Dictionary getPort(String deviceName) { + Dictionary returnDict = new Hashtable<>(); + returnDict.put("protocol","DI"); + Dictionary pins = new Hashtable<>(); + pins.put("GPIO2",true); + pins.put("GPIO3",false); + returnDict.put("pins",pins); + return returnDict; + } }