added ability to read buffered values from the raspberry

This commit is contained in:
paul-loedige 2021-01-07 22:58:24 +01:00
parent 3cb012d86b
commit 9c30a011e8

View File

@ -77,6 +77,27 @@ public class Communicator {
requestQueue.add(request); 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<JSONObject> 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. * Writes an api call to the endpoint of a device.
* @param deviceName the name of the device * @param deviceName the name of the device