Timer API

To use Samsung Product API, 

<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>

Should be loaded in index.html

This module defines the functionalities of device OSD menu clock and timer as the Samsung Product API. The Timer module provides the Timer features and clock features provided by the device to the API. You can turn on or turn off a device at the time you set up using the onTimer / offTimer WebAPI provided. You can also set the clock date and time of device OSD menu.

Since : 6.5

Product : B2B (LFD)


Summary of Interfaces and Methods

Interface Method
TimerInfo  
TimerManager DOMString getVersion();
void setCurrentTime(TimeSetting currentTime);
TimeSetting getCurrentTime();
void setOnTimer(TimerInfo info);;
TimerInfo getOnTimer(TimerID timer);
void setOffTimer(TimerInfo info);
TimerInfo getOffTimer(TimerID timer);
void addHoliday(HolidayInfo info);
void deleteHoliday(HolidayInfo info);
TimerInfo applyTimerHoliday(HolidayInfo info);
DOMString getTimerHoliday(HolidayInfo info);
void setNTP(NTPInfo info);
NTPInfo getNTP();
void setDST(DSTInfo info);
DSTInfo getDST();
TimerManagerObject  

1. Interfaces

1.1. TimerInfo

Timer settings information object.

Timer::TimerInfo

  TimerInfo implements Timer;

Attributes

  • readonly TimerIDtimerID
    TimerID, a unique identifier for a timer. One device can set 1 to 7 timers.
  • DOMString TimerIDtime
    Time value (hour:minute). The time format is 00:00, with the hour value from 0 to 24, and the minute value from 0 to 59.
  • TimerSetup TimerIDsetup
    TimerSetup enum value. Used when you want to set the Timer to be active only on certain days. This value can only be set for Timers with the OnTimer type.
  • long TimerIDvolume
    Volume of the Timer alarm (values from 0 to 99).
  • TimerDay TimerID[]manual
    Days when the Timer is set to go off. This attribute can be set only when the "TimerSetup" attribute is set to TIMER_MANUAL

1.2. TimerManager

This interface provides methods to use Timer functionalities.

[NoInterfaceObject]interface TimerManager {};

Methods

getVersion
This interface provides method to get timer module version.

DOMString getVersion();

Product:B2B (LFD)

Exceptions:

  • WebAPIException
    • with error type SecurityError if the application does not have the privilege to call this method.

    • with error type UnknownError in any other error case.

Code example:


		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);
		}
setCurrentTime(TimeSetting currentTime)
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.

       void setCurrentTime(TimeSetting currentTime);

Product: B2B (LFD, IWB)

Parameters:

  • currentTime: Setting information object

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type UnknownError in any other error case.

    • with the error type TypeMismatchError if invalid parameter values passed for input parameter.

Code example:


		var current_time = {
			"year"     : 2022,
			"month"    : 12,
			"day"      : 15,
			"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);
		   }
getCurrentTime()
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.

	TimeSetting getCurrentTime();

Product: B2B (LFD, IWB)

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type UnknownError in any other error case.

Code example:


		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);
		}
setOnTimer
This interface provides a method to set the OnTimer of the device.

	void setOnTimer(TimerInfo info);

Product: B2B (LFD)

Parameters:

  • info: Timer information. Only the timerID, time, setup, volume, and manual attributes are supported.

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		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);
		   }
getOnTimer
This interface provides a method to get the value set in the specified OnTimer.

	TimerInfo getOnTimer(TimerID timer);

Product: B2B (LFD)

Parameters:

  • timer: Timer to be retrieved. Only the timerID attribute is supported.

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		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);
		}
setOffTimer
This interface provides a method to set the OffTimer of the device.

void setOffTimer(TimerInfo info);

Product: B2B (LFD)

