Merge branch 'master' of https://its-gitlab.init.hs-owl.de/mo_b_l/aped_app
This commit is contained in:
commit
83e8ec0aea
@ -1,8 +1,19 @@
|
||||
package com.example.aped.communication;
|
||||
|
||||
public interface IIO {
|
||||
public interface IIO
|
||||
{
|
||||
/**
|
||||
* reads a value from a device connected to the raspberry
|
||||
* @param deviceName the name of the device to read from
|
||||
* @return the value read
|
||||
*/
|
||||
String read(String deviceName);
|
||||
|
||||
public Object read(String deviceName);
|
||||
|
||||
public Object write(String deviceName, Object value);
|
||||
/**
|
||||
* writes a value to a device connected to the raspberry
|
||||
* @param deviceName the name of the device to write to
|
||||
* @param value the value to write to the device
|
||||
* @return the value written
|
||||
*/
|
||||
String write(String deviceName, String value);
|
||||
}
|
||||
|
@ -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<String> 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<String, Object> 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<String, Object> getPort(String deviceName);
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ package com.example.aped.communication;
|
||||
public class TestIO implements IIO {
|
||||
|
||||
@Override
|
||||
public Object read(String deviceName) {
|
||||
return new String("test");
|
||||
public String read(String deviceName) {
|
||||
return "test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object write(String deviceName, Object value) {
|
||||
public String write(String deviceName, String value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -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<String> getDeviceNames() {
|
||||
List<String> returnList = new ArrayList<>();
|
||||
returnList.add("stoff");
|
||||
returnList.add("schnaps");
|
||||
return returnList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dictionary<String, Object> getValueInfo(String deviceName) {
|
||||
Dictionary<String,Object> 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<String, Object> getPort(String deviceName) {
|
||||
Dictionary<String, Object> returnDict = new Hashtable<>();
|
||||
returnDict.put("protocol","DI");
|
||||
Dictionary<String,Object> pins = new Hashtable<>();
|
||||
pins.put("GPIO2",true);
|
||||
pins.put("GPIO3",false);
|
||||
returnDict.put("pins",pins);
|
||||
return returnDict;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user