# Namespace hcap.time

hcap.time

- Defined in: hcap-1.24.6.5901.js

Namespace Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| hcap.time

## Method Summary

## Namespace Detail

hcap.time

## Method Detail

- <static> hcap.time.getAlarmInformation(param)
  Gets the alarm time, alarm channel and alarm volume level of TV. These settings are applied only once at the alarm time and will be disabled.
  At the alarm time, if TV is off, TV will be turned on automatically with the alarm volume level and tune to the alarm channel. And if TV is on at the alarm time, nothing will happen. If the alarm time is disabled, param.hour = -1 and param.minute = -1 will be returned. And if the alarm channel is disabled, param.channelType = hcap.channel.ChannelType.UNKNOWN will be returned. If the alarm volume is disabled, param.volumeLevel = -1 will be returned.

      hcap.time.getAlarmInformation({
           "onSuccess" : function(s) {
               console.log("onSuccess :" +
                   "\n alarm time = " + s.hour = " : " + s.minute +
                   "\n alarm volume level = " + s.volumeLevel +
                   "\n ========= alarm channel information =========" +
                   "\n channel type      : " + s.channelType     +
                   "\n logical number    : " + s.logicalNumber   +
                   "\n frequency         : " + s.frequency       +
                   "\n program number    : " + s.programNumber   +
                   "\n major number      : " + s.majorNumber     +
                   "\n minor number      : " + s.minorNumber     +
                   "\n satellite ID      : " + s.satelliteId     +
                   "\n polarization      : " + s.polarization    +
                   "\n rf broadcast type : " + s.rfBroadcastType +
                   "\n ip                : " + s.ip              +
                   "\n port              : " + s.port            +
                   "\n ip broadcast type : " + s.ipBroadcastType +
                   "\n symbol rate       : " + s.symbolRate      +
                   "\n pcr pid           : " + s.pcrPid          +
                   "\n video pid         : " + s.videoPid        +
                   "\n video stream type : " + s.videoStreamType +
                   "\n audio pid         : " + s.audioPid        +
                   "\n audio stream type : " + s.audioStreamType +
                   "\n signal strength   : " + s.signalStrength  +
                   "\n source address    : " + s.sourceAddress);
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // {Number} param.hour - hour of alarm time (-1 ~ 23), -1 if the setting is disabled.
                // {Number} param.minute - minute of alarm time (-1 ~ 59), -1 if the setting is disabled.
                // {Number} param.volumeLevel - alarm volume level (-1 ~ 100) which is applied only once for the first alarm booting. -1 if setting is disabled.
                // For the alarm channel, see the { Channel Properties } in hcap.channel.requestChangeCurrentChannel(). The alarm channel is applied only once for the first alarm booting.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.5.0
  See:
    hcap.time.setAlarmInformation()
- <static> hcap.time.getCpuTime(param)
  Gets the CPU time. It means that the monotonic time after TV is turned on.

      hcap.time.getCpuTime({
           "onSuccess" : function (param) {
               console.log("onSuccess : cpu time(milliseconds) = " + param.cpuTime);
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // {Number} param.cpuTime - cpu time(milliseconds) of the platform.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.21.0
- <static> hcap.time.getLocalTime(param)
  Gets the TV time.
  TV time is the local time which is the time after applying GMT offset for time zone and daylight saving time.
  In this error case, failure callback function will be invoked.

      hcap.time.getLocalTime({
           "onSuccess" : function(s) {
               console.log("onSuccess : \n" +
                   "TV localtime = " + s.year + "-" + s.month + "-" + s.day + " " + s.hour + " : " + s.minute + " : " + s.second + "\n" +
                   "GMT offset = " + s.gmtOffsetInMinute + "\n" +
                   "daylight saving = " + s.isDaylightSaving);
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // {Number} param.year - year (2000 ~ 2029).
                // {Number} param.month - month (1 ~ 12).
                // {Number} param.day - day (1 ~ 31).
                // {Number} param.hour - hour (0 ~ 23).
                // {Number} param.minute - minute (0 ~ 59).
                // {Number} param.second - second (0 ~ 59).
                // {Number} param.gmtOffsetInMinute - GMT offset in minute for time zone (-660 ~ 720).
                // {Number} param.isDaylightSaving - false : not applying daylight saving time to local time, true : applying daylight saving time to local time.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.6.0
  See:
    hcap.time.setLocalTime()
- <static> hcap.time.getPowerOffTimer(param)
  Gets the sleep time to power off.

      hcap.time.getPowerOffTimer({
           "onSuccess" : function(s) {
               console.log("onSuccess : remaining time (min) = " + s.minute);
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // {Number} param.minute - remaining time(minutes: 0 ~ 240, -1:off) of the sleep timer.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.3.1
  See:
    hcap.time.setPowerOffTimer()
- <static> hcap.time.getPowerOnTime(param)
  Gets the wake-up time of TV. This setting is applied only once at the wake-up time and will be disabled.
  If the setting is disabled, returns -1 for hour and -1 for minute.

      hcap.time.getPowerOnTime({
           "onSuccess" : function(s) {
               console.log("onSuccess : wake-up time = " + s.hour + " : " + s.minute);
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // {Number} param.hour - hour of wake-up time (0~23), -1 if the setting is disabled.
                // {Number} param.minute - minute of wake-up time (0~59), -1 if the setting is disabled.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.3.1
  See:
    hcap.time.setPowerOnTime()
- <static> hcap.time.setAlarmInformation(param)
  Sets the alarm time, alarm channel and alarm volume level of TV. These settings are applied only once at the alarm time and will be disabled.
  At the alarm time, if TV is off, TV will be turned on automatically with the alarm volume level and tune to the alarm channel. And if TV is on at the alarm time, nothing will happen. To disable the alarm time, param.hour = -1 and param.minute = -1 should be set. When the alarm time is disabled, the alarm channel and the alarm volume level will be disabled together.

      hcap.time.setAlarmInformation({
           "hour" : 9,
           "minute" : 30,
           "volumeLevel" : 30,
           "channelType" : hcap.channel.ChannelType.RF,
           "frequency" : 63000000,
           "programNumber" : 1,
           "rfBroadcastType" : hcap.channel.RfBroadcastType.TERRESTRIAL,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.hour [Required] - hour of alarm time. The range is -1 ~ 23.
    - {Number} param.minute [Required] - minute of alarm time. The range is -1 ~ 59.
    - {Number} param.volumeLevel [Required] - alarm volume level (-1 ~ 100). -1 to disable the alarm volume.
    - { Channel Properties } [Required] - Alarm Channel Information.
    The alarm channel is taken affect prior to the start channel. If you want to disable the alarm channel, set param.channelType to hcap.channel.ChannelType.UNKNOWN.
- {Function} param.onSuccess [Optional] - success callback function.
  Setting to the same hour/minute/alarm channel/alarm volume level as before will invoke this callback function.

        param.onSuccess = function() {
            // No parameter.
        }

- {Function} param.onFailure [Optional] - failure callback function.

        param.onFailure = function (param) {
            // {String} param.errorMessage - in case of failure, this message provides the details.
        }

Since:
  1.5.0

See:
  hcap.time.getAlarmInformation()

- <static> hcap.time.setLocalTime(param)
  Sets the TV time.
  Input time is the local time which is the time after applying GMT offset for time zone and daylight saving time.
  GMT offset for time zone and daylight saving time are required to set the TV localtime.
  Current GMT offset and daylight saving time can be got from hcap.time.getLocalTime(). GMT offset must be standard GMT offset of the city.
  Some of the standard GMT offset values and illegal GMT offset like -110 could not be set to TV.
  In this error case, failure callback function will be invoked.

      hcap.time.setLocalTime({
           "year" : 2010,
           "month" : 8,
           "day" : 31,
           "hour" : 1,
           "minute" : 0,
           "second" : 0,
           "gmtOffsetInMinute" : 180,
           "isDaylightSaving" : false,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.year [REQUIRED] - year (2000 ~ 2029).
    - {Number} param.month [REQUIRED] - month (1 ~ 12).
    - {Number} param.day [REQUIRED] - day (1 ~ 31).
    - {Number} param.hour [REQUIRED] - hour (0 ~ 23).
    - {Number} param.minute [REQUIRED] - minute (0 ~ 59).
    - {Number} param.second [REQUIRED] - second (0 ~ 59).
    - {Number} param.gmtOffsetInMinute [REQUIRED] - GMT offset in minute for time zone (-660 ~ 720).
    - {Boolean} param.isDaylightSaving [REQUIRED] - false : not applying daylight saving time to local time, true : applying daylight saving time to local time.
    - {Function} param.onSuccess [Optional] - success callback function.
      Setting to the same year/month/day/hour/minute/second/gmt_offset_in_minute/daylight_saving as before will invoke this callback function.

            param.onSuccess = function() {
                // No Parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.3.1
  See:
    hcap.time.getLocalTime()
- <static> hcap.time.setPowerOffTimer(param)
  Sets the power-off timer of TV.

      hcap.time.setPowerOffTimer({
           "minute" : 60,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.minute [Required] - preset time(in minutes) of power-off timer. The range is 0~240 minutes(4 hours) or -1(off).
    - {Function} param.onSuccess [Optional] - success callback function.
      Setting to the same minutes of sleep timer as before will invoke this callback function.

            param.onSuccess = function() {
                // No parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.3.1
  See:
    hcap.time.getPowerOffTimer()
- <static> hcap.time.setPowerOnTime(param)
  Sets the wake-up time of TV. This setting is applied only once at the wake-up time and will be disabled.
  Set parm.hour -1 and param.minute -1 to disable the wake-up time.

      hcap.time.setPowerOnTime({
           "hour" : 9,
           "minute" : 30,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.hour [Required] - hour of wake-up time. The range is 0~23 or -1 if the setting is disabled.
    - {Number} param.minute [Required] - minute of wake-up time. The range is 0~59 or -1 if the setting is disabled.
    - {Function} param.onSuccess [Optional] - success callback function.
      Setting to the same hour/minute as before will invoke this callback function.

            param.onSuccess = function() {
                // No parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.3.1
  See:
    hcap.time.getPowerOnTime()