Parameters:

  • Info: Timer information. Only the timerID, time, and setup attributes are supported..

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		var timer_profile = {
			"timerID"     : "TIMER1",
			"time"        : "19:50",
			"setup"       : "TIMER_ONCE"
		}

		   try {
			webapis.timer.setOffTimer(timer_profile);   
		   } catch (e) {
			console.log("[setOffTimer] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
		   }

Remark :

Frequent calls to the set timer API may cause internal EEPROM problems in the device. Use it according to the hardware specification..
getOffTimer
This interface provides a method to get the value set in the specified OffTimer.

TimerInfo getOffTimer(TimerID timer);

Product: B2B (LFD)

Parameters:

  • timer: Timer to be retrieved. Only the timerID attribute is supported.

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		var OnTimer = null;
		try {
			OnTimer = 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);
		}
 
addHoliday
This interface provides a method to add a holiday. It can be set for up to 15 days.

void addHoliday(HolidayInfo info);

Product: B2B (LFD)

Parameters:

  • info: Information of the holiday as a HolidayInfo object. Only the startMonth, startDay, endMonth, and endDay attributes are supported..

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		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);
		}
deleteHoliday
This interface provides a method to remove a holiday.

  void deleteHoliday(HolidayInfo info);

Product: B2B (LFD)

Parameters:

  • info: Information of the holiday as a HolidayInfo object. Only the startMonth, startDay, endMonth, and endDay attributes are supported.

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		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);
		}
applyTimerHoliday
This interface provides a method to apply a holiday to a Timer.

 void applyTimerHoliday(HolidayInfo info);

Product: B2B (LFD)

Parameters:

  • info:Holiday to be applied.

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		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);
		}
getTimerHoliday
This interface provides a method to get the list of holidays for a device.

 DOMString getTimerHoliday(HolidayInfo info);

Product: B2B (LFD)

Parameters:

  • info: Information of the holiday as a HolidayInfo object. Only the type and timerID attributes are supported.

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type UnknownError in any other error case.

    • with the error type TypeMismatchError if invalid values are passed for an input parameter.

Code example:


		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);
		}
setNTP
This interface provides a method to set the NTP info of the device.

void setNTP(NTPInfo info);

Product: B2B (LFD)

Parameters:

  • info: NTP settings information object

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		var ntpinfo = {
		"use"       : "ON",
		"address"   : "10.89.10.13",
			"timeZone"  : "Asia/Seoul"
		}
		   try {
			webapis.timer.setNTP(ntpinfo);
		   } catch (e) {
			console.log("[setNTP] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
		   }
getNTP
This interface provides a method to get the NTPUse status of the device.

NTPInfo getNTP();

Product: B2B (LFD)

Return value:

NTP Information

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type UnknownError in any other error case.

Code example:


		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);
setDST
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.

void setDST(DSTInfo info);

Product: B2B (LFD, IWB)

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


		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);
		 }
getDST
This interface provides a method to get the clock's DST mode of device OSD menu.

DSTInfo getDST();

Product: B2B (LFD, IWB)

Exceptions:

  • WebAPIException
    • with error type SecurityError if the application does not have the privilege to call this method.

    • with error type UnknownError in any other error case.

Code example:


		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);
		}
setSystemTimeSyncTimeout
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.

void setSystemTimeSyncTimeout(SyncTimeout timeout);

Product: B2B (LFD)

Parameters

  • timeout: Timeout value

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type TypeMismatchError if different type argument values are passed for an input parameter.

    • with the error type InvalidValuesError if invalid values are passed for an input parameter even if same argument type.

    • with the error type NotSupportedError if this feature is not supported.

Code example:


var timeout = "30SEC";
try {
 webapis.timer.setSystemTimeSyncTimeout(timeout);
} catch (e) {
 console.log("[setSystemTimeSyncTimeout] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
}
getSystemTimeSyncTimeout
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..

 SyncTimeout getSystemTimeSyncTimeout();

Product: B2B (LFD)

Exceptions:

  • WebAPIException
    • with the error type SecurityError if the application does not have the privilege to call this method.

    • with the error type UnknownError in any other error case.

Code example:


		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);
		}

1.3. TimerManagerObject

The interface defines what is instantiated by the Timer object of the Samsung Product API. A webapis.timer object allows access to the functionality of the Timer API..

Attributes

  • readonly TimerManager timer
    Timer API namespace