Search in sources :

Example 1 with DeviceParser

use of com.jaku.parser.DeviceParser in project RoMote by wseemann.

the class DeviceInfoFragment method sendCommand.

private void sendCommand(String command) {
    String url = command;
    QueryDeviceInfoRequest queryActiveAppRequest = new QueryDeviceInfoRequest(url);
    JakuRequest request = new JakuRequest(queryActiveAppRequest, new DeviceParser());
    new RequestTask(request, new RequestCallback() {

        @Override
        public void requestResult(RokuRequestTypes rokuRequestType, RequestTask.Result result) {
            Device device = (Device) result.mResultValue;
            List<Entry> entries = parseDevice(device);
            mAdapter.addAll(entries);
            mAdapter.notifyDataSetChanged();
            DeviceInfoFragment.this.setListShown(true);
        }

        @Override
        public void onErrorResponse(RequestTask.Result result) {
            DeviceInfoFragment.this.setListShown(true);
        }
    }).execute(RokuRequestTypes.query_device_info);
}
Also used : RequestTask(wseemann.media.romote.tasks.RequestTask) Entry(wseemann.media.romote.model.Entry) QueryDeviceInfoRequest(com.jaku.request.QueryDeviceInfoRequest) RokuRequestTypes(wseemann.media.romote.utils.RokuRequestTypes) JakuRequest(com.jaku.core.JakuRequest) RequestCallback(wseemann.media.romote.tasks.RequestCallback) DeviceParser(com.jaku.parser.DeviceParser) Device(com.jaku.model.Device)

Example 2 with DeviceParser

use of com.jaku.parser.DeviceParser in project RoMote by wseemann.

the class ManualConnectionDialog method sendCommand.

private void sendCommand(String command) {
    String url = command;
    QueryDeviceInfoRequest queryActiveAppRequest = new QueryDeviceInfoRequest(url);
    JakuRequest request = new JakuRequest(queryActiveAppRequest, new DeviceParser());
    new RequestTask(request, new RequestCallback() {

        @Override
        public void requestResult(RokuRequestTypes rokuRequestType, RequestTask.Result result) {
            Device device = (Device) result.mResultValue;
            mProgressLayout.setVisibility(View.GONE);
            storeDevice(device);
        }

        @Override
        public void onErrorResponse(RequestTask.Result result) {
            mProgressLayout.setVisibility(View.GONE);
            mErrorText.setVisibility(View.VISIBLE);
        }
    }).execute(RokuRequestTypes.query_device_info);
}
Also used : RequestTask(wseemann.media.romote.tasks.RequestTask) QueryDeviceInfoRequest(com.jaku.request.QueryDeviceInfoRequest) RokuRequestTypes(wseemann.media.romote.utils.RokuRequestTypes) JakuRequest(com.jaku.core.JakuRequest) RequestCallback(wseemann.media.romote.tasks.RequestCallback) DeviceParser(com.jaku.parser.DeviceParser) Device(com.jaku.model.Device)

Example 3 with DeviceParser

use of com.jaku.parser.DeviceParser in project RoMote by wseemann.

the class ManualConnectionFragment method sendCommand.

private void sendCommand(String command) {
    String url = command;
    QueryDeviceInfoRequest queryActiveAppRequest = new QueryDeviceInfoRequest(url);
    JakuRequest request = new JakuRequest(queryActiveAppRequest, new DeviceParser());
    new RequestTask(request, new RequestCallback() {

        @Override
        public void requestResult(RokuRequestTypes rokuRequestType, RequestTask.Result result) {
            Device device = (Device) result.mResultValue;
            mProgressLayout.setVisibility(View.GONE);
            storeDevice(device);
        }

        @Override
        public void onErrorResponse(RequestTask.Result result) {
            mProgressLayout.setVisibility(View.GONE);
            mErrorText.setVisibility(View.VISIBLE);
        }
    }).execute(RokuRequestTypes.query_device_info);
}
Also used : RequestTask(wseemann.media.romote.tasks.RequestTask) QueryDeviceInfoRequest(com.jaku.request.QueryDeviceInfoRequest) RokuRequestTypes(wseemann.media.romote.utils.RokuRequestTypes) JakuRequest(com.jaku.core.JakuRequest) RequestCallback(wseemann.media.romote.tasks.RequestCallback) DeviceParser(com.jaku.parser.DeviceParser) Device(com.jaku.model.Device)

Aggregations

JakuRequest (com.jaku.core.JakuRequest)3 Device (com.jaku.model.Device)3 DeviceParser (com.jaku.parser.DeviceParser)3 QueryDeviceInfoRequest (com.jaku.request.QueryDeviceInfoRequest)3 RequestCallback (wseemann.media.romote.tasks.RequestCallback)3 RequestTask (wseemann.media.romote.tasks.RequestTask)3 RokuRequestTypes (wseemann.media.romote.utils.RokuRequestTypes)3 Entry (wseemann.media.romote.model.Entry)1