diff --git a/APED/app/src/main/java/com/example/aped/communication/Communicator.java b/APED/app/src/main/java/com/example/aped/communication/Communicator.java index 8eec165..3fee86c 100644 --- a/APED/app/src/main/java/com/example/aped/communication/Communicator.java +++ b/APED/app/src/main/java/com/example/aped/communication/Communicator.java @@ -2,33 +2,21 @@ package com.example.aped.communication; import android.content.Context; import android.util.Log; - import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; -import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; -import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; - import org.json.JSONObject; - -import java.io.BufferedReader; import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; - import kotlin.NotImplementedError; -public class Communicator{ +public class Communicator { private String address; private int port; private RequestQueue requestQueue; - public Communicator(String address, int port, Context context){ + public Communicator(String address, int port, Context context) { this.address = address; this.port = port; requestQueue = Volley.newRequestQueue(context); @@ -41,7 +29,7 @@ public class Communicator{ requestString, null, responseListener, - error -> Log.e("Communicator","Error during READ: " + error.getMessage()) + error -> Log.e("Communicator", "Error during READ: " + error.getMessage()) ); requestQueue.add(request); } @@ -53,7 +41,8 @@ public class Communicator{ requestString, message, responseListener, - error -> {Log.e("Communicator", "Error during WRITE: " + error.getMessage()); error.printStackTrace();} + error -> { + Log.e("Communicator", "Error during WRITE: " + error.getMessage()); error.printStackTrace(); } ); requestQueue.add(request); } diff --git a/APED/app/src/main/java/com/example/aped/utils/IXML.java b/APED/app/src/main/java/com/example/aped/utils/IXML.java index 4fc1132..ec38d82 100644 --- a/APED/app/src/main/java/com/example/aped/utils/IXML.java +++ b/APED/app/src/main/java/com/example/aped/utils/IXML.java @@ -6,20 +6,20 @@ import java.util.List; public interface IXML { /** - * reads the list of available devices from the XML + * 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 + * 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 + * 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 */ diff --git a/APED/app/src/main/java/com/example/aped/utils/TestFavorites.java b/APED/app/src/main/java/com/example/aped/utils/TestFavorites.java index ad69d36..5eb63ec 100644 --- a/APED/app/src/main/java/com/example/aped/utils/TestFavorites.java +++ b/APED/app/src/main/java/com/example/aped/utils/TestFavorites.java @@ -7,7 +7,7 @@ import java.util.List; * implementation for the favorites interface * does not use persistent storage! */ -public class TestFavorites implements IFAVORITES{ +public class TestFavorites implements IFAVORITES { private List favorites = new ArrayList<>(); diff --git a/APED/app/src/main/java/com/example/aped/utils/TestXML.java b/APED/app/src/main/java/com/example/aped/utils/TestXML.java index cdd9fa1..701014a 100644 --- a/APED/app/src/main/java/com/example/aped/utils/TestXML.java +++ b/APED/app/src/main/java/com/example/aped/utils/TestXML.java @@ -19,22 +19,22 @@ public class TestXML implements IXML { @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); + 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); + returnDict.put("protocol", "DI"); + Dictionary pins = new Hashtable<>(); + pins.put("GPIO2", true); + pins.put("GPIO3", false); + returnDict.put("pins", pins); return returnDict; } }