Skip to content

Legacy API: TVChannel

Hyojin Kim edited this page Mar 21, 2017 · 3 revisions

For converting TVChannel API of Legacy to TOAST API, please refer to the followings.

If you want more information, please refer to toast.tvchannel

turn

  • Before

    /* webapis */
    webapis.tv.channel.tune({
        major: 7,
        minor: 1
    }, function() {}, function() {}, 0);
    /* SEF */
    var sef = document.getElementById('sef');
    sef.open('Window', '1.0', 'Window');
    sef.Execute('SetChannel', 7, 1);
  • After

    toast.tvchannel.tune({
        major: 7,
        minor: 1
    },{
        onsuccess: function() {},
        onnosignal: function() {},
        onprograminforeceived: function() {}
    }, function() {});

tuneUp

  • Before

    /* webapis */
    webapis.tv.channel.tuneUp(function() {}, function() {}, 0, 0);
    /* SEF */
    sef.Execute('SetChannel_Seek', 3, 0);
  • After

    toast.tvchannel.tuneUp({
        onsuccess: function() {},
        onnosignal: function() {},
        onprograminforeceived: function() {}
    }, function() {});

tuneDown

  • Before

    /* webapis */
    webapis.tv.channel.tuneDown(function() {}, function() {}, 0, 0);
    /* SEF */
    sef.Execute('SetChannel_Seek', 4, 0);
  • After

    toast.tvchannel.tuneDown({
        onsuccess: function() {},
        onnosignal: function() {},
        onprograminforeceived: function() {}
    }, function() {});
    });   

findChannel

  • Before

    /* webapis */
    webapis.tv.channel.findChannel(7, 1, function() {}, function() {});
    /* SEF */
    var channelSize = sef.Execute('GetChannel_Size', 0, 0);
    for(var i = 0; i < channelSize; i++) {
        if(sef.Execute('GetChannel_Major', i) == 7 && sef.Execute('GetChannel_Minor', i) == 1) {}
    }
  • After

    toast.tvchannel.findChannel(7, 1, function() {}, function() {});

getChannelList

  • Before

    /* webapis */
    webapis.tv.channel.getChannelList(function() {}, function() {}, 0, 0, 10);
    /* SEF */
    var channelList = [];
    var channelSize = sef.Execute('GetChannel_Size', 0, 0);
    for(var i = 0; i < channelSize; i++) {
        channelList[i].major = sef.Execute('GetChannel_Major', i);
        channelList[i].minor = sef.Execute('GetChannel_Minor', i);
    }
  • After

    toast.tvchannel.getChannelList(function() {}, function() {}, 'ALL', 0, 10);

getCurrentChannel

  • Before

    /* webapis */
    var channelInfo = webapis.tv.channel.getCurrentChannel(0);
    /* SEF */
    var channelInfo = {};
    channelInfo.major = sef.Execute('GetCurrentChannel_Major');
    channelInfo.minor = sef.Execute('GetCurrentChannel_Minor');
  • After

    toast.tvchannel.getCurrentChannel(function() {}, function() {});

getProgramList

  • Before

    /* webapis */
    var channelInfo = webapis.tv.channel.getCurrentChannel(0);
    webapis.tv.channel.getProgramList(channelInfo, new Date(), function() {}, function() {}, 3);
    /* SEF */
    var channelInfo = {};
    channelInfo.major = sef.Execute('GetCurrentChannel_Major');
    channelInfo.minor = sef.Execute('GetCurrentChannel_Minor');
    
    var programList = [];
    var programSize = sef.Execute('GetProgramList_Size');
    
    for(var i = 0; i < listSize; i++) {
        programList[i].title = sef.Execute('GetProgram_Title', i);
        programList[i].start_Time = sef.Execute('GetProgram_StartTime', i);
        programList[i].duration = sef.Execute('GetProgram_Duration', i);
        programList[i].end_Time = sef.Execute('GetProgram_EndTime', i);
    }
  • After

    toast.tvchannel.getCurrentChannel(function(channelInfo) {
        toast.tvchannel.getProgramList(channelInfo, new Date(), function() {}, function() {}, 3);
    }, function() {});

getCurrentProgram

  • Before

    /* webapis */
    var programInfo = webapis.tv.channel.getCurrentProgram(0);
    /* SEF */
    var programInfo = {};
    programInfo.major = sef.Execute('GetPresentProgram_Title');
    programInfo.minor = sef.Execute('GetPresentProgram_StartTime');
    programInfo.minor = sef.Execute('GetPresentProgram_Duration');
    programInfo.minor = sef.Execute('GetPresentProgram_EndTime');
  • After

    toast.tvchannel.getCurrentProgram(function() {}, function() {});

addChannelChangeListener

  • Before

    Not supported
  • After

    var testFunc = function() {};
    toast.tvchannel.addChannelChangeListener(testFunc);   

removeChannelChangeListener

  • Before

    Not supported
  • After

    var testFunc = function() {};
    toast.tvchannel.addChannelChangeListener(testFunc);
    toast.tvchannel.removeChannelChangeListener(testFunc);   
Clone this wiki locally