use of com.jaku.core.JakuResponse in project RoMote by wseemann.
the class RequestTask method doInBackground.
@Override
protected RequestTask.Result doInBackground(RokuRequestTypes... requestTypes) {
Result result = null;
if (!isCancelled() && requestTypes != null && requestTypes.length > 0) {
RokuRequestTypes requestType = requestTypes[0];
try {
if (requestType.equals(RokuRequestTypes.query_active_app)) {
JakuResponse response = request.send();
List<Channel> channels = (List<Channel>) response.getResponseData();
result = new Result(channels);
} else if (requestType.equals(RokuRequestTypes.query_device_info)) {
JakuResponse response = request.send();
Device device = (Device) response.getResponseData();
result = new Result(device);
} else if (requestType.equals(RokuRequestTypes.query_icon)) {
JakuResponse response = request.send();
byte[] data = ((ByteArrayOutputStream) response.getResponseData()).toByteArray();
result = new Result(data);
} else {
request.send();
}
} catch (Exception e) {
e.printStackTrace();
result = new Result(e);
}
}
return result;
}
Aggregations