Player APIs (BrightScript & Ja...
JavaScript APIs
dwsconfiguration
10min
the dwsconfiguration object allows you to configure the diagnostic web server (dws) docid\ qxt4yhey7iej m9dh73wm on the player by default, the diagnostic web server is enabled on port 80, with the player serial number as password the username is always "admin" dwsconfiguration idl \[ garbagecollected, ] interface dws { dwsconfig defaultconfig(); promise\<dwsconfig> getconfig(); promise\<dwsresult> applyconfig(dwsconfigwritable config); }; interface dwsconfig { attribute int port; attribute password password; attribute array\<string> authenticationlist; }; interface dwsconfigwritable dwsconfig { attribute password password; }; interface password { attribute string value; attribute bool obfuscated; }; interface dwsresult { attribute bool restartrequired; }; object creation to create a dwsconfiguration object, first load the brightsign/dwsconfiguration module using the require() method then create an instance of the dwsconfiguration class var dwsconfigurationclass = require("@brightsign/dwsconfiguration"); var dwsconfig = new dwsconfigurationclass(); dws use this interface to retrieve and modify the dws configuration getconfig() promise \<dwsconfig> getconfig() returns a dwsconfig interface containing current dws configuration information if there is a set password, getconfig() will return true for the password parameter if there isn't a set password, if there is a set password, getconfig() will return false for the password parameter applyconfig() promise \<dwsresult> applyconfig(dwsconfigwritable config) applies dws configuration settings to the player this method accepts a dwsconfig interface it returns a dwsresult interface that indicates whether or not a reboot is required for the changes to take effect (the caller is responsible for requesting the reboot) the restartrequired property of the dwsresult indicates whether the reboot is required 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) dwsconfig this interface contains dws configuration parameters port int int the port number of the dws, located at the ip address of the player the default for the dws is port 80 setting this value to 0 will disable the dws password password password a password interface containing password settings for the dws to enable the dws without password protection, set value to an empty string and obfuscated to false authenticationlist array array the authentication scheme for the dws password this entry currently accepts a single value only the following are accepted values "basic" the password will be validated using basic authentication "digest" the password will be validated using digest access authentication to enable the dws without password authentication, set the password value to be an empty string and password obfuscated to be false, when calling the applyconfig() method dwsconfigwritable password password password a password interface containing password settings for the dws password this interface contains password settings for the dws value string string the dws password obfuscated bool bool a flag indicating whether the password string is obfuscated contact support\@brightsign biz mailto\ support\@brightsign biz to learn more about generating a key for obfuscation and storing it on the player dwsresult this interface contains results from an applyconfig() operation restartrequired bool bool a flag indicating whether a reboot is required for changes to go into effect (the script must perform the reboot) examples var dwsconfigurationclass = require("@brightsign/dwsconfiguration"); var dwsconfig = new dwsconfigurationclass(); var configdata = {}; var pw = {}; configdata port = 1010; configdata password = pw; configdata authenticationlist = \["basic"]; pw\ value = "password"; pw\ obfuscated = false; dwsconfig applyconfig(configdata) then( function(data) { console log(json stringify(data)); }) catch( function(data) { console log(json stringify(data)); }); dwsconfig getconfig() then( function(data) { console log(json stringify(data)); }) catch( function(data) { console log(json stringify(data)); }); to change one item while keeping the rest of the configuration the same, then call getconfig and modify the returned object var dwsconfigurationclass = require("@brightsign/dwsconfiguration"); var dwsconfig = new dwsconfigurationclass(); var pw = {}; dwsconfig getconfig() then(function(config) { pw\ value = "password"; pw\ obfuscated = false; config password = pw; dwsconfig applyconfig(config); }) then(function() { console log("success"); }) catch(function(error) { console log(json stringify(error)); });