Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 23 Next »

ON THIS PAGE

The hostconfiguration object allows you to retrieve information about network interfaces and Internet connectivity.

hostconfiguration IDL
interface NetworkHost {
    HostConfig defaultConfig();
    Promise<HostConfig> getConfig();
    Promise<void> applyConfig(HostConfigWritable config);
};

interface HostConfig {
    [optional] attribute String proxy;
    [optional] attribute Array<String> proxyBypassList;
    [optional] attribute Array<String> timeServerList;
    [optional] attribute String timeServerInterval;
    [optional] attribute String hostName;
    [optional] attribute bool loginPassword;
};

interface HostConfigWritable : HostConfig {
    [optional] attribute String[or bool] loginPassword;
    [optional] attribute String[or bool] obfuscatedLoginPassword;
};

Object Creation

To create a hostconfiguration object, first load the brightsign/hostconfiguration module using the require() method. Then create an instance of the hostconfiguration class.

var HostConfigurationClass = require("@brightsign/hostconfiguration");
var hc = new HostConfigurationClass();

NetworkHost

Use this interface to retrieve and modify host configuration.

getConfig()
Promise<HostConfig> getConfig() 

Returns a HostConfig interface containing current host-configuration information.

applyConfig()
Promise<void> applyConfig(HostConfigWritable config)

Applies host-configuration settings to the player. This method accepts a HostConfigWritable interface.

The config parameter should contain the complete desired configuration. Any previous configuration is overwritten. If you wish to change one item while keeping the rest of the configuration the same, then call getConfig and modify the returned object (see the example in the Examples section).

HostConfig

This interface contains host configuration parameters:

  • [String] proxy:  The name or address of the proxy server used for HTTP and FTP requests. The proxy string should be formatted as "http://user:password@hostname:port". The hostname can contain up to four "*" characters; each "*" character can be used to replace one octet from the current IP address. For example, if the IP address is currently 192.168.1.2, and the proxy is set to "proxy-*-*", then the player will attempt to use a proxy named "proxy-192-168".
  • [Array<String>] proxyBypassList: A list of hostnames exempted from the proxy setting. The player will attempt to reach the specified hosts directly rather than using the proxy specified in the proxy attribute. For example, the hostname "example.com" would exempt "example.com", "example.com:80", and "www.example.com" from the proxy setting.
  • [Array<String>] timeServerList: An array containing zero or one time servers to be used by the player. An empty array disables automatic setting of the player's clock. A single entry indicates the time server and protocol that should be used as a URL. Supported protocols are HTTP, HTTPS and NTP. For backward-compatibility the use of just a host name is supported and indicates that NTP should be used. Note that when using HTTPS, host and peer verification are disabled since the player clock may not be correct. The following are valid time server addresses:
  • [String] timeServerInterval: A value specifying how often (in seconds) the player should communicate with the time server to adjust its clock. The default interval is 12 hours. The minimum interval allowed is 120 seconds.
  • [String] hostName: The player host name. If no host name has been explicitly set, then a host name is automatically generated based on the device serial number. Passing an empty string to this method resets the device host name to its automatically generated value.
  • [bool] loginPassword: A value of true means that the password exists, false means that there is no password.

HostConfigWritable

This interface contains password settings for SSH.

  • [String or bool] loginPassword: A plain-text login password for the SSH connection (if SSH has been enabled in the registry)
  • [String or bool] obfuscatedLoginPassword: A login password for the SSH connection (if SSH has been enabled in the registry) that has been obfuscated using a shared secret. Contact support@brightsign.biz to learn more about generating an obfuscating key and storing it on the player.

Examples

The following script uses the applyConfig() method to set the hostname, time server, and time-server refresh interval:

var HostConfigurationClass = require("@brightsign/hostconfiguration");
var hc = new HostConfigurationClass();

var configData = {};
configData.hostName = "myplayer";
configData.proxy = "";
configData.proxyBypassList = [];
configData.timeServerInterval = 1200;
configData.timeServerList = ["time.brightsignnetwork.com"];

console.log("***Configuring Host***")
hc.applyConfig(configData).then(
        function() {
            console.log("Success");
        })
    .catch(
        function(data) {
            console.log(JSON.stringify(data));
        }); 


To change one item while keeping the rest of the configuration the same, call getConfig and modify the returned object:

  var HostConfiguration = require('@brightsign/hostconfiguration');
  var hostConfiguration = new HostConfiguration;
  hostConfiguration.getConfig()
  .then(function(config) {
    config.hostName = "host-brightsign";
    hostConfiguration.applyConfig(config);
  })
  .then(function() {
    console.log("Success");
  })
  .catch(function(error) {
    console.log(`${JSON.stringify(error)}`);
  });
  • No labels