Search in sources :

Example 1 with ProgramInfo

use of com.connectsdk.core.ProgramInfo in project butter-android by butterproject.

the class WebOSTVService method getChannelCurrentProgramInfo.

private ServiceCommand<ResponseListener<Object>> getChannelCurrentProgramInfo(boolean isSubscription, final ProgramInfoListener listener) {
    String uri = "ssap://tv/getChannelCurrentProgramInfo";
    ServiceCommand<ResponseListener<Object>> request;
    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {
            JSONObject jsonObj = (JSONObject) response;
            ProgramInfo programInfo = parseRawProgramInfo(jsonObj);
            Util.postSuccess(listener, programInfo);
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };
    if (isSubscription)
        request = new URLServiceSubscription<ResponseListener<Object>>(this, uri, null, true, responseListener);
    else
        request = new ServiceCommand<ResponseListener<Object>>(this, uri, null, true, responseListener);
    request.send();
    return request;
}
Also used : ProgramInfo(com.connectsdk.core.ProgramInfo) JSONObject(org.json.JSONObject) URLServiceSubscription(com.connectsdk.service.command.URLServiceSubscription) JSONObject(org.json.JSONObject) ServiceCommandError(com.connectsdk.service.command.ServiceCommandError) ResponseListener(com.connectsdk.service.capability.listeners.ResponseListener) ServiceCommand(com.connectsdk.service.command.ServiceCommand)

Example 2 with ProgramInfo

use of com.connectsdk.core.ProgramInfo in project butter-android by butterproject.

the class WebOSTVService method parseRawProgramInfo.

private ProgramInfo parseRawProgramInfo(JSONObject programRawData) {
    String programId;
    String programName;
    ProgramInfo programInfo = new ProgramInfo();
    programInfo.setRawData(programRawData);
    programId = programRawData.optString("programId");
    programName = programRawData.optString("programName");
    ChannelInfo channelInfo = parseRawChannelData(programRawData);
    programInfo.setId(programId);
    programInfo.setName(programName);
    programInfo.setChannelInfo(channelInfo);
    return programInfo;
}
Also used : ProgramInfo(com.connectsdk.core.ProgramInfo) ChannelInfo(com.connectsdk.core.ChannelInfo)

Aggregations

ProgramInfo (com.connectsdk.core.ProgramInfo)2 ChannelInfo (com.connectsdk.core.ChannelInfo)1 ResponseListener (com.connectsdk.service.capability.listeners.ResponseListener)1 ServiceCommand (com.connectsdk.service.command.ServiceCommand)1 ServiceCommandError (com.connectsdk.service.command.ServiceCommandError)1 URLServiceSubscription (com.connectsdk.service.command.URLServiceSubscription)1 JSONObject (org.json.JSONObject)1