# Namespace hcap.rs232c

hcap.rs232c

- Defined in: hcap-1.24.6.5901.js

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

## Method Summary

## Namespace Detail

hcap.rs232c

## Method Detail

- <static> hcap.rs232c.clearStartupData(param)
  Clears startup command which is fired to RS232C when TV is turned on. [since 1.24.0] EU model only.
  This is worked only when the property "rs232c" is "1".

      hcap.rs232c.clearStartupData({
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

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

            param.onSuccess = function (param) {
                // 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.18.4
  See:
    hcap.rs232c.getConfiguration()
    hcap.rs232c.setConfiguration()
    hcap.rs232c.sendData()
    hcap.rs232c.setStartupData()
    {Event} rs232c_data_received
- <static> hcap.rs232c.getConfiguration(param)
  Returns the current RS232C configuration.
  This is worked only when the property "rs232c" is "1".

      hcap.rs232c.getConfiguration({
           "onSuccess" : function(p) {
               console.log("onSuccess : port = " + p.port + ", baud rate = " + p.baudRate + ", data bit = " + p.dataBit + ", parity = " + p.parity + ", stop bit = " + p.stopBit + ", flow control = " + p.flowControl + ", Rx timeout (ms) = " + p.rxTimeoutInMs);
           },
           "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.port - COM port such as 1 for COM1 and 13 for COM13.
                // {Number} param.baudRate - baud rate (hcap.rs232c.BaudRate)
                // {Number} param.dataBit - data bit (hcap.rs232c.DataBit)
                // {Number} param.parity - parity (hcap.rs232c.Parity)
                // {Number} param.stopBit - stop bit (hcap.rs232c.StopBit)
                // {Number} param.flowControl - flow control (hcap.rs232c.FlowControl)
                // {Number} param.rxTimeoutInMs - Rx data timeout in ms which could be set from 0 to 1000(ms) by 10(ms). Max buffer size for Rx data is 80 bytes. For the Rx data bigger than 80 bytes, 80 bytes will be delivered to HCAP application first regardless of the timeout and the rest of the data will be sent in the next timeout.
            }

    - {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.18.4
  See:
    hcap.rs232c.setConfiguration()
    hcap.rs232c.sendData()
    hcap.rs232c.setStartupData()
    hcap.rs232c.clearStartupData()
    {Event} rs232c_data_received
- <static> hcap.rs232c.sendData(param)
  Sends RS232C data.
  This is worked only when the property "rs232c" is "1".

      hcap.rs232c.sendData({
           "data" : "3B1C42",
           "dataLength" : 3,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {String} param.data - rs232c data string converted from binary data to ascii data such as ascii "3B1C42" for binary 0x3B1C42 with param.dataLength 3 (3 bytes) and ascii "00" for binary null data (0x00) with param.dataLength 1 (1 byte).
    - {Number} param.dataLength - received rs232c data length in bytes. Max length of EU model is 255 (bytes) and US model is 32 (bytes).
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // 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.18.4
  See:
    hcap.rs232c.getConfiguration()
    hcap.rs232c.setConfiguration()
    hcap.rs232c.setStartupData()
    hcap.rs232c.clearStartupData()
    {Event} rs232c_data_received
- <static> hcap.rs232c.setConfiguration(param)
  Sets the RS232C configuration.
  This is worked only when the property "rs232c" is "1".
  Once RS232C is configured, it maintains its configuration unless the property "rs232c" is changed, TV is reset or other setting values are configured.
  If given setting value is not supported in the platform, it will be failed.
  Supported setting values are dependent on the platform or the model.
  To set rs232c configuration, we recommend to get the current configuration, modify it for values you want to change and set.

      hcap.rs232c.setConfiguration({
           "port" : 3,
           "baudRate" : hcap.rs232c.BaudRate.BR_115200,
           "dataBit" : hcap.rs232c.DataBit.BIT_7,
           "parity" : hcap.rs232c.Parity.NONE,
           "stopBit" : hcap.rs232c.StopBit.BIT_1,
           "flowControl" : hcap.rs232c.FlowControl.NONE,
           "rxTimeoutInMs" : 10,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.port [Required] - COM port such as 1 for COM1 and 13 for COM13.
    - {Number} param.baudRate [Required] - baud rate (hcap.rs232c.BaudRate)
    - {Number} param.dataBit [Required] - data bit (hcap.rs232c.DataBit)
    - {Number} param.parity [Required] - parity (hcap.rs232c.Parity)
    - {Number} param.stopBit [Required] - stop bit (hcap.rs232c.StopBit)
    - {Number} param.flowControl [Required] - flow control (hcap.rs232c.FlowControl)
    - {Number} param.rxTimeoutInMs [Required] - Rx data timeout in ms which could be set from 0 to 1000(ms) by 10(ms). Max buffer size for Rx data is 80 bytes. For the Rx data bigger than 80 bytes, 80 bytes will be delivered to HCAP application first regardless of the timeout and the rest of the data will be sent in the next timeout.
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // 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.18.4
  See:
    hcap.rs232c.getConfiguration()
    hcap.rs232c.sendData()
    hcap.rs232c.setStartupData()
    hcap.rs232c.clearStartupData()
    {Event} rs232c_data_received
- <static> hcap.rs232c.setStartupData(param)
  Sets startup command which is fired to RS232C when TV is turned on. [since 1.24.0] EU model only.
  This is worked only when the property "rs232c" is "1".

      hcap.rs232c.setStartupData({
           "data" : "3B1C42",
           "dataLength" : 3,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {String} param.data - rs232c data string converted from binary data to ascii data such as ascii "3B1C42" for binary 0x3B1C42 with param.dataLength 3 (3 bytes) and ascii "00" for binary null data (0x00) with param.dataLength 1 (1 byte).
    - {Number} param.dataLength - received rs232c data length in bytes. Max length of EU model is 255 (bytes) and US model is 32 (bytes).
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // 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.18.4
  See:
    hcap.rs232c.getConfiguration()
    hcap.rs232c.setConfiguration()
    hcap.rs232c.sendData()
    hcap.rs232c.clearStartupData()
    {Event} rs232c_data_received