This document describes new usages of Samsung Product Timer API for Tizen 6.5 and higher, and differences with SSSP B2BControl API.
This interface provides methods to get timer module version.
SSSP API sample code:
var Version = null; try { Version = b2bapis.b2bcontrol.getVersion(); } catch (e) { console.log("[getVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== Version) { console.log("[getVersion] call syncFunction type: " + Version); }
Samsung Product API sample code:
var Version = null; try { Version = webapis.timer.getVersion(); } catch (e) { console.log("[getVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== Version) { console.log("[getVersion] call syncFunction type: " + Version); }
This interface provides a method to set the clock (date and time) of device OSD menu. By this method, device OSD menu clock can be set differently from system date and time.
var onSuccess = function(val) { console.log("[setCurrentTime] success : " + val ); }; var onError = function(error) { console.log("[setCurrentTime] code :" + error.code + " error name: " + error.name + " message " + error.message); }; //2015->year; 12->month; 25->day; 15->hour; 56->minute; 4->second b2bapis.b2bcontrol.setCurrentTime("2015:12:25:15:56:40", onSuccess, onError);
var current_time = { "year" : 2022, "month" : 12, "dayofweek": "MON", "hour" : 8, "minute" : 55, "second" : 43 }; try { webapis.timer.setCurrentTime(current_time); } catch (e) { console.log("[setCurrentTime] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to get the current date and time of device OSD menu clock. The device OSD menu clock's date and time may be different from system date and time.
var CurrentTime = null; try { CurrentTime = b2bapis.b2bcontrol.getCurrentTime(); } catch (e) { console.log("[getCurrentTime] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== CurrentTime) { console.log("[getCurrentTime] call syncFunction type: " + CurrentTime); }
var CurrentTime = null; try { CurrentTime = webapis.timer.getCurrentTime(); } catch (e) { console.log("[getCurrentTime] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== CurrentTime) { console.log("[getCurrentTime] call syncFunction type: " + CurrentTime); }
This interface provides a method to set the OnTimer of the device.
var onSuccess = function(val) { console.log("[setOnTimer] success : " + val); }; var onError = function(error) { console.log("[setOnTimer] code :" + error.code + " error name: " + error.name + " message " + error.message); }; b2bapis.b2bcontrol.setOnTimer("TIMER1","21:30", onSuccess, onError); // or b2bapis.b2bcontrol.setOnTimerRepeat("TIMER2","19:50","TIMER_MANUAL","SUN:WED", onSuccess, onError);
var timer_profile1 = { "timerID" : "TIMER1", "time" : "19:50", "setup" : "TIMER_ONCE", "volume" : 10 }; var timer_profile2 = { "timerID" : "TIMER2", "time" : "19:50", "setup" : "TIMER_MANUAL", "volume" : 10, "manual" : ["SUN", "WED"] }; try { webapis.timer.setOnTimer(timer_profile1); } catch (e) { console.log("[setOnTimer] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to get the value set in the specified OnTimer.
var OnTimer = null; try { OnTimer = b2bapis.b2bcontrol.getOnTimer("TIMER1"); // or OnTimer = b2bapis.b2bcontrol.getOnTimerRepeat("TIMER2"); } catch (e) { console.log("[getOnTimer] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== OnTimer) { console.log("[getOnTimer] call syncFunction type: " + OnTimer); }
var OnTimer = null; try { OnTimer = webapis.timer.getOnTimer("TIMER1"); } catch (e) { console.log("[getOnTimer] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== OnTimer) { console.log("[getOnTimer] call syncFunction Timer : " + OnTimer); }
This interface provides a method to set the OffTimer of the device.
var onSuccess = function(val) { console.log("[setOffTimer] success : " + val); }; var onError = function(error) { console.log("[setOffTimer] code :" + error.code + " error name: " + error.name + " message " + error.message); }; console.log("[setOffTimer] "); b2bapis.b2bcontrol.setOffTimer("TIMER1","21:30", onSuccess, onError); // or b2bapis.b2bcontrol.setOffTimerRepeat("TIMER2","19:50","TIMER_MANUAL","SUN:WED", onSuccess, onError);
var timer_profile = { "timerID" : "TIMER1", "time" : "19:50", "setup" : "TIMER_ONCE" }; var timer_profile2 = { "timerID" : "TIMER2", "time" : "19:50", "setup" : "TIMER_MANUAL", "manual" : ["SUN", "WED"] }; try { webapis.timer.setOffTimer(timer_profile); } catch (e) { console.log("[setOffTimer] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to get the value set in the specified OffTimer.
var OffTimer = null; try { OffTimer = b2bapis.b2bcontrol.getOffTimer("TIMER1"); // or OffTimer = b2bapis.b2bcontrol.getOffTimerRepeat("TIMER2"); } catch (e) { console.log("[getOffTimer] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== OffTimer) { console.log("[getOffTimer] call syncFunction type: " + OffTimer); }
var OffTimer = null; try { OffTimer = webapis.timer.getOffTimer("TIMER1"); } catch (e) { console.log("[getOffTimer] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== OnTimer) { console.log("[getOffTimer] call syncFunction Timer : " + OnTimer); }
This interface provides a method to add a holiday. It can be set for up to 15 days.
var onSuccess = function(val) { console.log("[setHolidayList] success : " + val); }; var onError = function(error) { console.log("[setHolidayList] code :" + error.code + " error name: " + error.name + " message " + error.message); }; b2bapis.b2bcontrol.setHolidayList("ADD","8","15","10","18",onSuccess, onError);
var ADD_Holiday_profile = { "startMonth" : 8, "startDay" : 15, "endMonth" : 10, "endDay" : 18 }; try { webapis.timer.addHoliday(ADD_Holiday_profile); } catch (e) { console.log("[addHoliday] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to remove a holiday.
var onSuccess = function(val) { console.log("[setHolidayList] success : " + val); }; var onError = function(error) { console.log("[setHolidayList] code :" + error.code + " error name: " + error.name + " message " + error.message); }; b2bapis.b2bcontrol.setHolidayList("DELETE","8","15","10","18",onSuccess, onError);
var DEL_Holiday_profile = { "startMonth" : 8, "startDay" : 15, "endMonth" : 10, "endDay" : 18 }; try { webapis.timer.deleteHoliday(DEL_Holiday_profile); } catch (e) { console.log("[deleteHoliday] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to apply a holiday to a Timer.
var onSuccess = function(val) { console.log("[setHolidayToTimer] success : " + val); }; var onError = function(error) { console.log("[setHolidayToTimer] code :" + error.code + " error name: " + error.name + " message " + error.message); }; b2bapis.b2bcontrol.setHolidayToTimer("OFF_TIMER", "TIMER1", "HOLIDAY_OFF", onSuccess, onError);
var timer_profile = { "type" : "OnTimer", "timerID" : "TIMER1", "timerOnOff" : "ON" }; try { webapis.timer.applyTimerHoliday(timer_profile); } catch (e) { console.log("[deleteHoliday] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to get the list of holidays for a device.
var HolidayList = null; try { HolidayList = b2bapis.b2bcontrol.getHolidayList(); } catch (e) { console.log("[getHolidayList] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== HolidayList) { console.log("[getHolidayList] call syncFunction type: " + HolidayList); }
var Holiday = null; var timer_profile = { "type" : "OnTimer", "timerID" : "TIMER1" }; try { Holiday = webapis.timer.getTimerHoliday(timer_profile); } catch (e) { console.log("[getHoliday] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== Holiday) { console.log("[getHoliday] call syncFunction type: " + Holiday); }
This interface provides a method to set the NTP info of the device.
var onSuccess = function(val) { console.log("[setNTPServerAddress] success : " + val); }; var onError = function(error) { console.log("[setNTPServerAddress] code :" + error.code + " error name: " + error.name + " message " + error.message); }; b2bapis.b2bcontrol.setNTPUse("USE", onSuccess, onError); b2bapis.b2bcontrol.setNTPServerAddress("pool.ntp.org", onSuccess, onError); b2bapis.b2bcontrol.setCurrentTimeZone("Asia/Seoul", onSuccess, onError);
var ntpinfo = { "use" : "ON", "address" : "pool.ntp.org", "timezone" : "Asia/Seoul" }; try { webapis.timer.setNTP(ntpinfo); } catch (e) { console.log("[setNTP] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to get the NTPUse status of the device.
var NTPUse = null; var NTPServerAddress = null; var TimeZone = null; try { NTPUse = b2bapis.b2bcontrol.getNTPUse(); NTPServerAddress = b2bapis.b2bcontrol.getNTPServerAddress(); TimeZone = b2bapis.b2bcontrol.getCurrentTimeZone(); } catch (e) { console.log("[getNTPUse] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } console.log("[getNTPUse] call syncFunction type: " + NTPUse + " : " + NTPServerAddress + " : " + TimeZone);
var ntpinfo= null; try { ntpinfo = webapis.timer.getNTP(); } catch (e) { console.log("[getNTP] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } console.log("[getNTP] call syncFunction type: " + ntpinfo);
This interface provides a method to set the DST mode to the clock of device OSD menu. This DST mode is not applied to system time.
var DSTInfo = { "mode" : "ON", "start" : { "month" : 10, "week" : 3, "dayofweek" : "MON", "hour" : 8, "minute" : 22 }, "end" : { "month" : 11, "week" : 9, "dayofweek" : "MON", "hour" : 13, "minute" : 58 }, "offset": "+1" }; try { webapis.timer.setDST(DSTInfo); } catch (e) { console.log("[setDST] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to get the clock's DST mode of device OSD menu.
var DSTMode = null; try { DSTMode = webapis.timer.getDST(); } catch (e) { console.log("[getDST] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== DSTMode) { console.log("[getDST] call syncFunction type: " + DSTMode); }
This interface provides a method to set the time sync timeout for the device. If connection to the Samsung server cannot be made within the chose time period, the System/Kernel time is set to same as menu time.
var timeout = "30SEC"; try { webapis.timer.setSystemTimeSyncTimeout(timeout); } catch (e) { console.log("[setSystemTimeSyncTimeout] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); }
This interface provides a method to get the time sync timeout. If connection to the Samsung server cannot be made within the chose time period, the System/Kernel time is set to same as menu time.
var TIMEOUT = null; try { TIMEOUT = webapis.timer.getSystemTimeSyncTimeout(); } catch (e) { console.log("[getSystemTimeSyncTimeout] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null !== TIMEOUT) { console.log("[getSystemTimeSyncTimeout] call syncFunction type: " + TIMEOUT); }