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 f2bec72..d9012aa 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 @@ -77,6 +77,27 @@ public class Communicator { requestQueue.add(request); } + /** + * Method to read a device value buffer from the raspberry. + * @param deviceName the name of the device + * @param responseListener the {@link Response.Listener} for defining + * actions to be performed on response + */ + public void readBuffer(final String deviceName, + final Response.Listener responseListener) { + String url = "http://" + address + + ":" + port + + "/device/" + deviceName + "/buffer/"; + JsonObjectRequest request = new JsonObjectRequest( + Request.Method.GET, + url, + null, + responseListener, + error -> handleError(error, "READ") + ); + requestQueue.add(request); + } + /** * Writes an api call to the endpoint of a device. * @param deviceName the name of the device